aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/gem_dependency.rb10
-rw-r--r--railties/test/gem_dependency_test.rb9
2 files changed, 16 insertions, 3 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb
index 3cc75494e4..06d830ba24 100644
--- a/railties/lib/rails/gem_dependency.rb
+++ b/railties/lib/rails/gem_dependency.rb
@@ -122,10 +122,14 @@ module Rails
def built?
return false unless frozen?
- specification.extensions.each do |ext|
- makefile = File.join(unpacked_gem_directory, File.dirname(ext), 'Makefile')
- return false unless File.exists?(makefile)
+
+ if vendor_gem?
+ specification.extensions.each do |ext|
+ makefile = File.join(unpacked_gem_directory, File.dirname(ext), 'Makefile')
+ return false unless File.exists?(makefile)
+ end
end
+
true
end
diff --git a/railties/test/gem_dependency_test.rb b/railties/test/gem_dependency_test.rb
index 70f4496685..92132be992 100644
--- a/railties/test/gem_dependency_test.rb
+++ b/railties/test/gem_dependency_test.rb
@@ -199,6 +199,15 @@ class GemDependencyTest < Test::Unit::TestCase
assert_equal true, Rails::GemDependency.new("dummy-gem-i").built?
assert_equal false, Rails::GemDependency.new("dummy-gem-j").built?
end
+
+ def test_gem_determines_build_status_only_on_vendor_gems
+ framework_gem = Rails::GemDependency.new('dummy-framework-gem')
+ framework_gem.stubs(:framework_gem?).returns(true) # already loaded
+ framework_gem.stubs(:vendor_rails?).returns(false) # but not in vendor/rails
+ framework_gem.stubs(:vendor_gem?).returns(false) # and not in vendor/gems
+ framework_gem.add_load_paths # freeze framework gem early
+ assert framework_gem.built?
+ end
def test_gem_build_passes_options_to_dependencies
start_gem = Rails::GemDependency.new("dummy-gem-g")