Skip to content

Commit c493ccf

Browse files
committed
Define the Rails version constraint in a library constant
1 parent cfc3a31 commit c493ccf

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Records the Bundler-style dependency constraint for the version of Rails to be
2+
# used with the Metasploit Framework and Metasploit Pro.
3+
module Metasploit
4+
module Framework
5+
module RailsVersionConstraint
6+
# The Metasploit ecosystem is not ready for Rails 4 as it uses features of
7+
# Rails 3.X that are removed in Rails 4.
8+
RAILS_VERSION = '< 4.0.0'
9+
end
10+
end
11+
end

metasploit-framework-db.gemspec

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ end
1212

1313
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
1414
require 'metasploit/framework/version'
15+
require 'metasploit/framework/rails_version_constraint'
1516

1617
Gem::Specification.new do |spec|
1718
spec.name = 'metasploit-framework-db'
@@ -26,10 +27,7 @@ Gem::Specification.new do |spec|
2627
# no files, just dependencies
2728
spec.files = []
2829

29-
# The Metasploit ecosystem is not ready for Rails 4 as it uses features of Rails 3.X that are removed in Rails 4.
30-
rails_version_constraint = '< 4.0.0'
31-
32-
spec.add_runtime_dependency 'activerecord', rails_version_constraint
30+
spec.add_runtime_dependency 'activerecord', Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
3331
# Metasploit::Credential database models
3432
spec.add_runtime_dependency 'metasploit-credential', '~> 0.13.8'
3533
# Database models shared between framework and Pro.

metasploit-framework-full.gemspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ end
1212

1313
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
1414
require 'metasploit/framework/version'
15+
require 'metasploit/framework/rails_version_constraint'
1516

1617
Gem::Specification.new do |spec|
1718
spec.name = 'metasploit-framework-full'
@@ -28,6 +29,7 @@ Gem::Specification.new do |spec|
2829

2930
metasploit_framework_version_constraint = "= #{spec.version}"
3031

32+
spec.add_runtime_dependency 'rails', Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
3133
spec.add_runtime_dependency 'metasploit-framework', metasploit_framework_version_constraint
3234
spec.add_runtime_dependency 'metasploit-framework-db', metasploit_framework_version_constraint
3335
spec.add_runtime_dependency 'metasploit-framework-pcap', metasploit_framework_version_constraint

metasploit-framework.gemspec

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ end
1212

1313
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
1414
require 'metasploit/framework/version'
15+
require 'metasploit/framework/rails_version_constraint'
1516

1617
Gem::Specification.new do |spec|
1718
spec.name = 'metasploit-framework'
@@ -46,13 +47,11 @@ Gem::Specification.new do |spec|
4647
spec.test_files = spec.files.grep(%r{^spec/})
4748
spec.require_paths = ["lib"]
4849

49-
# The Metasploit ecosystem is not ready for Rails 4 as it uses features of Rails 3.X that are removed in Rails 4.
50-
rails_version_constraint = '< 4.0.0'
5150

5251
# Need 3+ for ActiveSupport::Concern
53-
spec.add_runtime_dependency 'activesupport', '>= 3.0.0', rails_version_constraint
52+
spec.add_runtime_dependency 'activesupport', '>= 3.0.0', Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
5453
# Needed for config.action_view for view plugin compatibility for Pro
55-
spec.add_runtime_dependency 'actionpack', rails_version_constraint
54+
spec.add_runtime_dependency 'actionpack', Metasploit::Framework::RailsVersionConstraint::RAILS_VERSION
5655
# Needed for some admin modules (cfme_manageiq_evm_pass_reset.rb)
5756
spec.add_runtime_dependency 'bcrypt'
5857
# Needed for Javascript obfuscation

0 commit comments

Comments
 (0)