summaryrefslogtreecommitdiff
path: root/lib/bundler/source
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2021-04-15 12:47:04 +0900
committerHiroshi SHIBATA <[email protected]>2021-04-15 15:36:15 +0900
commited149dbf46d1a8b16e6de9c3dbbcc10f72c9c019 (patch)
tree1c8c755fa592e280dc7718dc8a9317d1ac368394 /lib/bundler/source
parent0d9496f924d36534bd524791554d49dc0026b0e0 (diff)
Merge the master branch of Bundler
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4383
Diffstat (limited to 'lib/bundler/source')
-rw-r--r--lib/bundler/source/metadata.rb4
-rw-r--r--lib/bundler/source/path.rb4
-rw-r--r--lib/bundler/source/path/installer.rb2
-rw-r--r--lib/bundler/source/rubygems.rb24
4 files changed, 24 insertions, 10 deletions
diff --git a/lib/bundler/source/metadata.rb b/lib/bundler/source/metadata.rb
index 0867879861..50b65ce0ea 100644
--- a/lib/bundler/source/metadata.rb
+++ b/lib/bundler/source/metadata.rb
@@ -33,10 +33,6 @@ module Bundler
end
end
- def cached!; end
-
- def remote!; end
-
def options
{}
end
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 2c2e9023b3..01f89b204d 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -82,7 +82,9 @@ module Bundler
end
def install(spec, options = {})
- print_using_message "Using #{version_message(spec)} from #{self}"
+ using_message = "Using #{version_message(spec)} from #{self}"
+ using_message += " and installing its executables" unless spec.executables.empty?
+ print_using_message using_message
generate_bin(spec, :disable_extensions => true)
nil # no post-install message
end
diff --git a/lib/bundler/source/path/installer.rb b/lib/bundler/source/path/installer.rb
index 72bfbb4836..a70973bde7 100644
--- a/lib/bundler/source/path/installer.rb
+++ b/lib/bundler/source/path/installer.rb
@@ -35,7 +35,7 @@ module Bundler
run_hooks(:post_build)
end
- generate_bin unless spec.executables.nil? || spec.executables.empty?
+ generate_bin unless spec.executables.empty?
run_hooks(:post_install)
ensure
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index 5b89b1645d..cede580b0a 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -20,17 +20,29 @@ module Bundler
@dependency_names = []
@allow_remote = false
@allow_cached = false
+ @allow_local = options["allow_local"] || false
@caches = [cache_path, *Bundler.rubygems.gem_cache]
- Array(options["remotes"] || []).reverse_each {|r| add_remote(r) }
+ Array(options["remotes"]).reverse_each {|r| add_remote(r) }
+ end
+
+ def local!
+ return if @allow_local
+
+ @specs = nil
+ @allow_local = true
end
def remote!
+ return if @allow_remote
+
@specs = nil
@allow_remote = true
end
def cached!
+ return if @allow_cached
+
@specs = nil
@allow_cached = true
end
@@ -49,8 +61,12 @@ module Bundler
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
end
+ def disable_multisource?
+ @remotes.size <= 1
+ end
+
def can_lock?(spec)
- return super if Bundler.feature_flag.disable_multisource?
+ return super if disable_multisource?
spec.source.is_a?(Rubygems)
end
@@ -87,7 +103,7 @@ module Bundler
# small_idx.use large_idx.
idx = @allow_remote ? remote_specs.dup : Index.new
idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
- idx.use(installed_specs, :override_dupes)
+ idx.use(installed_specs, :override_dupes) if @allow_local
idx
end
end
@@ -365,7 +381,7 @@ module Bundler
def cached_specs
@cached_specs ||= begin
- idx = installed_specs.dup
+ idx = @allow_local ? installed_specs.dup : Index.new
Dir["#{cache_path}/*.gem"].each do |gemfile|
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/