bundler 1.14.6 → 1.15.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.

Files changed (131) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +1 -1
  3. data/.rubocop_todo.yml +131 -43
  4. data/.travis.yml +5 -5
  5. data/CHANGELOG.md +52 -8
  6. data/CONTRIBUTING.md +10 -29
  7. data/README.md +13 -6
  8. data/Rakefile +4 -2
  9. data/bin/rubocop +1 -1
  10. data/doc/README.md +30 -0
  11. data/doc/TROUBLESHOOTING.md +64 -0
  12. data/doc/contributing/BUG_TRIAGE.md +36 -0
  13. data/doc/contributing/COMMUNITY.md +13 -0
  14. data/doc/contributing/GETTING_HELP.md +11 -0
  15. data/doc/contributing/HOW_YOU_CAN_HELP.md +27 -0
  16. data/doc/contributing/ISSUES.md +51 -0
  17. data/doc/contributing/README.md +38 -0
  18. data/doc/development/NEW_FEATURES.md +10 -0
  19. data/doc/development/PULL_REQUESTS.md +40 -0
  20. data/doc/development/README.md +19 -0
  21. data/doc/development/RELEASING.md +9 -0
  22. data/doc/development/SETUP.md +29 -0
  23. data/doc/documentation/README.md +29 -0
  24. data/doc/documentation/VISION.md +26 -0
  25. data/doc/documentation/WRITING.md +54 -0
  26. data/exe/bundle +4 -1
  27. data/lib/bundler.rb +20 -13
  28. data/lib/bundler/cli.rb +67 -3
  29. data/lib/bundler/cli/add.rb +26 -0
  30. data/lib/bundler/cli/config.rb +24 -6
  31. data/lib/bundler/cli/gem.rb +13 -8
  32. data/lib/bundler/cli/info.rb +51 -0
  33. data/lib/bundler/cli/inject.rb +8 -2
  34. data/lib/bundler/cli/install.rb +1 -1
  35. data/lib/bundler/cli/issue.rb +40 -0
  36. data/lib/bundler/cli/outdated.rb +16 -18
  37. data/lib/bundler/cli/pristine.rb +33 -0
  38. data/lib/bundler/cli/viz.rb +1 -1
  39. data/lib/bundler/definition.rb +64 -48
  40. data/lib/bundler/dsl.rb +6 -0
  41. data/lib/bundler/endpoint_specification.rb +3 -9
  42. data/lib/bundler/env.rb +3 -3
  43. data/lib/bundler/errors.rb +1 -1
  44. data/lib/bundler/fetcher/downloader.rb +3 -2
  45. data/lib/bundler/gem_helper.rb +5 -0
  46. data/lib/bundler/index.rb +9 -3
  47. data/lib/bundler/injector.rb +32 -11
  48. data/lib/bundler/installer.rb +1 -1
  49. data/lib/bundler/installer/parallel_installer.rb +15 -1
  50. data/lib/bundler/lazy_specification.rb +6 -0
  51. data/lib/bundler/lockfile_parser.rb +42 -34
  52. data/lib/bundler/mirror.rb +2 -0
  53. data/lib/bundler/plugin.rb +5 -1
  54. data/lib/bundler/plugin/api/source.rb +1 -1
  55. data/lib/bundler/plugin/index.rb +2 -0
  56. data/lib/bundler/remote_specification.rb +16 -7
  57. data/lib/bundler/resolver.rb +13 -3
  58. data/lib/bundler/rubygems_ext.rb +8 -3
  59. data/lib/bundler/rubygems_integration.rb +85 -36
  60. data/lib/bundler/runtime.rb +4 -1
  61. data/lib/bundler/settings.rb +2 -1
  62. data/lib/bundler/setup.rb +1 -1
  63. data/lib/bundler/shared_helpers.rb +26 -1
  64. data/lib/bundler/source.rb +17 -1
  65. data/lib/bundler/source/git.rb +16 -0
  66. data/lib/bundler/source/path.rb +13 -3
  67. data/lib/bundler/source/path/installer.rb +2 -2
  68. data/lib/bundler/source/rubygems.rb +5 -2
  69. data/lib/bundler/spec_set.rb +22 -13
  70. data/lib/bundler/stub_specification.rb +64 -2
  71. data/lib/bundler/templates/Executable +1 -1
  72. data/lib/bundler/templates/Executable.standalone +5 -5
  73. data/lib/bundler/templates/newgem/Gemfile.tt +2 -2
  74. data/lib/bundler/templates/newgem/LICENSE.txt.tt +1 -1
  75. data/lib/bundler/templates/newgem/README.md.tt +12 -6
  76. data/lib/bundler/templates/newgem/Rakefile.tt +5 -5
  77. data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +4 -4
  78. data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +3 -3
  79. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +6 -6
  80. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +4 -4
  81. data/lib/bundler/templates/newgem/newgem.gemspec.tt +9 -9
  82. data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +3 -0
  83. data/lib/bundler/templates/newgem/test/newgem_test.rb.tt +1 -1
  84. data/lib/bundler/templates/newgem/test/test_helper.rb.tt +3 -3
  85. data/lib/bundler/ui/shell.rb +9 -6
  86. data/lib/bundler/vendor/thor/lib/thor.rb +31 -23
  87. data/lib/bundler/vendor/thor/lib/thor/actions.rb +21 -22
  88. data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
  89. data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
  90. data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +2 -2
  91. data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +8 -8
  92. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +23 -12
  93. data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +10 -14
  94. data/lib/bundler/vendor/thor/lib/thor/base.rb +30 -30
  95. data/lib/bundler/vendor/thor/lib/thor/command.rb +9 -9
  96. data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +9 -1
  97. data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +7 -5
  98. data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +94 -63
  99. data/lib/bundler/vendor/thor/lib/thor/error.rb +3 -3
  100. data/lib/bundler/vendor/thor/lib/thor/group.rb +12 -12
  101. data/lib/bundler/vendor/thor/lib/thor/invocation.rb +4 -5
  102. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +4 -7
  103. data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +16 -16
  104. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +40 -19
  105. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +7 -5
  106. data/lib/bundler/vendor/thor/lib/thor/runner.rb +25 -25
  107. data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
  108. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +41 -26
  109. data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
  110. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +4 -4
  111. data/lib/bundler/vendor/thor/lib/thor/util.rb +8 -7
  112. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  113. data/lib/bundler/version.rb +14 -1
  114. data/lib/bundler/version_ranges.rb +75 -0
  115. data/lib/bundler/worker.rb +2 -1
  116. data/man/bundle-check.ronn +26 -0
  117. data/man/bundle-clean.ronn +18 -0
  118. data/man/bundle-config.ronn +4 -1
  119. data/man/bundle-info.ronn +17 -0
  120. data/man/bundle-init.ronn +18 -0
  121. data/man/bundle-inject.ronn +22 -0
  122. data/man/bundle-open.ronn +19 -0
  123. data/man/bundle-show.ronn +20 -0
  124. data/man/bundle-update.ronn +5 -2
  125. data/man/bundle-viz.ronn +30 -0
  126. data/man/bundle.ronn +3 -0
  127. data/man/gemfile.5.ronn +24 -64
  128. data/task/release.rake +115 -0
  129. metadata +49 -5
  130. data/DEVELOPMENT.md +0 -150
  131. data/ISSUES.md +0 -117
@@ -9,7 +9,7 @@ class Bundler::Thor
9
9
  # it will use a colored log, otherwise it will use a basic one without color.
10
10
  #
11
11
  def shell
12
- @shell ||= if ENV["THOR_SHELL"] && ENV["THOR_SHELL"].size > 0
12
+ @shell ||= if ENV["THOR_SHELL"] && !ENV["THOR_SHELL"].empty?
13
13
  Bundler::Thor::Shell.const_get(ENV["THOR_SHELL"])
14
14
  elsif RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ && !ENV["ANSICON"]
15
15
  Bundler::Thor::Shell::Basic
@@ -3,14 +3,17 @@ require "io/console" if RUBY_VERSION > "1.9.2"
3
3
 
4
4
  class Bundler::Thor
5
5
  module Shell
6
- class Basic # rubocop:disable ClassLength
6
+ class Basic
7
7
  attr_accessor :base
8
8
  attr_reader :padding
9
9
 
10
10
  # Initialize base, mute and padding to nil.
11
11
  #
12
12
  def initialize #:nodoc:
13
- @base, @mute, @padding, @always_force = nil, false, 0, false
13
+ @base = nil
14
+ @mute = false
15
+ @padding = 0
16
+ @always_force = false
14
17
  end
15
18
 
16
19
  # Mute everything that's inside given block
@@ -24,7 +27,7 @@ class Bundler::Thor
24
27
 
25
28
  # Check if base is muted
26
29
  #
27
- def mute? # rubocop:disable TrivialAccessors
30
+ def mute?
28
31
  @mute
29
32
  end
30
33
 
@@ -34,6 +37,15 @@ class Bundler::Thor
34
37
  @padding = [0, value].max
35
38
  end
36
39
 
40
+ # Sets the output padding while executing a block and resets it.
41
+ #
42
+ def indent(count = 1)
43
+ orig_padding = padding
44
+ self.padding = padding + count
45
+ yield
46
+ self.padding = orig_padding
47
+ end
48
+
37
49
  # Asks something to the user and receives a response.
38
50
  #
39
51
  # If asked to limit the correct responses, you can pass in an
@@ -148,7 +160,9 @@ class Bundler::Thor
148
160
  def print_table(array, options = {}) # rubocop:disable MethodLength
149
161
  return if array.empty?
150
162
 
151
- formats, indent, colwidth = [], options[:indent].to_i, options[:colwidth]
163
+ formats = []
164
+ indent = options[:indent].to_i
165
+ colwidth = options[:colwidth]
152
166
  options[:truncate] = terminal_width if options[:truncate] == true
153
167
 
154
168
  formats << "%-#{colwidth + 2}s" if colwidth
@@ -161,12 +175,12 @@ class Bundler::Thor
161
175
  start.upto(colcount - 1) do |index|
162
176
  maxima = array.map { |row| row[index] ? row[index].to_s.size : 0 }.max
163
177
  maximas << maxima
164
- if index == colcount - 1
165
- # Don't output 2 trailing spaces when printing the last column
166
- formats << "%-s"
167
- else
168
- formats << "%-#{maxima + 2}s"
169
- end
178
+ formats << if index == colcount - 1
179
+ # Don't output 2 trailing spaces when printing the last column
180
+ "%-s"
181
+ else
182
+ "%-#{maxima + 2}s"
183
+ end
170
184
  end
171
185
 
172
186
  formats[0] = formats[0].insert(0, " " * indent)
@@ -178,15 +192,15 @@ class Bundler::Thor
178
192
  row.each_with_index do |column, index|
179
193
  maxima = maximas[index]
180
194
 
181
- if column.is_a?(Numeric)
195
+ f = if column.is_a?(Numeric)
182
196
  if index == row.size - 1
183
197
  # Don't output 2 trailing spaces when printing the last column
184
- f = "%#{maxima}s"
198
+ "%#{maxima}s"
185
199
  else
186
- f = "%#{maxima}s "
200
+ "%#{maxima}s "
187
201
  end
188
202
  else
189
- f = formats[index]
203
+ formats[index]
190
204
  end
191
205
  sentence << f % column.to_s
192
206
  end
@@ -211,7 +225,7 @@ class Bundler::Thor
211
225
  paras = message.split("\n\n")
212
226
 
213
227
  paras.map! do |unwrapped|
214
- unwrapped.strip.gsub(/\n/, " ").squeeze(" ").gsub(/.{1,#{width}}(?:\s|\Z)/) { ($& + 5.chr).gsub(/\n\005/, "\n").gsub(/\005/, "\n") }
228
+ unwrapped.strip.tr("\n", " ").squeeze(" ").gsub(/.{1,#{width}}(?:\s|\Z)/) { ($& + 5.chr).gsub(/\n\005/, "\n").gsub(/\005/, "\n") }
215
229
  end
216
230
 
217
231
  paras.each do |para|
@@ -230,7 +244,7 @@ class Bundler::Thor
230
244
  # destination<String>:: the destination file to solve conflicts
231
245
  # block<Proc>:: an optional block that returns the value to be used in diff
232
246
  #
233
- def file_collision(destination) # rubocop:disable MethodLength
247
+ def file_collision(destination)
234
248
  return true if @always_force
235
249
  options = block_given? ? "[Ynaqdh]" : "[Ynaqh]"
236
250
 
@@ -249,7 +263,7 @@ class Bundler::Thor
249
263
  return @always_force = true
250
264
  when is?(:quit)
251
265
  say "Aborting..."
252
- fail SystemExit
266
+ raise SystemExit
253
267
  when is?(:diff)
254
268
  show_diff(destination, yield) if block_given?
255
269
  say "Retrying..."
@@ -262,10 +276,10 @@ class Bundler::Thor
262
276
  # This code was copied from Rake, available under MIT-LICENSE
263
277
  # Copyright (c) 2003, 2004 Jim Weirich
264
278
  def terminal_width
265
- if ENV["THOR_COLUMNS"]
266
- result = ENV["THOR_COLUMNS"].to_i
279
+ result = if ENV["THOR_COLUMNS"]
280
+ ENV["THOR_COLUMNS"].to_i
267
281
  else
268
- result = unix? ? dynamic_width : 80
282
+ unix? ? dynamic_width : 80
269
283
  end
270
284
  result < 10 ? 80 : result
271
285
  rescue
@@ -284,7 +298,7 @@ class Bundler::Thor
284
298
  # Apply color to the given string with optional bold. Disabled in the
285
299
  # Bundler::Thor::Shell::Basic class.
286
300
  #
287
- def set_color(string, *args) #:nodoc:
301
+ def set_color(string, *) #:nodoc:
288
302
  string
289
303
  end
290
304
 
@@ -353,11 +367,11 @@ class Bundler::Thor
353
367
  end
354
368
 
355
369
  def dynamic_width_stty
356
- %x(stty size 2>/dev/null).split[1].to_i
370
+ `stty size 2>/dev/null`.split[1].to_i
357
371
  end
358
372
 
359
373
  def dynamic_width_tput
360
- %x(tput cols 2>/dev/null).to_i
374
+ `tput cols 2>/dev/null`.to_i
361
375
  end
362
376
 
363
377
  def unix?
@@ -370,7 +384,7 @@ class Bundler::Thor
370
384
  if chars.length <= width
371
385
  chars.join
372
386
  else
373
- ( chars[0, width - 3].join) + "..."
387
+ chars[0, width - 3].join + "..."
374
388
  end
375
389
  end
376
390
  end
@@ -381,7 +395,8 @@ class Bundler::Thor
381
395
  end
382
396
  else
383
397
  def as_unicode
384
- old, $KCODE = $KCODE, "U"
398
+ old = $KCODE
399
+ $KCODE = "U"
385
400
  yield
386
401
  ensure
387
402
  $KCODE = old
@@ -391,7 +406,7 @@ class Bundler::Thor
391
406
  def ask_simply(statement, color, options)
392
407
  default = options[:default]
393
408
  message = [statement, ("(#{default})" if default), nil].uniq.join(" ")
394
- message = prepare_message(message, color)
409
+ message = prepare_message(message, *color)
395
410
  result = Bundler::Thor::LineEditor.readline(message, options)
396
411
 
397
412
  return unless result
@@ -134,7 +134,7 @@ class Bundler::Thor
134
134
  # for diff.
135
135
  #
136
136
  def diff_lcs_loaded? #:nodoc:
137
- return true if defined?(Diff::LCS)
137
+ return true if defined?(Diff::LCS)
138
138
  return @diff_lcs_loaded unless @diff_lcs_loaded.nil?
139
139
 
140
140
  @diff_lcs_loaded = begin
@@ -51,13 +51,13 @@ class Bundler::Thor
51
51
  def set_color(string, *colors)
52
52
  if colors.all? { |color| color.is_a?(Symbol) || color.is_a?(String) }
53
53
  html_colors = colors.map { |color| lookup_color(color) }
54
- "<span style=\"#{html_colors.join("; ")};\">#{string}</span>"
54
+ "<span style=\"#{html_colors.join('; ')};\">#{string}</span>"
55
55
  else
56
56
  color, bold = colors
57
57
  html_color = self.class.const_get(color.to_s.upcase) if color.is_a?(Symbol)
58
58
  styles = [html_color]
59
59
  styles << BOLD if bold
60
- "<span style=\"#{styles.join("; ")};\">#{string}</span>"
60
+ "<span style=\"#{styles.join('; ')};\">#{string}</span>"
61
61
  end
62
62
  end
63
63
 
@@ -68,7 +68,7 @@ class Bundler::Thor
68
68
  #
69
69
  # TODO: Implement #ask for Bundler::Thor::Shell::HTML
70
70
  def ask(statement, color = nil)
71
- fail NotImplementedError, "Implement #ask for Bundler::Thor::Shell::HTML"
71
+ raise NotImplementedError, "Implement #ask for Bundler::Thor::Shell::HTML"
72
72
  end
73
73
 
74
74
  protected
@@ -111,7 +111,7 @@ class Bundler::Thor
111
111
  # for diff.
112
112
  #
113
113
  def diff_lcs_loaded? #:nodoc:
114
- return true if defined?(Diff::LCS)
114
+ return true if defined?(Diff::LCS)
115
115
  return @diff_lcs_loaded unless @diff_lcs_loaded.nil?
116
116
 
117
117
  @diff_lcs_loaded = begin
@@ -64,7 +64,7 @@ class Bundler::Thor
64
64
  new_constants = Bundler::Thor::Base.subclasses.dup
65
65
  Bundler::Thor::Base.subclasses.replace(old_constants)
66
66
 
67
- new_constants.map! { |c| c.namespace }
67
+ new_constants.map!(&:namespace)
68
68
  new_constants.compact!
69
69
  new_constants
70
70
  end
@@ -72,7 +72,7 @@ class Bundler::Thor
72
72
  # Returns the thor classes declared inside the given class.
73
73
  #
74
74
  def thor_classes_in(klass)
75
- stringfied_constants = klass.constants.map { |c| c.to_s }
75
+ stringfied_constants = klass.constants.map(&:to_s)
76
76
  Bundler::Thor::Base.subclasses.select do |subclass|
77
77
  next unless subclass.name
78
78
  stringfied_constants.include?(subclass.name.gsub("#{klass.name}::", ""))
@@ -103,7 +103,7 @@ class Bundler::Thor
103
103
  #
104
104
  def camel_case(str)
105
105
  return str if str !~ /_/ && str =~ /[A-Z]+.*/
106
- str.split("_").map { |i| i.capitalize }.join
106
+ str.split("_").map(&:capitalize).join
107
107
  end
108
108
 
109
109
  # Receives a namespace and tries to retrieve a Bundler::Thor or Bundler::Thor::Group class
@@ -135,7 +135,8 @@ class Bundler::Thor
135
135
  klass = Bundler::Thor::Util.find_by_namespace(pieces.join(":"))
136
136
  end
137
137
  unless klass # look for a Bundler::Thor::Group with the right name
138
- klass, command = Bundler::Thor::Util.find_by_namespace(namespace), nil
138
+ klass = Bundler::Thor::Util.find_by_namespace(namespace)
139
+ command = nil
139
140
  end
140
141
  if !klass && fallback # try a command in the default namespace
141
142
  command = namespace
@@ -163,7 +164,7 @@ class Bundler::Thor
163
164
  end
164
165
  end
165
166
 
166
- def user_home # rubocop:disable MethodLength
167
+ def user_home
167
168
  @@user_home ||= if ENV["HOME"]
168
169
  ENV["HOME"]
169
170
  elsif ENV["USERPROFILE"]
@@ -188,7 +189,7 @@ class Bundler::Thor
188
189
  # Returns the root where thor files are located, depending on the OS.
189
190
  #
190
191
  def thor_root
191
- File.join(user_home, ".thor").gsub(/\\/, "/")
192
+ File.join(user_home, ".thor").tr('\\', "/")
192
193
  end
193
194
 
194
195
  # Returns the files in the thor root. On Windows thor_root will be something
@@ -216,7 +217,7 @@ class Bundler::Thor
216
217
  # Return the path to the ruby interpreter taking into account multiple
217
218
  # installations and windows extensions.
218
219
  #
219
- def ruby_command # rubocop:disable MethodLength
220
+ def ruby_command
220
221
  @ruby_command ||= begin
221
222
  ruby_name = RbConfig::CONFIG["ruby_install_name"]
222
223
  ruby = File.join(RbConfig::CONFIG["bindir"], ruby_name)
@@ -1,3 +1,3 @@
1
1
  class Bundler::Thor
2
- VERSION = "0.19.1"
2
+ VERSION = "0.19.4"
3
3
  end
@@ -7,5 +7,18 @@ module Bundler
7
7
  # We're doing this because we might write tests that deal
8
8
  # with other versions of bundler and we are unsure how to
9
9
  # handle this better.
10
- VERSION = "1.14.6" unless defined?(::Bundler::VERSION)
10
+ VERSION = "1.15.0.pre.1" unless defined?(::Bundler::VERSION)
11
+
12
+ def self.overwrite_loaded_gem_version
13
+ begin
14
+ require "rubygems"
15
+ rescue LoadError
16
+ return
17
+ end
18
+ return unless bundler_spec = Gem.loaded_specs["bundler"]
19
+ return if bundler_spec.version == VERSION
20
+ bundler_spec.version = Bundler::VERSION
21
+ end
22
+ private_class_method :overwrite_loaded_gem_version
23
+ overwrite_loaded_gem_version
11
24
  end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+ module Bundler
3
+ module VersionRanges
4
+ NEq = Struct.new(:version)
5
+ ReqR = Struct.new(:left, :right)
6
+ class ReqR
7
+ Endpoint = Struct.new(:version, :inclusive)
8
+ def to_s
9
+ "#{left.inclusive ? "[" : "("}#{left.version}, #{right.version}#{right.inclusive ? "]" : ")"}"
10
+ end
11
+ INFINITY = Object.new.freeze
12
+ ZERO = Gem::Version.new("0.a")
13
+
14
+ def cover?(v)
15
+ return false if left.inclusive && left.version > v
16
+ return false if !left.inclusive && left.version >= v
17
+
18
+ if right.version != INFINITY
19
+ return false if right.inclusive && right.version < v
20
+ return false if !right.inclusive && right.version <= v
21
+ end
22
+
23
+ true
24
+ end
25
+
26
+ def empty?
27
+ left.version == right.version && !(left.inclusive && right.inclusive)
28
+ end
29
+
30
+ def single?
31
+ left.version == right.version
32
+ end
33
+
34
+ UNIVERSAL = ReqR.new(ReqR::Endpoint.new(Gem::Version.new("0.a"), true), ReqR::Endpoint.new(ReqR::INFINITY, false)).freeze
35
+ end
36
+
37
+ def self.for_many(requirements)
38
+ requirements = requirements.map(&:requirements).flatten(1).map {|r| r.join(" ") }
39
+ requirements << ">= 0.a" if requirements.empty?
40
+ requirement = Gem::Requirement.new(requirements)
41
+ self.for(requirement)
42
+ end
43
+
44
+ def self.for(requirement)
45
+ ranges = requirement.requirements.map do |op, v|
46
+ case op
47
+ when "=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v, true))
48
+ when "!=" then NEq.new(v)
49
+ when ">=" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(ReqR::INFINITY, false))
50
+ when ">" then ReqR.new(ReqR::Endpoint.new(v, false), ReqR::Endpoint.new(ReqR::INFINITY, false))
51
+ when "<" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, false))
52
+ when "<=" then ReqR.new(ReqR::Endpoint.new(ReqR::ZERO, true), ReqR::Endpoint.new(v, true))
53
+ when "~>" then ReqR.new(ReqR::Endpoint.new(v, true), ReqR::Endpoint.new(v.bump, false))
54
+ else raise "unknown version op #{op} in requirement #{requirement}"
55
+ end
56
+ end.uniq
57
+ ranges, neqs = ranges.partition {|r| !r.is_a?(NEq) }
58
+
59
+ [ranges.sort_by {|range| [range.left.version, range.left.inclusive ? 0 : 1] }, neqs.map(&:version)]
60
+ end
61
+
62
+ def self.empty?(ranges, neqs)
63
+ !ranges.reduce(ReqR::UNIVERSAL) do |last_range, curr_range|
64
+ next false unless last_range
65
+ next false if curr_range.single? && neqs.include?(curr_range.left.version)
66
+ next curr_range if last_range.right.version == ReqR::INFINITY
67
+ case last_range.right.version <=> curr_range.left.version
68
+ when 1 then next curr_range
69
+ when 0 then next(last_range.right.inclusive && curr_range.left.inclusive && !neqs.include?(curr_range.left.version) && curr_range)
70
+ when -1 then next false
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -27,7 +27,7 @@ module Bundler
27
27
  @func = func
28
28
  @size = size
29
29
  @threads = nil
30
- trap("INT") { abort_threads }
30
+ SharedHelpers.trap("INT") { abort_threads }
31
31
  end
32
32
 
33
33
  # Enqueue a request to be executed in the worker pool
@@ -76,6 +76,7 @@ module Bundler
76
76
 
77
77
  def abort_threads
78
78
  return unless @threads
79
+ Bundler.ui.debug("\n#{caller.join("\n")}")
79
80
  @threads.each(&:exit)
80
81
  exit 1
81
82
  end
@@ -0,0 +1,26 @@
1
+ bundle-check(1) -- Verifies if dependencies are satisfied by installed gems
2
+ ===========================================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `bundle check` [--dry-run]
7
+ [--gemfile=FILE]
8
+ [--path=PATH]
9
+
10
+ ## DESCRIPTION
11
+
12
+ `check` searches the local machine for each of the gems requested in the
13
+ Gemfile. If all gems are found, Bundler prints a success message and exits with
14
+ a status of 0.
15
+
16
+ If not, the first missing gem is listed and Bundler exits status 1.
17
+
18
+ ## OPTIONS
19
+
20
+ * `--dry-run`:
21
+ Locks the `Gemfile(5)` before running the command.
22
+ * `--gemfile`:
23
+ Use the specified gemfile instead of the `Gemfile(5)`
24
+ * `--path`:
25
+ Specify a different path than the system default ($BUNDLE_PATH or $GEM_HOME).
26
+ Bundler will remember this value for future installs on this machine.
@@ -0,0 +1,18 @@
1
+ bundle-clean(1) -- Cleans up unused gems in your bundler directory
2
+ ==================================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `bundle clean` [--dry-run] [--force]
7
+
8
+ ## DESCRIPTION
9
+
10
+ This command will remove all unused gems in your bundler directory. This is
11
+ useful when you have made many changes to your gem dependencies.
12
+
13
+ ## OPTIONS
14
+
15
+ * `--dry-run`:
16
+ Print the changes, but do not clean the unused gems.
17
+ * `--force`:
18
+ Force a clean even if `--path` is not set.