bundler 1.1.pre.8 → 1.1.pre.9

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 (45) hide show
  1. data/.travis.yml +29 -5
  2. data/CHANGELOG.md +58 -3
  3. data/Rakefile +25 -2
  4. data/UPGRADING.md +2 -2
  5. data/bin/bundle +10 -10
  6. data/bundler.gemspec +2 -1
  7. data/lib/bundler.rb +8 -6
  8. data/lib/bundler/cli.rb +45 -14
  9. data/lib/bundler/definition.rb +4 -4
  10. data/lib/bundler/dependency.rb +1 -8
  11. data/lib/bundler/deployment.rb +8 -3
  12. data/lib/bundler/dsl.rb +3 -18
  13. data/lib/bundler/fetcher.rb +15 -3
  14. data/lib/bundler/gem_helper.rb +1 -1
  15. data/lib/bundler/gem_installer.rb +9 -0
  16. data/lib/bundler/installer.rb +33 -18
  17. data/lib/bundler/resolver.rb +19 -7
  18. data/lib/bundler/rubygems_ext.rb +3 -1
  19. data/lib/bundler/rubygems_integration.rb +37 -4
  20. data/lib/bundler/runtime.rb +47 -15
  21. data/lib/bundler/settings.rb +1 -3
  22. data/lib/bundler/source.rb +23 -23
  23. data/lib/bundler/ui.rb +9 -9
  24. data/lib/bundler/version.rb +1 -1
  25. data/man/bundle-install.ronn +3 -3
  26. data/man/bundle.ronn +0 -6
  27. data/man/gemfile.5.ronn +2 -2
  28. data/spec/bundler/dsl_spec.rb +22 -0
  29. data/spec/{other → bundler}/gem_helper_spec.rb +7 -0
  30. data/spec/install/deprecated_spec.rb +2 -3
  31. data/spec/install/gems/dependency_api_spec.rb +13 -2
  32. data/spec/install/gems/groups_spec.rb +14 -0
  33. data/spec/install/gems/simple_case_spec.rb +34 -1
  34. data/spec/install/gems/standalone_spec.rb +24 -10
  35. data/spec/lock/lockfile_spec.rb +48 -15
  36. data/spec/other/clean_spec.rb +236 -37
  37. data/spec/other/exec_spec.rb +6 -0
  38. data/spec/other/help_spec.rb +2 -1
  39. data/spec/other/newgem_spec.rb +18 -0
  40. data/spec/other/outdated_spec.rb +19 -2
  41. data/spec/other/show_spec.rb +6 -0
  42. data/spec/runtime/setup_spec.rb +19 -0
  43. data/spec/support/builders.rb +10 -1
  44. data/spec/update/gems_spec.rb +3 -2
  45. metadata +90 -17
data/.travis.yml CHANGED
@@ -1,8 +1,32 @@
1
+ before_script:
2
+ - sudo apt-get install groff -y
3
+ - rake spec:deps
4
+
5
+ script: rake spec:travis
6
+
1
7
  rvm:
2
- - 1.8.6
3
8
  - 1.8.7
4
9
  - 1.9.2
5
- - jruby
6
- - rbx
7
- - ree
8
- - ruby-head
10
+
11
+ env:
12
+ - RGV=v1.3.6
13
+ - RGV=v1.3.7
14
+ - RGV=v1.4.2
15
+ - RGV=v1.5.3
16
+ - RGV=v1.6.2
17
+ - RGV=v1.7.2
18
+ - RGV=v1.8.10
19
+ - RGV=master
20
+
21
+ matrix:
22
+ exclude:
23
+ - rvm: 1.9.2
24
+ env: RGV=v1.3.6
25
+ - rvm: 1.9.2
26
+ env: RGV=v1.3.7
27
+ - rvm: 1.9.2
28
+ env: RGV=v1.4.2
29
+
30
+ notifications:
31
+ email:
32
+ - travis-ci@andrearko.com
data/CHANGELOG.md CHANGED
@@ -1,3 +1,28 @@
1
+ ## 1.1.pre.9 (Sep 18, 2011)
2
+
3
+ Features:
4
+
5
+ - `clean` will now clean up all old .gem and .gemspec files, cleaning up older pres
6
+ - `clean` will be automatically run after bundle install and update when using `--path` (#1420, #1425)
7
+ - `clean` now takes a `--force` option (#1247, #1426)
8
+ - `clean` will clean up cached git dirs in bundle clean (#1390)
9
+ - remove deprecations from DSL (#1119)
10
+ - autorequire tries directories for gems with dashed names (#1205)
11
+ - adds a `--paths` flag to `bundle show` to list all the paths of bundled gems (@tiegz, #1360)
12
+ - load rubygems plugins in the bundle binary (@tpope, #1364)
13
+ - make `--standalone` respect `--path` (@cowboyd, #1361)
14
+
15
+ Bugfixes:
16
+
17
+ - Fix `clean` to handle nested gems in a git repo (#1329)
18
+ - Fix conflict from revert of benchmark tool (@boffbowsh, #1355)
19
+ - Fix fatal error when unable to connect to gem source (#1269)
20
+ - Fix `outdated` to find pre-release gems that are installed. (#1359)
21
+ - Fix color for ui. (#1374)
22
+ - Fix installing to user-owned system gems on OS X
23
+ - Fix caching issue in the resolver (#1353, #1421)
24
+ - Fix :github DSL option
25
+
1
26
  ## 1.1.pre.8 (Aug 13, 2011)
2
27
 
3
28
  Bugfixes:
@@ -100,12 +125,42 @@ Removed:
100
125
  - Removed bundle install --production
101
126
  - Removed bundle install --disable-shared-gems
102
127
 
103
- ## 1.0.18 (Aug 13, 2011)
128
+ ## 1.0.20.rc (September 18, 2011)
129
+
130
+ Features:
131
+
132
+ - Rescue interrupts to `bundle` while loading bundler.rb (#1395)
133
+ - Allow clearing without groups by passing `--without ''` (#1259)
134
+
135
+ Bugfixes:
136
+
137
+ - Manually sort requirements in the lockfile (#1375)
138
+ - Remove several warnings generated by ruby -w (@stephencelis)
139
+ - Handle trailing slashes on names passed to `gem` (#1372)
140
+ - Name modules for gems like 'test-foo_bar' correctly (#1303)
141
+ - Don't require Psych if Syck is already loaded (#1239)
142
+
143
+ ## 1.0.19.rc (September 13, 2011)
144
+
145
+ Features:
146
+
147
+ - Compatability with Rubygems 1.8.10 installer changes
148
+ - Report gem installation failures clearly (@rwilcox, #1380)
149
+ - Useful error for cap and vlad on first deploy (@nexmat, @kirs)
150
+
151
+ Bugfixes:
152
+
153
+ - `exec` now works when the command contains 'exec'
154
+ - Only touch lock after changes on Windows (@robertwahler, #1358)
155
+ - Keep load paths when #setup is called multiple times (@radsaq, #1379)
156
+
157
+ ## 1.0.18 (August 16, 2011)
104
158
 
105
159
  Bugfixes:
106
160
 
107
161
  - Fix typo in DEBUG_RESOLVER (@geemus)
108
162
  - Fixes rake 0.9.x warning (@mtylty, #1333)
163
+ - Fix `bundle cache` again for rubygems 1.3.x
109
164
 
110
165
  Features:
111
166
 
@@ -114,14 +169,14 @@ Features:
114
169
  - Make fetch_specs faster (@zeha, #1294)
115
170
  - Allow overriding development deps loaded by #gemspec (@lgierth, #1245)
116
171
 
117
- ## 1.0.17 (Aug 8, 2011)
172
+ ## 1.0.17 (August 8, 2011)
118
173
 
119
174
  Bugfixes:
120
175
 
121
176
  - Fix rake issues with rubygems 1.3.x (#1342)
122
177
  - Fixed invalid byte sequence error while installing gem on Ruby 1.9 (#1341)
123
178
 
124
- ## 1.0.16 (Aug 8, 2011)
179
+ ## 1.0.16 (August 8, 2011)
125
180
 
126
181
  Features:
127
182
 
data/Rakefile CHANGED
@@ -2,6 +2,13 @@
2
2
  $:.unshift File.expand_path("../lib", __FILE__)
3
3
  require 'bundler/gem_tasks'
4
4
 
5
+ def safe_task(&block)
6
+ yield
7
+ true
8
+ rescue
9
+ false
10
+ end
11
+
5
12
  namespace :spec do
6
13
  desc "Ensure spec dependencies are installed"
7
14
  task :deps do
@@ -42,7 +49,7 @@ begin
42
49
  namespace :rubygems do
43
50
  # Rubygems specs by version
44
51
  rubyopt = ENV["RUBYOPT"]
45
- %w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.7).each do |rg|
52
+ %w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.10).each do |rg|
46
53
  desc "Run specs with Rubygems #{rg}"
47
54
  RSpec::Core::RakeTask.new(rg) do |t|
48
55
  t.rspec_opts = %w(-fs --color)
@@ -71,7 +78,7 @@ begin
71
78
  ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
72
79
  end
73
80
 
74
- task rg => "clone_rubygems_#{rg}"
81
+ task rg => ["clone_rubygems_#{rg}", "man:build"]
75
82
  task "rubygems:all" => rg
76
83
  end
77
84
 
@@ -114,6 +121,22 @@ begin
114
121
  end
115
122
  end
116
123
 
124
+ desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
125
+ task "travis" do
126
+ rg = ENV['RGV'] || 'master'
127
+
128
+ puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
129
+ specs = safe_task { Rake::Task["spec:rubygems:#{rg}"].invoke }
130
+
131
+ Rake::Task["spec:rubygems:#{rg}"].reenable
132
+
133
+ puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
134
+ sudos = safe_task { Rake::Task["spec:rubygems:#{rg}:sudo"].invoke }
135
+
136
+ unless specs && sudos
137
+ fail "Bundler tests failed, please review the log for more information"
138
+ end
139
+ end
117
140
  end
118
141
 
119
142
  namespace :man do
data/UPGRADING.md CHANGED
@@ -33,7 +33,7 @@ your deploy.rb file to run Bundler automatically as part of deploying:
33
33
  require 'bundler/capistrano'
34
34
 
35
35
  For more details on deploying using bundler, see the documentation
36
- for the bundler cap task, and the [documentation on deploying](http://gembundler.com/v1.0/deploying.html).
36
+ for the bundler cap task, and the [documentation on deploying](http://gembundler.com/deploying.html).
37
37
 
38
38
 
39
39
  ## Bundler 0.8 to 0.9 and above
@@ -100,4 +100,4 @@ Bundler 0.9 changes the following Bundler 0.8 Gemfile APIs:
100
100
  mode, where using system gems, this becomes
101
101
  `Bundler.setup(:multiple, :groups)`. If you don't
102
102
  specify any groups, this puts all groups on the load
103
- path. In locked, mode, it becomes `require '.bundle/environment'`
103
+ path. In locked mode, it becomes `require '.bundle/environment'`
data/bin/bundle CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- # Check if an older version of bundler is installed
4
- require 'bundler'
5
- $:.each do |path|
6
- if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
7
- abort "Please remove older versions of bundler. This can be done by running `gem cleanup bundler`."
8
- end
9
- end
10
- require 'bundler/cli'
11
-
12
2
  begin
3
+ require 'bundler'
4
+ # Check if an older version of bundler is installed
5
+ $:.each do |path|
6
+ if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
7
+ err = "Please remove Bundler 0.8 versions."
8
+ err << "This can be done by running `gem cleanup bundler`."
9
+ abort(err)
10
+ end
11
+ end
12
+ require 'bundler/cli'
13
13
  Bundler::CLI.start
14
14
  rescue Bundler::BundlerError => e
15
15
  Bundler.ui.error e.message
data/bundler.gemspec CHANGED
@@ -22,7 +22,8 @@ Gem::Specification.new do |s|
22
22
 
23
23
  # Man files are required because they are ignored by git
24
24
  man_files = Dir.glob("lib/bundler/man/**/*")
25
- s.files = `git ls-files`.split("\n") + man_files
25
+ git_files = `git ls-files`.split("\n") rescue ''
26
+ s.files = git_files + man_files
26
27
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
28
  s.executables = %w(bundle)
28
29
  s.require_paths = ["lib"]
data/lib/bundler.rb CHANGED
@@ -3,11 +3,12 @@ require 'fileutils'
3
3
  require 'pathname'
4
4
 
5
5
  begin
6
- require 'psych'
6
+ # Pull in Psych if we can, but not if Syck is already loaded
7
+ require 'psych' unless defined?(YAML)
7
8
  rescue LoadError
9
+ require 'yaml'
8
10
  end
9
11
 
10
- require 'yaml'
11
12
  require 'bundler/rubygems_ext'
12
13
  require 'bundler/rubygems_integration'
13
14
  require 'bundler/version'
@@ -22,6 +23,7 @@ module Bundler
22
23
  autoload :Environment, 'bundler/environment'
23
24
  autoload :Fetcher, 'bundler/fetcher'
24
25
  autoload :GemHelper, 'bundler/gem_helper'
26
+ autoload :GemInstaller, 'bundler/gem_installer'
25
27
  autoload :Graph, 'bundler/graph'
26
28
  autoload :Index, 'bundler/index'
27
29
  autoload :Installer, 'bundler/installer'
@@ -38,7 +40,7 @@ module Bundler
38
40
  autoload :UI, 'bundler/ui'
39
41
 
40
42
  class BundlerError < StandardError
41
- def self.status_code(code = nil)
43
+ def self.status_code(code)
42
44
  define_method(:status_code) { code }
43
45
  end
44
46
  end
@@ -46,6 +48,7 @@ module Bundler
46
48
  class GemfileNotFound < BundlerError; status_code(10) ; end
47
49
  class GemNotFound < BundlerError; status_code(7) ; end
48
50
  class GemfileError < BundlerError; status_code(4) ; end
51
+ class InstallError < BundlerError; status_code(5) ; end
49
52
  class PathError < BundlerError; status_code(13) ; end
50
53
  class GitError < BundlerError; status_code(11) ; end
51
54
  class DeprecatedError < BundlerError; status_code(12) ; end
@@ -114,8 +117,7 @@ module Bundler
114
117
  unloaded = groups - @completed_groups
115
118
  # Record groups that are now loaded
116
119
  @completed_groups = groups
117
- # Load any groups that are not yet loaded
118
- unloaded.any? ? load.setup(*unloaded) : load
120
+ unloaded.any? ? load.setup(*groups) : load
119
121
  end
120
122
  end
121
123
 
@@ -218,7 +220,7 @@ module Bundler
218
220
  end
219
221
 
220
222
  def requires_sudo?
221
- return @requires_sudo if defined?(@checked_for_sudo) && @checked_for_sudo
223
+ return @requires_sudo if defined?(@checked_for_sudo)
222
224
 
223
225
  path = bundle_path
224
226
  path = path.parent until path.exist?
data/lib/bundler/cli.rb CHANGED
@@ -154,14 +154,15 @@ module Bundler
154
154
  "Make a bundle that can work without the Bundler runtime"
155
155
  method_option "full-index", :tpye => :boolean, :banner =>
156
156
  "Use the rubygems modern index instead of the API endpoint"
157
+ method_option "clean", :type => :boolean, :default => true, :banner =>
158
+ "Run bundle clean automatically after clean"
157
159
  def install
158
160
  opts = options.dup
159
- opts[:without] ||= []
160
- if opts[:without].size == 1
161
- opts[:without] = opts[:without].map{|g| g.split(" ") }
161
+ if opts[:without]
162
+ opts[:without].map!{|g| g.split(" ") }
162
163
  opts[:without].flatten!
164
+ opts[:without].map!{|g| g.to_sym }
163
165
  end
164
- opts[:without] = opts[:without].map{|g| g.to_sym }
165
166
 
166
167
  # Can't use Bundler.settings for this because settings needs gemfile.dirname
167
168
  ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
@@ -204,11 +205,13 @@ module Bundler
204
205
  Bundler.settings[:path] ||= "bundle" if opts[:standalone]
205
206
  Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
206
207
  Bundler.settings[:no_prune] = true if opts["no-prune"]
207
- Bundler.settings[:disable_shared_gems] = '1' if Bundler.settings[:path]
208
- Bundler.settings.without = opts[:without] unless opts[:without].empty?
208
+ Bundler.settings[:disable_shared_gems] = Bundler.settings[:path] ? '1' : nil
209
+ Bundler.settings.without = opts[:without]
209
210
  Bundler.ui.be_quiet! if opts[:quiet]
210
211
 
211
212
  Bundler::Fetcher.disable_endpoint = opts["full-index"]
213
+ # rubygems plugins sometimes hook into the gem install process
214
+ Gem.load_plugins if Gem.respond_to?(:load_plugins)
212
215
 
213
216
  Installer.install(Bundler.root, Bundler.definition, opts)
214
217
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist? && !options["no-cache"]
@@ -224,6 +227,8 @@ module Bundler
224
227
  Installer.post_install_messages.to_a.each do |name, msg|
225
228
  Bundler.ui.confirm "Post-install message from #{name}:\n#{msg}"
226
229
  end
230
+
231
+ clean if opts["clean"] && Bundler.settings[:path]
227
232
  rescue GemNotFound => e
228
233
  if opts[:local] && Bundler.app_cache.exist?
229
234
  Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory."
@@ -244,6 +249,8 @@ module Bundler
244
249
  method_option "source", :type => :array, :banner => "Update a specific source (and all gems associated with it)"
245
250
  method_option "local", :type => :boolean, :banner =>
246
251
  "Do not attempt to fetch gems remotely and use the gem cache instead"
252
+ method_option "clean", :type => :boolean, :default => true, :banner =>
253
+ "Run bundle clean automatically after clean"
247
254
  def update(*gems)
248
255
  sources = Array(options[:source])
249
256
 
@@ -255,8 +262,12 @@ module Bundler
255
262
  end
256
263
 
257
264
  opts = {"update" => true, "local" => options[:local]}
265
+ # rubygems plugins sometimes hook into the gem install process
266
+ Gem.load_plugins if Gem.respond_to?(:load_plugins)
267
+
258
268
  Installer.install Bundler.root, Bundler.definition, opts
259
269
  Bundler.load.cache if Bundler.root.join("vendor/cache").exist?
270
+ clean if options["clean"] && Bundler.settings[:path]
260
271
  Bundler.ui.confirm "Your bundle is updated! " +
261
272
  "Use `bundle show [gemname]` to see where a bundled gem is installed."
262
273
  end
@@ -266,11 +277,17 @@ module Bundler
266
277
  Show lists the names and versions of all gems that are required by your Gemfile.
267
278
  Calling show with [GEM] will list the exact location of that gem on your machine.
268
279
  D
280
+ method_option "paths", :type => :boolean,
281
+ :banner => "List the paths of all gems that are required by your Gemfile."
269
282
  def show(gem_name = nil)
270
283
  Bundler.load.lock
271
284
 
272
285
  if gem_name
273
286
  Bundler.ui.info locate_gem(gem_name)
287
+ elsif options[:paths]
288
+ Bundler.load.specs.sort_by { |s| s.name }.each do |s|
289
+ Bundler.ui.info locate_gem(s.name)
290
+ end
274
291
  else
275
292
  Bundler.ui.info "Gems included by the bundle:"
276
293
  Bundler.load.specs.sort_by { |s| s.name }.each do |s|
@@ -302,7 +319,14 @@ module Bundler
302
319
  end
303
320
  options["local"] ? definition.resolve_with_cache! : definition.resolve_remotely!
304
321
 
305
- Bundler.ui.info "Outdated gems included in the bundle:"
322
+ Bundler.ui.info ""
323
+ if options["pre"]
324
+ Bundler.ui.info "Outdated gems included in the bundle (including pre-releases):"
325
+ else
326
+ Bundler.ui.info "Outdated gems included in the bundle:"
327
+ end
328
+
329
+ out_count = 0
306
330
  definition.specs.each do |spec|
307
331
  next if !gems.empty? && !gems.include?(spec.name)
308
332
 
@@ -315,11 +339,12 @@ module Bundler
315
339
  current = spec
316
340
  spec = definition.index[current.name].sort_by{|b| b.version }
317
341
 
318
- if !options[:pre] && spec.size > 1
342
+ if !current.version.prerelease? && !options[:pre] && spec.size > 1
319
343
  spec = spec.delete_if{|b| b.respond_to?(:version) && b.version.prerelease? }
320
344
  end
321
345
 
322
346
  spec = spec.last
347
+ next if spec.nil?
323
348
  end
324
349
 
325
350
  gem_outdated = Gem::Version.new(spec.version) > Gem::Version.new(current.version)
@@ -328,10 +353,12 @@ module Bundler
328
353
  spec_version = "#{spec.version}#{spec.git_version}"
329
354
  current_version = "#{current.version}#{current.git_version}"
330
355
  Bundler.ui.info " * #{spec.name} (#{spec_version} > #{current_version})"
356
+ out_count += 1
331
357
  end
332
358
  Bundler.ui.debug "from #{spec.loaded_from}"
333
359
  end
334
360
 
361
+ Bundler.ui.info " Your bundle is up to date!" if out_count < 1
335
362
  Bundler.ui.info ""
336
363
  end
337
364
 
@@ -370,7 +397,7 @@ module Bundler
370
397
  into the systemwide Rubygems repository.
371
398
  D
372
399
  def exec(*)
373
- ARGV.delete("exec")
400
+ ARGV.shift # remove "exec"
374
401
 
375
402
  Bundler.setup
376
403
 
@@ -508,9 +535,10 @@ module Bundler
508
535
  desc "gem GEM", "Creates a skeleton for creating a rubygem"
509
536
  method_option :bin, :type => :boolean, :default => false, :aliases => '-b', :banner => "Generate a binary for your library."
510
537
  def gem(name)
538
+ name = name.chomp("/") # remove trailing slash if present
511
539
  target = File.join(Dir.pwd, name)
512
- constant_name = name.split('_').map{|p| p.capitalize}.join
513
- constant_name = constant_name.split('-').map{|q| q.capitalize}.join('::') if constant_name =~ /-/
540
+ constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
541
+ constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
514
542
  constant_array = constant_name.split('::')
515
543
  FileUtils.mkdir_p(File.join(target, 'lib', name))
516
544
  git_user_name = `git config user.name`.chomp
@@ -540,10 +568,13 @@ module Bundler
540
568
  end
541
569
 
542
570
  desc "clean", "Cleans up unused gems in your bundler directory"
571
+ method_option "force", :type => :boolean, :default => false, :banner =>
572
+ "forces clean even if --path is set"
543
573
  def clean
544
- clean_output = Bundler.load.clean
545
- if !clean_output
546
- Bundler.ui.error "Can only use bundle clean when --path is set"
574
+ if Bundler.settings[:path] || options[:force]
575
+ Bundler.load.clean
576
+ else
577
+ Bundler.ui.error "Can only use bundle clean when --path is set or --force is set"
547
578
  end
548
579
  end
549
580