bundler 1.1.rc.5 → 1.1.rc.6

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.

@@ -1,3 +1,12 @@
1
+ ## 1.1.rc.6 (Dec 22, 2011)
2
+
3
+ Bugfixes:
4
+
5
+ - Fix performance regression from 1.0 (@spastorino, #1511, #1591, #1592)
6
+ - Load gems correctly when GEM_HOME is blank
7
+ - Refresh gems so Bundler works from inside a bundle
8
+ - Handle empty .bundle/config files without an error
9
+
1
10
  ## 1.1.rc.5 (Dec 14, 2011)
2
11
 
3
12
  Bugfixes:
@@ -77,10 +77,7 @@ module Bundler
77
77
  attr_writer :ui, :bundle_path
78
78
 
79
79
  def configure
80
- @configured ||= begin
81
- configure_gem_home_and_path
82
- true
83
- end
80
+ @configured ||= configure_gem_home_and_path
84
81
  end
85
82
 
86
83
  def ui
@@ -295,23 +292,28 @@ module Bundler
295
292
  private
296
293
 
297
294
  def configure_gem_home_and_path
295
+ blank_home = ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty?
296
+
298
297
  if settings[:disable_shared_gems]
299
298
  ENV['GEM_PATH'] = ''
300
- ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
301
- # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
302
- FileUtils.mkdir_p bundle_path.to_s rescue nil
303
-
304
- Bundler.rubygems.clear_paths
305
- elsif Bundler.rubygems.gem_dir != bundle_path.to_s
299
+ configure_gem_home
300
+ elsif blank_home || Bundler.rubygems.gem_dir != bundle_path.to_s
306
301
  possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
307
302
  paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
308
303
  ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
309
- ENV["GEM_HOME"] = bundle_path.to_s
310
- # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
311
- FileUtils.mkdir_p bundle_path.to_s rescue nil
312
-
313
- Bundler.rubygems.clear_paths
304
+ configure_gem_home
314
305
  end
306
+
307
+ Bundler.rubygems.refresh
308
+ bundle_path
309
+ end
310
+
311
+ def configure_gem_home
312
+ # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
313
+ FileUtils.mkdir_p bundle_path.to_s rescue nil
314
+
315
+ ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
316
+ Bundler.rubygems.clear_paths
315
317
  end
316
318
 
317
319
  def upgrade_lockfile
@@ -395,7 +395,7 @@ module Bundler
395
395
  def exec(*)
396
396
  ARGV.shift # remove "exec"
397
397
 
398
- Bundler.setup
398
+ Bundler.load.setup_environment
399
399
 
400
400
  begin
401
401
  # Run
@@ -408,7 +408,7 @@ module Bundler
408
408
  Bundler.ui.warn "Install missing gem executables with `bundle install`"
409
409
  exit 127
410
410
  rescue ArgumentError
411
- Bundler.ui.error "bundle exec needs a command to run"
411
+ Bundler.ui.error "bundler: exec needs a command to run"
412
412
  exit 128
413
413
  end
414
414
  end
@@ -6,6 +6,11 @@ module Bundler
6
6
  builder = new
7
7
  builder.instance_eval(Bundler.read_file(gemfile.to_s), gemfile.to_s, 1)
8
8
  builder.to_definition(lockfile, unlock)
9
+ rescue ScriptError, RegexpError, NameError, ArgumentError => e
10
+ e.backtrace[0] = "#{e.backtrace[0]}: #{e.message} (#{e.class})"
11
+ Bundler.ui.info e.backtrace.join("\n ")
12
+ raise GemfileError, "There was an error in your Gemfile," \
13
+ " and Bundler cannot continue."
9
14
  end
10
15
 
11
16
  VALID_PLATFORMS = Bundler::Dependency::PLATFORM_MAP.keys.freeze
@@ -156,6 +156,7 @@ module Bundler
156
156
 
157
157
  def start(reqs)
158
158
  activated = {}
159
+ @gems_size = Hash[reqs.map { |r| [r, gems_size(r)] }]
159
160
 
160
161
  resolve(reqs, activated)
161
162
  end
@@ -176,7 +177,7 @@ module Bundler
176
177
  [ activated[a.name] ? 0 : 1,
177
178
  a.requirement.prerelease? ? 0 : 1,
178
179
  @errors[a.name] ? 0 : 1,
179
- activated[a.name] ? 0 : gems_size(a) ]
180
+ activated[a.name] ? 0 : @gems_size[a] ]
180
181
  end
181
182
 
182
183
  debug { "Activated:\n" + activated.values.map {|a| " #{a}" }.join("\n") }
@@ -210,7 +211,13 @@ module Bundler
210
211
  # I have no idea if this is the right way to do it, but let's see if it works
211
212
  # The current requirement might activate some other platforms, so let's try
212
213
  # adding those requirements here.
213
- reqs.concat existing.activate_platform(current.__platform)
214
+ dependencies = existing.activate_platform(current.__platform)
215
+ reqs.concat dependencies
216
+
217
+ dependencies.each do |dep|
218
+ next if dep.type == :development
219
+ @gems_size[dep] ||= gems_size(dep)
220
+ end
214
221
 
215
222
  resolve(reqs, activated)
216
223
  else
@@ -325,6 +332,7 @@ module Bundler
325
332
  debug { " * #{dep.name} (#{dep.requirement})" }
326
333
  dep.required_by.replace(requirement.required_by)
327
334
  dep.required_by << requirement
335
+ @gems_size[dep] ||= gems_size(dep)
328
336
  reqs << dep
329
337
  end
330
338
 
@@ -73,6 +73,10 @@ module Bundler
73
73
  Gem.bin_path(gem, bin, ver)
74
74
  end
75
75
 
76
+ def refresh
77
+ Gem.refresh
78
+ end
79
+
76
80
  def preserve_paths
77
81
  # this is a no-op outside of Rubygems 1.8
78
82
  yield
@@ -229,7 +233,7 @@ module Bundler
229
233
  end
230
234
 
231
235
  # Because Bundler has a static view of what specs are available,
232
- # we don't #reflesh, so stub it out.
236
+ # we don't #refresh, so stub it out.
233
237
  def replace_refresh
234
238
  gem_class = (class << Gem ; self ; end)
235
239
  gem_class.send(:remove_method, :refresh)
@@ -200,12 +200,6 @@ module Bundler
200
200
  output
201
201
  end
202
202
 
203
- private
204
-
205
- def cache_path
206
- root.join("vendor/cache")
207
- end
208
-
209
203
  def setup_environment
210
204
  begin
211
205
  ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
@@ -229,5 +223,11 @@ module Bundler
229
223
  ENV["RUBYOPT"] = rubyopt.join(' ')
230
224
  end
231
225
  end
226
+
227
+ private
228
+
229
+ def cache_path
230
+ root.join("vendor/cache")
231
+ end
232
232
  end
233
233
  end
@@ -1,9 +1,9 @@
1
1
  module Bundler
2
2
  class Settings
3
3
  def initialize(root)
4
- @root = root
5
- @local_config = File.exist?(local_config_file) ? YAML.load_file(local_config_file) : {}
6
- @global_config = File.exist?(global_config_file) ? YAML.load_file(global_config_file) : {}
4
+ @root = root
5
+ @local_config = (File.exist?(local_config_file) && yaml = YAML.load_file(local_config_file)) ? yaml : {}
6
+ @global_config = (File.exist?(global_config_file) && yaml = YAML.load_file(global_config_file)) ? yaml : {}
7
7
  end
8
8
 
9
9
  def [](key)
@@ -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.1.rc.5" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.1.rc.6" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -19,4 +19,12 @@ describe Bundler::Dsl do
19
19
  subject.dependencies.first.source.uri.should == github_uri
20
20
  end
21
21
  end
22
+
23
+ describe "syntax errors" do
24
+ it "should raise a Bundler::GemfileError" do
25
+ gemfile "gem 'foo', :path => /unquoted/string/syntax/error"
26
+ lambda { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }.
27
+ should raise_error(Bundler::GemfileError)
28
+ end
29
+ end
22
30
  end
@@ -313,6 +313,30 @@ describe "bundle install with gem sources" do
313
313
  out.should include("Could not reach http://localhost:9384/")
314
314
  out.should_not include("file://")
315
315
  end
316
+
317
+ it "doesn't blow up when the local .bundle/config is empty" do
318
+ FileUtils.mkdir_p(bundled_app(".bundle"))
319
+ FileUtils.touch(bundled_app(".bundle/config"))
320
+
321
+ install_gemfile(<<-G, :exitstatus => true)
322
+ source "file://#{gem_repo1}"
323
+
324
+ gem 'foo'
325
+ G
326
+ exitstatus.should == 0
327
+ end
328
+
329
+ it "doesn't blow up when the global .bundle/config is empty" do
330
+ FileUtils.mkdir_p("#{Bundler.rubygems.user_home}/.bundle")
331
+ FileUtils.touch("#{Bundler.rubygems.user_home}/.bundle/config")
332
+
333
+ install_gemfile(<<-G, :exitstatus => true)
334
+ source "file://#{gem_repo1}"
335
+
336
+ gem 'foo'
337
+ G
338
+ exitstatus.should == 0
339
+ end
316
340
  end
317
341
 
318
342
  describe "when prerelease gems are available" do
@@ -128,7 +128,7 @@ describe "bundle exec" do
128
128
 
129
129
  bundle "exec", :exitstatus => true
130
130
  # exitstatus.should eq(128)
131
- out.should include("bundle exec needs a command to run")
131
+ out.should include("bundler: exec needs a command to run")
132
132
  end
133
133
 
134
134
  describe "with gem executables" do
@@ -16,7 +16,7 @@ describe "bundle show" do
16
16
  bundled_app("Gemfile.lock").should exist
17
17
  end
18
18
 
19
- it "creates a Gemfile.lock if one did not exist and we're doing bundle show rails" do
19
+ it "creates a Gemfile.lock when invoked with a gem name" do
20
20
  FileUtils.rm("Gemfile.lock")
21
21
 
22
22
  bundle "show rails"
@@ -35,14 +35,14 @@ module Spec
35
35
  @out = ruby(setup + cmd, :expect_err => expect_err, :env => env)
36
36
  end
37
37
 
38
- def load_error_run(ruby, gem, *args)
39
- cmd = <<-R
38
+ def load_error_run(ruby, name, *args)
39
+ cmd = <<-RUBY
40
40
  begin
41
41
  #{ruby}
42
42
  rescue LoadError => e
43
- $stderr.puts "ZOMG LOAD ERROR" if e.message.include?("-- #{gem}")
43
+ $stderr.puts "ZOMG LOAD ERROR" if e.message.include?("-- #{name}")
44
44
  end
45
- R
45
+ RUBY
46
46
  opts = args.last.is_a?(Hash) ? args.pop : {}
47
47
  opts.merge!(:expect_err => true)
48
48
  args += [opts]
@@ -87,12 +87,12 @@ module Spec
87
87
  sys_exec(%{#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"}, expect_err)
88
88
  end
89
89
 
90
- def load_error_ruby(ruby, gem, opts = {})
90
+ def load_error_ruby(ruby, name, opts = {})
91
91
  cmd = <<-R
92
92
  begin
93
93
  #{ruby}
94
94
  rescue LoadError => e
95
- $stderr.puts "ZOMG LOAD ERROR"# if e.message.include?("-- #{gem}")
95
+ $stderr.puts "ZOMG LOAD ERROR"# if e.message.include?("-- #{name}")
96
96
  end
97
97
  R
98
98
  ruby(cmd, opts.merge(:expect_err => true))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15424247
4
+ hash: 15424241
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - rc
10
- - 5
11
- version: 1.1.rc.5
10
+ - 6
11
+ version: 1.1.rc.6
12
12
  platform: ruby
13
13
  authors:
14
14
  - "Andr\xC3\xA9 Arko"
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2011-12-14 00:00:00 -05:00
22
+ date: 2011-12-23 00:00:00 -08:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -235,20 +235,20 @@ files:
235
235
  - spec/update/gems_spec.rb
236
236
  - spec/update/git_spec.rb
237
237
  - spec/update/source_spec.rb
238
- - lib/bundler/man/bundle-exec
239
238
  - lib/bundler/man/bundle
239
+ - lib/bundler/man/bundle-config
240
+ - lib/bundler/man/bundle-config.txt
241
+ - lib/bundler/man/bundle-exec
242
+ - lib/bundler/man/bundle-exec.txt
240
243
  - lib/bundler/man/bundle-install
241
- - lib/bundler/man/gemfile.5
244
+ - lib/bundler/man/bundle-install.txt
242
245
  - lib/bundler/man/bundle-package
246
+ - lib/bundler/man/bundle-package.txt
243
247
  - lib/bundler/man/bundle-update
244
- - lib/bundler/man/bundle-exec.txt
245
- - lib/bundler/man/gemfile.5.txt
246
248
  - lib/bundler/man/bundle-update.txt
247
- - lib/bundler/man/bundle-config
248
- - lib/bundler/man/bundle-config.txt
249
249
  - lib/bundler/man/bundle.txt
250
- - lib/bundler/man/bundle-package.txt
251
- - lib/bundler/man/bundle-install.txt
250
+ - lib/bundler/man/gemfile.5
251
+ - lib/bundler/man/gemfile.5.txt
252
252
  has_rdoc: true
253
253
  homepage: http://gembundler.com
254
254
  licenses: []
@@ -285,5 +285,81 @@ rubygems_version: 1.3.7
285
285
  signing_key:
286
286
  specification_version: 3
287
287
  summary: The best way to manage your application's dependencies
288
- test_files: []
289
-
288
+ test_files:
289
+ - spec/bundler/dsl_spec.rb
290
+ - spec/bundler/gem_helper_spec.rb
291
+ - spec/bundler/source_spec.rb
292
+ - spec/cache/gems_spec.rb
293
+ - spec/cache/git_spec.rb
294
+ - spec/cache/path_spec.rb
295
+ - spec/cache/platform_spec.rb
296
+ - spec/install/deploy_spec.rb
297
+ - spec/install/deprecated_spec.rb
298
+ - spec/install/gems/c_ext_spec.rb
299
+ - spec/install/gems/dependency_api_spec.rb
300
+ - spec/install/gems/env_spec.rb
301
+ - spec/install/gems/flex_spec.rb
302
+ - spec/install/gems/groups_spec.rb
303
+ - spec/install/gems/packed_spec.rb
304
+ - spec/install/gems/platform_spec.rb
305
+ - spec/install/gems/post_install_spec.rb
306
+ - spec/install/gems/resolving_spec.rb
307
+ - spec/install/gems/simple_case_spec.rb
308
+ - spec/install/gems/standalone_spec.rb
309
+ - spec/install/gems/sudo_spec.rb
310
+ - spec/install/gems/win32_spec.rb
311
+ - spec/install/gemspec_spec.rb
312
+ - spec/install/git_spec.rb
313
+ - spec/install/invalid_spec.rb
314
+ - spec/install/path_spec.rb
315
+ - spec/install/upgrade_spec.rb
316
+ - spec/lock/git_spec.rb
317
+ - spec/lock/lockfile_spec.rb
318
+ - spec/other/check_spec.rb
319
+ - spec/other/clean_spec.rb
320
+ - spec/other/config_spec.rb
321
+ - spec/other/console_spec.rb
322
+ - spec/other/exec_spec.rb
323
+ - spec/other/ext_spec.rb
324
+ - spec/other/help_spec.rb
325
+ - spec/other/init_spec.rb
326
+ - spec/other/newgem_spec.rb
327
+ - spec/other/open_spec.rb
328
+ - spec/other/outdated_spec.rb
329
+ - spec/other/show_spec.rb
330
+ - spec/quality_spec.rb
331
+ - spec/realworld/edgecases_spec.rb
332
+ - spec/resolver/basic_spec.rb
333
+ - spec/resolver/platform_spec.rb
334
+ - spec/runtime/executable_spec.rb
335
+ - spec/runtime/load_spec.rb
336
+ - spec/runtime/platform_spec.rb
337
+ - spec/runtime/require_spec.rb
338
+ - spec/runtime/setup_spec.rb
339
+ - spec/runtime/with_clean_env_spec.rb
340
+ - spec/spec_helper.rb
341
+ - spec/support/artifice/endopint_marshal_fail_basic_authentication.rb
342
+ - spec/support/artifice/endpoint.rb
343
+ - spec/support/artifice/endpoint_500.rb
344
+ - spec/support/artifice/endpoint_api_missing.rb
345
+ - spec/support/artifice/endpoint_basic_authentication.rb
346
+ - spec/support/artifice/endpoint_extra.rb
347
+ - spec/support/artifice/endpoint_extra_missing.rb
348
+ - spec/support/artifice/endpoint_fallback.rb
349
+ - spec/support/artifice/endpoint_marshal_fail.rb
350
+ - spec/support/artifice/endpoint_redirect.rb
351
+ - spec/support/builders.rb
352
+ - spec/support/fakeweb/rack-1.0.0.marshal
353
+ - spec/support/fakeweb/windows.rb
354
+ - spec/support/helpers.rb
355
+ - spec/support/indexes.rb
356
+ - spec/support/matchers.rb
357
+ - spec/support/path.rb
358
+ - spec/support/platforms.rb
359
+ - spec/support/ruby_ext.rb
360
+ - spec/support/rubygems_ext.rb
361
+ - spec/support/rubygems_hax/platform.rb
362
+ - spec/support/sudo.rb
363
+ - spec/update/gems_spec.rb
364
+ - spec/update/git_spec.rb
365
+ - spec/update/source_spec.rb