Skip to content

Commit

Permalink
Only check for built extensions on gem dependencies that are in vendo…
Browse files Browse the repository at this point in the history
…r/gems. [#2825 state:resolved]

Signed-off-by: Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>
  • Loading branch information
jdhollis authored and Yehuda Katz + Carl Lerche committed Jul 2, 2009
1 parent 8bb510f commit 9eab435
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 7 additions & 3 deletions railties/lib/rails/gem_dependency.rb
Expand Up @@ -122,10 +122,14 @@ def requirement

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

Expand Down
9 changes: 9 additions & 0 deletions railties/test/gem_dependency_test.rb
Expand Up @@ -199,6 +199,15 @@ def test_gem_determines_build_status
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")
Expand Down

0 comments on commit 9eab435

Please sign in to comment.