mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Fix bundle plugin install
misdetection of installed versions
9c88db949d
This commit is contained in:
parent
c044f818ca
commit
c119dd2b5a
Notes:
git
2021-08-31 19:07:00 +09:00
4 changed files with 26 additions and 9 deletions
|
@ -636,6 +636,12 @@ EOF
|
|||
@rubygems = nil
|
||||
end
|
||||
|
||||
def configure_gem_home_and_path(path = bundle_path)
|
||||
configure_gem_path
|
||||
configure_gem_home(path)
|
||||
Bundler.rubygems.clear_paths
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def eval_yaml_gemspec(path, contents)
|
||||
|
@ -656,12 +662,6 @@ EOF
|
|||
raise GemspecError, Dsl::DSLError.new(msg, path, e.backtrace, contents)
|
||||
end
|
||||
|
||||
def configure_gem_home_and_path
|
||||
configure_gem_path
|
||||
configure_gem_home
|
||||
Bundler.rubygems.clear_paths
|
||||
end
|
||||
|
||||
def configure_gem_path
|
||||
unless use_system_gems?
|
||||
# this needs to be empty string to cause
|
||||
|
@ -671,8 +671,8 @@ EOF
|
|||
end
|
||||
end
|
||||
|
||||
def configure_gem_home
|
||||
Bundler::SharedHelpers.set_env "GEM_HOME", bundle_path.to_s
|
||||
def configure_gem_home(path)
|
||||
Bundler::SharedHelpers.set_env "GEM_HOME", path.to_s
|
||||
end
|
||||
|
||||
def tmp_home_path
|
||||
|
|
|
@ -81,6 +81,8 @@ module Bundler
|
|||
|
||||
deps = names.map {|name| Dependency.new name, version }
|
||||
|
||||
Bundler.configure_gem_home_and_path(Plugin.root)
|
||||
|
||||
definition = Definition.new(nil, deps, source_list, true)
|
||||
install_definition(definition)
|
||||
end
|
||||
|
|
|
@ -144,7 +144,7 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
if (installed?(spec) || Plugin.installed?(spec.name)) && !force
|
||||
if installed?(spec) && !force
|
||||
print_using_message "Using #{version_message(spec)}"
|
||||
return nil # no post-install message
|
||||
end
|
||||
|
|
|
@ -69,6 +69,21 @@ RSpec.describe "bundler plugin install" do
|
|||
plugin_should_be_installed("foo", "kung-foo")
|
||||
end
|
||||
|
||||
it "installs the latest version if not installed" do
|
||||
update_repo2 do
|
||||
build_plugin "foo", "1.1"
|
||||
end
|
||||
|
||||
bundle "plugin install foo --version 1.0 --source #{file_uri_for(gem_repo2)} --verbose"
|
||||
expect(out).to include("Installing foo 1.0")
|
||||
|
||||
bundle "plugin install foo --source #{file_uri_for(gem_repo2)} --verbose"
|
||||
expect(out).to include("Installing foo 1.1")
|
||||
|
||||
bundle "plugin install foo --source #{file_uri_for(gem_repo2)} --verbose"
|
||||
expect(out).to include("Using foo 1.1")
|
||||
end
|
||||
|
||||
it "works with different load paths" do
|
||||
build_repo2 do
|
||||
build_plugin "testing" do |s|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue