1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems/commands/install_command.rb: Restore gem install

--ignore-dependencies for remote gems
* test/rubygems/test_gem_commands_install_command.rb:  Test for the
  above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-12-22 02:06:02 +00:00
parent 87923e02ba
commit cb8be30ef1
3 changed files with 60 additions and 5 deletions

View file

@ -1,3 +1,10 @@
Sun Dec 22 11:05:53 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems/commands/install_command.rb: Restore gem install
--ignore-dependencies for remote gems
* test/rubygems/test_gem_commands_install_command.rb: Test for the
above.
Sun Dec 22 10:23:40 2013 Eric Hodel <drbrain@segment7.net> Sun Dec 22 10:23:40 2013 Eric Hodel <drbrain@segment7.net>
* lib/rdoc.rb: Set RDoc to release version. * lib/rdoc.rb: Set RDoc to release version.

View file

@ -69,7 +69,7 @@ class Gem::Commands::InstallCommand < Gem::Command
o[:explain] = v o[:explain] = v
end end
@installed_specs = nil @installed_specs = []
end end
def arguments # :nodoc: def arguments # :nodoc:
@ -200,10 +200,8 @@ to write the specification by hand. For example:
req = Gem::Requirement.create(version) req = Gem::Requirement.create(version)
if options[:ignore_dependencies] if options[:ignore_dependencies] then
inst = Gem::Installer.new name, options install_gem_without_dependencies name, req
inst.install
@installed_specs.push(inst.spec)
else else
inst = Gem::DependencyInstaller.new options inst = Gem::DependencyInstaller.new options
@ -227,6 +225,30 @@ to write the specification by hand. For example:
end end
end end
def install_gem_without_dependencies name, req # :nodoc:
gem = nil
if remote? then
dependency = Gem::Dependency.new name, req
dependency.prerelease = options[:prerelease]
fetcher = Gem::RemoteFetcher.fetcher
gem = fetcher.download_to_cache dependency
end
if local? and not gem then
source = Gem::Source::Local.new
spec = source.find_gem name, req
gem = source.download spec
end
inst = Gem::Installer.new gem, options
inst.install
@installed_specs.push(inst.spec)
end
def install_gems # :nodoc: def install_gems # :nodoc:
exit_code = 0 exit_code = 0

View file

@ -533,6 +533,32 @@ ERROR: Possible alternatives: non_existent_with_hint
assert_match "1 gem installed", @ui.output assert_match "1 gem installed", @ui.output
end end
def test_install_gem_ignore_dependencies_both
spec = quick_spec 'a', 2
util_build_gem spec
FileUtils.mv spec.cache_file, @tempdir
@cmd.options[:ignore_dependencies] = true
@cmd.install_gem 'a', '>= 0'
assert_equal %w[a-2], @cmd.installed_specs.map { |s| s.full_name }
end
def test_install_gem_ignore_dependencies_remote
spec_fetcher do |fetcher|
fetcher.gem 'a', 2
end
@cmd.options[:ignore_dependencies] = true
@cmd.install_gem 'a', '>= 0'
assert_equal %w[a-2], @cmd.installed_specs.map { |spec| spec.full_name }
end
def test_parses_requirement_from_gemname def test_parses_requirement_from_gemname
spec_fetcher do |fetcher| spec_fetcher do |fetcher|
fetcher.gem 'a', 2 fetcher.gem 'a', 2