bundler 1.0.3 → 1.0.5

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 (64) hide show
  1. data/.gitignore +10 -3
  2. data/CHANGELOG.md +31 -0
  3. data/ISSUES.md +16 -1
  4. data/LICENSE +2 -1
  5. data/Rakefile +39 -13
  6. data/bin/bundle +1 -1
  7. data/lib/bundler.rb +7 -19
  8. data/lib/bundler/capistrano.rb +0 -1
  9. data/lib/bundler/cli.rb +10 -6
  10. data/lib/bundler/definition.rb +23 -9
  11. data/lib/bundler/dependency.rb +7 -2
  12. data/lib/bundler/deployment.rb +25 -9
  13. data/lib/bundler/dsl.rb +3 -2
  14. data/lib/bundler/gem_helper.rb +25 -26
  15. data/lib/bundler/installer.rb +1 -0
  16. data/lib/bundler/resolver.rb +27 -14
  17. data/lib/bundler/rubygems_ext.rb +9 -6
  18. data/lib/bundler/runtime.rb +1 -1
  19. data/lib/bundler/setup.rb +1 -0
  20. data/lib/bundler/shared_helpers.rb +11 -4
  21. data/lib/bundler/source.rb +24 -15
  22. data/lib/bundler/ui.rb +11 -1
  23. data/lib/bundler/version.rb +1 -1
  24. data/lib/bundler/vlad.rb +1 -1
  25. data/man/bundle-exec.ronn +13 -0
  26. data/man/bundle-install.ronn +6 -3
  27. data/man/bundle.ronn +4 -1
  28. data/spec/cache/gems_spec.rb +14 -0
  29. data/spec/cache/git_spec.rb +1 -1
  30. data/spec/install/deploy_spec.rb +23 -4
  31. data/spec/install/gems/flex_spec.rb +41 -0
  32. data/spec/install/gems/groups_spec.rb +1 -1
  33. data/spec/install/gems/platform_spec.rb +4 -21
  34. data/spec/install/gems/simple_case_spec.rb +21 -14
  35. data/spec/install/gems/sudo_spec.rb +2 -2
  36. data/spec/install/gems/win32_spec.rb +1 -1
  37. data/spec/install/git_spec.rb +23 -5
  38. data/spec/install/path_spec.rb +31 -7
  39. data/spec/lock/{flex_spec.rb → lockfile_spec.rb} +33 -0
  40. data/spec/other/check_spec.rb +7 -7
  41. data/spec/other/config_spec.rb +2 -2
  42. data/spec/other/exec_spec.rb +6 -6
  43. data/spec/other/ext_spec.rb +2 -2
  44. data/spec/other/gem_helper_spec.rb +18 -6
  45. data/spec/other/help_spec.rb +1 -1
  46. data/spec/other/init_spec.rb +3 -3
  47. data/spec/quality_spec.rb +3 -0
  48. data/spec/resolver/platform_spec.rb +29 -4
  49. data/spec/runtime/load_spec.rb +47 -42
  50. data/spec/runtime/require_spec.rb +1 -1
  51. data/spec/runtime/setup_spec.rb +168 -2
  52. data/spec/spec_helper.rb +2 -1
  53. data/spec/support/builders.rb +18 -10
  54. data/spec/support/helpers.rb +7 -11
  55. data/spec/support/indexes.rb +3 -4
  56. data/spec/support/matchers.rb +1 -1
  57. data/spec/support/path.rb +1 -1
  58. data/spec/support/platforms.rb +5 -1
  59. data/spec/support/sudo.rb +1 -1
  60. data/spec/update/gems_spec.rb +26 -0
  61. data/spec/update/git_spec.rb +25 -2
  62. data/spec/update/source_spec.rb +2 -1
  63. metadata +6 -8
  64. data/spec/runtime/environment_rb_spec.rb +0 -162
data/.gitignore CHANGED
@@ -1,12 +1,19 @@
1
+ # system crap
1
2
  .DS_Store
2
3
  .*.swp
4
+
5
+ # files created by running the specs
3
6
  tmp
7
+
8
+ # built gems
4
9
  pkg
5
10
  *.gem
11
+
12
+ # rubinius bytecode
6
13
  *.rbc
7
14
 
15
+ # output from ronn
8
16
  lib/bundler/man
9
17
 
10
- man/*
11
- !man/*.ronn
12
- !man/index.txt
18
+ # output from ci_reporter
19
+ spec/reports
data/CHANGELOG.md CHANGED
@@ -1,3 +1,34 @@
1
+ ## 1.0.5 (November 13, 2010)
2
+
3
+ Bugfixes:
4
+
5
+ - Fix regression disabling all operations that employ sudo
6
+
7
+ ## 1.0.4 (November 12, 2010)
8
+
9
+ Bugfixes:
10
+
11
+ - Expand relative :paths from Bundler.root (eg ./foogem)
12
+ - Allow git gems in --without groups while --frozen
13
+ - Allow gem :ref to be a symbol as well as a string
14
+ - Fix exception when Gemfile needs a newer Bundler version
15
+ - Explanation when the current Bundler version conflicts
16
+ - Explicit error message if Gemfile needs newer Bundler
17
+ - Ignore an empty string BUNDLE_GEMFILE
18
+ - Skeleton gemspec now works with older versions of git
19
+ - Fix shell quoting and ref fetching in GemHelper
20
+ - Disable colored output in --deployment
21
+ - Preserve line endings in lock file
22
+
23
+ Features:
24
+
25
+ - Add support for 'mingw32' platform (aka RubyInstaller)
26
+ - Large speed increase when Gemfile.lock is already present
27
+ - Huge speed increase when many (100+) system gems are present
28
+ - Significant expansion of ISSUES, man pages, and docs site
29
+ - Remove Open3 from GemHelper (now it works on Windows™®©)
30
+ - Allow setting roles in built-in cap and vlad tasks
31
+
1
32
  ## 1.0.3 (October 15, 2010)
2
33
 
3
34
  Bugfixes:
data/ISSUES.md CHANGED
@@ -6,7 +6,22 @@ Instructions for common Bundler use-cases can be found on the [Bundler documenta
6
6
 
7
7
  After reading the documentation, try these troubleshooting steps:
8
8
 
9
- rm -rf ~/.bundle/ ~/.gem/ .bundle/ vendor/cache/ Gemfile.lock
9
+ # remove user-specific gems and git repos
10
+ rm -rf ~/.bundle/ ~/.gem/
11
+
12
+ # remove system-wide git repos and git checkouts
13
+ rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/
14
+
15
+ # remove project-specific settings and git repos
16
+ rm -rf .bundle/
17
+
18
+ # remove project-specific cached .gem files
19
+ rm -rf vendor/cache/
20
+
21
+ # remove the saved resolve of the Gemfile
22
+ rm -rf Gemfile.lock
23
+
24
+ # try to install one more time
10
25
  bundle install
11
26
 
12
27
  ## Reporting unresolved problems
data/LICENSE CHANGED
@@ -1,4 +1,5 @@
1
- Copyright (c) 2009 Engine Yard
1
+ Portions copyright (c) 2010 Andre Arko
2
+ Portions copyright (c) 2009 Engine Yard
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person obtaining
4
5
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -9,20 +9,42 @@ end
9
9
 
10
10
  begin
11
11
  require 'rspec/core/rake_task'
12
-
13
- task :clear_tmp do
14
- FileUtils.rm_rf(File.expand_path("../tmp", __FILE__))
15
- end
12
+ require 'ronn'
16
13
 
17
14
  desc "Run specs"
18
15
  RSpec::Core::RakeTask.new do |t|
19
16
  t.rspec_opts = %w(-fs --color)
20
17
  t.ruby_opts = %w(-w)
21
18
  end
19
+ task :spec => "man:build"
20
+
21
+ begin
22
+ require 'ci/reporter/rake/rspec'
22
23
 
23
- task :spec => :build
24
+ namespace :ci do
25
+ desc "Run specs with Hudson output"
26
+ RSpec::Core::RakeTask.new(:spec)
27
+ task :spec => ["ci:setup:rspec", "man:build"]
28
+ end
29
+
30
+ rescue LoadError
31
+ namespace :ci do
32
+ task :spec do
33
+ abort "Run `rake ci:deps` to be able to run the CI specs"
34
+ end
35
+
36
+ desc "Install CI dependencies"
37
+ task :deps do
38
+ sh "gem list ci_reporter | (grep 'ci_reporter' 1> /dev/null) || gem install ci_reporter --no-ri --no-rdoc"
39
+ end
40
+ task :deps => "spec:deps"
41
+ end
42
+ end
24
43
 
25
44
  namespace :spec do
45
+ desc "Run the spec suite with the sudo tests"
46
+ task :sudo => ["set_sudo", "clean", "spec"]
47
+
26
48
  task :set_sudo do
27
49
  ENV['BUNDLER_SUDO_TESTS'] = '1'
28
50
  end
@@ -35,9 +57,6 @@ begin
35
57
  end
36
58
  end
37
59
 
38
- desc "Run the spec suite with the sudo tests"
39
- task :sudo => ["set_sudo", "clean", "spec"]
40
-
41
60
  namespace :rubygems do
42
61
  # Rubygems 1.3.5, 1.3.6, and HEAD specs
43
62
  rubyopt = ENV["RUBYOPT"]
@@ -89,8 +108,17 @@ begin
89
108
 
90
109
  rescue LoadError
91
110
  task :spec do
92
- abort "Run `gem install rspec --pre` to be able to run specs"
111
+ abort "Run `rake spec:deps` to be able to run the specs"
93
112
  end
113
+
114
+ namespace :spec do
115
+ desc "Ensure spec dependencies are installed"
116
+ task :deps do
117
+ sh "gem list ronn | (grep 'ronn' 1> /dev/null) || gem install ronn --no-ri --no-rdoc"
118
+ sh "gem list rspec | (grep 'rspec (2.0' 1> /dev/null) || gem install rspec --no-ri --no-rdoc"
119
+ end
120
+ end
121
+
94
122
  end
95
123
 
96
124
  namespace :man do
@@ -108,11 +136,11 @@ namespace :man do
108
136
  sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
109
137
  end
110
138
 
111
- task :build_pages => "#{roff}.txt"
139
+ task :build_all_pages => "#{roff}.txt"
112
140
  end
113
141
 
114
142
  desc "Build the man pages"
115
- task :build => "man:build_pages"
143
+ task :build => "man:build_all_pages"
116
144
 
117
145
  desc "Clean up from the built man pages"
118
146
  task :clean do
@@ -134,6 +162,4 @@ namespace :vendor do
134
162
  end
135
163
  end
136
164
 
137
- task :build => "man:build"
138
-
139
165
  task :default => :spec
data/bin/bundle CHANGED
@@ -13,7 +13,7 @@ begin
13
13
  Bundler::CLI.start
14
14
  rescue Bundler::BundlerError => e
15
15
  Bundler.ui.error e.message
16
- Bundler.ui.error e.backtrace.join("\n") if ENV["BUNDLE_DEBUG"]
16
+ Bundler.ui.debug e.backtrace.join("\n")
17
17
  exit e.status_code
18
18
  rescue Interrupt
19
19
  Bundler.ui.error "\nQuitting..."
data/lib/bundler.rb CHANGED
@@ -47,9 +47,10 @@ module Bundler
47
47
 
48
48
 
49
49
  WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
50
+ FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
50
51
  NULL = WINDOWS ? "NUL" : "/dev/null"
51
52
 
52
-
53
+ # Internal errors, should be rescued
53
54
  class VersionConflict < BundlerError
54
55
  attr_reader :conflicts
55
56
 
@@ -61,7 +62,6 @@ module Bundler
61
62
  status_code(6)
62
63
  end
63
64
 
64
- # Internal errors, should be rescued
65
65
  class InvalidSpecSet < StandardError; end
66
66
 
67
67
  class << self
@@ -192,11 +192,14 @@ module Bundler
192
192
  end
193
193
 
194
194
  def requires_sudo?
195
+ return @requires_sudo if @checked_for_sudo
196
+
195
197
  path = bundle_path
196
198
  path = path.parent until path.exist?
197
- sudo_present = !`which sudo 2>#{NULL}`.empty?
199
+ sudo_present = !(`which sudo` rescue '').empty?
198
200
 
199
- settings.allow_sudo? && !File.writable?(path) && sudo_present
201
+ @checked_for_sudo = true
202
+ @requires_sudo = settings.allow_sudo? && !File.writable?(path) && sudo_present
200
203
  end
201
204
 
202
205
  def mkdir_p(path)
@@ -262,21 +265,6 @@ module Bundler
262
265
  if lockfile.exist? && lockfile.read(3) == "---"
263
266
  Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
264
267
  lockfile.rmtree
265
- # lock = YAML.load_file(lockfile)
266
- #
267
- # source_uris = lock["sources"].map{|s| s["Rubygems"]["uri"] }
268
- # sources = [Bundler::Source::Rubygems.new({"remotes" => source_uris})]
269
- #
270
- # deps = lock["dependencies"].map do |name, opts|
271
- # version = opts.delete("version")
272
- # Bundler::Dependency.new(name, version, opts)
273
- # end
274
- #
275
- # definition = Bundler::Definition.new(nil, deps, sources, {})
276
- #
277
- # File.open(lockfile, 'w') do |f|
278
- # f.write definition.to_lock
279
- # end
280
268
  end
281
269
  end
282
270
 
@@ -6,6 +6,5 @@ require 'bundler/deployment'
6
6
 
7
7
  Capistrano::Configuration.instance(:must_exist).load do
8
8
  after "deploy:update_code", "bundle:install"
9
-
10
9
  Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
11
10
  end
data/lib/bundler/cli.rb CHANGED
@@ -12,9 +12,9 @@ module Bundler
12
12
 
13
13
  def initialize(*)
14
14
  super
15
- use_shell = options["no-color"] ? Thor::Shell::Basic.new : shell
16
-
17
- Bundler.ui = UI::Shell.new(use_shell)
15
+ the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
16
+ Bundler.ui = UI::Shell.new(the_shell)
17
+ Bundler.ui.debug! if options["verbose"]
18
18
  Gem::DefaultUserInteraction.ui = UI::RGProxy.new(Bundler.ui)
19
19
  end
20
20
 
@@ -22,6 +22,7 @@ module Bundler
22
22
 
23
23
  default_task :install
24
24
  class_option "no-color", :type => :boolean, :banner => "Disable colorization in output"
25
+ class_option "verbose", :type => :boolean, :banner => "Enable verbose output mode", :aliases => "-V"
25
26
 
26
27
  def help(cli = nil)
27
28
  case cli
@@ -162,8 +163,11 @@ module Bundler
162
163
  end
163
164
  opts[:without].map!{|g| g.to_sym }
164
165
 
165
-
166
166
  ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
167
+ ENV['RB_USER_INSTALL'] = '1' if Bundler::FREEBSD
168
+
169
+ # Just disable color in deployment mode
170
+ Bundler.ui.shell = Thor::Shell::Basic.new if opts[:deployment]
167
171
 
168
172
  if opts[:production]
169
173
  opts[:deployment] = true
@@ -499,8 +503,7 @@ module Bundler
499
503
  private
500
504
 
501
505
  def have_groff?
502
- `which groff 2>#{NULL}`
503
- $? == 0
506
+ !(`which groff` rescue '').empty?
504
507
  end
505
508
 
506
509
  def locate_gem(name)
@@ -511,5 +514,6 @@ module Bundler
511
514
  end
512
515
  spec.full_gem_path
513
516
  end
517
+
514
518
  end
515
519
  end
@@ -14,10 +14,7 @@ module Bundler
14
14
  raise GemfileNotFound, "#{gemfile} not found"
15
15
  end
16
16
 
17
- # TODO: move this back into DSL
18
- builder = Dsl.new
19
- builder.instance_eval(Bundler.read_file(gemfile.to_s), gemfile.to_s, 1)
20
- builder.to_definition(lockfile, unlock)
17
+ Dsl.evaluate(gemfile, lockfile, unlock)
21
18
  end
22
19
 
23
20
  =begin
@@ -93,7 +90,8 @@ module Bundler
93
90
  specs = resolve.materialize(requested_dependencies)
94
91
 
95
92
  unless specs["bundler"].any?
96
- bundler = index.search(Gem::Dependency.new('bundler', VERSION)).last
93
+ local = Bundler.settings[:frozen] ? rubygems_index : index
94
+ bundler = local.search(Gem::Dependency.new('bundler', VERSION)).last
97
95
  specs["bundler"] = bundler if bundler
98
96
  end
99
97
 
@@ -150,7 +148,9 @@ module Bundler
150
148
  end
151
149
 
152
150
  # Run a resolve against the locally available gems
153
- last_resolve.merge Resolver.resolve(expanded_dependencies, index, source_requirements, last_resolve)
151
+ local = Resolver.resolve(expanded_dependencies,
152
+ index, source_requirements, last_resolve, unlocked?)
153
+ last_resolve.merge(local)
154
154
  end
155
155
  end
156
156
  end
@@ -163,6 +163,14 @@ module Bundler
163
163
  end
164
164
  end
165
165
 
166
+ def rubygems_index
167
+ @rubygems_index ||= Index.build do |idx|
168
+ @sources.find_all{|s| s.is_a?(Source::Rubygems) }.each do |s|
169
+ idx.use s.specs
170
+ end
171
+ end
172
+ end
173
+
166
174
  def no_sources?
167
175
  @sources.length == 1 && @sources.first.remotes.empty?
168
176
  end
@@ -181,9 +189,11 @@ module Bundler
181
189
  return
182
190
  end
183
191
 
184
- File.open(file, 'wb') do |f|
185
- f.puts contents
186
- end
192
+ # Convert to \r\n if the existing lock has them
193
+ # i.e., Windows with `git config core.autocrlf=true`
194
+ contents.gsub!(/\n/, "\r\n") if @lockfile_contents.match("\r\n")
195
+
196
+ File.open(file, 'wb'){|f| f.puts(contents) }
187
197
  end
188
198
 
189
199
  def to_lock
@@ -417,5 +427,9 @@ module Bundler
417
427
  groups.map! { |g| g.to_sym }
418
428
  dependencies.reject { |d| !d.should_include? || (d.groups & groups).empty? }
419
429
  end
430
+
431
+ def unlocked?
432
+ @lockfile_contents.empty?
433
+ end
420
434
  end
421
435
  end
@@ -16,7 +16,8 @@ module Bundler
16
16
  :mri_18 => Gem::Platform::RUBY,
17
17
  :mri_19 => Gem::Platform::RUBY,
18
18
  :jruby => Gem::Platform::JAVA,
19
- :mswin => Gem::Platform::MSWIN
19
+ :mswin => Gem::Platform::MSWIN,
20
+ :mingw => Gem::Platform::MINGW
20
21
  }.freeze
21
22
 
22
23
  def initialize(name, version, options = {}, &blk)
@@ -108,7 +109,11 @@ module Bundler
108
109
  end
109
110
 
110
111
  def mswin?
111
- # w0t?
112
+ Bundler::WINDOWS
113
+ end
114
+
115
+ def mingw?
116
+ Bundler::WINDOWS && Gem::Platform.local.os == "mingw32"
112
117
  end
113
118
  end
114
119
  end
@@ -1,21 +1,37 @@
1
1
  module Bundler
2
2
  class Deployment
3
3
  def self.define_task(context, task_method = :task, opts = {})
4
+ if context.is_a?(Capistrano::Configuration)
5
+ context_name = "capistrano"
6
+ role_default = "{:except => {:no_release => true}}"
7
+ else
8
+ context_name = "vlad"
9
+ role_default = "[:app]"
10
+ end
11
+
12
+ roles = context.fetch(:bundle_roles, nil)
13
+ opts[:roles] = roles if roles
14
+
4
15
  context.send :namespace, :bundle do
5
16
  send :desc, <<-DESC
6
17
  Install the current Bundler environment. By default, gems will be \
7
18
  installed to the shared/bundle path. Gems in the development and \
8
19
  test group will not be installed. The install command is executed \
9
- with the --deployment and --quiet flags. You can override any of \
10
- these defaults by setting the variables shown below. If the bundle \
11
- cmd cannot be found then you can override the bundle_cmd variable \
12
- to specifiy which one it should use.
20
+ with the --deployment and --quiet flags. If the bundle cmd cannot \
21
+ be found then you can override the bundle_cmd variable to specifiy \
22
+ which one it should use.
23
+
24
+ You can override any of these defaults by setting the variables shown below.
25
+
26
+ N.B. bundle_roles must be defined before you require 'bundler/#{context_name}' \
27
+ in your deploy.rb file.
13
28
 
14
- set :bundle_gemfile, "Gemfile"
15
- set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
16
- set :bundle_flags, "--deployment --quiet"
17
- set :bundle_without, [:development, :test]
18
- set :bundle_cmd, "bundle" # e.g. change to "/opt/ruby/bin/bundle"
29
+ set :bundle_gemfile, "Gemfile"
30
+ set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
31
+ set :bundle_flags, "--deployment --quiet"
32
+ set :bundle_without, [:development, :test]
33
+ set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle"
34
+ set :bundle_roles, #{role_default} # e.g. [:app, :batch]
19
35
  DESC
20
36
  send task_method, :install, opts do
21
37
  bundle_cmd = context.fetch(:bundle_cmd, "bundle")