bundler 1.15.4 → 1.16.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +43 -0
- data/README.md +12 -7
- data/exe/bundle +1 -1
- data/exe/bundle_ruby +4 -3
- data/lib/bundler.rb +47 -37
- data/lib/bundler/build_metadata.rb +38 -0
- data/lib/bundler/capistrano.rb +5 -0
- data/lib/bundler/cli.rb +155 -67
- data/lib/bundler/cli/add.rb +0 -1
- data/lib/bundler/cli/binstubs.rb +9 -7
- data/lib/bundler/cli/cache.rb +5 -4
- data/lib/bundler/cli/check.rb +3 -5
- data/lib/bundler/cli/clean.rb +5 -6
- data/lib/bundler/cli/common.rb +11 -2
- data/lib/bundler/cli/config.rb +2 -1
- data/lib/bundler/cli/console.rb +2 -1
- data/lib/bundler/cli/doctor.rb +1 -0
- data/lib/bundler/cli/exec.rb +2 -1
- data/lib/bundler/cli/gem.rb +3 -2
- data/lib/bundler/cli/info.rb +0 -1
- data/lib/bundler/cli/init.rb +17 -6
- data/lib/bundler/cli/inject.rb +1 -0
- data/lib/bundler/cli/install.rb +61 -61
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/list.rb +22 -0
- data/lib/bundler/cli/lock.rb +0 -1
- data/lib/bundler/cli/open.rb +2 -2
- data/lib/bundler/cli/outdated.rb +13 -8
- data/lib/bundler/cli/package.rb +9 -6
- data/lib/bundler/cli/platform.rb +1 -0
- data/lib/bundler/cli/plugin.rb +1 -0
- data/lib/bundler/cli/pristine.rb +9 -2
- data/lib/bundler/cli/show.rb +0 -1
- data/lib/bundler/cli/update.rb +31 -5
- data/lib/bundler/cli/viz.rb +1 -0
- data/lib/bundler/compact_index_client.rb +1 -0
- data/lib/bundler/compact_index_client/cache.rb +1 -0
- data/lib/bundler/compact_index_client/updater.rb +3 -2
- data/lib/bundler/compatibility_guard.rb +14 -0
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +5 -4
- data/lib/bundler/definition.rb +140 -95
- data/lib/bundler/dep_proxy.rb +2 -0
- data/lib/bundler/dependency.rb +6 -7
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/deprecate.rb +1 -0
- data/lib/bundler/dsl.rb +97 -62
- data/lib/bundler/endpoint_specification.rb +9 -0
- data/lib/bundler/env.rb +63 -27
- data/lib/bundler/environment_preserver.rb +26 -6
- data/lib/bundler/errors.rb +1 -0
- data/lib/bundler/feature_flag.rb +39 -4
- data/lib/bundler/fetcher.rb +15 -8
- data/lib/bundler/fetcher/base.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +2 -11
- data/lib/bundler/fetcher/dependency.rb +1 -0
- data/lib/bundler/fetcher/downloader.rb +1 -0
- data/lib/bundler/fetcher/index.rb +1 -0
- data/lib/bundler/friendly_errors.rb +2 -1
- data/lib/bundler/gem_helper.rb +14 -9
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/gem_version_promoter.rb +1 -0
- data/lib/bundler/gemdeps.rb +1 -0
- data/lib/bundler/graph.rb +1 -0
- data/lib/bundler/index.rb +15 -8
- data/lib/bundler/injector.rb +25 -22
- data/lib/bundler/inline.rb +5 -7
- data/lib/bundler/installer.rb +93 -45
- data/lib/bundler/installer/gem_installer.rb +2 -0
- data/lib/bundler/installer/parallel_installer.rb +73 -42
- data/lib/bundler/installer/standalone.rb +1 -0
- data/lib/bundler/lazy_specification.rb +2 -1
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +10 -4
- data/lib/bundler/match_platform.rb +1 -0
- data/lib/bundler/mirror.rb +6 -3
- data/lib/bundler/plugin.rb +1 -0
- data/lib/bundler/plugin/api/source.rb +8 -0
- data/lib/bundler/plugin/installer.rb +7 -6
- data/lib/bundler/plugin/source_list.rb +7 -8
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +1 -0
- data/lib/bundler/remote_specification.rb +1 -0
- data/lib/bundler/resolver.rb +138 -191
- data/lib/bundler/resolver/spec_group.rb +111 -0
- data/lib/bundler/retry.rb +1 -0
- data/lib/bundler/ruby_dsl.rb +1 -0
- data/lib/bundler/ruby_version.rb +1 -0
- data/lib/bundler/rubygems_ext.rb +5 -4
- data/lib/bundler/rubygems_gem_installer.rb +23 -0
- data/lib/bundler/rubygems_integration.rb +56 -27
- data/lib/bundler/runtime.rb +3 -5
- data/lib/bundler/settings.rb +177 -76
- data/lib/bundler/settings/validator.rb +79 -0
- data/lib/bundler/setup.rb +1 -0
- data/lib/bundler/shared_helpers.rb +86 -26
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source.rb +32 -0
- data/lib/bundler/source/gemspec.rb +1 -0
- data/lib/bundler/source/git.rb +21 -16
- data/lib/bundler/source/git/git_proxy.rb +14 -10
- data/lib/bundler/source/metadata.rb +63 -0
- data/lib/bundler/source/path.rb +8 -8
- data/lib/bundler/source/path/installer.rb +2 -0
- data/lib/bundler/source/rubygems.rb +131 -84
- data/lib/bundler/source/rubygems/remote.rb +3 -0
- data/lib/bundler/source_list.rb +75 -15
- data/lib/bundler/spec_set.rb +2 -1
- data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/lib/bundler/stub_specification.rb +1 -0
- data/lib/bundler/templates/Executable +4 -0
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Gemfile +1 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/gitignore.tt +0 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +15 -4
- data/lib/bundler/ui/silent.rb +1 -0
- data/lib/bundler/uri_credentials_filter.rb +1 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +69 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +487 -148
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +34 -0
- data/lib/bundler/vendored_thor.rb +1 -0
- data/lib/bundler/version.rb +6 -2
- data/lib/bundler/version_ranges.rb +1 -0
- data/lib/bundler/vlad.rb +5 -0
- data/lib/bundler/worker.rb +1 -0
- data/lib/bundler/yaml_serializer.rb +3 -3
- data/man/bundle-add.1 +43 -0
- data/man/bundle-add.1.txt +40 -0
- data/man/bundle-binstubs.1 +40 -0
- data/man/bundle-binstubs.1.txt +48 -0
- data/man/bundle-binstubs.ronn +14 -0
- data/man/bundle-check.1 +31 -0
- data/man/bundle-check.1.txt +32 -0
- data/man/bundle-clean.1 +24 -0
- data/man/bundle-clean.1.txt +26 -0
- data/man/bundle-config.1 +455 -0
- data/man/bundle-config.1.txt +491 -0
- data/man/bundle-config.ronn +133 -79
- data/man/bundle-exec.1 +165 -0
- data/man/bundle-exec.1.txt +178 -0
- data/man/bundle-exec.ronn +7 -0
- data/man/bundle-gem.1 +80 -0
- data/man/bundle-gem.1.txt +91 -0
- data/man/bundle-gem.ronn +2 -1
- data/man/bundle-info.1 +20 -0
- data/man/bundle-info.1.txt +21 -0
- data/man/bundle-init.1 +20 -0
- data/man/bundle-init.1.txt +24 -0
- data/man/bundle-inject.1 +33 -0
- data/man/bundle-inject.1.txt +32 -0
- data/man/bundle-install.1 +305 -0
- data/man/bundle-install.1.txt +385 -0
- data/man/bundle-install.ronn +32 -32
- data/man/bundle-list.1 +20 -0
- data/man/bundle-list.1.txt +21 -0
- data/man/bundle-list.ronn +15 -0
- data/man/bundle-lock.1 +84 -0
- data/man/bundle-lock.1.txt +93 -0
- data/man/bundle-open.1 +32 -0
- data/man/bundle-open.1.txt +29 -0
- data/man/bundle-outdated.1 +151 -0
- data/man/bundle-outdated.1.txt +127 -0
- data/man/bundle-outdated.ronn +1 -1
- data/man/bundle-package.1 +55 -0
- data/man/bundle-package.1.txt +79 -0
- data/man/bundle-package.ronn +5 -0
- data/man/bundle-platform.1 +61 -0
- data/man/bundle-platform.1.txt +57 -0
- data/man/bundle-pristine.1 +34 -0
- data/man/bundle-pristine.1.txt +44 -0
- data/man/bundle-pristine.ronn +24 -3
- data/man/bundle-show.1 +23 -0
- data/man/bundle-show.1.txt +25 -0
- data/man/bundle-update.1 +390 -0
- data/man/bundle-update.1.txt +386 -0
- data/man/bundle-update.ronn +2 -2
- data/man/bundle-viz.1 +39 -0
- data/man/bundle-viz.1.txt +38 -0
- data/man/bundle-viz.ronn +5 -5
- data/man/bundle.1 +132 -0
- data/man/bundle.1.txt +113 -0
- data/man/bundle.ronn +5 -2
- data/man/gemfile.5 +679 -0
- data/man/gemfile.5.ronn +31 -0
- data/man/gemfile.5.txt +636 -0
- data/man/index.txt +23 -0
- metadata +21 -36
- data/.codeclimate.yml +0 -25
- data/.gitignore +0 -18
- data/.rspec +0 -3
- data/.rubocop.yml +0 -131
- data/.rubocop_todo.yml +0 -418
- data/.travis.yml +0 -122
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -17
- data/Rakefile +0 -338
- data/bin/rake +0 -19
- data/bin/rspec +0 -15
- data/bin/rubocop +0 -17
- data/bin/with_rubygems +0 -39
- data/bundler.gemspec +0 -48
- data/doc/README.md +0 -30
- data/doc/TROUBLESHOOTING.md +0 -64
- data/doc/contributing/BUG_TRIAGE.md +0 -36
- data/doc/contributing/COMMUNITY.md +0 -13
- data/doc/contributing/GETTING_HELP.md +0 -11
- data/doc/contributing/HOW_YOU_CAN_HELP.md +0 -27
- data/doc/contributing/ISSUES.md +0 -51
- data/doc/contributing/README.md +0 -38
- data/doc/development/NEW_FEATURES.md +0 -10
- data/doc/development/PULL_REQUESTS.md +0 -40
- data/doc/development/README.md +0 -19
- data/doc/development/RELEASING.md +0 -9
- data/doc/development/SETUP.md +0 -27
- data/doc/documentation/README.md +0 -29
- data/doc/documentation/VISION.md +0 -26
- data/doc/documentation/WRITING.md +0 -54
- data/task/release.rake +0 -116
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class Settings
|
5
|
+
class Validator
|
6
|
+
class Rule
|
7
|
+
attr_reader :description
|
8
|
+
|
9
|
+
def initialize(keys, description, &validate)
|
10
|
+
@keys = keys
|
11
|
+
@description = description
|
12
|
+
@validate = validate
|
13
|
+
end
|
14
|
+
|
15
|
+
def validate!(key, value, settings)
|
16
|
+
instance_exec(key, value, settings, &@validate)
|
17
|
+
end
|
18
|
+
|
19
|
+
def fail!(key, value, *reasons)
|
20
|
+
reasons.unshift @description
|
21
|
+
raise InvalidOption, "Setting `#{key}` to #{value.inspect} failed:\n#{reasons.map {|r| " - #{r}" }.join("\n")}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def set(settings, key, value, *reasons)
|
25
|
+
hash_key = k(key)
|
26
|
+
return if settings[hash_key] == value
|
27
|
+
reasons.unshift @description
|
28
|
+
Bundler.ui.info "Setting `#{key}` to #{value.inspect}, since #{reasons.join(", ")}"
|
29
|
+
if value.nil?
|
30
|
+
settings.delete(hash_key)
|
31
|
+
else
|
32
|
+
settings[hash_key] = value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def k(key)
|
37
|
+
Bundler.settings.key_for(key)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.rules
|
42
|
+
@rules ||= Hash.new {|h, k| h[k] = [] }
|
43
|
+
end
|
44
|
+
private_class_method :rules
|
45
|
+
|
46
|
+
def self.rule(keys, description, &blk)
|
47
|
+
rule = Rule.new(keys, description, &blk)
|
48
|
+
keys.each {|k| rules[k] << rule }
|
49
|
+
end
|
50
|
+
private_class_method :rule
|
51
|
+
|
52
|
+
def self.validate!(key, value, settings)
|
53
|
+
rules_to_validate = rules[key]
|
54
|
+
rules_to_validate.each {|rule| rule.validate!(key, value, settings) }
|
55
|
+
end
|
56
|
+
|
57
|
+
rule %w[path path.system], "path and path.system are mutually exclusive" do |key, value, settings|
|
58
|
+
if key == "path" && value
|
59
|
+
set(settings, "path.system", nil)
|
60
|
+
elsif key == "path.system" && value
|
61
|
+
set(settings, :path, nil)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
rule %w[with without], "a group cannot be in both `with` & `without` simultaneously" do |key, value, settings|
|
66
|
+
with = settings.fetch(k(:with), "").split(":").map(&:to_sym)
|
67
|
+
without = settings.fetch(k(:without), "").split(":").map(&:to_sym)
|
68
|
+
|
69
|
+
other_key = key == "with" ? :without : :with
|
70
|
+
other_setting = key == "with" ? without : with
|
71
|
+
|
72
|
+
conflicting = with & without
|
73
|
+
if conflicting.any?
|
74
|
+
fail!(key, value, "`#{other_key}` is current set to #{other_setting.inspect}", "the `#{conflicting.join("`, `")}` groups conflict")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/lib/bundler/setup.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/compatibility_guard"
|
4
|
+
|
2
5
|
require "pathname"
|
3
6
|
require "rubygems"
|
4
7
|
|
8
|
+
require "bundler/version"
|
5
9
|
require "bundler/constants"
|
6
10
|
require "bundler/rubygems_integration"
|
7
11
|
require "bundler/current_ruby"
|
@@ -19,10 +23,16 @@ end
|
|
19
23
|
|
20
24
|
module Bundler
|
21
25
|
module SharedHelpers
|
22
|
-
def
|
26
|
+
def root
|
23
27
|
gemfile = find_gemfile
|
24
28
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
25
|
-
Pathname.new(gemfile).untaint
|
29
|
+
Pathname.new(gemfile).untaint.expand_path.parent
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_gemfile
|
33
|
+
gemfile = find_gemfile(:order_matters)
|
34
|
+
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
35
|
+
Pathname.new(gemfile).untaint.expand_path
|
26
36
|
end
|
27
37
|
|
28
38
|
def default_lockfile
|
@@ -63,7 +73,7 @@ module Bundler
|
|
63
73
|
end
|
64
74
|
|
65
75
|
def with_clean_git_env(&block)
|
66
|
-
keys = %w
|
76
|
+
keys = %w[GIT_DIR GIT_WORK_TREE]
|
67
77
|
old_env = keys.inject({}) do |h, k|
|
68
78
|
h.update(k => ENV[k])
|
69
79
|
end
|
@@ -129,20 +139,34 @@ module Bundler
|
|
129
139
|
namespace.const_get(constant_name)
|
130
140
|
end
|
131
141
|
|
132
|
-
def major_deprecation(message)
|
142
|
+
def major_deprecation(major_version, message)
|
143
|
+
if Bundler.bundler_major_version >= major_version
|
144
|
+
require "bundler/errors"
|
145
|
+
raise DeprecatedError, "[REMOVED FROM #{major_version}.0] #{message}"
|
146
|
+
end
|
147
|
+
|
133
148
|
return unless prints_major_deprecations?
|
134
149
|
@major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
|
135
150
|
ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
|
136
|
-
ui.warn("[DEPRECATED FOR #{
|
151
|
+
ui.warn("[DEPRECATED FOR #{major_version}.0] #{message}")
|
137
152
|
end
|
138
153
|
|
139
154
|
def print_major_deprecations!
|
140
|
-
|
155
|
+
multiple_gemfiles = search_up(".") do |dir|
|
156
|
+
gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
|
157
|
+
next if gemfiles.empty?
|
158
|
+
break false if gemfiles.size == 1
|
159
|
+
end
|
160
|
+
if multiple_gemfiles && Bundler.bundler_major_version == 1
|
161
|
+
Bundler::SharedHelpers.major_deprecation 2, \
|
162
|
+
"gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
|
163
|
+
end
|
164
|
+
|
141
165
|
if RUBY_VERSION < "2"
|
142
|
-
major_deprecation("Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
|
166
|
+
major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
|
143
167
|
end
|
144
168
|
return if Bundler.rubygems.provides?(">= 2")
|
145
|
-
major_deprecation("Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
|
169
|
+
major_deprecation(2, "Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
|
146
170
|
end
|
147
171
|
|
148
172
|
def trap(signal, override = false, &block)
|
@@ -170,23 +194,54 @@ module Bundler
|
|
170
194
|
"\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
|
171
195
|
end
|
172
196
|
|
197
|
+
def pretty_dependency(dep, print_source = false)
|
198
|
+
msg = String.new(dep.name)
|
199
|
+
msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
|
200
|
+
if dep.is_a?(Bundler::Dependency)
|
201
|
+
platform_string = dep.platforms.join(", ")
|
202
|
+
msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
|
203
|
+
end
|
204
|
+
msg << " from the `#{dep.source}` source" if print_source && dep.source
|
205
|
+
msg
|
206
|
+
end
|
207
|
+
|
208
|
+
def md5_available?
|
209
|
+
return @md5_available if defined?(@md5_available)
|
210
|
+
@md5_available = begin
|
211
|
+
require "openssl"
|
212
|
+
OpenSSL::Digest::MD5.digest("")
|
213
|
+
true
|
214
|
+
rescue LoadError
|
215
|
+
true
|
216
|
+
rescue OpenSSL::Digest::DigestError
|
217
|
+
false
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
173
221
|
private
|
174
222
|
|
175
223
|
def validate_bundle_path
|
176
|
-
|
177
|
-
|
224
|
+
path_separator = Bundler.rubygems.path_separator
|
225
|
+
return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
|
226
|
+
message = "Your bundle path contains text matching #{path_separator.inspect}, " \
|
178
227
|
"which is the path separator for your system. Bundler cannot " \
|
179
228
|
"function correctly when the Bundle path contains the " \
|
180
229
|
"system's PATH separator. Please change your " \
|
181
|
-
"bundle path to not
|
230
|
+
"bundle path to not match #{path_separator.inspect}." \
|
182
231
|
"\nYour current bundle path is '#{Bundler.bundle_path}'."
|
183
232
|
raise Bundler::PathError, message
|
184
233
|
end
|
185
234
|
|
186
|
-
def find_gemfile
|
235
|
+
def find_gemfile(order_matters = false)
|
187
236
|
given = ENV["BUNDLE_GEMFILE"]
|
188
237
|
return given if given && !given.empty?
|
189
|
-
|
238
|
+
names = gemfile_names
|
239
|
+
names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb?
|
240
|
+
find_file(*names)
|
241
|
+
end
|
242
|
+
|
243
|
+
def gemfile_names
|
244
|
+
["Gemfile", "gems.rb"]
|
190
245
|
end
|
191
246
|
|
192
247
|
def find_file(*names)
|
@@ -220,36 +275,47 @@ module Bundler
|
|
220
275
|
end
|
221
276
|
end
|
222
277
|
|
278
|
+
def set_env(key, value)
|
279
|
+
raise ArgumentError, "new key #{key}" unless EnvironmentPreserver::BUNDLER_KEYS.include?(key)
|
280
|
+
orig_key = "#{EnvironmentPreserver::BUNDLER_PREFIX}#{key}"
|
281
|
+
orig = ENV[key]
|
282
|
+
orig ||= EnvironmentPreserver::INTENTIONALLY_NIL
|
283
|
+
ENV[orig_key] ||= orig
|
284
|
+
|
285
|
+
ENV[key] = value
|
286
|
+
end
|
287
|
+
public :set_env
|
288
|
+
|
223
289
|
def set_bundle_variables
|
224
290
|
begin
|
225
|
-
|
291
|
+
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
|
226
292
|
rescue Gem::GemNotFoundException
|
227
|
-
|
293
|
+
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", File.expand_path("../../../exe/bundle", __FILE__)
|
228
294
|
end
|
229
295
|
|
230
296
|
# Set BUNDLE_GEMFILE
|
231
|
-
|
232
|
-
|
297
|
+
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile(:order_matters).to_s
|
298
|
+
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
|
233
299
|
end
|
234
300
|
|
235
301
|
def set_path
|
236
302
|
validate_bundle_path
|
237
303
|
paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
|
238
304
|
paths.unshift "#{Bundler.bundle_path}/bin"
|
239
|
-
|
305
|
+
Bundler::SharedHelpers.set_env "PATH", paths.uniq.join(File::PATH_SEPARATOR)
|
240
306
|
end
|
241
307
|
|
242
308
|
def set_rubyopt
|
243
309
|
rubyopt = [ENV["RUBYOPT"]].compact
|
244
310
|
return if !rubyopt.empty? && rubyopt.first =~ %r{-rbundler/setup}
|
245
311
|
rubyopt.unshift %(-rbundler/setup)
|
246
|
-
|
312
|
+
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
|
247
313
|
end
|
248
314
|
|
249
315
|
def set_rubylib
|
250
316
|
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
|
251
317
|
rubylib.unshift bundler_ruby_lib
|
252
|
-
|
318
|
+
Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
|
253
319
|
end
|
254
320
|
|
255
321
|
def bundler_ruby_lib
|
@@ -280,12 +346,6 @@ module Bundler
|
|
280
346
|
true
|
281
347
|
end
|
282
348
|
|
283
|
-
def deprecate_gemfile(gemfile)
|
284
|
-
return unless gemfile && File.basename(gemfile) == "Gemfile"
|
285
|
-
Bundler::SharedHelpers.major_deprecation \
|
286
|
-
"gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
|
287
|
-
end
|
288
|
-
|
289
349
|
extend self
|
290
350
|
end
|
291
351
|
end
|
data/lib/bundler/source.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class Source
|
4
5
|
autoload :Gemspec, "bundler/source/gemspec"
|
5
6
|
autoload :Git, "bundler/source/git"
|
7
|
+
autoload :Metadata, "bundler/source/metadata"
|
6
8
|
autoload :Path, "bundler/source/path"
|
7
9
|
autoload :Rubygems, "bundler/source/rubygems"
|
8
10
|
|
@@ -31,6 +33,11 @@ module Bundler
|
|
31
33
|
spec.source == self
|
32
34
|
end
|
33
35
|
|
36
|
+
# it's possible that gems from one source depend on gems from some
|
37
|
+
# other source, so now we download gemspecs and iterate over those
|
38
|
+
# dependencies, looking for gems we don't have info on yet.
|
39
|
+
def double_check_for(*); end
|
40
|
+
|
34
41
|
def include?(other)
|
35
42
|
other == self
|
36
43
|
end
|
@@ -39,6 +46,10 @@ module Bundler
|
|
39
46
|
"#<#{self.class}:0x#{object_id} #{self}>"
|
40
47
|
end
|
41
48
|
|
49
|
+
def path?
|
50
|
+
instance_of?(Bundler::Source::Path)
|
51
|
+
end
|
52
|
+
|
42
53
|
private
|
43
54
|
|
44
55
|
def version_color(spec_version, locked_spec_version)
|
@@ -54,5 +65,26 @@ module Bundler
|
|
54
65
|
def earlier_version?(spec_version, locked_spec_version)
|
55
66
|
Gem::Version.new(spec_version) < Gem::Version.new(locked_spec_version)
|
56
67
|
end
|
68
|
+
|
69
|
+
def print_using_message(message)
|
70
|
+
if !message.include?("(was ") && Bundler.feature_flag.suppress_install_using_messages?
|
71
|
+
Bundler.ui.debug message
|
72
|
+
else
|
73
|
+
Bundler.ui.info message
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def extension_cache_path(spec)
|
78
|
+
return unless Bundler.feature_flag.global_gem_cache?
|
79
|
+
return unless source_slug = extension_cache_slug(spec)
|
80
|
+
Bundler.user_cache.join(
|
81
|
+
"extensions", Gem::Platform.local.to_s, Bundler.ruby_scope,
|
82
|
+
source_slug, spec.full_name
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
def extension_cache_slug(_)
|
87
|
+
nil
|
88
|
+
end
|
57
89
|
end
|
58
90
|
end
|
data/lib/bundler/source/git.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "bundler/vendored_fileutils"
|
3
4
|
require "uri"
|
4
5
|
require "digest/sha1"
|
5
6
|
|
@@ -18,7 +19,7 @@ module Bundler
|
|
18
19
|
@allow_remote = false
|
19
20
|
|
20
21
|
# Stringify options that could be set as symbols
|
21
|
-
%w
|
22
|
+
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
|
22
23
|
|
23
24
|
@uri = options["uri"] || ""
|
24
25
|
@branch = options["branch"]
|
@@ -39,7 +40,7 @@ module Bundler
|
|
39
40
|
out = String.new("GIT\n")
|
40
41
|
out << " remote: #{@uri}\n"
|
41
42
|
out << " revision: #{revision}\n"
|
42
|
-
%w
|
43
|
+
%w[ref branch tag submodules].each do |opt|
|
43
44
|
out << " #{opt}: #{options[opt]}\n" if options[opt]
|
44
45
|
end
|
45
46
|
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
|
@@ -169,15 +170,13 @@ module Bundler
|
|
169
170
|
def install(spec, options = {})
|
170
171
|
force = options[:force]
|
171
172
|
|
172
|
-
|
173
|
+
print_using_message "Using #{version_message(spec)} from #{self}"
|
173
174
|
|
174
|
-
if requires_checkout? && !@copied
|
175
|
+
if (requires_checkout? && !@copied) || force
|
175
176
|
Bundler.ui.debug " * Checking out revision: #{ref}"
|
176
177
|
git_proxy.copy_to(install_path, submodules)
|
177
178
|
serialize_gemspecs_in(install_path)
|
178
179
|
@copied = true
|
179
|
-
elsif force
|
180
|
-
git_proxy.copy_to(install_path, submodules)
|
181
180
|
end
|
182
181
|
|
183
182
|
generate_bin_options = { :disable_extensions => !Bundler.rubygems.spec_missing_extensions?(spec), :build_args => options[:build_args] }
|
@@ -188,7 +187,7 @@ module Bundler
|
|
188
187
|
|
189
188
|
def cache(spec, custom_path = nil)
|
190
189
|
app_cache_path = app_cache_path(custom_path)
|
191
|
-
return unless Bundler.
|
190
|
+
return unless Bundler.feature_flag.cache_all?
|
192
191
|
return if path == app_cache_path
|
193
192
|
cached!
|
194
193
|
FileUtils.rm_rf(app_cache_path)
|
@@ -210,13 +209,11 @@ module Bundler
|
|
210
209
|
# When using local git repos, this is set to the local repo.
|
211
210
|
def cache_path
|
212
211
|
@cache_path ||= begin
|
213
|
-
|
214
|
-
|
215
|
-
if Bundler.requires_sudo?
|
216
|
-
Bundler.user_bundle_path.join("cache/git", git_scope)
|
212
|
+
if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
|
213
|
+
Bundler.user_cache
|
217
214
|
else
|
218
|
-
Bundler.
|
219
|
-
end
|
215
|
+
Bundler.bundle_path.join("cache", "bundler")
|
216
|
+
end.join("git", git_scope)
|
220
217
|
end
|
221
218
|
end
|
222
219
|
|
@@ -304,9 +301,9 @@ module Bundler
|
|
304
301
|
|
305
302
|
def fetch
|
306
303
|
git_proxy.checkout
|
307
|
-
rescue GitError
|
304
|
+
rescue GitError => e
|
308
305
|
raise unless Bundler.feature_flag.allow_offline_install?
|
309
|
-
Bundler.ui.warn "Using cached git data because of network errors"
|
306
|
+
Bundler.ui.warn "Using cached git data because of network errors:\n#{e}"
|
310
307
|
end
|
311
308
|
|
312
309
|
# no-op, since we validate when re-serializing the gemspec
|
@@ -319,6 +316,14 @@ module Bundler
|
|
319
316
|
StubSpecification.from_stub(stub)
|
320
317
|
end
|
321
318
|
end
|
319
|
+
|
320
|
+
def git_scope
|
321
|
+
"#{base_name}-#{uri_hash}"
|
322
|
+
end
|
323
|
+
|
324
|
+
def extension_cache_slug(_)
|
325
|
+
extension_dir_name
|
326
|
+
end
|
322
327
|
end
|
323
328
|
end
|
324
329
|
end
|