bundler 1.4.0.pre.1 → 1.4.0.pre.2

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 (63) hide show
  1. data/.travis.yml +18 -7
  2. data/CHANGELOG.md +15 -0
  3. data/CONTRIBUTING.md +8 -0
  4. data/DEVELOPMENT.md +27 -25
  5. data/ISSUES.md +33 -20
  6. data/README.md +6 -4
  7. data/Rakefile +1 -1
  8. data/UPGRADING.md +1 -1
  9. data/bin/bundle +1 -1
  10. data/bin/bundler +10 -0
  11. data/bundler.gemspec +2 -2
  12. data/lib/bundler/capistrano.rb +4 -0
  13. data/lib/bundler/cli.rb +7 -0
  14. data/lib/bundler/current_ruby.rb +9 -1
  15. data/lib/bundler/definition.rb +2 -0
  16. data/lib/bundler/dependency.rb +3 -1
  17. data/lib/bundler/dsl.rb +1 -1
  18. data/lib/bundler/fetcher.rb +1 -1
  19. data/lib/bundler/friendly_errors.rb +5 -0
  20. data/lib/bundler/gem_helpers.rb +7 -6
  21. data/lib/bundler/installer.rb +27 -20
  22. data/lib/bundler/parallel_workers/unix_worker.rb +2 -2
  23. data/lib/bundler/ruby_dsl.rb +1 -1
  24. data/lib/bundler/ruby_version.rb +12 -3
  25. data/lib/bundler/rubygems_ext.rb +1 -0
  26. data/lib/bundler/rubygems_integration.rb +1 -1
  27. data/lib/bundler/runtime.rb +2 -1
  28. data/lib/bundler/shared_helpers.rb +13 -0
  29. data/lib/bundler/source/git.rb +3 -3
  30. data/lib/bundler/source/git/git_proxy.rb +1 -1
  31. data/lib/bundler/source/path.rb +1 -2
  32. data/lib/bundler/source/rubygems.rb +3 -5
  33. data/lib/bundler/version.rb +1 -1
  34. data/man/bundle.ronn +1 -1
  35. data/man/gemfile.5.ronn +6 -2
  36. data/spec/bundler/dsl_spec.rb +2 -2
  37. data/spec/bundler/friendly_errors_spec.rb +13 -0
  38. data/spec/{other → commands}/binstubs_spec.rb +0 -0
  39. data/spec/{other → commands}/check_spec.rb +0 -0
  40. data/spec/{other → commands}/clean_spec.rb +0 -0
  41. data/spec/{other → commands}/config_spec.rb +0 -0
  42. data/spec/{other → commands}/console_spec.rb +0 -0
  43. data/spec/{other → commands}/exec_spec.rb +0 -0
  44. data/spec/{other → commands}/help_spec.rb +0 -0
  45. data/spec/{other → commands}/init_spec.rb +0 -0
  46. data/spec/{other → commands}/licenses_spec.rb +0 -0
  47. data/spec/{other → commands}/newgem_spec.rb +0 -0
  48. data/spec/{other → commands}/open_spec.rb +0 -0
  49. data/spec/{other → commands}/outdated_spec.rb +0 -0
  50. data/spec/{other → commands}/show_spec.rb +0 -0
  51. data/spec/install/gems/dependency_api_spec.rb +14 -0
  52. data/spec/install/git_spec.rb +42 -0
  53. data/spec/other/bundle_ruby_spec.rb +105 -75
  54. data/spec/other/cli_dispatch_spec.rb +21 -0
  55. data/spec/other/ext_spec.rb +23 -0
  56. data/spec/other/platform_spec.rb +204 -4
  57. data/spec/resolver/platform_spec.rb +7 -1
  58. data/spec/runtime/setup_spec.rb +1 -1
  59. data/spec/support/builders.rb +5 -1
  60. data/spec/support/indexes.rb +1 -1
  61. data/spec/support/platforms.rb +9 -1
  62. metadata +116 -84
  63. checksums.yaml +0 -7
@@ -3,18 +3,19 @@ module Bundler
3
3
 
4
4
  GENERIC_CACHE = {}
5
5
  GENERICS = [
6
- Gem::Platform.new('java'),
7
- Gem::Platform.new('mswin32'),
8
- Gem::Platform.new('x86-mingw32'),
9
- Gem::Platform::RUBY
6
+ [Gem::Platform.new('java'), Gem::Platform.new('java')],
7
+ [Gem::Platform.new('mswin32'), Gem::Platform.new('mswin32')],
8
+ [Gem::Platform.new('x64-mingw32'), Gem::Platform.new('x64-mingw32')],
9
+ [Gem::Platform.new('x86_64-mingw32'), Gem::Platform.new('x64-mingw32')],
10
+ [Gem::Platform.new('mingw32'), Gem::Platform.new('x86-mingw32')]
10
11
  ]
11
12
 
12
13
  def generic(p)
13
14
  return p if p == Gem::Platform::RUBY
14
15
 
15
16
  GENERIC_CACHE[p] ||= begin
16
- found = GENERICS.find do |p2|
17
- p2.is_a?(Gem::Platform) && p.os == p2.os
17
+ _, found = GENERICS.find do |match, _generic|
18
+ p.os == match.os && (!match.cpu || p.cpu == match.cpu)
18
19
  end
19
20
  found || Gem::Platform::RUBY
20
21
  end
@@ -84,16 +84,15 @@ module Bundler
84
84
  @definition.resolve_remotely!
85
85
  end
86
86
 
87
- # Must install gems in the order that the resolver provides
88
- # as dependencies might actually affect the installation of
89
- # the gem.
90
87
  Installer.post_install_messages = {}
91
88
 
92
- size = options[:jobs] || 1
93
- size = [size, 1].max
94
-
95
- if size > 1 && can_install_parallely?
96
- install_in_parallel size, options[:standalone]
89
+ # the order that the resolver provides is significant, since
90
+ # dependencies might actually affect the installation of a gem.
91
+ # that said, it's a rare situation (other than rake), and parallel
92
+ # installation is just SO MUCH FASTER. so we let people opt in.
93
+ jobs = [options[:jobs].to_i, 1].max
94
+ if jobs > 1 && can_install_parallely?
95
+ install_in_parallel jobs, options[:standalone]
97
96
  else
98
97
  install_sequentially options[:standalone]
99
98
  end
@@ -102,17 +101,21 @@ module Bundler
102
101
  generate_standalone(options[:standalone]) if options[:standalone]
103
102
  end
104
103
 
105
- def install_gem_from_spec(spec, standalone = false)
104
+ def install_gem_from_spec(spec, standalone = false, worker = 0)
106
105
  # Download the gem to get the spec, because some specs that are returned
107
106
  # by rubygems.org are broken and wrong.
108
107
  Bundler::Fetcher.fetch(spec) if spec.source.is_a?(Bundler::Source::Rubygems)
109
108
 
110
109
  # Fetch the build settings, if there are any
111
- settings = Bundler.settings["build.#{spec.name}"]
112
- message = nil
110
+ settings = Bundler.settings["build.#{spec.name}"]
111
+ install_message = nil
112
+ post_install_message = nil
113
+ debug_message = nil
113
114
  Bundler.rubygems.with_build_args [settings] do
114
- message = spec.source.install(spec)
115
- Bundler.ui.debug " #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
115
+ install_message, post_install_message, debug_message = spec.source.install(spec)
116
+ Bundler.ui.info install_message
117
+ Bundler.ui.debug debug_message if debug_message
118
+ Bundler.ui.debug "#{worker}: #{spec.name} (#{spec.version}) from #{spec.loaded_from}"
116
119
  end
117
120
 
118
121
  if Bundler.settings[:bin] && standalone
@@ -122,17 +125,21 @@ module Bundler
122
125
  end
123
126
 
124
127
  FileUtils.rm_rf(Bundler.tmp)
125
- message
128
+ post_install_message
126
129
  rescue Exception => e
127
- # install hook failed
130
+ # if install hook failed or gem signature is bad, just die
128
131
  raise e if e.is_a?(Bundler::InstallHookError) || e.is_a?(Bundler::SecurityError)
129
132
 
130
133
  # other failure, likely a native extension build failure
131
134
  Bundler.ui.info ""
132
135
  Bundler.ui.warn "#{e.class}: #{e.message}"
133
136
  msg = "An error occurred while installing #{spec.name} (#{spec.version}),"
134
- msg << " and Bundler cannot continue.\nMake sure that `gem install"
135
- msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling."
137
+ msg << " and Bundler cannot continue."
138
+
139
+ unless spec.source.options["git"]
140
+ msg << "\nMake sure that `gem install"
141
+ msg << " #{spec.name} -v '#{spec.version}'` succeeds before bundling."
142
+ end
136
143
  Bundler.ui.debug e.backtrace.join("\n")
137
144
  raise Bundler::InstallError, msg
138
145
  end
@@ -256,7 +263,7 @@ module Bundler
256
263
 
257
264
  def install_sequentially(standalone)
258
265
  specs.each do |spec|
259
- message = install_gem_from_spec spec, standalone
266
+ message = install_gem_from_spec spec, standalone, 0
260
267
  if message
261
268
  Installer.post_install_messages[spec.name] = message
262
269
  end
@@ -272,9 +279,9 @@ module Bundler
272
279
  remains[spec.name] = true
273
280
  end
274
281
 
275
- worker_pool = ParallelWorkers.worker_pool size, lambda { |name|
282
+ worker_pool = ParallelWorkers.worker_pool size, lambda { |name, worker|
276
283
  spec = name2spec[name]
277
- message = install_gem_from_spec spec, standalone
284
+ message = install_gem_from_spec spec, standalone, worker
278
285
  { :name => spec.name, :post_install => message }
279
286
  }
280
287
  specs.each do |spec|
@@ -22,7 +22,7 @@ module Bundler
22
22
  # @param size [Integer] Size of worker pool
23
23
  # @param func [Proc] Job that should be executed in the worker
24
24
  def prepare_workers(size, func)
25
- @workers = size.times.map do
25
+ @workers = size.times.map do |num|
26
26
  child_read, parent_write = IO.pipe
27
27
  parent_read, child_write = IO.pipe
28
28
 
@@ -33,7 +33,7 @@ module Bundler
33
33
 
34
34
  while !child_read.eof?
35
35
  obj = Marshal.load child_read
36
- Marshal.dump func.call(obj), child_write
36
+ Marshal.dump func.call(obj, num), child_write
37
37
  end
38
38
  rescue Exception => e
39
39
  begin
@@ -5,7 +5,7 @@ module Bundler
5
5
  raise GemfileError, "Please define :engine" if options[:engine_version] && options[:engine].nil?
6
6
 
7
7
  raise GemfileError, "ruby_version must match the :engine_version for MRI" if options[:engine] == "ruby" && options[:engine_version] && ruby_version != options[:engine_version]
8
- @ruby_version = RubyVersion.new(ruby_version, options[:engine], options[:engine_version])
8
+ @ruby_version = RubyVersion.new(ruby_version, options[:patchlevel], options[:engine], options[:engine_version])
9
9
  end
10
10
  end
11
11
  end
@@ -1,8 +1,8 @@
1
1
  module Bundler
2
2
  class RubyVersion
3
- attr_reader :version, :engine, :engine_version
3
+ attr_reader :version, :patchlevel, :engine, :engine_version
4
4
 
5
- def initialize(version, engine, engine_version)
5
+ def initialize(version, patchlevel, engine, engine_version)
6
6
  # The parameters to this method must satisfy the
7
7
  # following constraints, which are verified in
8
8
  # the DSL:
@@ -20,10 +20,12 @@ module Bundler
20
20
  # keep track of the engine specified by the user
21
21
  @input_engine = engine
22
22
  @engine_version = engine_version || version
23
+ @patchlevel = patchlevel
23
24
  end
24
25
 
25
26
  def to_s
26
27
  output = "ruby #{version}"
28
+ output << "p#{patchlevel}" if patchlevel
27
29
  output << " (#{engine} #{engine_version})" unless engine == "ruby"
28
30
 
29
31
  output
@@ -32,7 +34,8 @@ module Bundler
32
34
  def ==(other)
33
35
  version == other.version &&
34
36
  engine == other.engine &&
35
- engine_version == other.engine_version
37
+ engine_version == other.engine_version &&
38
+ patchlevel == other.patchlevel
36
39
  end
37
40
 
38
41
  # Returns a tuple of thsee things:
@@ -48,6 +51,8 @@ module Bundler
48
51
  [ :version, version, other.version ]
49
52
  elsif engine_version != other.engine_version && @input_engine
50
53
  [ :engine_version, engine_version, other.engine_version ]
54
+ elsif patchlevel != other.patchlevel && @patchlevel
55
+ [ :patchlevel, patchlevel, other.patchlevel ]
51
56
  else
52
57
  nil
53
58
  end
@@ -96,5 +101,9 @@ module Bundler
96
101
  nil
97
102
  end
98
103
  end
104
+
105
+ def patchlevel
106
+ RUBY_PATCHLEVEL
107
+ end
99
108
  end
100
109
  end
@@ -136,6 +136,7 @@ module Gem
136
136
  JAVA = Gem::Platform.new('java') unless defined?(JAVA)
137
137
  MSWIN = Gem::Platform.new('mswin32') unless defined?(MSWIN)
138
138
  MINGW = Gem::Platform.new('x86-mingw32') unless defined?(MINGW)
139
+ X64_MINGW = Gem::Platform.new('x64-mingw32') unless defined?(X64_MINGW)
139
140
 
140
141
  undef_method :hash if method_defined? :hash
141
142
  def hash
@@ -194,7 +194,7 @@ module Bundler
194
194
  @security_policies ||= begin
195
195
  require 'rubygems/security'
196
196
  Gem::Security::Policies
197
- rescue LoadError
197
+ rescue LoadError, NameError
198
198
  {}
199
199
  end
200
200
  end
@@ -23,7 +23,8 @@ module Bundler
23
23
 
24
24
  if activated_spec = Bundler.rubygems.loaded_specs(spec.name) and activated_spec.version != spec.version
25
25
  e = Gem::LoadError.new "You have already activated #{activated_spec.name} #{activated_spec.version}, " \
26
- "but your Gemfile requires #{spec.name} #{spec.version}. Using bundle exec may solve this."
26
+ "but your Gemfile requires #{spec.name} #{spec.version}. Prepending " \
27
+ "`bundle exec` to your command may solve this."
27
28
  e.name = spec.name
28
29
  if e.respond_to?(:requirement=)
29
30
  e.requirement = Gem::Requirement.new(spec.version.to_s)
@@ -57,6 +57,19 @@ module Bundler
57
57
  end
58
58
  end
59
59
 
60
+ def with_clean_git_env(&block)
61
+ keys = %w[GIT_DIR GIT_WORK_TREE]
62
+ old_env = keys.inject({}) do |h, k|
63
+ h.update(k => ENV[k])
64
+ end
65
+
66
+ keys.each {|key| ENV.delete(key) }
67
+
68
+ block.call
69
+ ensure
70
+ keys.each {|key| ENV[key] = old_env[key] }
71
+ end
72
+
60
73
  private
61
74
 
62
75
  def find_gemfile
@@ -151,15 +151,15 @@ module Bundler
151
151
  end
152
152
 
153
153
  def install(spec)
154
- Bundler.ui.info "Using #{spec.name} (#{spec.version}) from #{to_s}"
154
+ debug = nil
155
155
  if requires_checkout? && !@copied
156
- Bundler.ui.debug " * Checking out revision: #{ref}"
156
+ debug = " * Checking out revision: #{ref}"
157
157
  git_proxy.copy_to(install_path, submodules)
158
158
  serialize_gemspecs_in(install_path)
159
159
  @copied = true
160
160
  end
161
161
  generate_bin(spec)
162
- nil
162
+ ["Using #{spec.name} (#{spec.version}) from #{to_s}", nil, debug]
163
163
  end
164
164
 
165
165
  def cache(spec)
@@ -85,7 +85,7 @@ module Bundler
85
85
 
86
86
  def git(command, check_errors=true)
87
87
  if allow?
88
- out = %x{git #{command}}
88
+ out = SharedHelpers.with_clean_git_env { %x{git #{command}} }
89
89
 
90
90
  if check_errors && $?.exitstatus != 0
91
91
  msg = "Git error: command `git #{command}` in directory #{Dir.pwd} has failed."
@@ -70,9 +70,8 @@ module Bundler
70
70
  end
71
71
 
72
72
  def install(spec)
73
- Bundler.ui.info "Using #{spec.name} (#{spec.version}) from #{to_s}"
74
73
  generate_bin(spec, :disable_extensions)
75
- nil
74
+ ["Using #{spec.name} (#{spec.version}) from #{to_s}", nil]
76
75
  end
77
76
 
78
77
  def cache(spec)
@@ -69,11 +69,10 @@ module Bundler
69
69
 
70
70
  def install(spec)
71
71
  if installed_specs[spec].any?
72
- Bundler.ui.info "Using #{spec.name} (#{spec.version})"
73
- return
72
+ return ["Using #{spec.name} (#{spec.version})", nil]
74
73
  end
75
74
 
76
- Bundler.ui.info "Installing #{spec.name} (#{spec.version})"
75
+ install_message = "Installing #{spec.name} (#{spec.version})"
77
76
  path = cached_gem(spec)
78
77
  if Bundler.requires_sudo?
79
78
  install_path = Bundler.tmp
@@ -105,10 +104,9 @@ module Bundler
105
104
  Bundler.sudo "cp -R #{Bundler.tmp}/bin/#{exe} #{Bundler.system_bindir}"
106
105
  end
107
106
  end
108
- Bundler.ui.info "Installed #{spec.name} (#{spec.version})"
109
107
  installed_spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec"
110
108
  spec.loaded_from = "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec"
111
- spec.post_install_message
109
+ [install_message, spec.post_install_message]
112
110
  end
113
111
 
114
112
  def cache(spec)
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.4.0.pre.1" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.4.0.pre.2" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -10,7 +10,7 @@ bundle(1) -- Ruby Dependency Management
10
10
  Bundler manages an `application's dependencies` through its entire life
11
11
  across many machines systematically and repeatably.
12
12
 
13
- See [the bundler website](http://gembundler.com) for information on getting
13
+ See [the bundler website](http://bundler.io) for information on getting
14
14
  started, and Gemfile(5) for more information on the `Gemfile` format.
15
15
 
16
16
  ## OPTIONS
@@ -130,7 +130,7 @@ are obviously not available).
130
130
  Note that on `bundle install`, bundler downloads and evaluates all gems, in order to
131
131
  create a single canonical list of all of the required gems and their dependencies.
132
132
  This means that you cannot list different versions of the same gems in different
133
- groups. For more details, see [Understanding Bundler](http://gembundler.com/rationale.html).
133
+ groups. For more details, see [Understanding Bundler](http://bundler.io/rationale.html).
134
134
 
135
135
  ### PLATFORMS (:platforms)
136
136
 
@@ -164,13 +164,17 @@ There are a number of `Gemfile` platforms:
164
164
  * `mswin`:
165
165
  Windows
166
166
  * `mingw`:
167
- Windows 'mingw32' platform (aka RubyInstaller)
167
+ Windows 32 bit 'mingw32' platform (aka RubyInstaller)
168
168
  * `mingw_18`:
169
169
  _mingw_ `AND` version 1.8
170
170
  * `mingw_19`:
171
171
  _mingw_ `AND` version 1.9
172
172
  * `mingw_20`:
173
173
  _mingw_ `AND` version 2.0
174
+ * `x64_mingw`:
175
+ Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
176
+ * `x64_mingw_20`:
177
+ _x64_mingw_ `AND` version 2.0
174
178
 
175
179
  As with groups, you can specify one or more platforms:
176
180
 
@@ -9,7 +9,7 @@ describe Bundler::Dsl do
9
9
  describe "#_normalize_options" do
10
10
  it "converts :github to :git" do
11
11
  subject.gem("sparks", :github => "indirect/sparks")
12
- github_uri = "https://github.com/indirect/sparks.git"
12
+ github_uri = "git://github.com/indirect/sparks.git"
13
13
  expect(subject.dependencies.first.source.uri).to eq(github_uri)
14
14
  end
15
15
 
@@ -27,7 +27,7 @@ describe Bundler::Dsl do
27
27
 
28
28
  it "converts 'rails' to 'rails/rails'" do
29
29
  subject.gem("rails", :github => "rails")
30
- github_uri = "https://github.com/rails/rails.git"
30
+ github_uri = "git://github.com/rails/rails.git"
31
31
  expect(subject.dependencies.first.source.uri).to eq(github_uri)
32
32
  end
33
33
  end
@@ -0,0 +1,13 @@
1
+ require "spec_helper"
2
+ require "bundler"
3
+ require "bundler/friendly_errors"
4
+
5
+ describe Bundler, "friendly errors" do
6
+ it "rescues Thor::AmbiguousTaskError and raises SystemExit" do
7
+ expect {
8
+ Bundler.with_friendly_errors do
9
+ raise Thor::AmbiguousTaskError.new("")
10
+ end
11
+ }.to raise_error(SystemExit)
12
+ end
13
+ end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -419,6 +419,20 @@ describe "gemcutter's dependency API" do
419
419
  bundle :install, :artifice => "endpoint_creds_diff_host"
420
420
  should_be_installed "rack 1.0.0"
421
421
  end
422
+
423
+ describe "with no password" do
424
+ let(:password) { nil }
425
+
426
+ it "passes basic authentication details" do
427
+ gemfile <<-G
428
+ source "#{basic_auth_source_uri}"
429
+ gem "rack"
430
+ G
431
+
432
+ bundle :install, :artifice => "endpoint_basic_authentication"
433
+ should_be_installed "rack 1.0.0"
434
+ end
435
+ end
422
436
  end
423
437
 
424
438
  context "when ruby is compiled without openssl" do