bundler 1.1.pre.1 → 1.1.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.

@@ -1,3 +1,10 @@
1
+ ## 1.1.pre.2 (April 28, 2011)
2
+
3
+ Features:
4
+
5
+ - Add :github option to Gemfile DSL for easy git repos
6
+ - Merge all fixes from 1.0.12 and 1.0.13
7
+
1
8
  ## 1.1.pre.1 (February 2, 2011)
2
9
 
3
10
  Bugfixes:
@@ -22,6 +29,45 @@ Removed:
22
29
  - Removed bundle install --production
23
30
  - Removed bundle install --disable-shared-gems
24
31
 
32
+ ## 1.0.13 (April 28, 2011)
33
+
34
+ Features:
35
+
36
+ - Compatibility with Rubygems master (soon to be v1.8)
37
+ - Check for Rubygems features before overriding them
38
+ - Informative error when --path points to a broken symlink
39
+
40
+ ## 1.0.12 (April 8, 2011)
41
+
42
+ Features:
43
+
44
+ - Add --no-deployment option to `install` for disabling it on dev machines
45
+ - Better error message when git fails and cache is present (@parndt)
46
+ - Honor :bundle_cmd in cap `rake` command (@voidlock, @cgriego)
47
+
48
+ Bugfixes:
49
+
50
+ - Compatibility with Rubygems 1.7 and Rails 2.3 and vendored gems (@evanphx)
51
+ - Fix changing gem order in lock (@gucki)
52
+ - Remove color escape sequences when displaying man pages (@bgreenlee)
53
+ - Fix creating GEM_HOME on both JRuby 1.5 and 1.6 (@nickseiger)
54
+ - Fix gems without a gemspec and directories in bin/ (@epall)
55
+ - Fix --no-prune option for `bundle install` (@cmeiklejohn)
56
+
57
+ ## 1.0.11 (April 1, 2011)
58
+
59
+ Features:
60
+
61
+ - Compatibility with Rubygems 1.6 and 1.7
62
+ - Better error messages when a git command fails
63
+
64
+ Bugfixes:
65
+
66
+ - Don't always update gemspec gems (@carllerche)
67
+ - Remove ivar warnings (@jackdempsey)
68
+ - Fix occasional git failures in zsh (@jonah-carbonfive)
69
+ - Consistent lock for gems with double deps like Cap (@akahn)
70
+
25
71
  ## 1.0.10 (February 1, 2011)
26
72
 
27
73
  Bugfixes:
data/Rakefile CHANGED
@@ -60,7 +60,7 @@ begin
60
60
  namespace :rubygems do
61
61
  # Rubygems 1.3.5, 1.3.6, and HEAD specs
62
62
  rubyopt = ENV["RUBYOPT"]
63
- %w(master v1.3.6 v1.3.7 v1.4.0 v1.4.1 v1.5.0).each do |rg|
63
+ %w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.1 v1.7.2).each do |rg|
64
64
  desc "Run specs with Rubygems #{rg}"
65
65
  RSpec::Core::RakeTask.new(rg) do |t|
66
66
  t.rspec_opts = %w(-fs --color)
@@ -71,14 +71,31 @@ begin
71
71
  unless File.directory?("tmp/rubygems")
72
72
  system("git clone git://github.com/rubygems/rubygems.git tmp/rubygems")
73
73
  end
74
- system("cd tmp/rubygems && git checkout #{rg}")
75
- system("git pull") if rg == "master"
74
+ Dir.chdir("tmp/rubygems") do
75
+ system("git remote update")
76
+ system("git checkout #{rg}")
77
+ system("git pull origin master") if rg == "master"
78
+ end
79
+ puts "Running bundler specs against rubygems '#{rg}'"
76
80
  ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
77
81
  end
78
82
 
79
83
  task rg => "clone_rubygems_#{rg}"
80
84
  task "rubygems:all" => rg
81
85
  end
86
+
87
+ desc "Run specs under a Rubygems checkout (set RG=path)"
88
+ RSpec::Core::RakeTask.new("co") do |t|
89
+ t.rspec_opts = %w(-fs --color)
90
+ t.ruby_opts = %w(-w)
91
+ end
92
+
93
+ task "setup_co" do
94
+ ENV["RUBYOPT"] = "-I#{File.expand_path ENV['RG']} #{rubyopt}"
95
+ end
96
+
97
+ task "co" => "setup_co"
98
+ task "rubygems:all" => "co"
82
99
  end
83
100
 
84
101
  namespace :ruby do
data/bin/bundle CHANGED
@@ -19,4 +19,9 @@ rescue Interrupt => e
19
19
  Bundler.ui.error "\nQuitting..."
20
20
  Bundler.ui.debug e.backtrace.join("\n")
21
21
  exit 1
22
+ rescue Exception => e
23
+ Bundler.ui.error "Unfortunately, a fatal error has occurred. " +
24
+ "Please report this error to the Bundler issue tracker at " +
25
+ "https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!"
26
+ raise e
22
27
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
8
8
  s.name = "bundler"
9
9
  s.version = Bundler::VERSION
10
10
  s.platform = Gem::Platform::RUBY
11
- s.authors = ["Carl Lerche", "Yehuda Katz", "André Arko", "Terence Lee"]
12
- s.email = ["carlhuda@engineyard.com"]
11
+ s.authors = ["André Arko", "Terence Lee", "Carl Lerche", "Yehuda Katz"]
12
+ s.email = ["andre@arko.net"]
13
13
  s.homepage = "http://gembundler.com"
14
14
  s.summary = %q{The best way to manage your application's dependencies}
15
15
  s.description = %q{Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably}
@@ -18,13 +18,12 @@ Gem::Specification.new do |s|
18
18
  s.rubyforge_project = "bundler"
19
19
 
20
20
  s.add_development_dependency "ronn"
21
- s.add_development_dependency "rspec", "2.0.0.rc"
21
+ s.add_development_dependency "rspec", "~> 2.0"
22
22
 
23
23
  # Man files are required because they are ignored by git
24
24
  man_files = Dir.glob("lib/bundler/man/**/*")
25
25
  s.files = `git ls-files`.split("\n") + man_files
26
26
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
27
  s.executables = %w(bundle)
28
- s.default_executable = "bundle"
29
28
  s.require_paths = ["lib"]
30
29
  end
@@ -9,6 +9,7 @@ end
9
9
 
10
10
  require 'yaml'
11
11
  require 'bundler/rubygems_ext'
12
+ require 'bundler/rubygems_integration'
12
13
  require 'bundler/version'
13
14
 
14
15
  module Bundler
@@ -87,7 +88,6 @@ module Bundler
87
88
  end
88
89
 
89
90
  def bundle_path
90
- # STDERR.puts settings.path
91
91
  @bundle_path ||= Pathname.new(settings.path).expand_path(root)
92
92
  end
93
93
 
@@ -140,11 +140,11 @@ module Bundler
140
140
  end
141
141
 
142
142
  def ruby_scope
143
- "#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
143
+ "#{Bundler.rubygems.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
144
144
  end
145
145
 
146
146
  def user_bundle_path
147
- Pathname.new(Gem.user_home).join(".bundler")
147
+ Pathname.new(Bundler.rubygems.user_home).join(".bundler")
148
148
  end
149
149
 
150
150
  def home
@@ -202,7 +202,7 @@ module Bundler
202
202
  end
203
203
 
204
204
  def requires_sudo?
205
- return @requires_sudo if @checked_for_sudo
205
+ return @requires_sudo if defined?(@checked_for_sudo) && @checked_for_sudo
206
206
 
207
207
  path = bundle_path
208
208
  path = path.parent until path.exist?
@@ -261,14 +261,17 @@ module Bundler
261
261
  if settings[:disable_shared_gems]
262
262
  ENV['GEM_PATH'] = ''
263
263
  ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
264
- elsif Gem.dir != bundle_path.to_s
265
- paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
264
+ elsif Bundler.rubygems.gem_dir != bundle_path.to_s
265
+ possibles = [Bundler.rubygems.gem_dir, Bundler.rubygems.gem_path]
266
+ paths = possibles.flatten.compact.uniq.reject { |p| p.empty? }
266
267
  ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
267
268
  ENV["GEM_HOME"] = bundle_path.to_s
268
269
  end
269
270
 
270
- FileUtils.mkdir_p bundle_path.to_s
271
- Gem.clear_paths
271
+ # TODO: This mkdir_p is only needed for JRuby <= 1.5 and should go away (GH #602)
272
+ FileUtils.mkdir_p bundle_path.to_s rescue nil
273
+
274
+ Bundler.rubygems.clear_paths
272
275
  end
273
276
 
274
277
  def upgrade_lockfile
@@ -7,5 +7,5 @@ require 'bundler/deployment'
7
7
  Capistrano::Configuration.instance(:must_exist).load do
8
8
  after "deploy:update_code", "bundle:install"
9
9
  Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
10
- set :rake, 'bundle exec rake'
10
+ set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" }
11
11
  end
@@ -4,9 +4,6 @@ require 'thor/actions'
4
4
  require 'rubygems/user_interaction'
5
5
  require 'rubygems/config_file'
6
6
 
7
- # Work around a RubyGems bug
8
- Gem.configuration
9
-
10
7
  module Bundler
11
8
  class CLI < Thor
12
9
  include Thor::Actions
@@ -16,7 +13,7 @@ module Bundler
16
13
  the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
17
14
  Bundler.ui = UI::Shell.new(the_shell)
18
15
  Bundler.ui.debug! if options["verbose"]
19
- Gem::DefaultUserInteraction.ui = UI::RGProxy.new(Bundler.ui)
16
+ Bundler.rubygems.ui = UI::RGProxy.new(Bundler.ui)
20
17
  end
21
18
 
22
19
  check_unknown_options! unless ARGV.include?("exec") || ARGV.include?("config")
@@ -46,7 +43,7 @@ module Bundler
46
43
 
47
44
  if have_groff? && root !~ %r{^file:/.+!/META-INF/jruby.home/.+}
48
45
  groff = "groff -Wall -mtty-char -mandoc -Tascii"
49
- pager = ENV['MANPAGER'] || ENV['PAGER'] || 'less'
46
+ pager = ENV['MANPAGER'] || ENV['PAGER'] || 'less -R'
50
47
 
51
48
  Kernel.exec "#{groff} #{root}/#{command} | #{pager}"
52
49
  else
@@ -162,6 +159,7 @@ module Bundler
162
159
  end
163
160
  opts[:without].map!{|g| g.to_sym }
164
161
 
162
+ # Can't use Bundler.settings for this because settings needs gemfile.dirname
165
163
  ENV['BUNDLE_GEMFILE'] = File.expand_path(opts[:gemfile]) if opts[:gemfile]
166
164
  ENV['RB_USER_INSTALL'] = '1' if Bundler::FREEBSD
167
165
 
@@ -189,12 +187,19 @@ module Bundler
189
187
  Bundler.settings[:frozen] = '1'
190
188
  end
191
189
 
190
+ # When install is called with --no-deployment, disable deployment mode
191
+ if opts[:deployment] == false
192
+ Bundler.settings.delete(:frozen)
193
+ opts[:system] = true
194
+ end
195
+
192
196
  # Can't use Bundler.settings for this because settings needs gemfile.dirname
193
197
  Bundler.settings[:path] = nil if opts[:system]
194
198
  Bundler.settings[:path] = "vendor/bundle" if opts[:deployment]
195
199
  Bundler.settings[:path] = opts[:path] if opts[:path]
196
200
  Bundler.settings[:path] ||= "bundle" if opts[:standalone]
197
201
  Bundler.settings[:bin] = opts["binstubs"] if opts[:binstubs]
202
+ Bundler.settings[:no_prune] = true if opts["no-prune"]
198
203
  Bundler.settings[:disable_shared_gems] = '1' if Bundler.settings[:path]
199
204
  Bundler.settings.without = opts[:without] unless opts[:without].empty?
200
205
  Bundler.ui.be_quiet! if opts[:quiet]
@@ -212,7 +217,7 @@ module Bundler
212
217
  "Use `bundle show [gemname]` to see where a bundled gem is installed."
213
218
  end
214
219
  rescue GemNotFound => e
215
- if opts[:local]
220
+ if opts[:local] && Bundler.app_cache.exist?
216
221
  Bundler.ui.warn "Some gems seem to be missing from your vendor/cache directory."
217
222
  end
218
223
 
@@ -272,7 +277,7 @@ module Bundler
272
277
  def cache
273
278
  Bundler.definition.resolve_with_cache!
274
279
  Bundler.load.cache
275
- Bundler.settings[:no_prune] = true if options[:no_prune]
280
+ Bundler.settings[:no_prune] = true if options["no-prune"]
276
281
  Bundler.load.lock
277
282
  rescue GemNotFound => e
278
283
  Bundler.ui.error(e.message)
@@ -61,7 +61,7 @@ module Bundler
61
61
  @unlock[:gems] ||= []
62
62
  @unlock[:sources] ||= []
63
63
 
64
- current_platform = Gem.platforms.map { |p| generic(p) }.compact.last
64
+ current_platform = Bundler.rubygems.platforms.map { |p| generic(p) }.compact.last
65
65
  @new_platform = !@platforms.include?(current_platform)
66
66
  @platforms |= [current_platform]
67
67
 
@@ -141,6 +141,10 @@ module Bundler
141
141
  @locked_specs
142
142
  else
143
143
  last_resolve = converge_locked_specs
144
+
145
+ # Record the specs available in each gem's source, so that those
146
+ # specs will be available later when the resolver knows where to
147
+ # look for that gemspec (or its dependencies)
144
148
  source_requirements = {}
145
149
  dependencies.each do |dep|
146
150
  next unless dep.source
@@ -225,7 +229,7 @@ module Bundler
225
229
 
226
230
  handled = []
227
231
  dependencies.
228
- sort_by { |d| d.name }.
232
+ sort_by { |d| d.to_s }.
229
233
  each do |dep|
230
234
  next if handled.include?(dep.name)
231
235
  out << dep.to_lock
@@ -235,11 +239,17 @@ module Bundler
235
239
  out
236
240
  end
237
241
 
238
- def ensure_equivalent_gemfile_and_lockfile
242
+ def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
239
243
  changes = false
240
244
 
241
- msg = "You have modified your Gemfile in development but did not check\n" \
242
- "the resulting snapshot (Gemfile.lock) into version control"
245
+ msg = "You are trying to install in deployment mode after changing\n" \
246
+ "your Gemfile. Run `bundle install` elsewhere and add the\n" \
247
+ "updated Gemfile.lock to version control."
248
+
249
+ unless explicit_flag
250
+ msg += "\n\nIf this is a development machine, remove the Gemfile " \
251
+ "freeze \nby running `bundle install --no-deployment`."
252
+ end
243
253
 
244
254
  added = []
245
255
  deleted = []
@@ -287,6 +297,7 @@ module Bundler
287
297
  msg << "\n\nYou have added to the Gemfile:\n" << added.join("\n") if added.any?
288
298
  msg << "\n\nYou have deleted from the Gemfile:\n" << deleted.join("\n") if deleted.any?
289
299
  msg << "\n\nYou have changed in the Gemfile:\n" << changed.join("\n") if changed.any?
300
+ msg << "\n"
290
301
 
291
302
  raise ProductionError, msg if added.any? || deleted.any? || changed.any?
292
303
  end
@@ -367,8 +378,10 @@ module Bundler
367
378
  # If the spec is no longer in the path source, unlock it. This
368
379
  # commonly happens if the version changed in the gemspec
369
380
  next unless other
381
+
382
+ deps2 = other.dependencies.select { |d| d.type != :development }
370
383
  # If the dependencies of the path source have changed, unlock it
371
- next unless s.dependencies.sort == other.dependencies.sort
384
+ next unless s.dependencies.sort == deps2.sort
372
385
  end
373
386
 
374
387
  converged << s
@@ -72,7 +72,8 @@ module Bundler
72
72
  out = " #{name}"
73
73
 
74
74
  unless requirement == Gem::Requirement.default
75
- out << " (#{requirement.to_s})"
75
+ reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }
76
+ out << " (#{reqs.join(', ')})"
76
77
  end
77
78
 
78
79
  out << '!' if source
@@ -76,18 +76,18 @@ module Bundler
76
76
  def source(source, options = {})
77
77
  case source
78
78
  when :gemcutter, :rubygems, :rubyforge then
79
- rubygems_source "http://rubygems.org"
79
+ @rubygems_source.add_remote "http://rubygems.org"
80
80
  return
81
81
  when String
82
- rubygems_source source
82
+ @rubygems_source.add_remote source
83
83
  return
84
- end
85
-
86
- @source = source
87
- options[:prepend] ? @sources.unshift(@source) : @sources << @source
84
+ else
85
+ @source = source
86
+ options[:prepend] ? @sources.unshift(@source) : @sources << @source
88
87
 
89
- yield if block_given?
90
- @source
88
+ yield if block_given?
89
+ return @source
90
+ end
91
91
  ensure
92
92
  @source = nil
93
93
  end
@@ -183,7 +183,7 @@ module Bundler
183
183
  def _normalize_options(name, version, opts)
184
184
  _normalize_hash(opts)
185
185
 
186
- invalid_keys = opts.keys - %w(group groups git path name branch ref tag require submodules platform platforms)
186
+ invalid_keys = opts.keys - %w(group groups git github path name branch ref tag require submodules platform platforms)
187
187
  if invalid_keys.any?
188
188
  plural = invalid_keys.size > 1
189
189
  message = "You passed #{invalid_keys.map{|k| ':'+k }.join(", ")} "
@@ -209,7 +209,11 @@ module Bundler
209
209
  raise DslError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
210
210
  end
211
211
 
212
- # Normalize git and path options
212
+ if github = opts.delete(:github)
213
+ github = "#{github}/#{github}" unless github.include?("/")
214
+ opts["git"] = "git://github.com/#{github}.git"
215
+ end
216
+
213
217
  ["git", "path"].each do |type|
214
218
  if param = opts[type]
215
219
  if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
@@ -8,16 +8,18 @@ module Bundler
8
8
  i
9
9
  end
10
10
 
11
- attr_reader :specs
11
+ attr_reader :specs, :sources
12
12
  protected :specs
13
13
 
14
14
  def initialize
15
+ @sources = []
15
16
  @cache = {}
16
17
  @specs = Hash.new { |h,k| h[k] = [] }
17
18
  end
18
19
 
19
20
  def initialize_copy(o)
20
21
  super
22
+ @sources = @sources.dup
21
23
  @cache = {}
22
24
  @specs = Hash.new { |h,k| h[k] = [] }
23
25
 
@@ -34,13 +36,19 @@ module Bundler
34
36
  def search(query)
35
37
  case query
36
38
  when Gem::Specification, RemoteSpecification, LazySpecification then search_by_spec(query)
37
- when String then @specs[query]
38
- else search_by_dependency(query)
39
+ when String then specs_by_name(query)
40
+ when Gem::Dependency then search_by_dependency(query)
41
+ else
42
+ raise "You can't search for a #{query.inspect}."
39
43
  end
40
44
  end
41
45
 
46
+ def specs_by_name(name)
47
+ @specs[name]
48
+ end
49
+
42
50
  def search_for_all_platforms(dependency, base = [])
43
- specs = @specs[dependency.name] + base
51
+ specs = specs_by_name(dependency.name) + base
44
52
 
45
53
  wants_prerelease = dependency.requirement.prerelease?
46
54
  only_prerelease = specs.all? {|spec| spec.version.prerelease? }
@@ -54,15 +62,19 @@ module Bundler
54
62
  end
55
63
 
56
64
  def sources
57
- @specs.values.map do |specs|
58
- specs.map{|s| s.source.class }
65
+ specs.values.map do |specs|
66
+ specs.map{|s| s.source }
59
67
  end.flatten.uniq
60
68
  end
61
69
 
70
+ def source_types
71
+ sources.map{|s| s.class }.uniq
72
+ end
73
+
62
74
  alias [] search
63
75
 
64
76
  def <<(spec)
65
- arr = @specs[spec.name]
77
+ arr = specs_by_name(spec.name)
66
78
 
67
79
  arr.delete_if do |s|
68
80
  same_version?(s.version, spec.version) && s.platform == spec.platform
@@ -73,7 +85,7 @@ module Bundler
73
85
  end
74
86
 
75
87
  def each(&blk)
76
- @specs.values.each do |specs|
88
+ specs.values.each do |specs|
77
89
  specs.each(&blk)
78
90
  end
79
91
  end
@@ -96,7 +108,7 @@ module Bundler
96
108
  private
97
109
 
98
110
  def search_by_spec(spec)
99
- @specs[spec.name].select do |s|
111
+ specs_by_name(spec.name).select do |s|
100
112
  same_version?(s.version, spec.version) && Gem::Platform.new(s.platform) == Gem::Platform.new(spec.platform)
101
113
  end
102
114
  end
@@ -114,12 +126,11 @@ module Bundler
114
126
 
115
127
  def search_by_dependency(dependency)
116
128
  @cache[dependency.hash] ||= begin
117
- specs = @specs[dependency.name]
129
+ specs = specs_by_name(dependency.name)
130
+ found = specs.select { |spec| dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) }
118
131
 
119
132
  wants_prerelease = dependency.requirement.prerelease?
120
133
  only_prerelease = specs.all? {|spec| spec.version.prerelease? }
121
- found = specs.select { |spec| dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) }
122
-
123
134
  unless wants_prerelease || only_prerelease
124
135
  found.reject! { |spec| spec.version.prerelease? }
125
136
  end