Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle missing dependecies in gem loading

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information...
commit 3c07a8828ede3d41000513af29c293ae2e2a49d4 1 parent 0a4a5f3
Matt Jones al2o3cr authored NZKoz committed
1  railties/lib/rails/gem_dependency.rb
View
@@ -74,6 +74,7 @@ def add_load_paths
def dependencies
return [] if framework_gem?
+ return [] if specification.nil?
all_dependencies = specification.dependencies.map do |dependency|
GemDependency.new(dependency.name, :requirement => dependency.version_requirements)
end
14 railties/test/gem_dependency_test.rb
View
@@ -129,5 +129,19 @@ def test_gem_load_bad_specification
assert_equal '1.0.0', DUMMY_GEM_E_VERSION
end
+ def test_gem_handle_missing_dependencies
+ dummy_gem = Rails::GemDependency.new "dummy-gem-g"
+ dummy_gem.add_load_paths
+ dummy_gem.load
+ assert dummy_gem.loaded?
+ debugger
+ assert_equal 2, dummy_gem.dependencies.size
+ assert_nothing_raised do
+ dummy_gem.dependencies.each do |g|
+ g.dependencies
+ end
+ end
+ end
+
end
end
39 railties/test/vendor/gems/dummy-gem-f-1.0.0/.specification
View
@@ -0,0 +1,39 @@
+--- !ruby/object:Gem::Specification
+name: dummy-gem-f
+version: !ruby/object:Gem::Version
+ version: 1.3.0
+platform: ruby
+authors:
+- "Nobody"
+date: 2008-10-03 00:00:00 -04:00
+dependencies:
+- !ruby/object:Gem::Dependency
+ name: absolutely-no-such-gem
+ type: :runtime
+ version_requirement:
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: 1.0.0
+ version:
+files:
+- lib
+- lib/dummy-gem-f.rb
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "0"
+ version:
+required_rubygems_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "0"
+ version:
+requirements: []
+specification_version: 2
+summary: Dummy Gem F
1  railties/test/vendor/gems/dummy-gem-f-1.0.0/lib/dummy-gem-f.rb
View
@@ -0,0 +1 @@
+DUMMY_GEM_F_VERSION="1.0.0"
39 railties/test/vendor/gems/dummy-gem-g-1.0.0/.specification
View
@@ -0,0 +1,39 @@
+--- !ruby/object:Gem::Specification
+name: dummy-gem-g
+version: !ruby/object:Gem::Version
+ version: 1.3.0
+platform: ruby
+authors:
+- "Nobody"
+date: 2008-10-03 00:00:00 -04:00
+dependencies:
+- !ruby/object:Gem::Dependency
+ name: dummy-gem-f
+ type: :development
+ version_requirement:
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: 1.0.0
+ version:
+files:
+- lib
+- lib/dummy-gem-g.rb
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "0"
+ version:
+required_rubygems_version: !ruby/object:Gem::Requirement
+ requirements:
+ - - ">="
+ - !ruby/object:Gem::Version
+ version: "0"
+ version:
+requirements: []
+specification_version: 2
+summary: Dummy Gem G
1  railties/test/vendor/gems/dummy-gem-g-1.0.0/lib/dummy-gem-g.rb
View
@@ -0,0 +1 @@
+DUMMY_GEM_G_VERSION="1.0.0"
Please sign in to comment.
Something went wrong with that request. Please try again.