Skip to content

Commit

Permalink
don't remove always_install requests for local gems
Browse files Browse the repository at this point in the history
If the gem was specified on the commandline, we should not remove it
from the `found` list even if it is a prerelease gem.

Fixes rubygems#828
  • Loading branch information
tenderlove authored and Zachary Scott committed May 9, 2014
1 parent 2cfee05 commit db5d888
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rubygems/resolver/installer_set.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def add_always_install dependency


found = find_all request found = find_all request


found.delete_if { |s| s.version.prerelease? } unless dependency.prerelease? found.delete_if { |s|
s.version.prerelease? and not s.local?
} unless dependency.prerelease?


found = found.select do |s| found = found.select do |s|
Gem::Source::SpecificFile === s.source or Gem::Source::SpecificFile === s.source or
Expand Down
4 changes: 4 additions & 0 deletions lib/rubygems/resolver/local_specification.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ def installable_platform?
super super
end end


def local? # :nodoc:
true
end

end end


3 changes: 3 additions & 0 deletions lib/rubygems/resolver/specification.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -85,5 +85,8 @@ def installable_platform?
Gem::Platform.match spec.platform Gem::Platform.match spec.platform
end end


def local? # :nodoc:
false
end
end end


14 changes: 14 additions & 0 deletions test/rubygems/test_gem_dependency_installer.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -457,6 +457,20 @@ def test_install_local
assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name } assert_equal %w[a-1], inst.installed_gems.map { |s| s.full_name }
end end


def test_install_local_prerelease
util_setup_gems

FileUtils.mv @a1_pre_gem, @tempdir
inst = nil

Dir.chdir @tempdir do
inst = Gem::DependencyInstaller.new :domain => :local
inst.install 'a-1.a.gem'
end

assert_equal %w[a-1.a], inst.installed_gems.map { |s| s.full_name }
end

def test_install_local_dependency def test_install_local_dependency
util_setup_gems util_setup_gems


Expand Down

0 comments on commit db5d888

Please sign in to comment.