bundler 1.13.7 → 1.14.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/.gitignore +2 -0
- data/.rubocop_todo.yml +100 -18
- data/.travis.yml +32 -18
- data/CHANGELOG.md +64 -2
- data/DEVELOPMENT.md +5 -3
- data/ISSUES.md +17 -0
- data/README.md +7 -0
- data/Rakefile +34 -23
- data/bin/rubocop +1 -1
- data/bundler.gemspec +2 -2
- data/exe/bundle +4 -6
- data/lib/bundler.rb +57 -5
- data/lib/bundler/cli.rb +51 -38
- data/lib/bundler/cli/binstubs.rb +1 -1
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/clean.rb +1 -1
- data/lib/bundler/cli/common.rb +30 -0
- data/lib/bundler/cli/doctor.rb +17 -19
- data/lib/bundler/cli/exec.rb +6 -0
- data/lib/bundler/cli/gem.rb +18 -4
- data/lib/bundler/cli/install.rb +9 -25
- data/lib/bundler/cli/lock.rb +8 -7
- data/lib/bundler/cli/outdated.rb +163 -56
- data/lib/bundler/cli/platform.rb +1 -1
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +10 -23
- data/lib/bundler/compact_index_client.rb +108 -0
- data/lib/bundler/compact_index_client/cache.rb +119 -0
- data/lib/bundler/compact_index_client/updater.rb +88 -0
- data/lib/bundler/current_ruby.rb +4 -3
- data/lib/bundler/definition.rb +107 -17
- data/lib/bundler/dependency.rb +6 -0
- data/lib/bundler/dsl.rb +3 -2
- data/lib/bundler/env.rb +27 -18
- data/lib/bundler/errors.rb +22 -0
- data/lib/bundler/feature_flag.rb +32 -0
- data/lib/bundler/fetcher.rb +2 -2
- data/lib/bundler/fetcher/compact_index.rb +17 -5
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +11 -0
- data/lib/bundler/friendly_errors.rb +28 -7
- data/lib/bundler/gem_helper.rb +1 -1
- data/lib/bundler/gem_helpers.rb +69 -1
- data/lib/bundler/gemdeps.rb +28 -0
- data/lib/bundler/index.rb +9 -4
- data/lib/bundler/inline.rb +3 -3
- data/lib/bundler/installer.rb +3 -2
- data/lib/bundler/installer/gem_installer.rb +2 -2
- data/lib/bundler/installer/parallel_installer.rb +40 -9
- data/lib/bundler/lazy_specification.rb +16 -1
- data/lib/bundler/lockfile_parser.rb +1 -2
- data/lib/bundler/match_platform.rb +12 -3
- data/lib/bundler/plugin.rb +4 -2
- data/lib/bundler/plugin/api.rb +2 -1
- data/lib/bundler/plugin/api/source.rb +1 -1
- data/lib/bundler/postit_trampoline.rb +12 -7
- data/lib/bundler/remote_specification.rb +5 -0
- data/lib/bundler/resolver.rb +59 -49
- data/lib/bundler/retry.rb +4 -1
- data/lib/bundler/ruby_version.rb +5 -0
- data/lib/bundler/rubygems_ext.rb +5 -0
- data/lib/bundler/rubygems_gem_installer.rb +60 -0
- data/lib/bundler/rubygems_integration.rb +28 -2
- data/lib/bundler/runtime.rb +2 -1
- data/lib/bundler/settings.rb +29 -5
- data/lib/bundler/setup.rb +1 -1
- data/lib/bundler/shared_helpers.rb +26 -15
- data/lib/bundler/source.rb +5 -0
- data/lib/bundler/source/git.rb +1 -1
- data/lib/bundler/source/git/git_proxy.rb +5 -0
- data/lib/bundler/source/path.rb +6 -1
- data/lib/bundler/source/rubygems.rb +11 -1
- data/lib/bundler/spec_set.rb +32 -13
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/bin/console.tt +1 -1
- data/lib/bundler/templates/newgem/gitignore.tt +5 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +1 -1
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +10 -1
- data/lib/bundler/ui/shell.rb +4 -0
- data/lib/bundler/ui/silent.rb +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +62 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +12 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +22 -13
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/faster.rb +1 -0
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent.rb +24 -23
- data/lib/bundler/vendor/{net → net-http-persistent/lib/net}/http/persistent/ssl_reuse.rb +2 -1
- data/lib/bundler/vendored_persistent.rb +9 -4
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +27 -5
- data/lib/bundler/yaml_serializer.rb +1 -1
- data/man/bundle-config.ronn +29 -2
- data/man/bundle-install.ronn +1 -1
- data/man/bundle-lock.ronn +47 -0
- data/man/bundle-outdated.ronn +107 -0
- data/man/bundle-update.ronn +152 -3
- data/man/bundle.ronn +27 -9
- data/man/gemfile.5.ronn +8 -0
- metadata +37 -31
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client.rb +0 -79
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/cache.rb +0 -112
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/updater.rb +0 -80
- data/lib/bundler/vendor/compact_index_client/lib/compact_index_client/version.rb +0 -4
data/ISSUES.md
CHANGED
@@ -10,6 +10,23 @@ Detailed information about each Bundler command, including help with common prob
|
|
10
10
|
|
11
11
|
## Troubleshooting
|
12
12
|
|
13
|
+
### Permission denied when installing bundler
|
14
|
+
|
15
|
+
Certain operating systems such as MacOS and Ubuntu have versions of Ruby that require evelated privileges to install gems.
|
16
|
+
|
17
|
+
ERROR: While executing gem ... (Gem::FilePermissionError)
|
18
|
+
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
|
19
|
+
|
20
|
+
There are multiple ways to solve this issue. You can install bundler with elevated privilges using `sudo` or `su`.
|
21
|
+
|
22
|
+
sudo gem install bundler
|
23
|
+
|
24
|
+
If you cannot elevated your privileges or do not want to globally install Bundler, you can use the `--user-install` option.
|
25
|
+
|
26
|
+
gem install bundler --user-install
|
27
|
+
|
28
|
+
This will install Bundler into your home directory. Note that you will need to append `~/.gem/ruby/<ruby version>/bin` to your `$PATH` variable to use `bundle`.
|
29
|
+
|
13
30
|
### Heroku errors
|
14
31
|
|
15
32
|
Please open a ticket with [Heroku](https://www.heroku.com) if you're having trouble deploying. They have a professional support team who can help you resolve Heroku issues far better than the Bundler team can. If the problem that you are having turns out to be a bug in Bundler itself, [Heroku support](https://www.heroku.com/support) can get the exact details to us.
|
data/README.md
CHANGED
@@ -19,12 +19,19 @@ bundle install
|
|
19
19
|
bundle exec rspec
|
20
20
|
```
|
21
21
|
|
22
|
+
For help with installation issues, see [ISSUES](https://github.com/bundler/bundler/blob/master/ISSUES.md)
|
23
|
+
|
22
24
|
See [bundler.io](http://bundler.io) for the full documentation.
|
23
25
|
|
24
26
|
### Troubleshooting
|
25
27
|
|
26
28
|
For help with common problems, see [ISSUES](https://github.com/bundler/bundler/blob/master/ISSUES.md).
|
27
29
|
|
30
|
+
### Supporting
|
31
|
+
|
32
|
+
<a href="https://rubytogether.org/"><img src="https://rubytogether.org/images/rubies.svg" width=200></a><br/>
|
33
|
+
Bundler is maintained by <a href="https://rubytogether.org/">Ruby Together</a>, a grassroots initiative committed to supporting the critical Ruby infrastructure you rely on. Contribute today <a href="https://rubytogether.org/developers">as an individual</a> or even better, <a href="https://rubytogether.org/companies">as a company</a>, and ensure that Bundler, RubyGems, and other shared tooling is around for years to come.
|
34
|
+
|
28
35
|
### Other questions
|
29
36
|
|
30
37
|
To see what has changed in recent versions of Bundler, see the [CHANGELOG](https://github.com/bundler/bundler/blob/master/CHANGELOG.md).
|
data/Rakefile
CHANGED
@@ -39,7 +39,7 @@ namespace :spec do
|
|
39
39
|
deps = Hash[BUNDLER_SPEC.development_dependencies.map do |d|
|
40
40
|
[d.name, d.requirement.to_s]
|
41
41
|
end]
|
42
|
-
deps["rubocop"] ||= "= 0.
|
42
|
+
deps["rubocop"] ||= "= 0.45.0" if RUBY_VERSION >= "2.0.0" # can't go in the gemspec because of the ruby version requirement
|
43
43
|
|
44
44
|
# JRuby can't build ronn or rdiscount, so we skip that
|
45
45
|
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
@@ -47,10 +47,10 @@ namespace :spec do
|
|
47
47
|
deps.delete("rdiscount")
|
48
48
|
end
|
49
49
|
|
50
|
-
deps.sort_by {|name, _| name }.
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
gem_install_command = "install --no-ri --no-rdoc --conservative " + deps.sort_by {|name, _| name }.map do |name, version|
|
51
|
+
"'#{name}:#{version}'"
|
52
|
+
end.join(" ")
|
53
|
+
sh %(#{Gem.ruby} -S gem #{gem_install_command})
|
54
54
|
|
55
55
|
# Download and install gems used inside tests
|
56
56
|
$LOAD_PATH.unshift("./spec")
|
@@ -74,7 +74,7 @@ namespace :spec do
|
|
74
74
|
|
75
75
|
$LOAD_PATH.unshift("./spec")
|
76
76
|
require "support/rubygems_ext"
|
77
|
-
Spec::Rubygems::DEPS["codeclimate-test-reporter"] =
|
77
|
+
Spec::Rubygems::DEPS["codeclimate-test-reporter"] = "~> 0.6.0" if RUBY_VERSION >= "2.2.0"
|
78
78
|
|
79
79
|
# Install the other gem deps, etc
|
80
80
|
Rake::Task["spec:deps"].invoke
|
@@ -91,9 +91,9 @@ begin
|
|
91
91
|
RSpec::Core::RakeTask.new
|
92
92
|
task :spec => "man:build"
|
93
93
|
|
94
|
-
if RUBY_VERSION >= "
|
94
|
+
if RUBY_VERSION >= "2.0.0"
|
95
95
|
# can't go in the gemspec because of the ruby version requirement
|
96
|
-
gem "rubocop", "= 0.
|
96
|
+
gem "rubocop", "= 0.45.0"
|
97
97
|
require "rubocop/rake_task"
|
98
98
|
RuboCop::RakeTask.new
|
99
99
|
end
|
@@ -127,7 +127,7 @@ begin
|
|
127
127
|
rubyopt = ENV["RUBYOPT"]
|
128
128
|
# When editing this list, also edit .travis.yml!
|
129
129
|
branches = %w(master)
|
130
|
-
releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.6.
|
130
|
+
releases = %w(v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.29 v2.0.14 v2.1.11 v2.2.5 v2.4.8 v2.5.2 v2.6.8)
|
131
131
|
(branches + releases).each do |rg|
|
132
132
|
desc "Run specs with Rubygems #{rg}"
|
133
133
|
RSpec::Core::RakeTask.new(rg) do |t|
|
@@ -190,7 +190,7 @@ begin
|
|
190
190
|
task :travis do
|
191
191
|
rg = ENV["RGV"] || raise("Rubygems version is required on Travis!")
|
192
192
|
|
193
|
-
if RUBY_VERSION
|
193
|
+
if RUBY_VERSION >= "2.0.0"
|
194
194
|
puts "\n\e[1;33m[Travis CI] Running bundler linter\e[m\n\n"
|
195
195
|
Rake::Task["rubocop"].invoke
|
196
196
|
end
|
@@ -238,14 +238,15 @@ begin
|
|
238
238
|
require "ronn"
|
239
239
|
|
240
240
|
namespace :man do
|
241
|
-
directory "
|
241
|
+
directory "man"
|
242
242
|
|
243
243
|
sources = Dir["man/*.ronn"].map {|f| File.basename(f, ".ronn") }
|
244
244
|
sources.map do |basename|
|
245
245
|
ronn = "man/#{basename}.ronn"
|
246
|
-
|
246
|
+
manual_section = ".1" unless basename =~ /.*(\d+)\Z/
|
247
|
+
roff = "man/#{basename}#{manual_section}"
|
247
248
|
|
248
|
-
file roff => ["
|
249
|
+
file roff => ["man", ronn] do
|
249
250
|
sh "#{Gem.ruby} -S ronn --roff --pipe #{ronn} > #{roff}"
|
250
251
|
end
|
251
252
|
|
@@ -257,9 +258,8 @@ begin
|
|
257
258
|
end
|
258
259
|
|
259
260
|
task :clean do
|
260
|
-
leftovers = Dir["
|
261
|
-
|
262
|
-
sources.include?(basename)
|
261
|
+
leftovers = Dir["man/*"].reject do |f|
|
262
|
+
File.extname(f) == ".ronn" || f == "man/index.txt"
|
263
263
|
end
|
264
264
|
rm leftovers if leftovers.any?
|
265
265
|
end
|
@@ -285,13 +285,6 @@ end
|
|
285
285
|
begin
|
286
286
|
require "automatiek"
|
287
287
|
|
288
|
-
Automatiek::RakeTask.new("compact_index_client") do |lib|
|
289
|
-
lib.download = { :github => "https://github.com/bundler/compact_index_client" }
|
290
|
-
lib.namespace = "CompactIndexClient"
|
291
|
-
lib.prefix = "Bundler"
|
292
|
-
lib.vendor_lib = "lib/bundler/vendor/compact_index_client"
|
293
|
-
end
|
294
|
-
|
295
288
|
Automatiek::RakeTask.new("molinillo") do |lib|
|
296
289
|
lib.download = { :github => "https://github.com/CocoaPods/Molinillo" }
|
297
290
|
lib.namespace = "Molinillo"
|
@@ -312,11 +305,29 @@ begin
|
|
312
305
|
lib.prefix = "BundlerVendoredPostIt"
|
313
306
|
lib.vendor_lib = "lib/bundler/vendor/postit"
|
314
307
|
end
|
308
|
+
|
309
|
+
Automatiek::RakeTask.new("net-http-persistent") do |lib|
|
310
|
+
lib.download = { :github => "https://github.com/drbrain/net-http-persistent" }
|
311
|
+
lib.namespace = "Net::HTTP::Persistent"
|
312
|
+
lib.prefix = "Bundler::Persistent"
|
313
|
+
lib.vendor_lib = "lib/bundler/vendor/net-http-persistent"
|
314
|
+
|
315
|
+
mixin = Module.new do
|
316
|
+
def namespace_files
|
317
|
+
super
|
318
|
+
require_target = vendor_lib.sub(%r{^(.+?/)?lib/}, "") << "/lib"
|
319
|
+
relative_files = files.map {|f| Pathname.new(f).relative_path_from(Pathname.new(vendor_lib) / "lib").sub_ext("").to_s }
|
320
|
+
process_files(/require (['"])(#{Regexp.union(relative_files)})/, "require \\1#{require_target}/\\2")
|
321
|
+
end
|
322
|
+
end
|
323
|
+
lib.send(:extend, mixin)
|
324
|
+
end
|
315
325
|
rescue LoadError
|
316
326
|
namespace :vendor do
|
317
327
|
task(:molinillo) { abort "Install the automatiek gem to be able to vendor gems." }
|
318
328
|
task(:thor) { abort "Install the automatiek gem to be able to vendor gems." }
|
319
329
|
task(:postit) { abort "Install the automatiek gem to be able to vendor gems." }
|
330
|
+
task("net-http-persistent") { abort "Install the automatiek gem to be able to vendor gems." }
|
320
331
|
end
|
321
332
|
end
|
322
333
|
|
data/bin/rubocop
CHANGED
data/bundler.gemspec
CHANGED
@@ -7,7 +7,7 @@ require "bundler/version"
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bundler"
|
9
9
|
s.version = Bundler::VERSION
|
10
|
-
s.
|
10
|
+
s.license = "MIT"
|
11
11
|
s.authors = ["André Arko", "Samuel Giddins"]
|
12
12
|
s.email = ["team@bundler.io"]
|
13
13
|
s.homepage = "http://bundler.io"
|
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.files = `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/}) }
|
28
28
|
# we don't check in man pages, but we need to ship them because
|
29
29
|
# we use them to generate the long-form help for each command.
|
30
|
-
s.files += Dir.glob("
|
30
|
+
s.files += Dir.glob("man/**/*")
|
31
31
|
|
32
32
|
s.bindir = "exe"
|
33
33
|
s.executables = %w(bundle bundler)
|
data/exe/bundle
CHANGED
@@ -4,12 +4,10 @@
|
|
4
4
|
# Exit cleanly from an early interrupt
|
5
5
|
Signal.trap("INT") { exit 1 }
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
require "bundler/postit_trampoline"
|
12
|
-
end
|
7
|
+
update = "update".start_with?(ARGV.first || " ") && ARGV.find {|a| a.start_with?("--bundler") }
|
8
|
+
update &&= update =~ /--bundler(?:=(.+))?/ && $1 || "> 0.a"
|
9
|
+
ENV["BUNDLER_VERSION"] = update if update
|
10
|
+
require "bundler/postit_trampoline"
|
13
11
|
|
14
12
|
require "bundler"
|
15
13
|
# Check if an older version of bundler is installed
|
data/lib/bundler.rb
CHANGED
@@ -3,9 +3,10 @@ require "fileutils"
|
|
3
3
|
require "pathname"
|
4
4
|
require "rbconfig"
|
5
5
|
require "thread"
|
6
|
+
require "tmpdir"
|
7
|
+
|
6
8
|
require "bundler/errors"
|
7
9
|
require "bundler/environment_preserver"
|
8
|
-
require "bundler/gem_remote_fetcher"
|
9
10
|
require "bundler/plugin"
|
10
11
|
require "bundler/rubygems_ext"
|
11
12
|
require "bundler/rubygems_integration"
|
@@ -27,8 +28,10 @@ module Bundler
|
|
27
28
|
autoload :EndpointSpecification, "bundler/endpoint_specification"
|
28
29
|
autoload :Env, "bundler/env"
|
29
30
|
autoload :Fetcher, "bundler/fetcher"
|
31
|
+
autoload :FeatureFlag, "bundler/feature_flag"
|
30
32
|
autoload :GemHelper, "bundler/gem_helper"
|
31
33
|
autoload :GemHelpers, "bundler/gem_helpers"
|
34
|
+
autoload :GemRemoteFetcher, "bundler/gem_remote_fetcher"
|
32
35
|
autoload :GemVersionPromoter, "bundler/gem_version_promoter"
|
33
36
|
autoload :Graph, "bundler/graph"
|
34
37
|
autoload :Index, "bundler/index"
|
@@ -90,7 +93,7 @@ module Bundler
|
|
90
93
|
# Return if all groups are already loaded
|
91
94
|
return @setup if defined?(@setup) && @setup
|
92
95
|
|
93
|
-
definition.
|
96
|
+
definition.validate_runtime!
|
94
97
|
|
95
98
|
SharedHelpers.print_major_deprecations!
|
96
99
|
|
@@ -142,8 +145,41 @@ module Bundler
|
|
142
145
|
"#{Bundler.rubygems.ruby_engine}/#{Bundler.rubygems.config_map[:ruby_version]}"
|
143
146
|
end
|
144
147
|
|
148
|
+
def user_home
|
149
|
+
@user_home ||= begin
|
150
|
+
home = Bundler.rubygems.user_home
|
151
|
+
warning = "Your home directory is not set properly:"
|
152
|
+
if home.nil?
|
153
|
+
warning += "\n * It is not set at all"
|
154
|
+
elsif !File.directory?(home)
|
155
|
+
warning += "\n * `#{home}` is not a directory"
|
156
|
+
elsif !File.writable?(home)
|
157
|
+
warning += "\n * `#{home}` is not writable"
|
158
|
+
else
|
159
|
+
return @user_home = Pathname.new(home)
|
160
|
+
end
|
161
|
+
|
162
|
+
login = Etc.getlogin || "unknown"
|
163
|
+
|
164
|
+
tmp_home = Pathname.new(Dir.tmpdir).join("bundler", "home", login)
|
165
|
+
begin
|
166
|
+
SharedHelpers.filesystem_access(tmp_home, :write) do |p|
|
167
|
+
FileUtils.mkdir_p(p)
|
168
|
+
end
|
169
|
+
rescue => e
|
170
|
+
warning += "\n\nBundler also failed to create a temporary home directory at `#{tmp_home}`:\n#{e}"
|
171
|
+
raise warning
|
172
|
+
end
|
173
|
+
|
174
|
+
warning += "\n\nBundler will use `#{tmp_home}` as your home directory temporarily"
|
175
|
+
|
176
|
+
Bundler.ui.warn(warning)
|
177
|
+
tmp_home
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
145
181
|
def user_bundle_path
|
146
|
-
Pathname.new(
|
182
|
+
Pathname.new(user_home).join(".bundle")
|
147
183
|
end
|
148
184
|
|
149
185
|
def home
|
@@ -257,6 +293,11 @@ EOF
|
|
257
293
|
with_clean_env { Kernel.exec(*args) }
|
258
294
|
end
|
259
295
|
|
296
|
+
def local_platform
|
297
|
+
return Gem::Platform::RUBY if settings[:force_ruby_platform]
|
298
|
+
Gem::Platform.local
|
299
|
+
end
|
300
|
+
|
260
301
|
def default_gemfile
|
261
302
|
SharedHelpers.default_gemfile
|
262
303
|
end
|
@@ -328,17 +369,23 @@ EOF
|
|
328
369
|
def sudo(str)
|
329
370
|
SUDO_MUTEX.synchronize do
|
330
371
|
prompt = "\n\n" + <<-PROMPT.gsub(/^ {6}/, "").strip + " "
|
331
|
-
Your user account isn't allowed to install to the system
|
372
|
+
Your user account isn't allowed to install to the system RubyGems.
|
332
373
|
You can cancel this installation and run:
|
333
374
|
|
334
375
|
bundle install --path vendor/bundle
|
335
376
|
|
336
377
|
to install the gems into ./vendor/bundle/, or you can enter your password
|
337
|
-
and install the bundled gems to
|
378
|
+
and install the bundled gems to RubyGems using sudo.
|
338
379
|
|
339
380
|
Password:
|
340
381
|
PROMPT
|
341
382
|
|
383
|
+
unless @prompted_for_sudo ||= system(%(sudo -k -p "#{prompt}" true))
|
384
|
+
raise SudoNotPermittedError,
|
385
|
+
"Bundler requires sudo access to install at the moment. " \
|
386
|
+
"Try installing again, granting Bundler sudo access when prompted, or installing into a different path."
|
387
|
+
end
|
388
|
+
|
342
389
|
`sudo -p "#{prompt}" #{str}`
|
343
390
|
end
|
344
391
|
end
|
@@ -389,6 +436,10 @@ EOF
|
|
389
436
|
@git_present = Bundler.which("git") || Bundler.which("git.exe")
|
390
437
|
end
|
391
438
|
|
439
|
+
def feature_flag
|
440
|
+
@feature_flag ||= FeatureFlag.new(VERSION)
|
441
|
+
end
|
442
|
+
|
392
443
|
def reset!
|
393
444
|
@root = nil
|
394
445
|
@settings = nil
|
@@ -398,6 +449,7 @@ EOF
|
|
398
449
|
@locked_gems = nil
|
399
450
|
@bundle_path = nil
|
400
451
|
@bin_path = nil
|
452
|
+
@user_home = nil
|
401
453
|
|
402
454
|
Plugin.reset!
|
403
455
|
|
data/lib/bundler/cli.rb
CHANGED
@@ -36,8 +36,10 @@ module Bundler
|
|
36
36
|
ensure
|
37
37
|
self.options ||= {}
|
38
38
|
Bundler.settings.cli_flags_given = !options.empty?
|
39
|
+
unprinted_warnings = Bundler.ui.unprinted_warnings
|
39
40
|
Bundler.ui = UI::Shell.new(options)
|
40
41
|
Bundler.ui.level = "debug" if options["verbose"]
|
42
|
+
unprinted_warnings.each {|w| Bundler.ui.warn(w) }
|
41
43
|
|
42
44
|
if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
|
43
45
|
Bundler.ui.warn(
|
@@ -59,30 +61,21 @@ module Bundler
|
|
59
61
|
|
60
62
|
def help(cli = nil)
|
61
63
|
case cli
|
62
|
-
when "gemfile" then command = "gemfile
|
64
|
+
when "gemfile" then command = "gemfile"
|
63
65
|
when nil then command = "bundle"
|
64
66
|
else command = "bundle-#{cli}"
|
65
67
|
end
|
66
68
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
bundle-platform
|
76
|
-
gemfile.5
|
77
|
-
)
|
78
|
-
|
79
|
-
if manpages.include?(command)
|
80
|
-
root = File.expand_path("../man", __FILE__)
|
81
|
-
|
82
|
-
if Bundler.which("man") && root !~ %r{^file:/.+!/META-INF/jruby.home/.+}
|
83
|
-
Kernel.exec "man #{root}/#{command}"
|
69
|
+
man_path = File.expand_path("../../../man", __FILE__)
|
70
|
+
man_pages = Hash[Dir.glob(File.join(man_path, "*")).grep(/.*\.\d*\Z/).collect do |f|
|
71
|
+
[File.basename(f, ".*"), f]
|
72
|
+
end]
|
73
|
+
|
74
|
+
if man_pages.include?(command)
|
75
|
+
if Bundler.which("man") && man_path !~ %r{^file:/.+!/META-INF/jruby.home/.+}
|
76
|
+
Kernel.exec "man #{man_pages[command]}"
|
84
77
|
else
|
85
|
-
puts File.read("#{
|
78
|
+
puts File.read("#{man_path}/#{File.basename(man_pages[command])}.txt")
|
86
79
|
end
|
87
80
|
elsif command_path = Bundler.which("bundler-#{cli}")
|
88
81
|
Kernel.exec(command_path, "--help")
|
@@ -92,7 +85,7 @@ module Bundler
|
|
92
85
|
end
|
93
86
|
|
94
87
|
def self.handle_no_command_error(command, has_namespace = $thor_runner)
|
95
|
-
if Bundler.
|
88
|
+
if Bundler.feature_flag.plugins? && Bundler::Plugin.command?(command)
|
96
89
|
return Bundler::Plugin.exec_command(command, ARGV[1..-1])
|
97
90
|
end
|
98
91
|
|
@@ -184,11 +177,9 @@ module Bundler
|
|
184
177
|
map "i" => "install"
|
185
178
|
def install
|
186
179
|
require "bundler/cli/install"
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
ensure
|
191
|
-
Bundler.settings[:no_install] = no_install unless no_install.nil?
|
180
|
+
Bundler.settings.temporary(:no_install => false) do
|
181
|
+
Install.new(options.dup).run
|
182
|
+
end
|
192
183
|
end
|
193
184
|
|
194
185
|
desc "update [OPTIONS]", "update the current environment"
|
@@ -215,14 +206,16 @@ module Bundler
|
|
215
206
|
"Update ruby specified in Gemfile.lock"
|
216
207
|
method_option "bundler", :type => :string, :lazy_default => "> 0.a", :banner =>
|
217
208
|
"Update the locked version of bundler"
|
218
|
-
method_option "patch", :type => :boolean, :
|
209
|
+
method_option "patch", :type => :boolean, :banner =>
|
219
210
|
"Prefer updating only to next patch version"
|
220
|
-
method_option "minor", :type => :boolean, :
|
211
|
+
method_option "minor", :type => :boolean, :banner =>
|
221
212
|
"Prefer updating only to next minor version"
|
222
|
-
method_option "major", :type => :boolean, :
|
213
|
+
method_option "major", :type => :boolean, :banner =>
|
223
214
|
"Prefer updating to next major version (default)"
|
224
|
-
method_option "strict", :type => :boolean, :
|
225
|
-
"Do not allow any gem to be updated past latest --patch
|
215
|
+
method_option "strict", :type => :boolean, :banner =>
|
216
|
+
"Do not allow any gem to be updated past latest --patch | --minor | --major"
|
217
|
+
method_option "conservative", :type => :boolean, :banner =>
|
218
|
+
"Use bundle install conservative update behavior and do not allow shared dependencies to be updated."
|
226
219
|
def update(*gems)
|
227
220
|
require "bundler/cli/update"
|
228
221
|
Update.new(options, gems).run
|
@@ -255,7 +248,7 @@ module Bundler
|
|
255
248
|
"Overwrite existing binstubs if they exist"
|
256
249
|
method_option "path", :type => :string, :lazy_default => "bin", :banner =>
|
257
250
|
"Binstub destination directory (default bin)"
|
258
|
-
method_option "standalone", :type => :
|
251
|
+
method_option "standalone", :type => :boolean, :banner =>
|
259
252
|
"Make binstubs that can work without the Bundler runtime"
|
260
253
|
def binstubs(*gems)
|
261
254
|
require "bundler/cli/binstubs"
|
@@ -268,16 +261,26 @@ module Bundler
|
|
268
261
|
in the given source. Calling outdated with [GEM [GEM]] will only check for newer
|
269
262
|
versions of the given gems. Prerelease gems are ignored by default. If your gems
|
270
263
|
are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
|
264
|
+
|
265
|
+
For more information on patch level options (--major, --minor, --patch,
|
266
|
+
--update-strict) see documentation on the same options on the update command.
|
271
267
|
D
|
268
|
+
method_option "group", :aliases => "--group", :type => :string, :banner => "List gems from a specific group"
|
269
|
+
method_option "groups", :aliases => "--groups", :type => :boolean, :banner => "List gems organized by groups"
|
272
270
|
method_option "local", :type => :boolean, :banner =>
|
273
271
|
"Do not attempt to fetch gems remotely and use the gem cache instead"
|
274
272
|
method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
|
275
273
|
method_option "source", :type => :array, :banner => "Check against a specific source"
|
276
274
|
method_option "strict", :type => :boolean, :banner =>
|
277
275
|
"Only list newer versions allowed by your Gemfile requirements"
|
278
|
-
method_option "
|
279
|
-
|
280
|
-
method_option "
|
276
|
+
method_option "update-strict", :type => :boolean, :banner =>
|
277
|
+
"Strict conservative resolution, do not allow any gem to be updated past latest --patch | --minor | --major"
|
278
|
+
method_option "minor", :type => :boolean, :banner => "Prefer updating only to next minor version"
|
279
|
+
method_option "major", :type => :boolean, :banner => "Prefer updating to next major version (default)"
|
280
|
+
method_option "patch", :type => :boolean, :banner => "Prefer updating only to next patch version"
|
281
|
+
method_option "filter-major", :type => :boolean, :banner => "Only list major newer versions"
|
282
|
+
method_option "filter-minor", :type => :boolean, :banner => "Only list minor newer versions"
|
283
|
+
method_option "filter-patch", :type => :boolean, :banner => "Only list patch newer versions"
|
281
284
|
method_option "parseable", :aliases => "--porcelain", :type => :boolean, :banner =>
|
282
285
|
"Use minimal formatting for more parseable output"
|
283
286
|
def outdated(*gems)
|
@@ -443,7 +446,7 @@ module Bundler
|
|
443
446
|
end
|
444
447
|
|
445
448
|
desc "lock", "Creates a lockfile without installing"
|
446
|
-
method_option "update", :type => :array, :lazy_default =>
|
449
|
+
method_option "update", :type => :array, :lazy_default => true, :banner =>
|
447
450
|
"ignore the existing lockfile, update all gems by default, or update list of given gems"
|
448
451
|
method_option "local", :type => :boolean, :default => false, :banner =>
|
449
452
|
"do not attempt to fetch remote gemspecs and use the local gem cache only"
|
@@ -454,9 +457,19 @@ module Bundler
|
|
454
457
|
method_option "full-index", :type => :boolean, :default => false, :banner =>
|
455
458
|
"Fall back to using the single-file index of all gems"
|
456
459
|
method_option "add-platform", :type => :array, :default => [], :banner =>
|
457
|
-
"
|
460
|
+
"Add a new platform to the lockfile"
|
458
461
|
method_option "remove-platform", :type => :array, :default => [], :banner =>
|
459
|
-
"
|
462
|
+
"Remove a platform from the lockfile"
|
463
|
+
method_option "patch", :type => :boolean, :banner =>
|
464
|
+
"If updating, prefer updating only to next patch version"
|
465
|
+
method_option "minor", :type => :boolean, :banner =>
|
466
|
+
"If updating, prefer updating only to next minor version"
|
467
|
+
method_option "major", :type => :boolean, :banner =>
|
468
|
+
"If updating, prefer updating to next major version (default)"
|
469
|
+
method_option "strict", :type => :boolean, :banner =>
|
470
|
+
"If updating, do not allow any gem to be updated past latest --patch | --minor | --major"
|
471
|
+
method_option "conservative", :type => :boolean, :banner =>
|
472
|
+
"If updating, use bundle install conservative update behavior and do not allow shared dependencies to be updated"
|
460
473
|
def lock
|
461
474
|
require "bundler/cli/lock"
|
462
475
|
Lock.new(options).run
|
@@ -482,7 +495,7 @@ module Bundler
|
|
482
495
|
Doctor.new(options).run
|
483
496
|
end
|
484
497
|
|
485
|
-
if Bundler.
|
498
|
+
if Bundler.feature_flag.plugins?
|
486
499
|
require "bundler/cli/plugin"
|
487
500
|
desc "plugin SUBCOMMAND ...ARGS", "manage the bundler plugins"
|
488
501
|
subcommand "plugin", Plugin
|