bundler 1.10.6 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +105 -0
  3. data/.rubocop_todo.yml +120 -0
  4. data/.travis.yml +8 -23
  5. data/CHANGELOG.md +95 -0
  6. data/CODE_OF_CONDUCT.md +6 -4
  7. data/DEVELOPMENT.md +4 -5
  8. data/README.md +2 -2
  9. data/Rakefile +71 -88
  10. data/bin/rake +14 -0
  11. data/bin/rspec +10 -0
  12. data/bin/rubocop +11 -0
  13. data/bundler.gemspec +17 -15
  14. data/exe/bundle +20 -0
  15. data/{bin → exe}/bundle_ruby +6 -4
  16. data/exe/bundler +20 -0
  17. data/lib/bundler/capistrano.rb +2 -2
  18. data/lib/bundler/cli/binstubs.rb +1 -2
  19. data/lib/bundler/cli/cache.rb +0 -1
  20. data/lib/bundler/cli/check.rb +7 -5
  21. data/lib/bundler/cli/clean.rb +0 -1
  22. data/lib/bundler/cli/common.rb +6 -7
  23. data/lib/bundler/cli/config.rb +69 -56
  24. data/lib/bundler/cli/console.rb +8 -8
  25. data/lib/bundler/cli/exec.rb +5 -4
  26. data/lib/bundler/cli/gem.rb +52 -40
  27. data/lib/bundler/cli/init.rb +5 -6
  28. data/lib/bundler/cli/inject.rb +1 -2
  29. data/lib/bundler/cli/install.rb +18 -21
  30. data/lib/bundler/cli/lock.rb +8 -3
  31. data/lib/bundler/cli/open.rb +4 -5
  32. data/lib/bundler/cli/outdated.rb +7 -8
  33. data/lib/bundler/cli/package.rb +1 -1
  34. data/lib/bundler/cli/platform.rb +2 -3
  35. data/lib/bundler/cli/show.rb +9 -9
  36. data/lib/bundler/cli/update.rb +2 -3
  37. data/lib/bundler/cli/viz.rb +1 -2
  38. data/lib/bundler/cli.rb +85 -74
  39. data/lib/bundler/constants.rb +1 -1
  40. data/lib/bundler/current_ruby.rb +38 -3
  41. data/lib/bundler/definition.rb +83 -88
  42. data/lib/bundler/dep_proxy.rb +11 -9
  43. data/lib/bundler/dependency.rb +17 -11
  44. data/lib/bundler/deployment.rb +2 -2
  45. data/lib/bundler/deprecate.rb +3 -3
  46. data/lib/bundler/dsl.rb +62 -43
  47. data/lib/bundler/env.rb +19 -12
  48. data/lib/bundler/environment.rb +1 -2
  49. data/lib/bundler/errors.rb +82 -0
  50. data/lib/bundler/fetcher/base.rb +20 -7
  51. data/lib/bundler/fetcher/dependency.rb +5 -5
  52. data/lib/bundler/fetcher/downloader.rb +1 -2
  53. data/lib/bundler/fetcher/index.rb +4 -7
  54. data/lib/bundler/fetcher.rb +49 -40
  55. data/lib/bundler/friendly_errors.rb +15 -8
  56. data/lib/bundler/gem_helper.rb +44 -35
  57. data/lib/bundler/gem_helpers.rb +7 -8
  58. data/lib/bundler/gem_remote_fetcher.rb +41 -0
  59. data/lib/bundler/gem_tasks.rb +4 -1
  60. data/lib/bundler/graph.rb +25 -24
  61. data/lib/bundler/index.rb +21 -18
  62. data/lib/bundler/injector.rb +2 -4
  63. data/lib/bundler/inline.rb +3 -3
  64. data/lib/bundler/installer/gem_installer.rb +76 -0
  65. data/lib/bundler/installer/parallel_installer.rb +22 -13
  66. data/lib/bundler/installer/standalone.rb +48 -0
  67. data/lib/bundler/installer.rb +57 -144
  68. data/lib/bundler/lazy_specification.rb +4 -5
  69. data/lib/bundler/lockfile_parser.rb +21 -19
  70. data/lib/bundler/man/bundle +2 -2
  71. data/lib/bundler/man/bundle-config +2 -2
  72. data/lib/bundler/man/bundle-config.txt +6 -4
  73. data/lib/bundler/man/bundle-exec +1 -1
  74. data/lib/bundler/man/bundle-exec.txt +1 -1
  75. data/lib/bundler/man/bundle-gem +80 -0
  76. data/lib/bundler/man/bundle-gem.txt +90 -0
  77. data/lib/bundler/man/bundle-install +37 -6
  78. data/lib/bundler/man/bundle-install.txt +68 -44
  79. data/lib/bundler/man/bundle-lock +55 -0
  80. data/lib/bundler/man/bundle-lock.txt +60 -0
  81. data/lib/bundler/man/bundle-package +1 -1
  82. data/lib/bundler/man/bundle-package.txt +1 -1
  83. data/lib/bundler/man/bundle-platform +1 -1
  84. data/lib/bundler/man/bundle-platform.txt +1 -1
  85. data/lib/bundler/man/bundle-update +1 -1
  86. data/lib/bundler/man/bundle-update.txt +1 -1
  87. data/lib/bundler/man/bundle.txt +2 -2
  88. data/lib/bundler/man/gemfile.5 +17 -1
  89. data/lib/bundler/man/gemfile.5.txt +12 -1
  90. data/lib/bundler/match_platform.rb +4 -4
  91. data/lib/bundler/psyched_yaml.rb +5 -5
  92. data/lib/bundler/remote_specification.rb +1 -1
  93. data/lib/bundler/resolver.rb +93 -88
  94. data/lib/bundler/retry.rb +9 -10
  95. data/lib/bundler/ruby_dsl.rb +1 -1
  96. data/lib/bundler/ruby_version.rb +7 -10
  97. data/lib/bundler/rubygems_ext.rb +32 -27
  98. data/lib/bundler/{gem_installer.rb → rubygems_gem_installer.rb} +2 -2
  99. data/lib/bundler/rubygems_integration.rb +85 -70
  100. data/lib/bundler/runtime.rb +65 -61
  101. data/lib/bundler/settings.rb +27 -26
  102. data/lib/bundler/setup.rb +3 -3
  103. data/lib/bundler/shared_helpers.rb +45 -20
  104. data/lib/bundler/similarity_detector.rb +19 -21
  105. data/lib/bundler/source/git/git_proxy.rb +52 -26
  106. data/lib/bundler/source/git.rb +29 -31
  107. data/lib/bundler/source/path/installer.rb +4 -4
  108. data/lib/bundler/source/path.rb +25 -28
  109. data/lib/bundler/source/rubygems/remote.rb +3 -3
  110. data/lib/bundler/source/rubygems.rb +62 -48
  111. data/lib/bundler/source.rb +4 -5
  112. data/lib/bundler/source_list.rb +4 -4
  113. data/lib/bundler/spec_set.rb +17 -15
  114. data/lib/bundler/ssl_certs/certificate_manager.rb +5 -6
  115. data/lib/bundler/stub_specification.rb +2 -2
  116. data/lib/bundler/templates/Executable +5 -5
  117. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +42 -6
  118. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  119. data/lib/bundler/templates/newgem/Rakefile.tt +4 -2
  120. data/lib/bundler/templates/newgem/bin/setup.tt +2 -1
  121. data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
  122. data/lib/bundler/ui/rg_proxy.rb +2 -2
  123. data/lib/bundler/ui/shell.rb +10 -6
  124. data/lib/bundler/ui.rb +3 -3
  125. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +82 -71
  126. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  127. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +9 -0
  128. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +40 -21
  129. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -0
  130. data/lib/bundler/vendored_molinillo.rb +1 -1
  131. data/lib/bundler/vendored_persistent.rb +3 -3
  132. data/lib/bundler/vendored_thor.rb +2 -2
  133. data/lib/bundler/version.rb +1 -1
  134. data/lib/bundler/vlad.rb +1 -1
  135. data/lib/bundler/worker.rb +4 -5
  136. data/lib/bundler.rb +99 -120
  137. data/man/bundle-config.ronn +4 -2
  138. data/man/bundle-gem.ronn +77 -0
  139. data/man/bundle-install.ronn +13 -6
  140. data/man/bundle-lock.ronn +47 -0
  141. data/man/bundle.ronn +1 -1
  142. data/man/gemfile.5.ronn +8 -0
  143. data/man/index.txt +1 -0
  144. metadata +36 -8
  145. data/bin/bundle +0 -21
  146. data/bin/bundler +0 -21
@@ -1,4 +1,4 @@
1
- require 'bundler/cli/common'
1
+ require "bundler/cli/common"
2
2
 
3
3
  module Bundler
4
4
  class CLI::Outdated
@@ -18,7 +18,7 @@ module Bundler
18
18
  Bundler.definition.validate_ruby!
19
19
  current_specs = Bundler.ui.silence { Bundler.load.specs }
20
20
  current_dependencies = {}
21
- Bundler.ui.silence { Bundler.load.dependencies.each { |dep| current_dependencies[dep.name] = dep } }
21
+ Bundler.ui.silence { Bundler.load.dependencies.each {|dep| current_dependencies[dep.name] = dep } }
22
22
 
23
23
  if gems.empty? && sources.empty?
24
24
  # We're doing a full update
@@ -32,18 +32,18 @@ module Bundler
32
32
 
33
33
  out_count = 0
34
34
  # Loop through the current specs
35
- gemfile_specs, dependency_specs = current_specs.partition { |spec| current_dependencies.has_key? spec.name }
35
+ gemfile_specs, dependency_specs = current_specs.partition {|spec| current_dependencies.key? spec.name }
36
36
  [gemfile_specs.sort_by(&:name), dependency_specs.sort_by(&:name)].flatten.each do |current_spec|
37
37
  next if !gems.empty? && !gems.include?(current_spec.name)
38
38
 
39
39
  dependency = current_dependencies[current_spec.name]
40
40
 
41
41
  if options["strict"]
42
- active_spec = definition.specs.detect { |spec| spec.name == current_spec.name }
42
+ active_spec = definition.specs.detect {|spec| spec.name == current_spec.name }
43
43
  else
44
- active_spec = definition.index[current_spec.name].sort_by { |b| b.version }
44
+ active_spec = definition.index[current_spec.name].sort_by(&:version)
45
45
  if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1
46
- active_spec = active_spec.delete_if { |b| b.respond_to?(:version) && b.version.prerelease? }
46
+ active_spec = active_spec.delete_if {|b| b.respond_to?(:version) && b.version.prerelease? }
47
47
  end
48
48
  active_spec = active_spec.last
49
49
  end
@@ -62,7 +62,7 @@ module Bundler
62
62
 
63
63
  spec_version = "#{active_spec.version}#{active_spec.git_version}"
64
64
  current_version = "#{current_spec.version}#{current_spec.git_version}"
65
- dependency_version = %|, requested #{dependency.requirement}| if dependency && dependency.specific?
65
+ dependency_version = %(, requested #{dependency.requirement}) if dependency && dependency.specific?
66
66
 
67
67
  if dependency
68
68
  groups = dependency.groups.join(", ")
@@ -82,6 +82,5 @@ module Bundler
82
82
  exit 1
83
83
  end
84
84
  end
85
-
86
85
  end
87
86
  end
@@ -23,7 +23,7 @@ module Bundler
23
23
  private
24
24
 
25
25
  def install
26
- require 'bundler/cli/install'
26
+ require "bundler/cli/install"
27
27
  options = self.options.dup
28
28
  if Bundler.settings[:cache_all_platforms]
29
29
  options["local"] = false
@@ -7,8 +7,8 @@ module Bundler
7
7
 
8
8
  def run
9
9
  platforms, ruby_version = Bundler.ui.silence do
10
- [ Bundler.definition.platforms.map {|p| "* #{p}" },
11
- Bundler.definition.ruby_version ]
10
+ [Bundler.definition.platforms.map {|p| "* #{p}" },
11
+ Bundler.definition.ruby_version]
12
12
  end
13
13
  output = []
14
14
 
@@ -38,6 +38,5 @@ module Bundler
38
38
 
39
39
  Bundler.ui.info output.join("\n\n")
40
40
  end
41
-
42
41
  end
43
42
  end
@@ -1,4 +1,4 @@
1
- require 'bundler/cli/common'
1
+ require "bundler/cli/common"
2
2
 
3
3
  module Bundler
4
4
  class CLI::Show
@@ -23,7 +23,7 @@ module Bundler
23
23
  spec = Bundler::CLI::Common.select_spec(gem_name, :regex_match)
24
24
  return unless spec
25
25
  path = spec.full_gem_path
26
- if !File.directory?(path)
26
+ unless File.directory?(path)
27
27
  Bundler.ui.warn "The gem #{gem_name} has been deleted. It was installed at:"
28
28
  end
29
29
  end
@@ -31,19 +31,19 @@ module Bundler
31
31
  end
32
32
 
33
33
  if options[:paths]
34
- Bundler.load.specs.sort_by { |s| s.name }.map do |s|
34
+ Bundler.load.specs.sort_by(&:name).map do |s|
35
35
  Bundler.ui.info s.full_gem_path
36
36
  end
37
37
  else
38
38
  Bundler.ui.info "Gems included by the bundle:"
39
- Bundler.load.specs.sort_by { |s| s.name }.each do |s|
39
+ Bundler.load.specs.sort_by(&:name).each do |s|
40
40
  desc = " * #{s.name} (#{s.version}#{s.git_version})"
41
41
  if @verbose
42
- latest = latest_specs.find { |l| l.name == s.name }
43
- Bundler.ui.info <<-END.gsub(/^ +/, '')
42
+ latest = latest_specs.find {|l| l.name == s.name }
43
+ Bundler.ui.info <<-END.gsub(/^ +/, "")
44
44
  #{desc}
45
- \tSummary: #{s.summary || 'No description available.'}
46
- \tHomepage: #{s.homepage || 'No website available.'}
45
+ \tSummary: #{s.summary || "No description available."}
46
+ \tHomepage: #{s.homepage || "No website available."}
47
47
  \tStatus: #{outdated?(s, latest) ? "Outdated - #{s.version} < #{latest.version}" : "Up to date"}
48
48
  END
49
49
  else
@@ -53,7 +53,7 @@ module Bundler
53
53
  end
54
54
  end
55
55
 
56
- private
56
+ private
57
57
 
58
58
  def fetch_latest_specs
59
59
  definition = Bundler.definition(true)
@@ -21,7 +21,7 @@ module Bundler
21
21
  "Run `bundle install` to update and install the bundled gems."
22
22
  end
23
23
  # cycle through the requested gems, just to make sure they exist
24
- names = Bundler.locked_gems.specs.map{ |s| s.name }
24
+ names = Bundler.locked_gems.specs.map(&:name)
25
25
  gems.each do |g|
26
26
  next if names.include?(g)
27
27
  require "bundler/cli/common"
@@ -30,7 +30,7 @@ module Bundler
30
30
 
31
31
  if groups.any?
32
32
  specs = Bundler.definition.specs_for groups
33
- sources.concat(specs.map(&:name))
33
+ gems.concat(specs.map(&:name))
34
34
  end
35
35
 
36
36
  Bundler.definition(:gems => gems, :sources => sources)
@@ -68,6 +68,5 @@ module Bundler
68
68
  Bundler.ui.confirm Bundler::CLI::Common.without_groups_message
69
69
  end
70
70
  end
71
-
72
71
  end
73
72
  end
@@ -6,7 +6,7 @@ module Bundler
6
6
  end
7
7
 
8
8
  def run
9
- require 'graphviz'
9
+ require "graphviz"
10
10
  output_file = File.expand_path(options[:file])
11
11
  graph = Graph.new(Bundler.load, output_file, options[:version], options[:requirements], options[:format], options[:without])
12
12
  graph.viz
@@ -22,6 +22,5 @@ module Bundler
22
22
  raise
23
23
  end
24
24
  end
25
-
26
25
  end
27
26
  end
data/lib/bundler/cli.rb CHANGED
@@ -1,10 +1,10 @@
1
- require 'bundler'
2
- require 'bundler/vendored_thor'
1
+ require "bundler"
2
+ require "bundler/vendored_thor"
3
3
 
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
+ AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean)
8
8
 
9
9
  def self.start(*)
10
10
  super
@@ -17,7 +17,7 @@ module Bundler
17
17
  super
18
18
 
19
19
  custom_gemfile = options[:gemfile] || Bundler.settings[:gemfile]
20
- ENV['BUNDLE_GEMFILE'] = File.expand_path(custom_gemfile) if custom_gemfile
20
+ ENV["BUNDLE_GEMFILE"] = File.expand_path(custom_gemfile) if custom_gemfile && !custom_gemfile.empty?
21
21
 
22
22
  Bundler.settings[:retry] = options[:retry] if options[:retry]
23
23
 
@@ -29,6 +29,13 @@ module Bundler
29
29
  self.options ||= {}
30
30
  Bundler.ui = UI::Shell.new(options)
31
31
  Bundler.ui.level = "debug" if options["verbose"]
32
+
33
+ if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
34
+ Bundler.ui.warn(
35
+ "The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
36
+ "experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
37
+ "To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true)
38
+ end
32
39
  end
33
40
 
34
41
  check_unknown_options!(:except => [:config, :exec])
@@ -37,8 +44,8 @@ module Bundler
37
44
  default_task :install
38
45
  class_option "no-color", :type => :boolean, :desc => "Disable colorization in output"
39
46
  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"
47
+ :desc => "Specify the number of times you wish to attempt network commands"
48
+ class_option "verbose", :type => :boolean, :desc => "Enable verbose output mode", :aliases => "-V"
42
49
 
43
50
  def help(cli = nil)
44
51
  case cli
@@ -48,14 +55,15 @@ module Bundler
48
55
  end
49
56
 
50
57
  manpages = %w(
51
- bundle
52
- bundle-config
53
- bundle-exec
54
- bundle-install
55
- bundle-package
56
- bundle-update
57
- bundle-platform
58
- gemfile.5)
58
+ bundle
59
+ bundle-config
60
+ bundle-exec
61
+ bundle-gem
62
+ bundle-install
63
+ bundle-package
64
+ bundle-update
65
+ bundle-platform
66
+ gemfile.5)
59
67
 
60
68
  if manpages.include?(command)
61
69
  root = File.expand_path("../man", __FILE__)
@@ -65,6 +73,8 @@ module Bundler
65
73
  else
66
74
  puts File.read("#{root}/#{command}.txt")
67
75
  end
76
+ elsif command_path = Bundler.which("bundler-#{cli}")
77
+ Kernel.exec(command_path, "--help")
68
78
  else
69
79
  super
70
80
  end
@@ -84,7 +94,7 @@ module Bundler
84
94
  D
85
95
  method_option "gemspec", :type => :string, :banner => "Use the specified .gemspec to create the Gemfile"
86
96
  def init
87
- require 'bundler/cli/init'
97
+ require "bundler/cli/init"
88
98
  Init.new(options.dup).run
89
99
  end
90
100
 
@@ -102,7 +112,7 @@ module Bundler
102
112
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
103
113
  map "c" => "check"
104
114
  def check
105
- require 'bundler/cli/check'
115
+ require "bundler/cli/check"
106
116
  Check.new(options).run
107
117
  end
108
118
 
@@ -151,14 +161,14 @@ module Bundler
151
161
  "Install to the system location ($BUNDLE_PATH or $GEM_HOME) even if the bundle was previously installed somewhere else for this application"
152
162
  method_option "trust-policy", :alias => "P", :type => :string, :banner =>
153
163
  "Gem trust policy (like gem install -P). Must be one of " +
154
- Bundler.rubygems.security_policy_keys.join('|')
164
+ Bundler.rubygems.security_policy_keys.join("|")
155
165
  method_option "without", :type => :array, :banner =>
156
166
  "Exclude gems that are part of the specified named group."
157
167
  method_option "with", :type => :array, :banner =>
158
168
  "Include gems that are part of the specified named group."
159
169
  map "i" => "install"
160
170
  def install
161
- require 'bundler/cli/install'
171
+ require "bundler/cli/install"
162
172
  Install.new(options.dup).run
163
173
  end
164
174
 
@@ -183,7 +193,7 @@ module Bundler
183
193
  method_option "force", :type => :boolean, :banner =>
184
194
  "Force downloading every gem."
185
195
  def update(*gems)
186
- require 'bundler/cli/update'
196
+ require "bundler/cli/update"
187
197
  Update.new(options, gems).run
188
198
  end
189
199
 
@@ -193,11 +203,11 @@ module Bundler
193
203
  Calling show with [GEM] will list the exact location of that gem on your machine.
194
204
  D
195
205
  method_option "paths", :type => :boolean,
196
- :banner => "List the paths of all gems that are required by your Gemfile."
206
+ :banner => "List the paths of all gems that are required by your Gemfile."
197
207
  method_option "outdated", :type => :boolean,
198
- :banner => "Show verbose output including whether gems are outdated."
208
+ :banner => "Show verbose output including whether gems are outdated."
199
209
  def show(gem_name = nil)
200
- require 'bundler/cli/show'
210
+ require "bundler/cli/show"
201
211
  Show.new(options, gem_name).run
202
212
  end
203
213
  map %w(list) => "show"
@@ -205,14 +215,15 @@ module Bundler
205
215
  desc "binstubs GEM [OPTIONS]", "Install the binstubs of the listed gem"
206
216
  long_desc <<-D
207
217
  Generate binstubs for executables in [GEM]. Binstubs are put into bin,
208
- or the --binstubs directory if one has been set.
218
+ or the --binstubs directory if one has been set. Calling binstubs with [GEM [GEM]]
219
+ will create binstubs for all given gems.
209
220
  D
210
221
  method_option "force", :type => :boolean, :default => false, :banner =>
211
222
  "Overwrite existing binstubs if they exist"
212
223
  method_option "path", :type => :string, :lazy_default => "bin", :banner =>
213
224
  "Binstub destination directory (default bin)"
214
225
  def binstubs(*gems)
215
- require 'bundler/cli/binstubs'
226
+ require "bundler/cli/binstubs"
216
227
  Binstubs.new(options, gems).run
217
228
  end
218
229
 
@@ -230,16 +241,16 @@ module Bundler
230
241
  method_option "strict", :type => :boolean, :banner =>
231
242
  "Only list newer versions allowed by your Gemfile requirements"
232
243
  def outdated(*gems)
233
- require 'bundler/cli/outdated'
244
+ require "bundler/cli/outdated"
234
245
  Outdated.new(options, gems).run
235
246
  end
236
247
 
237
248
  desc "cache [OPTIONS]", "Cache all the gems to vendor/cache", :hide => true
238
249
  method_option "all", :type => :boolean, :banner => "Include all sources (including path and git)."
239
250
  method_option "all-platforms", :type => :boolean, :banner => "Include gems for all platforms, not just the current one"
240
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
251
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
241
252
  def cache
242
- require 'bundler/cli/cache'
253
+ require "bundler/cli/cache"
243
254
  Cache.new(options).run
244
255
  end
245
256
 
@@ -249,8 +260,8 @@ module Bundler
249
260
  method_option "cache-path", :type => :string, :banner =>
250
261
  "Specify a different cache path than the default (vendor/cache)."
251
262
  method_option "gemfile", :type => :string, :banner => "Use the specified gemfile instead of Gemfile"
252
- method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package."
253
- method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
263
+ method_option "no-install", :type => :boolean, :banner => "Don't actually install the gems, just package."
264
+ method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
254
265
  method_option "path", :type => :string, :banner =>
255
266
  "Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME). Bundler will remember this value for future installs on this machine"
256
267
  method_option "quiet", :type => :boolean, :banner => "Only output warnings and errors."
@@ -261,7 +272,7 @@ module Bundler
261
272
  bundle without having to download any additional gems.
262
273
  D
263
274
  def package
264
- require 'bundler/cli/package'
275
+ require "bundler/cli/package"
265
276
  Package.new(options).run
266
277
  end
267
278
  map %w(pack) => :package
@@ -275,7 +286,7 @@ module Bundler
275
286
  D
276
287
  map "e" => "exec"
277
288
  def exec(*args)
278
- require 'bundler/cli/exec'
289
+ require "bundler/cli/exec"
279
290
  Exec.new(options, args).run
280
291
  end
281
292
 
@@ -292,19 +303,19 @@ module Bundler
292
303
  where they were specified.
293
304
  D
294
305
  def config(*args)
295
- require 'bundler/cli/config'
306
+ require "bundler/cli/config"
296
307
  Config.new(options, args, self).run
297
308
  end
298
309
 
299
310
  desc "open GEM", "Opens the source directory of the given bundled gem"
300
311
  def open(name)
301
- require 'bundler/cli/open'
312
+ require "bundler/cli/open"
302
313
  Open.new(options, name).run
303
314
  end
304
315
 
305
316
  desc "console [GROUP]", "Opens an IRB session with the bundle pre-loaded"
306
317
  def console(group = nil)
307
- require 'bundler/cli/console'
318
+ require "bundler/cli/console"
308
319
  Console.new(options, group).run
309
320
  end
310
321
 
@@ -316,7 +327,7 @@ module Bundler
316
327
 
317
328
  desc "licenses", "Prints the license of all gems in the bundle"
318
329
  def licenses
319
- Bundler.load.specs.sort_by { |s| s.license.to_s }.reverse.each do |s|
330
+ Bundler.load.specs.sort_by {|s| s.license.to_s }.reverse_each do |s|
320
331
  gem_name = s.name
321
332
  license = s.license || s.licenses
322
333
 
@@ -328,39 +339,39 @@ module Bundler
328
339
  end
329
340
  end
330
341
 
331
- desc 'viz [OPTIONS]', "Generates a visual dependency graph"
342
+ desc "viz [OPTIONS]", "Generates a visual dependency graph"
332
343
  long_desc <<-D
333
344
  Viz generates a PNG file of the current Gemfile as a dependency graph.
334
345
  Viz requires the ruby-graphviz gem (and its dependencies).
335
346
  The associated gems must also be installed via 'bundle install'.
336
347
  D
337
- method_option :file, :type => :string, :default => 'gem_graph', :aliases => '-f', :banner => "The name to use for the generated file. see format option"
338
- method_option :format, :type => :string, :default => "png", :aliases => '-F', :banner => "This is output format option. Supported format is png, jpg, svg, dot ..."
339
- method_option :requirements, :type => :boolean, :default => false, :aliases => '-r', :banner => "Set to show the version of each required dependency."
340
- method_option :version, :type => :boolean, :default => false, :aliases => '-v', :banner => "Set to show each gem version."
348
+ method_option :file, :type => :string, :default => "gem_graph", :aliases => "-f", :banner => "The name to use for the generated file. see format option"
349
+ method_option :format, :type => :string, :default => "png", :aliases => "-F", :banner => "This is output format option. Supported format is png, jpg, svg, dot ..."
350
+ method_option :requirements, :type => :boolean, :default => false, :aliases => "-r", :banner => "Set to show the version of each required dependency."
351
+ method_option :version, :type => :boolean, :default => false, :aliases => "-v", :banner => "Set to show each gem version."
341
352
  method_option :without, :type => :array, :default => [], :banner => "Exclude gems that are part of the specified named group."
342
353
  def viz
343
- require 'bundler/cli/viz'
354
+ require "bundler/cli/viz"
344
355
  Viz.new(options).run
345
356
  end
346
357
 
347
358
  desc "gem GEM [OPTIONS]", "Creates a skeleton for creating a rubygem"
348
- method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :desc => "Generate a binary for your library."
359
+ method_option :bin, :type => :boolean, :default => false, :aliases => "-b", :desc => "Generate a binary for your library."
349
360
  method_option :coc, :type => :boolean, :desc => "Generate a code of conduct file. Set a default with `bundle config gem.coc true`."
350
361
  method_option :edit, :type => :string, :aliases => "-e", :required => false, :banner => "EDITOR",
351
- :lazy_default => [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? },
352
- :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
362
+ :lazy_default => [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? },
363
+ :desc => "Open generated gemspec in the specified editor (defaults to $EDITOR or $BUNDLER_EDITOR)"
353
364
  method_option :ext, :type => :boolean, :default => false, :desc => "Generate the boilerplate for C extension code"
354
365
  method_option :mit, :type => :boolean, :desc => "Generate an MIT license file. Set a default with `bundle config gem.mit true`."
355
- method_option :test, :type => :string, :lazy_default => 'rspec', :aliases => '-t', :banner => "rspec",
356
- :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`."
366
+ method_option :test, :type => :string, :lazy_default => "rspec", :aliases => "-t", :banner => "rspec",
367
+ :desc => "Generate a test directory for your library, either rspec or minitest. Set a default with `bundle config gem.test rspec`."
357
368
  def gem(name)
358
- require 'bundler/cli/gem'
369
+ require "bundler/cli/gem"
359
370
  Gem.new(options, name, self).run
360
371
  end
361
372
 
362
373
  def self.source_root
363
- File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
374
+ File.expand_path(File.join(File.dirname(__FILE__), "templates"))
364
375
  end
365
376
 
366
377
  desc "clean [OPTIONS]", "Cleans up unused gems in your bundler directory"
@@ -369,7 +380,7 @@ module Bundler
369
380
  method_option "force", :type => :boolean, :default => false, :banner =>
370
381
  "Forces clean even if --path is not set"
371
382
  def clean
372
- require 'bundler/cli/clean'
383
+ require "bundler/cli/clean"
373
384
  Clean.new(options.dup).run
374
385
  end
375
386
 
@@ -377,19 +388,19 @@ module Bundler
377
388
  method_option "ruby", :type => :boolean, :default => false, :banner =>
378
389
  "only display ruby related platform information"
379
390
  def platform
380
- require 'bundler/cli/platform'
391
+ require "bundler/cli/platform"
381
392
  Platform.new(options).run
382
393
  end
383
394
 
384
395
  desc "inject GEM VERSION ...", "Add the named gem(s), with version requirements, to the resolved Gemfile"
385
396
  def inject(name, version, *gems)
386
- require 'bundler/cli/inject'
397
+ require "bundler/cli/inject"
387
398
  Inject.new(options, name, version, gems).run
388
399
  end
389
400
 
390
401
  desc "lock", "Creates a lockfile without installing"
391
- method_option "update", :type => :boolean, :default => false, :banner =>
392
- "ignore the existing lockfile"
402
+ method_option "update", :type => :array, :lazy_default => [], :banner =>
403
+ "ignore the existing lockfile, update all gems by default, or update list of given gems"
393
404
  method_option "local", :type => :boolean, :default => false, :banner =>
394
405
  "do not attempt to fetch remote gemspecs and use the local gem cache only"
395
406
  method_option "print", :type => :boolean, :default => false, :banner =>
@@ -397,7 +408,7 @@ module Bundler
397
408
  method_option "lockfile", :type => :string, :default => nil, :banner =>
398
409
  "the path the lockfile should be written to"
399
410
  def lock
400
- require 'bundler/cli/lock'
411
+ require "bundler/cli/lock"
401
412
  Lock.new(options).run
402
413
  end
403
414
 
@@ -406,26 +417,26 @@ module Bundler
406
417
  Env.new.write($stdout)
407
418
  end
408
419
 
409
- private
410
-
411
- # Automatically invoke `bundle install` and resume if
412
- # Bundler.settings[:auto_install] exists. This is set through config cmd
413
- # `bundle config auto_install 1`.
414
- #
415
- # Note that this method `nil`s out the global Definition object, so it
416
- # should be called first, before you instantiate anything like an
417
- # `Installer` that'll keep a reference to the old one instead.
418
- def auto_install
419
- return unless Bundler.settings[:auto_install]
420
-
421
- begin
422
- Bundler.definition.specs
423
- rescue GemNotFound
424
- Bundler.ui.info "Automatically installing missing gems."
425
- Bundler.reset!
426
- invoke :install, []
427
- Bundler.reset!
428
- end
420
+ private
421
+
422
+ # Automatically invoke `bundle install` and resume if
423
+ # Bundler.settings[:auto_install] exists. This is set through config cmd
424
+ # `bundle config auto_install 1`.
425
+ #
426
+ # Note that this method `nil`s out the global Definition object, so it
427
+ # should be called first, before you instantiate anything like an
428
+ # `Installer` that'll keep a reference to the old one instead.
429
+ def auto_install
430
+ return unless Bundler.settings[:auto_install]
431
+
432
+ begin
433
+ Bundler.definition.specs
434
+ rescue GemNotFound
435
+ Bundler.ui.info "Automatically installing missing gems."
436
+ Bundler.reset!
437
+ invoke :install, []
438
+ Bundler.reset!
429
439
  end
440
+ end
430
441
  end
431
442
  end
@@ -1,5 +1,5 @@
1
1
  module Bundler
2
- WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
2
+ WINDOWS = RbConfig::CONFIG["host_os"] =~ /(msdos|mswin|djgpp|mingw)/
3
3
  FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
4
4
  NULL = WINDOWS ? "NUL" : "/dev/null"
5
5
  end
@@ -27,6 +27,14 @@ module Bundler
27
27
  RUBY_VERSION =~ /^2\.2/
28
28
  end
29
29
 
30
+ def on_23?
31
+ RUBY_VERSION =~ /^2\.3/
32
+ end
33
+
34
+ def on_2?
35
+ on_20? || on_21? || on_22? || on_23?
36
+ end
37
+
30
38
  def ruby?
31
39
  !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev")
32
40
  end
@@ -51,6 +59,14 @@ module Bundler
51
59
  ruby? && on_22?
52
60
  end
53
61
 
62
+ def ruby_23?
63
+ ruby? && on_23?
64
+ end
65
+
66
+ def ruby_2?
67
+ ruby? && on_2?
68
+ end
69
+
54
70
  def mri?
55
71
  !mswin? && (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby")
56
72
  end
@@ -75,6 +91,10 @@ module Bundler
75
91
  mri? && on_22?
76
92
  end
77
93
 
94
+ def mri_23?
95
+ mri? && on_23?
96
+ end
97
+
78
98
  def rbx?
79
99
  ruby? && defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
80
100
  end
@@ -119,8 +139,12 @@ module Bundler
119
139
  mswin? && on_22?
120
140
  end
121
141
 
142
+ def mswin_23?
143
+ mswin? && on_23?
144
+ end
145
+
122
146
  def mswin64?
123
- Bundler::WINDOWS && Gem::Platform.local.os == "mswin64" && Gem::Platform.local.cpu == 'x64'
147
+ Bundler::WINDOWS && Gem::Platform.local.os == "mswin64" && Gem::Platform.local.cpu == "x64"
124
148
  end
125
149
 
126
150
  def mswin64_19?
@@ -139,8 +163,12 @@ module Bundler
139
163
  mswin64? && on_22?
140
164
  end
141
165
 
166
+ def mswin64_23?
167
+ mswin64? && on_23?
168
+ end
169
+
142
170
  def mingw?
143
- Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != 'x64'
171
+ Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu != "x64"
144
172
  end
145
173
 
146
174
  def mingw_18?
@@ -163,8 +191,12 @@ module Bundler
163
191
  mingw? && on_22?
164
192
  end
165
193
 
194
+ def mingw_23?
195
+ mingw? && on_23?
196
+ end
197
+
166
198
  def x64_mingw?
167
- Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == 'x64'
199
+ Bundler::WINDOWS && Gem::Platform.local.os == "mingw32" && Gem::Platform.local.cpu == "x64"
168
200
  end
169
201
 
170
202
  def x64_mingw_20?
@@ -179,5 +211,8 @@ module Bundler
179
211
  x64_mingw? && on_22?
180
212
  end
181
213
 
214
+ def x64_mingw_23?
215
+ x64_mingw? && on_23?
216
+ end
182
217
  end
183
218
  end