bundler 1.7.15 → 1.8.0.pre

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.

Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -14
  3. data/.rspec +1 -0
  4. data/.travis.yml +22 -15
  5. data/CHANGELOG.md +43 -13
  6. data/CODE_OF_CONDUCT.md +40 -0
  7. data/CONTRIBUTING.md +14 -12
  8. data/DEVELOPMENT.md +4 -2
  9. data/ISSUES.md +1 -1
  10. data/README.md +10 -14
  11. data/Rakefile +10 -10
  12. data/bin/bundle +1 -1
  13. data/bundler.gemspec +5 -4
  14. data/lib/bundler.rb +22 -3
  15. data/lib/bundler/anonymizable_uri.rb +24 -8
  16. data/lib/bundler/cli.rb +103 -66
  17. data/lib/bundler/cli/cache.rb +1 -0
  18. data/lib/bundler/cli/clean.rb +11 -4
  19. data/lib/bundler/cli/common.rb +2 -0
  20. data/lib/bundler/cli/console.rb +22 -26
  21. data/lib/bundler/cli/exec.rb +29 -22
  22. data/lib/bundler/cli/gem.rb +125 -37
  23. data/lib/bundler/cli/install.rb +22 -9
  24. data/lib/bundler/cli/outdated.rb +1 -1
  25. data/lib/bundler/cli/package.rb +8 -1
  26. data/lib/bundler/cli/show.rb +29 -3
  27. data/lib/bundler/cli/update.rb +2 -2
  28. data/lib/bundler/cli/viz.rb +1 -1
  29. data/lib/bundler/definition.rb +14 -22
  30. data/lib/bundler/dependency.rb +8 -1
  31. data/lib/bundler/dsl.rb +17 -4
  32. data/lib/bundler/endpoint_specification.rb +1 -1
  33. data/lib/bundler/env.rb +44 -25
  34. data/lib/bundler/fetcher.rb +33 -25
  35. data/lib/bundler/friendly_errors.rb +38 -5
  36. data/lib/bundler/gem_helper.rb +16 -10
  37. data/lib/bundler/gem_helpers.rb +1 -0
  38. data/lib/bundler/graph.rb +4 -1
  39. data/lib/bundler/index.rb +15 -25
  40. data/lib/bundler/installer.rb +6 -6
  41. data/lib/bundler/lockfile_parser.rb +7 -7
  42. data/lib/bundler/resolver.rb +2 -1
  43. data/lib/bundler/ruby_version.rb +1 -1
  44. data/lib/bundler/rubygems_ext.rb +1 -0
  45. data/lib/bundler/rubygems_integration.rb +1 -1
  46. data/lib/bundler/runtime.rb +22 -40
  47. data/lib/bundler/settings.rb +14 -5
  48. data/lib/bundler/setup.rb +2 -1
  49. data/lib/bundler/shared_helpers.rb +56 -4
  50. data/lib/bundler/source.rb +8 -9
  51. data/lib/bundler/source/git.rb +5 -1
  52. data/lib/bundler/source/git/git_proxy.rb +4 -0
  53. data/lib/bundler/source/path.rb +8 -11
  54. data/lib/bundler/source/path/installer.rb +0 -2
  55. data/lib/bundler/source/rubygems.rb +58 -72
  56. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
  57. data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
  58. data/lib/bundler/templates/newgem/README.md.tt +9 -1
  59. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  60. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  61. data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
  62. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  63. data/lib/bundler/templates/newgem/gitignore.tt +2 -0
  64. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
  66. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
  67. data/lib/bundler/ui/shell.rb +1 -1
  68. data/lib/bundler/version.rb +1 -1
  69. data/lib/bundler/worker.rb +73 -0
  70. data/man/bundle-config.ronn +17 -15
  71. data/man/bundle-install.ronn +102 -93
  72. data/man/bundle-update.ronn +39 -30
  73. data/man/bundle.ronn +6 -0
  74. data/man/gemfile.5.ronn +74 -13
  75. metadata +10 -231
  76. data/lib/bundler/parallel_workers.rb +0 -18
  77. data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
  78. data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
  79. data/lib/bundler/parallel_workers/worker.rb +0 -69
  80. data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
  81. data/spec/bundler/anonymizable_uri_spec.rb +0 -32
  82. data/spec/bundler/bundler_spec.rb +0 -72
  83. data/spec/bundler/cli_spec.rb +0 -16
  84. data/spec/bundler/definition_spec.rb +0 -22
  85. data/spec/bundler/dsl_spec.rb +0 -82
  86. data/spec/bundler/friendly_errors_spec.rb +0 -13
  87. data/spec/bundler/gem_helper_spec.rb +0 -226
  88. data/spec/bundler/psyched_yaml_spec.rb +0 -8
  89. data/spec/bundler/retry_spec.rb +0 -59
  90. data/spec/bundler/settings_spec.rb +0 -13
  91. data/spec/bundler/source/rubygems_spec.rb +0 -25
  92. data/spec/bundler/source_list_spec.rb +0 -361
  93. data/spec/cache/gems_spec.rb +0 -284
  94. data/spec/cache/git_spec.rb +0 -188
  95. data/spec/cache/path_spec.rb +0 -121
  96. data/spec/cache/platform_spec.rb +0 -57
  97. data/spec/commands/binstubs_spec.rb +0 -219
  98. data/spec/commands/check_spec.rb +0 -278
  99. data/spec/commands/clean_spec.rb +0 -592
  100. data/spec/commands/config_spec.rb +0 -263
  101. data/spec/commands/console_spec.rb +0 -76
  102. data/spec/commands/exec_spec.rb +0 -309
  103. data/spec/commands/help_spec.rb +0 -39
  104. data/spec/commands/init_spec.rb +0 -39
  105. data/spec/commands/inject_spec.rb +0 -78
  106. data/spec/commands/licenses_spec.rb +0 -18
  107. data/spec/commands/newgem_spec.rb +0 -428
  108. data/spec/commands/open_spec.rb +0 -68
  109. data/spec/commands/outdated_spec.rb +0 -156
  110. data/spec/commands/package_spec.rb +0 -114
  111. data/spec/commands/show_spec.rb +0 -125
  112. data/spec/install/binstubs_spec.rb +0 -24
  113. data/spec/install/bundler_spec.rb +0 -146
  114. data/spec/install/deploy_spec.rb +0 -250
  115. data/spec/install/gemfile/gemspec_spec.rb +0 -170
  116. data/spec/install/gemfile/git_spec.rb +0 -967
  117. data/spec/install/gemfile/path_spec.rb +0 -500
  118. data/spec/install/gemfile_spec.rb +0 -44
  119. data/spec/install/gems/c_ext_spec.rb +0 -48
  120. data/spec/install/gems/dependency_api_spec.rb +0 -652
  121. data/spec/install/gems/env_spec.rb +0 -107
  122. data/spec/install/gems/flex_spec.rb +0 -314
  123. data/spec/install/gems/groups_spec.rb +0 -308
  124. data/spec/install/gems/mirror_spec.rb +0 -39
  125. data/spec/install/gems/platform_spec.rb +0 -195
  126. data/spec/install/gems/post_install_spec.rb +0 -121
  127. data/spec/install/gems/resolving_spec.rb +0 -124
  128. data/spec/install/gems/simple_case_spec.rb +0 -377
  129. data/spec/install/gems/sources_spec.rb +0 -386
  130. data/spec/install/gems/standalone_spec.rb +0 -260
  131. data/spec/install/gems/sudo_spec.rb +0 -136
  132. data/spec/install/gems/win32_spec.rb +0 -26
  133. data/spec/install/gemspecs_spec.rb +0 -50
  134. data/spec/install/path_spec.rb +0 -150
  135. data/spec/install/post_bundle_message_spec.rb +0 -142
  136. data/spec/install/prereleases_spec.rb +0 -43
  137. data/spec/install/security_policy_spec.rb +0 -77
  138. data/spec/install/upgrade_spec.rb +0 -26
  139. data/spec/lock/git_spec.rb +0 -34
  140. data/spec/lock/lockfile_spec.rb +0 -924
  141. data/spec/other/bundle_ruby_spec.rb +0 -142
  142. data/spec/other/cli_dispatch_spec.rb +0 -21
  143. data/spec/other/ext_spec.rb +0 -60
  144. data/spec/other/platform_spec.rb +0 -1285
  145. data/spec/other/ssl_cert_spec.rb +0 -23
  146. data/spec/quality_spec.rb +0 -88
  147. data/spec/realworld/dependency_api_spec.rb +0 -60
  148. data/spec/realworld/edgecases_spec.rb +0 -212
  149. data/spec/realworld/parallel_spec.rb +0 -71
  150. data/spec/resolver/basic_spec.rb +0 -66
  151. data/spec/resolver/platform_spec.rb +0 -88
  152. data/spec/runtime/executable_spec.rb +0 -149
  153. data/spec/runtime/load_spec.rb +0 -107
  154. data/spec/runtime/platform_spec.rb +0 -90
  155. data/spec/runtime/require_spec.rb +0 -332
  156. data/spec/runtime/setup_spec.rb +0 -853
  157. data/spec/runtime/with_clean_env_spec.rb +0 -91
  158. data/spec/spec_helper.rb +0 -123
  159. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
  160. data/spec/support/artifice/endpoint.rb +0 -71
  161. data/spec/support/artifice/endpoint_500.rb +0 -37
  162. data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
  163. data/spec/support/artifice/endpoint_api_missing.rb +0 -16
  164. data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
  165. data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
  166. data/spec/support/artifice/endpoint_extra.rb +0 -31
  167. data/spec/support/artifice/endpoint_extra_api.rb +0 -32
  168. data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
  169. data/spec/support/artifice/endpoint_fallback.rb +0 -17
  170. data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
  171. data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
  172. data/spec/support/artifice/endpoint_redirect.rb +0 -15
  173. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
  174. data/spec/support/artifice/endpoint_timeout.rb +0 -13
  175. data/spec/support/builders.rb +0 -693
  176. data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
  177. data/spec/support/fakeweb/windows.rb +0 -23
  178. data/spec/support/hax.rb +0 -22
  179. data/spec/support/helpers.rb +0 -361
  180. data/spec/support/indexes.rb +0 -280
  181. data/spec/support/matchers.rb +0 -77
  182. data/spec/support/path.rb +0 -85
  183. data/spec/support/permissions.rb +0 -10
  184. data/spec/support/platforms.rb +0 -94
  185. data/spec/support/ruby_ext.rb +0 -20
  186. data/spec/support/rubygems_ext.rb +0 -39
  187. data/spec/support/streams.rb +0 -13
  188. data/spec/support/sudo.rb +0 -16
  189. data/spec/update/gems_spec.rb +0 -201
  190. data/spec/update/git_spec.rb +0 -283
  191. data/spec/update/path_spec.rb +0 -18
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = Bundler::VERSION
9
9
  s.licenses = ['MIT']
10
10
  s.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"]
11
- s.email = ["andre@arko.net"]
11
+ s.email = ["andre.arko+terence.lee@gmail.com"]
12
12
  s.homepage = "http://bundler.io"
13
13
  s.summary = %q{The best way to manage your application's dependencies}
14
14
  s.description = %q{Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably}
@@ -21,9 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'ronn', '~> 0.7.3'
22
22
  s.add_development_dependency 'rspec', '~> 3.0'
23
23
 
24
- s.files = `git ls-files -z`.split("\x0")
25
- s.files += Dir.glob('lib/bundler/man/**/*') # man/ is ignored by git
26
- s.test_files = s.files.grep(%r{^spec/})
24
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ # we don't check in man pages, but we need to ship them because
26
+ # we use them to generate the long-form help for each command.
27
+ s.files += Dir.glob('lib/bundler/man/**/*')
27
28
 
28
29
  s.executables = %w(bundle bundler)
29
30
  s.require_paths = ["lib"]
@@ -191,7 +191,13 @@ module Bundler
191
191
  end
192
192
 
193
193
  def root
194
- @root ||= default_gemfile.dirname.expand_path
194
+ @root ||= begin
195
+ default_gemfile.dirname.expand_path
196
+ rescue GemfileNotFound
197
+ bundle_dir = default_bundle_dir
198
+ raise GemfileNotFound, "Could not locate Gemfile or .bundle/ directory" unless bundle_dir
199
+ Pathname.new(File.expand_path("..", bundle_dir))
200
+ end
195
201
  end
196
202
 
197
203
  def app_config_path
@@ -202,7 +208,7 @@ module Bundler
202
208
 
203
209
  def app_cache(custom_path = nil)
204
210
  path = custom_path || root
205
- path.join("vendor/cache")
211
+ path.join(self.settings.app_cache_path)
206
212
  end
207
213
 
208
214
  def tmp(name = Process.pid.to_s)
@@ -210,11 +216,16 @@ module Bundler
210
216
  @tmp.join(name)
211
217
  end
212
218
 
219
+ def cleanup
220
+ FileUtils.remove_entry_secure(@tmp) if @tmp
221
+ rescue
222
+ end
223
+
213
224
  def settings
214
225
  return @settings if defined?(@settings)
215
226
  @settings = Settings.new(app_config_path)
216
227
  rescue GemfileNotFound
217
- @settings = Settings.new
228
+ @settings = Settings.new(Pathname.new(".bundle").expand_path)
218
229
  end
219
230
 
220
231
  def with_original_env
@@ -253,6 +264,10 @@ module Bundler
253
264
  SharedHelpers.default_lockfile
254
265
  end
255
266
 
267
+ def default_bundle_dir
268
+ SharedHelpers.default_bundle_dir
269
+ end
270
+
256
271
  def system_bindir
257
272
  # Gem.bindir doesn't always return the location that Rubygems will install
258
273
  # system binaries. If you put '-n foo' in your .gemrc, Rubygems will
@@ -369,6 +384,10 @@ module Bundler
369
384
  @ruby_version ||= SystemRubyVersion.new
370
385
  end
371
386
 
387
+ def reset!
388
+ @definition = nil
389
+ end
390
+
372
391
  private
373
392
 
374
393
  def eval_yaml_gemspec(path, contents)
@@ -3,14 +3,30 @@ module Bundler
3
3
  attr_reader :original_uri,
4
4
  :without_credentials
5
5
 
6
- def initialize(original_uri)
7
- @original_uri = original_uri.freeze
8
- @without_credentials ||=
9
- if original_uri.userinfo
10
- original_uri.dup.tap { |uri| uri.user = uri.password = nil }.freeze
11
- else
12
- original_uri
13
- end
6
+ def initialize(original_uri, fallback_auth = nil)
7
+ @original_uri = apply_auth(original_uri, fallback_auth).freeze
8
+ @without_credentials = remove_auth(@original_uri).freeze
14
9
  end
10
+
11
+ private
12
+
13
+ def apply_auth(uri, auth = nil)
14
+ if auth && uri.userinfo.nil?
15
+ uri = uri.dup
16
+ uri.userinfo = auth
17
+ end
18
+
19
+ uri
20
+ end
21
+
22
+ def remove_auth(uri)
23
+ if uri.userinfo
24
+ uri = uri.dup
25
+ uri.user = uri.password = nil
26
+ end
27
+
28
+ uri
29
+ end
30
+
15
31
  end
16
32
  end
@@ -4,19 +4,25 @@ require 'bundler/vendored_thor'
4
4
  module Bundler
5
5
  class CLI < Thor
6
6
  include Thor::Actions
7
+ AUTO_INSTALL_CMDS = %w[show binstubs outdated exec open console licenses clean]
7
8
 
8
9
  def self.start(*)
9
10
  super
10
11
  rescue Exception => e
11
12
  Bundler.ui = UI::Shell.new
12
13
  raise e
14
+ ensure
15
+ Bundler.cleanup
13
16
  end
14
17
 
15
- def initialize(*)
18
+ def initialize(*args)
16
19
  super
17
- ENV['BUNDLE_GEMFILE'] = File.expand_path(options[:gemfile]) if options[:gemfile]
20
+ current_cmd = args.last[:current_command].name
21
+ custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
22
+ ENV['BUNDLE_GEMFILE'] = File.expand_path(custom_gemfile) if custom_gemfile
18
23
  Bundler::Retry.attempts = options[:retry] || Bundler.settings[:retry] || Bundler::Retry::DEFAULT_ATTEMPTS
19
24
  Bundler.rubygems.ui = UI::RGProxy.new(Bundler.ui)
25
+ auto_install if AUTO_INSTALL_CMDS.include?(current_cmd)
20
26
  rescue UnknownArgumentError => e
21
27
  raise InvalidOption, e.message
22
28
  ensure
@@ -29,10 +35,10 @@ module Bundler
29
35
  stop_on_unknown_option! :exec
30
36
 
31
37
  default_task :install
32
- class_option "no-color", :type => :boolean, :banner => "Disable colorization in output"
33
- class_option "verbose", :type => :boolean, :banner => "Enable verbose output mode", :aliases => "-V"
34
- class_option "retry", :type => :numeric, :aliases => "-r", :banner =>
35
- "Specify the number of times you wish to attempt network commands"
38
+ class_option "no-color", :type => :boolean, :desc => "Disable colorization in output"
39
+ class_option "retry", :type => :numeric, :aliases => "-r", :banner => "NUM",
40
+ :desc => "Specify the number of times you wish to attempt network commands"
41
+ class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V"
36
42
 
37
43
  def help(cli = nil)
38
44
  case cli
@@ -64,6 +70,12 @@ module Bundler
64
70
  end
65
71
  end
66
72
 
73
+ def self.handle_no_command_error(command, has_namespace = $thor_runner)
74
+ return super unless command_path = Bundler.which("bundler-#{command}")
75
+
76
+ Kernel.exec(command_path, *ARGV[1..-1])
77
+ end
78
+
67
79
  desc "init [OPTIONS]", "Generates a Gemfile into the current working directory"
68
80
  long_desc <<-D
69
81
  Init generates a default Gemfile in the current working directory. When adding a
@@ -82,12 +94,12 @@ module Bundler
82
94
  all gems are found, Bundler prints a success message and exits with a status of 0.
83
95
  If not, the first missing gem is listed and Bundler exits status 1.
84
96
  D
97
+ method_option "dry-run", :type => :boolean, :default => false, :banner =>
98
+ "Lock the Gemfile"
85
99
  method_option "gemfile", :type => :string, :banner =>
86
100
  "Use the specified gemfile instead of Gemfile"
87
101
  method_option "path", :type => :string, :banner =>
88
102
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
89
- method_option "dry-run", :type => :boolean, :default => false, :banner =>
90
- "Lock the Gemfile"
91
103
  def check
92
104
  require 'bundler/cli/check'
93
105
  Check.new(options).run
@@ -104,41 +116,41 @@ module Bundler
104
116
 
105
117
  If the bundle has already been installed, bundler will tell you so and then exit.
106
118
  D
107
- method_option "without", :type => :array, :banner =>
108
- "Exclude gems that are part of the specified named group."
119
+ method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
120
+ "Generate bin stubs for bundled gems to ./bin"
121
+ method_option "clean", :type => :boolean, :banner =>
122
+ "Run bundle clean automatically after install"
123
+ method_option "deployment", :type => :boolean, :banner =>
124
+ "Install using defaults tuned for deployment environments"
125
+ method_option "frozen", :type => :boolean, :banner =>
126
+ "Do not allow the Gemfile.lock to be updated after this install"
127
+ method_option "full-index", :type => :boolean, :banner =>
128
+ "Use the rubygems modern index instead of the API endpoint"
109
129
  method_option "gemfile", :type => :string, :banner =>
110
130
  "Use the specified gemfile instead of Gemfile"
111
- method_option "no-prune", :type => :boolean, :banner =>
112
- "Don't remove stale gems from the cache."
131
+ method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
132
+ "Specify the number of jobs to run in parallel"
133
+ method_option "local", :type => :boolean, :banner =>
134
+ "Do not attempt to fetch gems remotely and use the gem cache instead"
113
135
  method_option "no-cache", :type => :boolean, :banner =>
114
136
  "Don't update the existing gem cache."
137
+ method_option "no-prune", :type => :boolean, :banner =>
138
+ "Don't remove stale gems from the cache."
139
+ method_option "path", :type => :string, :banner =>
140
+ "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
115
141
  method_option "quiet", :type => :boolean, :banner =>
116
142
  "Only output warnings and errors."
117
- method_option "local", :type => :boolean, :banner =>
118
- "Do not attempt to fetch gems remotely and use the gem cache instead"
119
- method_option "binstubs", :type => :string, :lazy_default => "bin", :banner =>
120
- "Generate bin stubs for bundled gems to ./bin"
121
143
  method_option "shebang", :type => :string, :banner =>
122
144
  "Specify a different shebang executable name than the default (usually 'ruby')"
123
- method_option "path", :type => :string, :banner =>
124
- "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
125
- method_option "system", :type => :boolean, :banner =>
126
- "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
127
- method_option "frozen", :type => :boolean, :banner =>
128
- "Do not allow the Gemfile.lock to be updated after this install"
129
- method_option "deployment", :type => :boolean, :banner =>
130
- "Install using defaults tuned for deployment environments"
131
145
  method_option "standalone", :type => :array, :lazy_default => [], :banner =>
132
146
  "Make a bundle that can work without the Bundler runtime"
133
- method_option "full-index", :type => :boolean, :banner =>
134
- "Use the rubygems modern index instead of the API endpoint"
135
- method_option "clean", :type => :boolean, :banner =>
136
- "Run bundle clean automatically after install"
147
+ method_option "system", :type => :boolean, :banner =>
148
+ "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
137
149
  method_option "trust-policy", :alias => "P", :type => :string, :banner =>
138
150
  "Gem trust policy (like gem install -P). Must be one of " +
139
151
  Bundler.rubygems.security_policy_keys.join('|')
140
- method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
141
- "Specify the number of jobs to run in parallel"
152
+ method_option "without", :type => :array, :banner =>
153
+ "Exclude gems that are part of the specified named group."
142
154
 
143
155
  def install
144
156
  require 'bundler/cli/install'
@@ -151,17 +163,18 @@ module Bundler
151
163
  update when you have changed the Gemfile, or if you want to get the newest
152
164
  possible versions of the gems in the bundle.
153
165
  D
154
- method_option "source", :type => :array, :banner => "Update a specific source (and all gems associated with it)"
166
+ method_option "full-index", :type => :boolean, :banner =>
167
+ "Use the rubygems modern index instead of the API endpoint"
168
+ method_option "group", :aliases => "-g", :type => :array, :banner =>
169
+ "Update a specific group"
170
+ method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
171
+ "Specify the number of jobs to run in parallel"
155
172
  method_option "local", :type => :boolean, :banner =>
156
173
  "Do not attempt to fetch gems remotely and use the gem cache instead"
157
174
  method_option "quiet", :type => :boolean, :banner =>
158
175
  "Only output warnings and errors."
159
- method_option "full-index", :type => :boolean, :banner =>
160
- "Use the rubygems modern index instead of the API endpoint"
161
- method_option "jobs", :aliases => "-j", :type => :numeric, :banner =>
162
- "Specify the number of jobs to run in parallel"
163
- method_option "group", :aliases => "-g", :type => :array, :banner =>
164
- "Update a specific group"
176
+ method_option "source", :type => :array, :banner =>
177
+ "Update a specific source (and all gems associated with it)"
165
178
  def update(*gems)
166
179
  require 'bundler/cli/update'
167
180
  Update.new(options, gems).run
@@ -174,21 +187,23 @@ module Bundler
174
187
  D
175
188
  method_option "paths", :type => :boolean,
176
189
  :banner => "List the paths of all gems that are required by your Gemfile."
190
+ method_option "outdated", :type => :boolean,
191
+ :banner => "Show verbose output including whether gems are outdated."
177
192
  def show(gem_name = nil)
178
193
  require 'bundler/cli/show'
179
194
  Show.new(options, gem_name).run
180
195
  end
181
196
  map %w(list) => "show"
182
197
 
183
- desc "binstubs GEM [OPTIONS]", "install the binstubs of the listed gem"
198
+ desc "binstubs GEM [OPTIONS]", "Install the binstubs of the listed gem"
184
199
  long_desc <<-D
185
200
  Generate binstubs for executables in [GEM]. Binstubs are put into bin,
186
201
  or the --binstubs directory if one has been set.
187
202
  D
188
- method_option "path", :type => :string, :lazy_default => "bin", :banner =>
189
- "binstub destination directory (default bin)"
190
203
  method_option "force", :type => :boolean, :default => false, :banner =>
191
- "overwrite existing binstubs if they exist"
204
+ "Overwrite existing binstubs if they exist"
205
+ method_option "path", :type => :string, :lazy_default => "bin", :banner =>
206
+ "Binstub destination directory (default bin)"
192
207
  def binstubs(*gems)
193
208
  require 'bundler/cli/binstubs'
194
209
  Binstubs.new(options, gems).run
@@ -201,10 +216,10 @@ module Bundler
201
216
  versions of the given gems. Prerelease gems are ignored by default. If your gems
202
217
  are up to date, Bundler will exit with a status of 0. Otherwise, it will exit 1.
203
218
  D
204
- method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
205
- method_option "source", :type => :array, :banner => "Check against a specific source"
206
219
  method_option "local", :type => :boolean, :banner =>
207
220
  "Do not attempt to fetch gems remotely and use the gem cache instead"
221
+ method_option "pre", :type => :boolean, :banner => "Check for newer pre-release gems"
222
+ method_option "source", :type => :array, :banner => "Check against a specific source"
208
223
  method_option "strict", :type => :boolean, :banner =>
209
224
  "Only list newer versions allowed by your Gemfile requirements"
210
225
  def outdated(*gems)
@@ -213,20 +228,25 @@ module Bundler
213
228
  end
214
229
 
215
230
  desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
216
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
217
231
  method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
232
+ method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one"
233
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
218
234
  def cache
219
235
  require 'bundler/cli/cache'
220
236
  Cache.new(options).run
221
237
  end
222
238
 
223
239
  desc "package [OPTIONS]", "Locks and then caches all of the gems into vendor/cache"
224
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
225
240
  method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
226
- method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
241
+ method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one"
242
+ method_option "cache-path", :type => :string, :banner =>
243
+ "Specify a different cache path than the default (vendor/cache)."
244
+ method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
245
+ method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package."
246
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
227
247
  method_option "path", :type => :string, :banner =>
228
248
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
229
- method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
249
+ method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
230
250
  long_desc <<-D
231
251
  The package command will copy the .gem files for every gem in the bundle into the
232
252
  directory ./vendor/cache. If you then check that directory into your source
@@ -274,16 +294,10 @@ module Bundler
274
294
  Open.new(options, name).run
275
295
  end
276
296
 
277
- CONSOLES = {
278
- 'pry' => :Pry,
279
- 'ripl' => :Ripl,
280
- 'irb' => :IRB,
281
- }
282
-
283
297
  desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
284
298
  def console(group = nil)
285
299
  require 'bundler/cli/console'
286
- Console.new(options, group, CONSOLES).run
300
+ Console.new(options, group).run
287
301
  end
288
302
 
289
303
  desc "version", "Prints the bundler's version information"
@@ -313,23 +327,25 @@ module Bundler
313
327
  The associated gems must also be installed via 'bundle install'.
314
328
  D
315
329
  method_option :file, :type => :string, :default => 'gem_graph', :aliases => '-f', :banner => "The name to use for the generated file. see format option"
316
- method_option :version, :type => :boolean, :default => false, :aliases => '-v', :banner => "Set to show each gem version."
317
- method_option :requirements, :type => :boolean, :default => false, :aliases => '-r', :banner => "Set to show the version of each required dependency."
318
330
  method_option :format, :type => :string, :default => "png", :aliases => '-F', :banner => "This is output format option. Supported format is png, jpg, svg, dot ..."
331
+ method_option :requirements, :type => :boolean, :default => false, :aliases => '-r', :banner => "Set to show the version of each required dependency."
332
+ method_option :version, :type => :boolean, :default => false, :aliases => '-v', :banner => "Set to show each gem version."
333
+ method_option :without, :type => :array, :default => [], :banner => "Exclude gems that are part of the specified named group."
319
334
  def viz
320
335
  require 'bundler/cli/viz'
321
336
  Viz.new(options).run
322
337
  end
323
338
 
324
339
  desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem"
325
- method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :banner => "Generate a binary for your library."
326
- method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner => "Generate a test directory for your library: 'rspec' is the default, but 'minitest' is also supported."
327
- method_option :edit, :type => :string, :aliases => "-e",
328
- :lazy_default => [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? },
329
- :required => false, :banner => "/path/to/your/editor",
330
- :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
331
- method_option :ext, :type => :boolean, :detailt => false, :banner => "Generate the boilerplate for C extension code"
332
-
340
+ method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :desc => "Generate a binary for your library. Set a default with `bundle config gem.mit true`."
341
+ method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`."
342
+ method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
343
+ :lazy_default => [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? },
344
+ :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
345
+ method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
346
+ method_option :mit, :type => :boolean, :desc => "Generate an MIT license file"
347
+ method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner => "rspec",
348
+ :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`."
333
349
  def gem(name)
334
350
  require 'bundler/cli/gem'
335
351
  Gem.new(options, name, self).run
@@ -341,9 +357,9 @@ module Bundler
341
357
 
342
358
  desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory"
343
359
  method_option "dry-run", :type => :boolean, :default => false, :banner =>
344
- "only print out changes, do not actually clean gems"
360
+ "Only print out changes, do not actually clean gems"
345
361
  method_option "force", :type => :boolean, :default => false, :banner =>
346
- "forces clean even if --path is not set"
362
+ "Forces clean even if --path is not set"
347
363
  def clean
348
364
  require 'bundler/cli/clean'
349
365
  Clean.new(options.dup).run
@@ -368,5 +384,26 @@ module Bundler
368
384
  Env.new.write($stdout)
369
385
  end
370
386
 
387
+ private
388
+
389
+ # Automatically invoke `bundle install` and resume if
390
+ # Bundler.settings[:auto_install] exists. This is set through config cmd
391
+ # `bundle config auto_install 1`.
392
+ #
393
+ # Note that this method `nil`s out the global Definition object, so it
394
+ # should be called first, before you instantiate anything like an
395
+ # `Installer` that'll keep a reference to the old one instead.
396
+ def auto_install
397
+ return unless Bundler.settings[:auto_install]
398
+
399
+ begin
400
+ Bundler.definition.specs
401
+ rescue GemNotFound
402
+ Bundler.ui.info "Automatically installing missing gems."
403
+ Bundler.reset!
404
+ invoke :install, []
405
+ Bundler.reset!
406
+ end
407
+ end
371
408
  end
372
409
  end
@@ -9,6 +9,7 @@ module Bundler
9
9
  Bundler.definition.validate_ruby!
10
10
  Bundler.definition.resolve_with_cache!
11
11
  setup_cache_all
12
+ Bundler.settings[:cache_all_platforms] = options["all-platforms"] if options.key?("all-platforms")
12
13
  Bundler.load.cache
13
14
  Bundler.settings[:no_prune] = true if options["no-prune"]
14
15
  Bundler.load.lock