bundler 1.10.6 → 1.11.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 (126) 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 +69 -0
  6. data/CODE_OF_CONDUCT.md +6 -4
  7. data/DEVELOPMENT.md +4 -5
  8. data/README.md +2 -2
  9. data/Rakefile +70 -87
  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.rb +98 -119
  18. data/lib/bundler/capistrano.rb +2 -2
  19. data/lib/bundler/cli.rb +85 -74
  20. data/lib/bundler/cli/binstubs.rb +1 -2
  21. data/lib/bundler/cli/cache.rb +0 -1
  22. data/lib/bundler/cli/check.rb +7 -5
  23. data/lib/bundler/cli/clean.rb +0 -1
  24. data/lib/bundler/cli/common.rb +6 -7
  25. data/lib/bundler/cli/config.rb +69 -56
  26. data/lib/bundler/cli/console.rb +8 -8
  27. data/lib/bundler/cli/exec.rb +4 -3
  28. data/lib/bundler/cli/gem.rb +50 -39
  29. data/lib/bundler/cli/init.rb +5 -6
  30. data/lib/bundler/cli/inject.rb +1 -2
  31. data/lib/bundler/cli/install.rb +18 -21
  32. data/lib/bundler/cli/lock.rb +8 -3
  33. data/lib/bundler/cli/open.rb +4 -5
  34. data/lib/bundler/cli/outdated.rb +7 -8
  35. data/lib/bundler/cli/package.rb +1 -1
  36. data/lib/bundler/cli/platform.rb +2 -3
  37. data/lib/bundler/cli/show.rb +9 -9
  38. data/lib/bundler/cli/update.rb +2 -3
  39. data/lib/bundler/cli/viz.rb +1 -2
  40. data/lib/bundler/constants.rb +1 -1
  41. data/lib/bundler/current_ruby.rb +38 -3
  42. data/lib/bundler/definition.rb +83 -88
  43. data/lib/bundler/dep_proxy.rb +11 -9
  44. data/lib/bundler/dependency.rb +26 -11
  45. data/lib/bundler/deployment.rb +2 -2
  46. data/lib/bundler/deprecate.rb +3 -3
  47. data/lib/bundler/dsl.rb +63 -44
  48. data/lib/bundler/env.rb +19 -12
  49. data/lib/bundler/environment.rb +1 -2
  50. data/lib/bundler/errors.rb +82 -0
  51. data/lib/bundler/fetcher.rb +45 -39
  52. data/lib/bundler/fetcher/base.rb +20 -7
  53. data/lib/bundler/fetcher/dependency.rb +5 -5
  54. data/lib/bundler/fetcher/downloader.rb +1 -2
  55. data/lib/bundler/fetcher/index.rb +4 -7
  56. data/lib/bundler/friendly_errors.rb +15 -8
  57. data/lib/bundler/gem_helper.rb +44 -35
  58. data/lib/bundler/gem_helpers.rb +7 -8
  59. data/lib/bundler/gem_remote_fetcher.rb +41 -0
  60. data/lib/bundler/gem_tasks.rb +4 -1
  61. data/lib/bundler/graph.rb +25 -24
  62. data/lib/bundler/index.rb +21 -18
  63. data/lib/bundler/injector.rb +2 -4
  64. data/lib/bundler/inline.rb +3 -3
  65. data/lib/bundler/installer.rb +57 -144
  66. data/lib/bundler/installer/gem_installer.rb +76 -0
  67. data/lib/bundler/installer/parallel_installer.rb +22 -13
  68. data/lib/bundler/installer/standalone.rb +48 -0
  69. data/lib/bundler/lazy_specification.rb +3 -4
  70. data/lib/bundler/lockfile_parser.rb +21 -19
  71. data/lib/bundler/match_platform.rb +4 -4
  72. data/lib/bundler/psyched_yaml.rb +3 -3
  73. data/lib/bundler/remote_specification.rb +1 -1
  74. data/lib/bundler/resolver.rb +93 -88
  75. data/lib/bundler/retry.rb +9 -10
  76. data/lib/bundler/ruby_dsl.rb +1 -1
  77. data/lib/bundler/ruby_version.rb +7 -10
  78. data/lib/bundler/rubygems_ext.rb +32 -27
  79. data/lib/bundler/{gem_installer.rb → rubygems_gem_installer.rb} +2 -2
  80. data/lib/bundler/rubygems_integration.rb +85 -70
  81. data/lib/bundler/runtime.rb +57 -61
  82. data/lib/bundler/settings.rb +27 -26
  83. data/lib/bundler/setup.rb +3 -3
  84. data/lib/bundler/shared_helpers.rb +45 -20
  85. data/lib/bundler/similarity_detector.rb +19 -21
  86. data/lib/bundler/source.rb +4 -5
  87. data/lib/bundler/source/git.rb +29 -31
  88. data/lib/bundler/source/git/git_proxy.rb +52 -26
  89. data/lib/bundler/source/path.rb +25 -28
  90. data/lib/bundler/source/path/installer.rb +4 -4
  91. data/lib/bundler/source/rubygems.rb +62 -48
  92. data/lib/bundler/source/rubygems/remote.rb +3 -3
  93. data/lib/bundler/source_list.rb +4 -4
  94. data/lib/bundler/spec_set.rb +17 -15
  95. data/lib/bundler/ssl_certs/certificate_manager.rb +5 -6
  96. data/lib/bundler/stub_specification.rb +2 -2
  97. data/lib/bundler/templates/Executable +5 -5
  98. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +42 -6
  99. data/lib/bundler/templates/newgem/README.md.tt +1 -1
  100. data/lib/bundler/templates/newgem/Rakefile.tt +4 -2
  101. data/lib/bundler/templates/newgem/bin/setup.tt +2 -1
  102. data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -2
  103. data/lib/bundler/ui.rb +3 -3
  104. data/lib/bundler/ui/rg_proxy.rb +2 -2
  105. data/lib/bundler/ui/shell.rb +10 -6
  106. data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +82 -71
  107. data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
  108. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +9 -0
  109. data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +40 -21
  110. data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -0
  111. data/lib/bundler/vendored_molinillo.rb +1 -1
  112. data/lib/bundler/vendored_persistent.rb +3 -3
  113. data/lib/bundler/vendored_thor.rb +2 -2
  114. data/lib/bundler/version.rb +1 -1
  115. data/lib/bundler/vlad.rb +1 -1
  116. data/lib/bundler/worker.rb +4 -5
  117. data/man/bundle-config.ronn +4 -2
  118. data/man/bundle-gem.ronn +77 -0
  119. data/man/bundle-install.ronn +13 -6
  120. data/man/bundle-lock.ronn +47 -0
  121. data/man/bundle.ronn +1 -1
  122. data/man/gemfile.5.ronn +8 -0
  123. data/man/index.txt +1 -0
  124. metadata +37 -8
  125. data/bin/bundle +0 -21
  126. data/bin/bundler +0 -21
@@ -1,6 +1,6 @@
1
- require 'rubygems/dependency'
2
- require 'bundler/shared_helpers'
3
- require 'bundler/rubygems_ext'
1
+ require "rubygems/dependency"
2
+ require "bundler/shared_helpers"
3
+ require "bundler/rubygems_ext"
4
4
 
5
5
  module Bundler
6
6
  class Dependency < Gem::Dependency
@@ -15,12 +15,14 @@ module Bundler
15
15
  :ruby_20 => Gem::Platform::RUBY,
16
16
  :ruby_21 => Gem::Platform::RUBY,
17
17
  :ruby_22 => Gem::Platform::RUBY,
18
+ :ruby_23 => Gem::Platform::RUBY,
18
19
  :mri => Gem::Platform::RUBY,
19
20
  :mri_18 => Gem::Platform::RUBY,
20
21
  :mri_19 => Gem::Platform::RUBY,
21
22
  :mri_20 => Gem::Platform::RUBY,
22
23
  :mri_21 => Gem::Platform::RUBY,
23
24
  :mri_22 => Gem::Platform::RUBY,
25
+ :mri_23 => Gem::Platform::RUBY,
24
26
  :rbx => Gem::Platform::RUBY,
25
27
  :jruby => Gem::Platform::JAVA,
26
28
  :jruby_18 => Gem::Platform::JAVA,
@@ -30,36 +32,49 @@ module Bundler
30
32
  :mswin_19 => Gem::Platform::MSWIN,
31
33
  :mswin_20 => Gem::Platform::MSWIN,
32
34
  :mswin_21 => Gem::Platform::MSWIN,
35
+ :mswin_22 => Gem::Platform::MSWIN,
36
+ :mswin_23 => Gem::Platform::MSWIN,
33
37
  :mswin64 => Gem::Platform::MSWIN64,
34
38
  :mswin64_19 => Gem::Platform::MSWIN64,
35
39
  :mswin64_20 => Gem::Platform::MSWIN64,
36
40
  :mswin64_21 => Gem::Platform::MSWIN64,
41
+ :mswin64_22 => Gem::Platform::MSWIN64,
42
+ :mswin64_23 => Gem::Platform::MSWIN64,
37
43
  :mingw => Gem::Platform::MINGW,
38
44
  :mingw_18 => Gem::Platform::MINGW,
39
45
  :mingw_19 => Gem::Platform::MINGW,
40
46
  :mingw_20 => Gem::Platform::MINGW,
41
47
  :mingw_21 => Gem::Platform::MINGW,
42
48
  :mingw_22 => Gem::Platform::MINGW,
49
+ :mingw_23 => Gem::Platform::MINGW,
43
50
  :x64_mingw => Gem::Platform::X64_MINGW,
44
51
  :x64_mingw_20 => Gem::Platform::X64_MINGW,
45
52
  :x64_mingw_21 => Gem::Platform::X64_MINGW,
46
- :x64_mingw_22 => Gem::Platform::X64_MINGW
53
+ :x64_mingw_22 => Gem::Platform::X64_MINGW,
54
+ :x64_mingw_23 => Gem::Platform::X64_MINGW
47
55
  }.freeze
48
56
 
57
+ REVERSE_PLATFORM_MAP = {}.tap do |reverse_platform_map|
58
+ PLATFORM_MAP.each do |key, value|
59
+ reverse_platform_map[value] ||= []
60
+ reverse_platform_map[value] << key
61
+ end
62
+
63
+ reverse_platform_map.each {|_, platforms| platforms.freeze }
64
+ end.freeze
65
+
49
66
  def initialize(name, version, options = {}, &blk)
50
67
  type = options["type"] || :runtime
51
68
  super(name, version, type)
52
69
 
53
70
  @autorequire = nil
54
- @groups = Array(options["group"] || :default).map { |g| g.to_sym }
71
+ @groups = Array(options["group"] || :default).map(&:to_sym)
55
72
  @source = options["source"]
56
73
  @platforms = Array(options["platforms"])
57
74
  @env = options["env"]
58
75
  @should_include = options.fetch("should_include", true)
59
76
 
60
- if options.key?('require')
61
- @autorequire = Array(options['require'] || [])
62
- end
77
+ @autorequire = Array(options["require"] || []) if options.key?("require")
63
78
  end
64
79
 
65
80
  def gem_platforms(valid_platforms)
@@ -91,14 +106,14 @@ module Bundler
91
106
 
92
107
  def current_platform?
93
108
  return true if @platforms.empty?
94
- @platforms.any? { |p|
109
+ @platforms.any? do |p|
95
110
  Bundler.current_ruby.send("#{p}?")
96
- }
111
+ end
97
112
  end
98
113
 
99
114
  def to_lock
100
115
  out = super
101
- out << '!' if source
116
+ out << "!" if source
102
117
  out << "\n"
103
118
  end
104
119
 
@@ -40,7 +40,7 @@ module Bundler
40
40
  send task_method, :install, opts do
41
41
  bundle_cmd = context.fetch(:bundle_cmd, "bundle")
42
42
  bundle_flags = context.fetch(:bundle_flags, "--deployment --quiet")
43
- bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), 'bundle'))
43
+ bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), "bundle"))
44
44
  bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile")
45
45
  bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact
46
46
  bundle_with = [*context.fetch(:bundle_with, [])].compact
@@ -54,7 +54,7 @@ module Bundler
54
54
  args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?
55
55
  args << "--with #{bundle_with.join(" ")}" unless bundle_with.empty?
56
56
 
57
- run "cd #{app_path} && #{bundle_cmd} install #{args.join(' ')}"
57
+ run "cd #{app_path} && #{bundle_cmd} install #{args.join(" ")}"
58
58
  end
59
59
  end
60
60
  end
@@ -1,5 +1,4 @@
1
1
  module Bundler
2
-
3
2
  if defined? ::Deprecate
4
3
  Deprecate = ::Deprecate
5
4
  elsif defined? Gem::Deprecate
@@ -9,7 +8,8 @@ module Bundler
9
8
  end
10
9
 
11
10
  unless Deprecate.respond_to?(:skip_during)
12
- def Deprecate.skip_during; yield; end
11
+ def Deprecate.skip_during
12
+ yield
13
+ end
13
14
  end
14
-
15
15
  end
@@ -1,5 +1,5 @@
1
- require 'bundler/dependency'
2
- require 'bundler/ruby_dsl'
1
+ require "bundler/dependency"
2
+ require "bundler/ruby_dsl"
3
3
 
4
4
  module Bundler
5
5
  class Dsl
@@ -13,6 +13,7 @@ module Bundler
13
13
 
14
14
  VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze
15
15
 
16
+ attr_reader :gemspecs
16
17
  attr_accessor :dependencies
17
18
 
18
19
  def initialize
@@ -26,6 +27,7 @@ module Bundler
26
27
  @platforms = []
27
28
  @env = nil
28
29
  @ruby_version = nil
30
+ @gemspecs = []
29
31
  add_git_sources
30
32
  end
31
33
 
@@ -33,14 +35,17 @@ module Bundler
33
35
  contents ||= Bundler.read_file(gemfile.to_s)
34
36
  instance_eval(contents, gemfile.to_s, 1)
35
37
  rescue Exception => e
36
- message = "There was an error parsing `#{File.basename gemfile.to_s}`: #{e.message}"
38
+ message = "There was an error " \
39
+ "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
40
+ "`#{File.basename gemfile.to_s}`: #{e.message}"
41
+
37
42
  raise DSLError.new(message, gemfile, e.backtrace, contents)
38
43
  end
39
44
 
40
45
  def gemspec(opts = nil)
41
- path = opts && opts[:path] || '.'
46
+ path = opts && opts[:path] || "."
42
47
  glob = opts && opts[:glob]
43
- name = opts && opts[:name] || '{,*}'
48
+ name = opts && opts[:name] || "{,*}"
44
49
  development_group = opts && opts[:development_group] || :development
45
50
  expanded_path = File.expand_path(path, Bundler.default_gemfile.dirname)
46
51
 
@@ -52,21 +57,23 @@ module Bundler
52
57
 
53
58
  unless spec
54
59
  raise InvalidOption, "There was an error loading the gemspec at " \
55
- "#{file}. Make sure you can build the gem, then try again."
60
+ "#{file}. Make sure you can build the gem, then try again"
56
61
  end
57
62
 
58
- gem spec.name, :path => path, :glob => glob
63
+ gem spec.name, :path => path, :glob => glob, :platforms => Bundler::Dependency::REVERSE_PLATFORM_MAP[spec.platform]
59
64
 
60
65
  group(development_group) do
61
66
  spec.development_dependencies.each do |dep|
62
67
  gem dep.name, *(dep.requirement.as_list + [:type => :development])
63
68
  end
64
69
  end
70
+
71
+ @gemspecs << gemspecs.first
65
72
  when 0
66
- raise InvalidOption, "There are no gemspecs at #{expanded_path}."
73
+ raise InvalidOption, "There are no gemspecs at #{expanded_path}"
67
74
  else
68
75
  raise InvalidOption, "There are multiple gemspecs at #{expanded_path}. " \
69
- "Please use the :name option to specify which one should be used."
76
+ "Please use the :name option to specify which one should be used"
70
77
  end
71
78
  end
72
79
 
@@ -79,7 +86,7 @@ module Bundler
79
86
  dep = Dependency.new(name, version, options)
80
87
 
81
88
  # if there's already a dependency with this name we try to prefer one
82
- if current = @dependencies.find { |d| d.name == dep.name }
89
+ if current = @dependencies.find {|d| d.name == dep.name }
83
90
  if current.requirement != dep.requirement
84
91
  if current.type == :development
85
92
  @dependencies.delete current
@@ -104,7 +111,7 @@ module Bundler
104
111
  else
105
112
  raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
106
113
  "You specified that #{dep.name} (#{dep.requirement}) should come from " \
107
- "#{current.source || 'an unspecified source'} and #{dep.source}\n"
114
+ "#{current.source || "an unspecified source"} and #{dep.source}\n"
108
115
  end
109
116
  end
110
117
  end
@@ -198,7 +205,8 @@ module Bundler
198
205
  alias_method :platform, :platforms
199
206
 
200
207
  def env(name)
201
- @env, old = name, @env
208
+ old = @env
209
+ @env = name
202
210
  yield
203
211
  ensure
204
212
  @env = old
@@ -212,27 +220,41 @@ module Bundler
212
220
 
213
221
  def add_git_sources
214
222
  git_source(:github) do |repo_name|
223
+ # It would be better to use https instead of the git protocol, but this
224
+ # can break deployment of existing locked bundles when switching between
225
+ # different versions of Bundler. The change will be made in 2.0, which
226
+ # does not guarantee compatibility with the 1.x series.
227
+ #
228
+ # See https://github.com/bundler/bundler/pull/2569 for discussion
229
+ #
230
+ # This can be overridden by adding this code to your Gemfiles:
231
+ #
232
+ # git_source(:github) do |repo_name|
233
+ # repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
234
+ # "https://github.com/#{repo_name}.git"
235
+ # end
215
236
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
216
237
  "git://github.com/#{repo_name}.git"
217
238
  end
218
239
 
219
- git_source(:gist){ |repo_name| "https://gist.github.com/#{repo_name}.git" }
240
+ git_source(:gist) {|repo_name| "https://gist.github.com/#{repo_name}.git" }
220
241
 
221
242
  git_source(:bitbucket) do |repo_name|
222
- user_name, repo_name = repo_name.split '/'
243
+ user_name, repo_name = repo_name.split "/"
223
244
  repo_name ||= user_name
224
245
  "https://#{user_name}@bitbucket.org/#{user_name}/#{repo_name}.git"
225
246
  end
226
247
  end
227
248
 
228
249
  def with_source(source)
250
+ old_source = @source
229
251
  if block_given?
230
252
  @source = source
231
253
  yield
232
254
  end
233
255
  source
234
256
  ensure
235
- @source = nil
257
+ @source = old_source
236
258
  end
237
259
 
238
260
  def normalize_hash(opts)
@@ -248,10 +270,10 @@ module Bundler
248
270
 
249
271
  def normalize_options(name, version, opts)
250
272
  if name.is_a?(Symbol)
251
- raise GemfileError, %{You need to specify gem names as Strings. Use 'gem "#{name}"' instead.}
273
+ raise GemfileError, %(You need to specify gem names as Strings. Use 'gem "#{name}"' instead)
252
274
  end
253
275
  if name =~ /\s/
254
- raise GemfileError, %{'#{name}' is not a valid gem name because it contains whitespace.}
276
+ raise GemfileError, %('#{name}' is not a valid gem name because it contains whitespace)
255
277
  end
256
278
 
257
279
  normalize_hash(opts)
@@ -273,14 +295,14 @@ module Bundler
273
295
  platforms = @platforms.dup
274
296
  opts["platforms"] = opts["platform"] || opts["platforms"]
275
297
  platforms.concat Array(opts.delete("platforms"))
276
- platforms.map! { |p| p.to_sym }
298
+ platforms.map!(&:to_sym)
277
299
  platforms.each do |p|
278
300
  next if VALID_PLATFORMS.include?(p)
279
301
  raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
280
302
  end
281
303
 
282
304
  # Save sources passed in a key
283
- if opts.has_key?("source")
305
+ if opts.key?("source")
284
306
  source = normalize_source(opts["source"])
285
307
  opts["source"] = @sources.add_rubygems_source("remotes" => source)
286
308
  end
@@ -290,20 +312,19 @@ module Bundler
290
312
  opts["git"] = @git_sources[git_name].call(opts[git_name])
291
313
  end
292
314
 
293
- ["git", "path"].each do |type|
294
- if param = opts[type]
295
- if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
296
- options = opts.merge("name" => name, "version" => $1)
297
- else
298
- options = opts.dup
299
- end
300
- source = send(type, param, options) {}
301
- opts["source"] = source
315
+ %w(git path).each do |type|
316
+ next unless param = opts[type]
317
+ if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
318
+ options = opts.merge("name" => name, "version" => $1)
319
+ else
320
+ options = opts.dup
302
321
  end
322
+ source = send(type, param, options) {}
323
+ opts["source"] = source
303
324
  end
304
325
 
305
- opts["source"] ||= @source
306
- opts["env"] ||= @env
326
+ opts["source"] ||= @source
327
+ opts["env"] ||= @env
307
328
  opts["platforms"] = platforms.dup
308
329
  opts["group"] = groups
309
330
  opts["should_include"] = install_if
@@ -321,7 +342,7 @@ module Bundler
321
342
  def validate_keys(command, opts, valid_keys)
322
343
  invalid_keys = opts.keys - valid_keys
323
344
  if invalid_keys.any?
324
- message = "You passed #{invalid_keys.map{|k| ':'+k }.join(", ")} "
345
+ message = "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} "
325
346
  message << if invalid_keys.size > 1
326
347
  "as options for #{command}, but they are invalid."
327
348
  else
@@ -354,7 +375,7 @@ module Bundler
354
375
  raise GemspecError, "Warning: this Gemfile contains multiple primary sources. " \
355
376
  "Each source after the first must include a block to indicate which gems " \
356
377
  "should come from that source. To downgrade this error to a warning, run " \
357
- "`bundle config --delete disable_multisource`."
378
+ "`bundle config --delete disable_multisource`"
358
379
  else
359
380
  Bundler.ui.warn "Warning: this Gemfile contains multiple primary sources. " \
360
381
  "Using `source` more than once without a block is a security risk, and " \
@@ -432,40 +453,38 @@ module Bundler
432
453
 
433
454
  return m unless backtrace && dsl_path && contents
434
455
 
435
- trace_line = backtrace.find { |l| l.include?(dsl_path.to_s) } || trace_line
456
+ trace_line = backtrace.find {|l| l.include?(dsl_path.to_s) } || trace_line
436
457
  return m unless trace_line
437
- line_numer = trace_line.split(':')[1].to_i - 1
458
+ line_numer = trace_line.split(":")[1].to_i - 1
438
459
  return m unless line_numer
439
460
 
440
461
  lines = contents.lines.to_a
441
- indent = ' # '
442
- indicator = indent.gsub('#', '>')
462
+ indent = " # "
463
+ indicator = indent.tr('#', ">")
443
464
  first_line = (line_numer.zero?)
444
465
  last_line = (line_numer == (lines.count - 1))
445
466
 
446
467
  m << "\n"
447
- m << "#{indent}from #{trace_line.gsub(/:in.*$/, '')}\n"
468
+ m << "#{indent}from #{trace_line.gsub(/:in.*$/, "")}\n"
448
469
  m << "#{indent}-------------------------------------------\n"
449
- m << "#{indent}#{ lines[line_numer - 1] }" unless first_line
450
- m << "#{indicator}#{ lines[line_numer] }"
451
- m << "#{indent}#{ lines[line_numer + 1] }" unless last_line
470
+ m << "#{indent}#{lines[line_numer - 1]}" unless first_line
471
+ m << "#{indicator}#{lines[line_numer]}"
472
+ m << "#{indent}#{lines[line_numer + 1]}" unless last_line
452
473
  m << "\n" unless m.end_with?("\n")
453
474
  m << "#{indent}-------------------------------------------\n"
454
475
  end
455
476
  end
456
477
 
457
- private
478
+ private
458
479
 
459
480
  def parse_line_number_from_description
460
481
  description = self.description
461
482
  if dsl_path && description =~ /((#{Regexp.quote File.expand_path(dsl_path)}|#{Regexp.quote dsl_path.to_s}):\d+)/
462
483
  trace_line = Regexp.last_match[1]
463
- description = description.sub(/#{Regexp.quote trace_line}:\s*/, '').sub("\n", ' - ')
484
+ description = description.sub(/#{Regexp.quote trace_line}:\s*/, "").sub("\n", " - ")
464
485
  end
465
486
  [trace_line, description]
466
487
  end
467
488
  end
468
-
469
489
  end
470
-
471
490
  end
@@ -1,27 +1,27 @@
1
- require 'bundler/rubygems_integration'
2
- require 'bundler/source/git/git_proxy'
1
+ require "bundler/rubygems_integration"
2
+ require "bundler/source/git/git_proxy"
3
3
 
4
4
  module Bundler
5
5
  class Env
6
-
7
6
  def write(io)
8
- io.write report(:print_gemfile => true)
7
+ io.write report(:print_gemfile => true, :print_gemspecs => true)
9
8
  end
10
9
 
11
10
  def report(options = {})
12
11
  print_gemfile = options.delete(:print_gemfile)
12
+ print_gemspecs = options.delete(:print_gemspecs)
13
13
 
14
14
  out = "Environment\n\n"
15
15
  out << " Bundler #{Bundler::VERSION}\n"
16
16
  out << " Rubygems #{Gem::VERSION}\n"
17
17
  out << " Ruby #{ruby_version}"
18
- out << " GEM_HOME #{ENV['GEM_HOME']}\n" unless ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty?
19
- out << " GEM_PATH #{ENV['GEM_PATH']}\n" unless ENV['GEM_PATH'] == ENV['GEM_HOME']
20
- out << " RVM #{ENV['rvm_version']}\n" if ENV['rvm_version']
18
+ out << " GEM_HOME #{ENV["GEM_HOME"]}\n" unless ENV["GEM_HOME"].nil? || ENV["GEM_HOME"].empty?
19
+ out << " GEM_PATH #{ENV["GEM_PATH"]}\n" unless ENV["GEM_PATH"] == ENV["GEM_HOME"]
20
+ out << " RVM #{ENV["rvm_version"]}\n" if ENV["rvm_version"]
21
21
  out << " Git #{git_version}\n"
22
22
  %w(rubygems-bundler open_gem).each do |name|
23
23
  specs = Bundler.rubygems.find_name(name)
24
- out << " #{name} (#{specs.map(&:version).join(',')})\n" unless specs.empty?
24
+ out << " #{name} (#{specs.map(&:version).join(",")})\n" unless specs.empty?
25
25
  end
26
26
 
27
27
  out << "\nBundler settings\n\n" unless Bundler.settings.all.empty?
@@ -33,13 +33,21 @@ module Bundler
33
33
  end
34
34
 
35
35
  if print_gemfile
36
- out << "\nGemfile\n\n"
36
+ out << "\n#{Bundler.default_gemfile.relative_path_from(SharedHelpers.pwd)}\n\n"
37
37
  out << " " << read_file(Bundler.default_gemfile).gsub(/\n/, "\n ") << "\n"
38
38
 
39
- out << "\n" << "Gemfile.lock\n\n"
39
+ out << "\n#{Bundler.default_lockfile.relative_path_from(SharedHelpers.pwd)}\n\n"
40
40
  out << " " << read_file(Bundler.default_lockfile).gsub(/\n/, "\n ") << "\n"
41
41
  end
42
42
 
43
+ if print_gemspecs
44
+ dsl = Dsl.new.tap {|d| d.eval_gemfile(Bundler.default_gemfile) }
45
+ dsl.gemspecs.each do |gs|
46
+ out << "\n#{Pathname.new(gs).basename}:"
47
+ out << "\n\n " << read_file(gs).gsub(/\n/, "\n ") << "\n"
48
+ end
49
+ end
50
+
43
51
  out
44
52
  end
45
53
 
@@ -55,7 +63,7 @@ module Bundler
55
63
 
56
64
  def ruby_version
57
65
  str = "#{RUBY_VERSION}"
58
- if RUBY_VERSION < '1.9'
66
+ if RUBY_VERSION < "1.9"
59
67
  str << " (#{RUBY_RELEASE_DATE}"
60
68
  str << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
61
69
  str << ") [#{RUBY_PLATFORM}]\n"
@@ -70,6 +78,5 @@ module Bundler
70
78
  rescue Bundler::Source::Git::GitNotInstalledError
71
79
  "not installed"
72
80
  end
73
-
74
81
  end
75
82
  end