bundler 1.11.2 → 1.12.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 +4 -4
- data/.codeclimate.yml +24 -0
- data/.gitignore +2 -2
- data/.rubocop.yml +17 -2
- data/.rubocop_todo.yml +145 -18
- data/.travis.yml +9 -2
- data/CHANGELOG.md +42 -0
- data/Rakefile +20 -13
- data/bin/rake +5 -0
- data/bin/rspec +5 -0
- data/bin/rubocop +7 -1
- data/bundler.gemspec +2 -1
- data/exe/bundle +10 -2
- data/exe/bundle_ruby +2 -1
- data/exe/bundler +3 -1
- data/lib/bundler.rb +54 -51
- data/lib/bundler/capistrano.rb +1 -0
- data/lib/bundler/cli.rb +26 -4
- data/lib/bundler/cli/binstubs.rb +1 -0
- data/lib/bundler/cli/cache.rb +1 -0
- data/lib/bundler/cli/check.rb +4 -1
- data/lib/bundler/cli/clean.rb +1 -0
- data/lib/bundler/cli/common.rb +1 -0
- data/lib/bundler/cli/config.rb +5 -5
- data/lib/bundler/cli/console.rb +1 -0
- data/lib/bundler/cli/exec.rb +4 -9
- data/lib/bundler/cli/gem.rb +12 -9
- data/lib/bundler/cli/init.rb +1 -0
- data/lib/bundler/cli/inject.rb +1 -0
- data/lib/bundler/cli/install.rb +8 -5
- data/lib/bundler/cli/lock.rb +2 -0
- data/lib/bundler/cli/open.rb +1 -0
- data/lib/bundler/cli/outdated.rb +36 -9
- data/lib/bundler/cli/package.rb +1 -0
- data/lib/bundler/cli/platform.rb +4 -1
- data/lib/bundler/cli/show.rb +1 -0
- data/lib/bundler/cli/update.rb +6 -6
- data/lib/bundler/cli/viz.rb +4 -6
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +34 -168
- data/lib/bundler/definition.rb +41 -15
- data/lib/bundler/dep_proxy.rb +1 -0
- data/lib/bundler/dependency.rb +10 -0
- data/lib/bundler/deployment.rb +1 -0
- data/lib/bundler/deprecate.rb +1 -0
- data/lib/bundler/dsl.rb +19 -9
- data/lib/bundler/endpoint_specification.rb +37 -8
- data/lib/bundler/env.rb +4 -3
- data/lib/bundler/environment.rb +1 -0
- data/lib/bundler/errors.rb +51 -32
- data/lib/bundler/fetcher.rb +44 -30
- data/lib/bundler/fetcher/base.rb +3 -2
- data/lib/bundler/fetcher/compact_index.rb +98 -0
- data/lib/bundler/fetcher/dependency.rb +36 -36
- data/lib/bundler/fetcher/downloader.rb +14 -8
- data/lib/bundler/fetcher/index.rb +28 -5
- data/lib/bundler/friendly_errors.rb +93 -85
- data/lib/bundler/gem_helper.rb +20 -21
- data/lib/bundler/gem_helpers.rb +9 -2
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/graph.rb +16 -17
- data/lib/bundler/index.rb +4 -6
- data/lib/bundler/injector.rb +1 -0
- data/lib/bundler/inline.rb +8 -2
- data/lib/bundler/installer.rb +4 -4
- data/lib/bundler/installer/gem_installer.rb +1 -0
- data/lib/bundler/installer/parallel_installer.rb +3 -2
- data/lib/bundler/installer/standalone.rb +5 -1
- data/lib/bundler/lazy_specification.rb +5 -2
- data/lib/bundler/lockfile_parser.rb +22 -15
- data/lib/bundler/match_platform.rb +1 -0
- data/lib/bundler/mirror.rb +218 -0
- data/lib/bundler/path_preserver.rb +12 -0
- data/lib/bundler/psyched_yaml.rb +1 -0
- data/lib/bundler/remote_specification.rb +4 -1
- data/lib/bundler/resolver.rb +17 -16
- data/lib/bundler/retry.rb +1 -0
- data/lib/bundler/ruby_dsl.rb +8 -2
- data/lib/bundler/ruby_version.rb +58 -61
- data/lib/bundler/rubygems_ext.rb +4 -3
- data/lib/bundler/rubygems_gem_installer.rb +1 -0
- data/lib/bundler/rubygems_integration.rb +9 -14
- data/lib/bundler/runtime.rb +17 -22
- data/lib/bundler/settings.rb +17 -21
- data/lib/bundler/setup.rb +1 -0
- data/lib/bundler/shared_helpers.rb +47 -17
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source.rb +2 -1
- data/lib/bundler/source/git.rb +2 -1
- data/lib/bundler/source/git/git_proxy.rb +33 -7
- data/lib/bundler/source/path.rb +17 -10
- data/lib/bundler/source/path/installer.rb +1 -0
- data/lib/bundler/source/rubygems.rb +4 -3
- data/lib/bundler/source/rubygems/remote.rb +16 -0
- data/lib/bundler/source_list.rb +1 -0
- data/lib/bundler/spec_set.rb +1 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +1 -0
- data/lib/bundler/stub_specification.rb +1 -0
- data/lib/bundler/templates/Executable +1 -0
- data/lib/bundler/templates/Gemfile +1 -0
- data/lib/bundler/templates/newgem/.travis.yml.tt +1 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +2 -1
- data/lib/bundler/ui/silent.rb +1 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +78 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +97 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +55 -0
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +3 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +4 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +13 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +5 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +37 -14
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +7 -7
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +1 -0
- data/lib/bundler/vendored_thor.rb +1 -0
- data/lib/bundler/version.rb +6 -1
- data/lib/bundler/vlad.rb +1 -0
- data/lib/bundler/worker.rb +12 -2
- data/man/bundle-config.ronn +6 -0
- data/man/bundle-gem.ronn +5 -5
- metadata +14 -6
- data/lib/bundler/gem_path_manipulation.rb +0 -8
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "bundler/fetcher/base"
|
2
3
|
require "rubygems/remote_fetcher"
|
3
4
|
|
@@ -13,16 +14,38 @@ module Bundler
|
|
13
14
|
when /401/
|
14
15
|
raise AuthenticationRequiredError, remote_uri
|
15
16
|
when /403/
|
16
|
-
if remote_uri.userinfo
|
17
|
-
|
18
|
-
else
|
19
|
-
raise AuthenticationRequiredError, remote_uri
|
20
|
-
end
|
17
|
+
raise BadAuthenticationError, remote_uri if remote_uri.userinfo
|
18
|
+
raise AuthenticationRequiredError, remote_uri
|
21
19
|
else
|
22
20
|
Bundler.ui.trace e
|
23
21
|
raise HTTPError, "Could not fetch specs from #{display_uri}"
|
24
22
|
end
|
25
23
|
end
|
24
|
+
|
25
|
+
def fetch_spec(spec)
|
26
|
+
spec -= [nil, "ruby", ""]
|
27
|
+
spec_file_name = "#{spec.join "-"}.gemspec"
|
28
|
+
|
29
|
+
uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
|
30
|
+
if uri.scheme == "file"
|
31
|
+
Bundler.load_marshal Gem.inflate(Gem.read_binary(uri.path))
|
32
|
+
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
|
33
|
+
Bundler.load_gemspec(cached_spec_path)
|
34
|
+
else
|
35
|
+
Bundler.load_marshal Gem.inflate(downloader.fetch(uri).body)
|
36
|
+
end
|
37
|
+
rescue MarshalError
|
38
|
+
raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
|
39
|
+
"Your network or your gem server is probably having issues right now."
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# cached gem specification path, if one exists
|
45
|
+
def gemspec_cached_path(spec_file_name)
|
46
|
+
paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
|
47
|
+
paths.find {|path| File.file? path }
|
48
|
+
end
|
26
49
|
end
|
27
50
|
end
|
28
51
|
end
|
@@ -1,95 +1,103 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
require "cgi"
|
3
4
|
require "bundler/vendored_thor"
|
4
5
|
|
5
6
|
module Bundler
|
7
|
+
module FriendlyErrors
|
8
|
+
module_function
|
9
|
+
|
10
|
+
def log_error(error)
|
11
|
+
case error
|
12
|
+
when YamlSyntaxError
|
13
|
+
Bundler.ui.error error.message
|
14
|
+
Bundler.ui.trace error.orig_exception
|
15
|
+
when Dsl::DSLError
|
16
|
+
Bundler.ui.error error.message
|
17
|
+
when GemRequireError
|
18
|
+
Bundler.ui.error error.message
|
19
|
+
Bundler.ui.trace error.orig_exception, nil, true
|
20
|
+
when BundlerError
|
21
|
+
Bundler.ui.error error.message, :wrap => true
|
22
|
+
Bundler.ui.trace error
|
23
|
+
when Thor::Error
|
24
|
+
Bundler.ui.error error.message
|
25
|
+
when LoadError
|
26
|
+
raise error unless error.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
|
27
|
+
Bundler.ui.error "\nCould not load OpenSSL."
|
28
|
+
Bundler.ui.warn <<-WARN, :wrap => true
|
29
|
+
You must recompile Ruby with OpenSSL support or change the sources in your \
|
30
|
+
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
|
31
|
+
using RVM are available at http://rvm.io/packages/openssl.
|
32
|
+
WARN
|
33
|
+
Bundler.ui.trace error
|
34
|
+
when Interrupt
|
35
|
+
Bundler.ui.error "\nQuitting..."
|
36
|
+
Bundler.ui.trace error
|
37
|
+
when Gem::InvalidSpecificationException
|
38
|
+
Bundler.ui.error error.message, :wrap => true
|
39
|
+
when SystemExit
|
40
|
+
else request_issue_report_for(error)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def exit_status(error)
|
45
|
+
case error
|
46
|
+
when BundlerError then error.status_code
|
47
|
+
when Thor::Error then 15
|
48
|
+
when SystemExit then error.status
|
49
|
+
else 1
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def request_issue_report_for(e)
|
54
|
+
Bundler.ui.info <<-EOS.gsub(/^ {8}/, "")
|
55
|
+
--- ERROR REPORT TEMPLATE -------------------------------------------------------
|
56
|
+
- What did you do?
|
57
|
+
|
58
|
+
I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
|
59
|
+
|
60
|
+
- What did you expect to happen?
|
61
|
+
|
62
|
+
I expected Bundler to...
|
63
|
+
|
64
|
+
- What happened instead?
|
65
|
+
|
66
|
+
Instead, what actually happened was...
|
67
|
+
|
68
|
+
|
69
|
+
Error details
|
70
|
+
|
71
|
+
#{e.class}: #{e.message}
|
72
|
+
#{e.backtrace.join("\n ")}
|
73
|
+
|
74
|
+
#{Bundler::Env.new.report(:print_gemfile => false, :print_gemspecs => false).gsub(/\n/, "\n ").strip}
|
75
|
+
--- TEMPLATE END ----------------------------------------------------------------
|
76
|
+
|
77
|
+
EOS
|
78
|
+
|
79
|
+
Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
|
80
|
+
|
81
|
+
Bundler.ui.warn <<-EOS.gsub(/^ {8}/, "")
|
82
|
+
|
83
|
+
First, try this link to see if there are any existing issue reports for this error:
|
84
|
+
#{issues_url(e)}
|
85
|
+
|
86
|
+
If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
|
87
|
+
https://github.com/bundler/bundler/issues/new
|
88
|
+
EOS
|
89
|
+
end
|
90
|
+
|
91
|
+
def issues_url(exception)
|
92
|
+
"https://github.com/bundler/bundler/search?q=" \
|
93
|
+
"#{CGI.escape(exception.message.lines.first.chomp)}&type=Issues"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
6
97
|
def self.with_friendly_errors
|
7
98
|
yield
|
8
|
-
rescue Bundler::YamlSyntaxError => e
|
9
|
-
Bundler.ui.error e.message
|
10
|
-
Bundler.ui.trace e.orig_exception
|
11
|
-
exit e.status_code
|
12
|
-
rescue Bundler::Dsl::DSLError => e
|
13
|
-
Bundler.ui.error e.message
|
14
|
-
exit e.status_code
|
15
|
-
rescue Bundler::GemRequireError => e
|
16
|
-
Bundler.ui.error e.message
|
17
|
-
Bundler.ui.trace e.orig_exception, nil, true
|
18
|
-
exit e.status_code
|
19
|
-
rescue Bundler::BundlerError => e
|
20
|
-
Bundler.ui.error e.message, :wrap => true
|
21
|
-
Bundler.ui.trace e
|
22
|
-
exit e.status_code
|
23
|
-
rescue Thor::AmbiguousTaskError => e
|
24
|
-
Bundler.ui.error e.message
|
25
|
-
exit 15
|
26
|
-
rescue Thor::UndefinedTaskError => e
|
27
|
-
Bundler.ui.error e.message
|
28
|
-
exit 15
|
29
|
-
rescue Thor::Error => e
|
30
|
-
Bundler.ui.error e.message
|
31
|
-
exit 1
|
32
|
-
rescue LoadError => e
|
33
|
-
raise e unless e.message =~ /cannot load such file -- openssl|openssl.so|libcrypto.so/
|
34
|
-
Bundler.ui.error "\nCould not load OpenSSL."
|
35
|
-
Bundler.ui.warn <<-WARN, :wrap => true
|
36
|
-
You must recompile Ruby with OpenSSL support or change the sources in your \
|
37
|
-
Gemfile from 'https' to 'http'. Instructions for compiling with OpenSSL \
|
38
|
-
using RVM are available at http://rvm.io/packages/openssl.
|
39
|
-
WARN
|
40
|
-
Bundler.ui.trace e
|
41
|
-
exit 1
|
42
|
-
rescue Interrupt => e
|
43
|
-
Bundler.ui.error "\nQuitting..."
|
44
|
-
Bundler.ui.trace e
|
45
|
-
exit 1
|
46
|
-
rescue SystemExit => e
|
47
|
-
exit e.status
|
48
99
|
rescue Exception => e
|
49
|
-
|
50
|
-
exit
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.request_issue_report_for(e)
|
54
|
-
Bundler.ui.info <<-EOS.gsub(/^ {6}/, "")
|
55
|
-
--- ERROR REPORT TEMPLATE -------------------------------------------------------
|
56
|
-
- What did you do?
|
57
|
-
|
58
|
-
I ran the command `#{$PROGRAM_NAME} #{ARGV.join(" ")}`
|
59
|
-
|
60
|
-
- What did you expect to happen?
|
61
|
-
|
62
|
-
I expected Bundler to...
|
63
|
-
|
64
|
-
- What happened instead?
|
65
|
-
|
66
|
-
Instead, what actually happened was...
|
67
|
-
|
68
|
-
|
69
|
-
Error details
|
70
|
-
|
71
|
-
#{e.class}: #{e.message}
|
72
|
-
#{e.backtrace.join("\n ")}
|
73
|
-
|
74
|
-
#{Bundler::Env.new.report(:print_gemfile => false, :print_gemspecs => false).gsub(/\n/, "\n ").strip}
|
75
|
-
--- TEMPLATE END ----------------------------------------------------------------
|
76
|
-
|
77
|
-
EOS
|
78
|
-
|
79
|
-
Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
|
80
|
-
|
81
|
-
Bundler.ui.warn <<-EOS.gsub(/^ {6}/, "")
|
82
|
-
|
83
|
-
First, try this link to see if there are any existing issue reports for this error:
|
84
|
-
#{issues_url(e)}
|
85
|
-
|
86
|
-
If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
|
87
|
-
https://github.com/bundler/bundler/issues/new
|
88
|
-
EOS
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.issues_url(exception)
|
92
|
-
"https://github.com/bundler/bundler/search?q=" \
|
93
|
-
"#{CGI.escape(exception.message.lines.first.chomp)}&type=Issues"
|
100
|
+
FriendlyErrors.log_error(e)
|
101
|
+
exit FriendlyErrors.exit_status(e)
|
94
102
|
end
|
95
103
|
end
|
data/lib/bundler/gem_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "bundler/vendored_thor" unless defined?(Thor)
|
2
3
|
require "bundler"
|
3
4
|
|
@@ -91,18 +92,17 @@ module Bundler
|
|
91
92
|
protected
|
92
93
|
|
93
94
|
def rubygem_push(path)
|
94
|
-
|
95
|
-
allowed_push_host = nil
|
96
|
-
gem_command = "gem push '#{path}'"
|
97
|
-
if @gemspec.respond_to?(:metadata)
|
98
|
-
allowed_push_host = @gemspec.metadata["allowed_push_host"]
|
99
|
-
gem_command << " --host #{allowed_push_host}" if allowed_push_host
|
100
|
-
end
|
101
|
-
sh(gem_command)
|
102
|
-
Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}"
|
103
|
-
else
|
95
|
+
unless Pathname.new("~/.gem/credentials").expand_path.file?
|
104
96
|
raise "Your rubygems.org credentials aren't set. Run `gem push` to set them."
|
105
97
|
end
|
98
|
+
allowed_push_host = nil
|
99
|
+
gem_command = "gem push '#{path}'"
|
100
|
+
if @gemspec.respond_to?(:metadata)
|
101
|
+
allowed_push_host = @gemspec.metadata["allowed_push_host"]
|
102
|
+
gem_command += " --host #{allowed_push_host}" if allowed_push_host
|
103
|
+
end
|
104
|
+
sh(gem_command)
|
105
|
+
Bundler.ui.confirm "Pushed #{name} #{version} to #{allowed_push_host ? allowed_push_host : "rubygems.org."}"
|
106
106
|
end
|
107
107
|
|
108
108
|
def built_gem_path
|
@@ -122,10 +122,9 @@ module Bundler
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def already_tagged?
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
125
|
+
return false unless sh("git tag").split(/\n/).include?(version_tag)
|
126
|
+
Bundler.ui.confirm "Tag #{version_tag} has already been created."
|
127
|
+
true
|
129
128
|
end
|
130
129
|
|
131
130
|
def guard_clean
|
@@ -164,22 +163,22 @@ module Bundler
|
|
164
163
|
|
165
164
|
def sh(cmd, &block)
|
166
165
|
out, code = sh_with_code(cmd, &block)
|
167
|
-
|
168
|
-
out
|
169
|
-
else
|
166
|
+
unless code.zero?
|
170
167
|
raise(out.empty? ? "Running `#{cmd}` failed. Run this command directly for more detailed output." : out)
|
171
168
|
end
|
169
|
+
out
|
172
170
|
end
|
173
171
|
|
174
172
|
def sh_with_code(cmd, &block)
|
175
|
-
cmd
|
176
|
-
outbuf =
|
173
|
+
cmd += " 2>&1"
|
174
|
+
outbuf = String.new
|
177
175
|
Bundler.ui.debug(cmd)
|
178
176
|
SharedHelpers.chdir(base) do
|
179
177
|
outbuf = `#{cmd}`
|
180
|
-
|
178
|
+
status = $?.exitstatus
|
179
|
+
block.call(outbuf) if status.zero? && block
|
180
|
+
[outbuf, status]
|
181
181
|
end
|
182
|
-
[outbuf, $?]
|
183
182
|
end
|
184
183
|
|
185
184
|
def gem_push?
|
data/lib/bundler/gem_helpers.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Bundler
|
2
3
|
module GemHelpers
|
3
|
-
GENERIC_CACHE = {}
|
4
|
+
GENERIC_CACHE = {} # rubocop:disable MutableConstant
|
4
5
|
GENERICS = [
|
5
6
|
[Gem::Platform.new("java"), Gem::Platform.new("java")],
|
6
7
|
[Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
|
@@ -9,7 +10,7 @@ module Bundler
|
|
9
10
|
[Gem::Platform.new("x64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
10
11
|
[Gem::Platform.new("x86_64-mingw32"), Gem::Platform.new("x64-mingw32")],
|
11
12
|
[Gem::Platform.new("mingw32"), Gem::Platform.new("x86-mingw32")]
|
12
|
-
]
|
13
|
+
].freeze
|
13
14
|
|
14
15
|
def generic(p)
|
15
16
|
return p if p == Gem::Platform::RUBY
|
@@ -21,5 +22,11 @@ module Bundler
|
|
21
22
|
found || Gem::Platform::RUBY
|
22
23
|
end
|
23
24
|
end
|
25
|
+
module_function :generic
|
26
|
+
|
27
|
+
def generic_local_platform
|
28
|
+
generic(Gem::Platform.local)
|
29
|
+
end
|
30
|
+
module_function :generic_local_platform
|
24
31
|
end
|
25
32
|
end
|
data/lib/bundler/gem_tasks.rb
CHANGED
data/lib/bundler/graph.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "set"
|
2
3
|
module Bundler
|
3
4
|
class Graph
|
@@ -31,25 +32,23 @@ module Bundler
|
|
31
32
|
def _populate_relations
|
32
33
|
parent_dependencies = _groups.values.to_set.flatten
|
33
34
|
loop do
|
34
|
-
if parent_dependencies.empty?
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
@edge_options["#{dependency.name}_#{c_dependency.name}"] = _make_label(c_dependency, :edge)
|
49
|
-
end
|
35
|
+
break if parent_dependencies.empty?
|
36
|
+
|
37
|
+
tmp = Set.new
|
38
|
+
parent_dependencies.each do |dependency|
|
39
|
+
# if the dependency is a prerelease, allow to_spec to be non-nil
|
40
|
+
dependency.prerelease = true
|
41
|
+
|
42
|
+
child_dependencies = dependency.to_spec.runtime_dependencies.to_set
|
43
|
+
@relations[dependency.name] += child_dependencies.map(&:name).to_set
|
44
|
+
tmp += child_dependencies
|
45
|
+
|
46
|
+
@node_options[dependency.name] = _make_label(dependency, :node)
|
47
|
+
child_dependencies.each do |c_dependency|
|
48
|
+
@edge_options["#{dependency.name}_#{c_dependency.name}"] = _make_label(c_dependency, :edge)
|
50
49
|
end
|
51
|
-
parent_dependencies = tmp
|
52
50
|
end
|
51
|
+
parent_dependencies = tmp
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
data/lib/bundler/index.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "set"
|
2
3
|
|
3
4
|
module Bundler
|
@@ -139,12 +140,9 @@ module Bundler
|
|
139
140
|
end
|
140
141
|
|
141
142
|
def add_source(index)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
else
|
146
|
-
raise ArgumentError, "Source must be an index, not #{index.class}"
|
147
|
-
end
|
143
|
+
raise ArgumentError, "Source must be an index, not #{index.class}" unless index.is_a?(Index)
|
144
|
+
@sources << index
|
145
|
+
@sources.uniq! # need to use uniq! here instead of checking for the item before adding
|
148
146
|
end
|
149
147
|
|
150
148
|
private
|
data/lib/bundler/injector.rb
CHANGED
data/lib/bundler/inline.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Allows for declaring a Gemfile inline in a ruby script, optionally installing
|
2
3
|
# any gems that aren't already installed on the user's system.
|
3
4
|
#
|
@@ -27,8 +28,13 @@
|
|
27
28
|
#
|
28
29
|
# puts Pod::VERSION # => "0.34.4"
|
29
30
|
#
|
30
|
-
def gemfile(install = false, &gemfile)
|
31
|
+
def gemfile(install = false, options = {}, &gemfile)
|
31
32
|
require "bundler"
|
33
|
+
|
34
|
+
opts = options.dup
|
35
|
+
ui = opts.delete(:ui) { Bundler::UI::Shell.new }
|
36
|
+
raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
|
37
|
+
|
32
38
|
old_root = Bundler.method(:root)
|
33
39
|
def Bundler.root
|
34
40
|
Bundler::SharedHelpers.pwd.expand_path
|
@@ -43,7 +49,7 @@ def gemfile(install = false, &gemfile)
|
|
43
49
|
definition.validate_ruby!
|
44
50
|
|
45
51
|
if install
|
46
|
-
Bundler.ui =
|
52
|
+
Bundler.ui = ui
|
47
53
|
Bundler::Installer.install(Bundler.root, definition, :system => true)
|
48
54
|
Bundler::Installer.post_install_messages.each do |name, message|
|
49
55
|
Bundler.ui.info "Post-install message from #{name}:\n#{message}"
|