bundler 1.0.10 → 1.0.11

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.

data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 1.0.11 (April 1, 2011)
2
+
3
+ Features:
4
+
5
+ - Compatibility with Rubygems 1.6 and 1.7
6
+ - Better error messages when a git command fails
7
+
8
+ Bugfixes:
9
+
10
+ - Don't always update gemspec gems (@carllerche)
11
+ - Remove ivar warnings (@jackdempsey)
12
+ - Fix occasional git failures in zsh (@jonah-carbonfive)
13
+ - Consistent lock for gems with double deps like Cap (@akahn)
14
+
1
15
  ## 1.0.10 (February 1, 2011)
2
16
 
3
17
  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).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,7 +71,11 @@ 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 remote update && git reset --hard origin/#{rg}")
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
75
79
  ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
76
80
  end
77
81
 
data/bundler.gemspec CHANGED
@@ -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}
@@ -25,6 +25,5 @@ Gem::Specification.new do |s|
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
data/lib/bundler.rb CHANGED
@@ -200,7 +200,7 @@ module Bundler
200
200
  end
201
201
 
202
202
  def requires_sudo?
203
- return @requires_sudo if @checked_for_sudo
203
+ return @requires_sudo if defined?(@checked_for_sudo) && @checked_for_sudo
204
204
 
205
205
  path = bundle_path
206
206
  path = path.parent until path.exist?
@@ -225,7 +225,7 @@ module Bundler
225
225
 
226
226
  handled = []
227
227
  dependencies.
228
- sort_by { |d| d.name }.
228
+ sort_by { |d| d.to_s }.
229
229
  each do |dep|
230
230
  next if handled.include?(dep.name)
231
231
  out << dep.to_lock
@@ -367,8 +367,10 @@ module Bundler
367
367
  # If the spec is no longer in the path source, unlock it. This
368
368
  # commonly happens if the version changed in the gemspec
369
369
  next unless other
370
+
371
+ deps2 = other.dependencies.select { |d| d.type != :development }
370
372
  # If the dependencies of the path source have changed, unlock it
371
- next unless s.dependencies.sort == other.dependencies.sort
373
+ next unless s.dependencies.sort == deps2.sort
372
374
  end
373
375
 
374
376
  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
data/lib/bundler/index.rb CHANGED
@@ -115,11 +115,10 @@ module Bundler
115
115
  def search_by_dependency(dependency)
116
116
  @cache[dependency.hash] ||= begin
117
117
  specs = @specs[dependency.name]
118
+ found = specs.select { |spec| dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) }
118
119
 
119
120
  wants_prerelease = dependency.requirement.prerelease?
120
121
  only_prerelease = specs.all? {|spec| spec.version.prerelease? }
121
- found = specs.select { |spec| dependency.matches_spec?(spec) && Gem::Platform.match(spec.platform) }
122
-
123
122
  unless wants_prerelease || only_prerelease
124
123
  found.reject! { |spec| spec.version.prerelease? }
125
124
  end
@@ -118,11 +118,13 @@ module Gem
118
118
  def to_lock
119
119
  out = " #{name}"
120
120
  unless requirement == Gem::Requirement.default
121
- out << " (#{requirement.to_s})"
121
+ reqs = requirement.requirements.map{|o,v| "#{o} #{v}" }
122
+ out << " (#{reqs.join(', ')})"
122
123
  end
123
124
  out
124
125
  end
125
126
 
127
+ # Backport of performance enhancement added to Rubygems 1.4
126
128
  def matches_spec?(spec)
127
129
  # name can be a Regexp, so use ===
128
130
  return false unless name === spec.name
@@ -133,6 +135,7 @@ module Gem
133
135
  end
134
136
 
135
137
  class Requirement
138
+ # Backport of performance enhancement added to Rubygems 1.4
136
139
  def none?
137
140
  @none ||= (to_s == ">= 0")
138
141
  end unless allocate.respond_to?(:none?)
@@ -123,13 +123,22 @@ module Bundler
123
123
  # === Following hacks are to improve on the generated bin wrappers ===
124
124
 
125
125
  # Yeah, talk about a hack
126
- source_index_class = (class << Gem::SourceIndex ; self ; end)
127
- source_index_class.send(:remove_method, :from_gems_in)
128
- source_index_class.send(:define_method, :from_gems_in) do |*args|
129
- source_index = Gem::SourceIndex.new
130
- source_index.spec_dirs = *args
131
- source_index.add_specs(*specs)
132
- source_index
126
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.7.0')
127
+ Gem::SourceIndex.send(:define_method, :initialize) do |*args|
128
+ @gems = {}
129
+ spec_dirs = *args
130
+ add_specs(*specs)
131
+ end
132
+ else
133
+ # Rubygems versions lower than 1.7 use SourceIndex#from_gems_in
134
+ source_index_class = (class << Gem::SourceIndex ; self ; end)
135
+ source_index_class.send(:remove_method, :from_gems_in)
136
+ source_index_class.send(:define_method, :from_gems_in) do |*args|
137
+ source_index = Gem::SourceIndex.new
138
+ source_index.spec_dirs = *args
139
+ source_index.add_specs(*specs)
140
+ source_index
141
+ end
133
142
  end
134
143
 
135
144
  # OMG more hacks
@@ -317,7 +317,6 @@ module Bundler
317
317
  def eql?(o)
318
318
  o.instance_of?(Path) &&
319
319
  path.expand_path(Bundler.root) == o.path.expand_path(Bundler.root) &&
320
- name == o.name &&
321
320
  version == o.version
322
321
  end
323
322
 
@@ -560,7 +559,10 @@ module Bundler
560
559
  out = %x{git #{command}}
561
560
 
562
561
  if $?.exitstatus != 0
563
- raise GitError, "An error has occurred in git when running `git #{command}`. Cannot complete bundling."
562
+ msg = "Git error: " +
563
+ "command `git #{command}` in directory #{Dir.pwd} has failed.\n" +
564
+ "Cannot complete bundling."
565
+ raise GitError, msg
564
566
  end
565
567
  out
566
568
  else
@@ -611,7 +613,7 @@ module Bundler
611
613
  return if has_revision_cached?
612
614
  Bundler.ui.info "Updating #{uri}"
613
615
  in_cache do
614
- git %|fetch --force --quiet --tags "#{uri}" refs/heads/*:refs/heads/*|
616
+ git %|fetch --force --quiet --tags "#{uri}" "refs/heads/*:refs/heads/*"|
615
617
  end
616
618
  else
617
619
  Bundler.ui.info "Fetching #{uri}"
@@ -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.0.10" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.0.11" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -348,7 +348,7 @@ describe "bundle install with git sources" do
348
348
 
349
349
  bundle :install, :expect_err => true
350
350
 
351
- out.should include("An error has occurred in git")
351
+ out.should include("Git error:")
352
352
  err.should include("fatal")
353
353
  err.should include("omgomg")
354
354
  err.should include("fatal: The remote end hung up unexpectedly")
@@ -141,6 +141,47 @@ describe "bundle install with explicit source paths" do
141
141
  should_be_installed "rack 1.0"
142
142
  end
143
143
 
144
+ it "doesn't automatically unlock dependencies when using the gemspec syntax" do
145
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
146
+ s.add_dependency "rack", ">= 1.0"
147
+ end
148
+
149
+ Dir.chdir lib_path("foo")
150
+
151
+ install_gemfile lib_path("foo/Gemfile"), <<-G
152
+ source "file://#{gem_repo1}"
153
+ gemspec
154
+ G
155
+
156
+ build_gem "rack", "1.0.1", :to_system => true
157
+
158
+ bundle "install"
159
+
160
+ should_be_installed "foo 1.0"
161
+ should_be_installed "rack 1.0"
162
+ end
163
+
164
+ it "doesn't automatically unlock dependencies when using the gemspec syntax and the gem has development dependencies" do
165
+ build_lib "foo", "1.0", :path => lib_path("foo") do |s|
166
+ s.add_dependency "rack", ">= 1.0"
167
+ s.add_development_dependency "activesupport"
168
+ end
169
+
170
+ Dir.chdir lib_path("foo")
171
+
172
+ install_gemfile lib_path("foo/Gemfile"), <<-G
173
+ source "file://#{gem_repo1}"
174
+ gemspec
175
+ G
176
+
177
+ build_gem "rack", "1.0.1", :to_system => true
178
+
179
+ bundle "install"
180
+
181
+ should_be_installed "foo 1.0"
182
+ should_be_installed "rack 1.0"
183
+ end
184
+
144
185
  it "raises if there are multiple gemspecs" do
145
186
  build_lib "foo", "1.0", :path => lib_path("foo") do |s|
146
187
  s.write "bar.gemspec"
@@ -329,6 +329,29 @@ describe "the lockfile format" do
329
329
  G
330
330
  end
331
331
 
332
+ it "orders dependencies according to version" do
333
+ install_gemfile <<-G
334
+ source "file://#{gem_repo1}"
335
+ gem 'double_deps'
336
+ G
337
+
338
+ lockfile_should_be <<-G
339
+ GEM
340
+ remote: file:#{gem_repo1}/
341
+ specs:
342
+ double_deps (1.0)
343
+ net-ssh (>= 1.0.0)
344
+ net-ssh
345
+ net-ssh (1.0)
346
+
347
+ PLATFORMS
348
+ #{generic(Gem::Platform.local)}
349
+
350
+ DEPENDENCIES
351
+ double_deps
352
+ G
353
+ end
354
+
332
355
  it "does not add the :require option to the lockfile" do
333
356
  install_gemfile <<-G
334
357
  source "file://#{gem_repo1}"
@@ -217,6 +217,12 @@ module Spec
217
217
  s.add_dependency "net_d"
218
218
  end
219
219
 
220
+ # Capistrano did this (at least until version 2.5.10)
221
+ build_gem "double_deps" do |s|
222
+ s.add_dependency "net-ssh", ">= 1.0.0"
223
+ s.add_dependency "net-ssh"
224
+ end
225
+
220
226
  build_gem "foo"
221
227
  end
222
228
  end
@@ -3,7 +3,7 @@ module Spec
3
3
  def reset!
4
4
  @in_p, @out_p, @err_p = nil, nil, nil
5
5
  Dir["#{tmp}/{gems/*,*}"].each do |dir|
6
- next if %(base remote1 gems rubygems_v1.3.5 rubygems_v1.3.6 rubygems_v1.3.7 rubygems_v1.4.0 rubygems_v1.4.1 rubygems_master).include?(File.basename(dir))
6
+ next if %(base remote1 gems rubygems).include?(File.basename(dir))
7
7
  unless ENV['BUNDLER_SUDO_TESTS']
8
8
  FileUtils.rm_rf(dir)
9
9
  else
@@ -67,23 +67,11 @@ module Spec
67
67
  bundled_app("Gemfile.lock").should exist
68
68
  end
69
69
 
70
- RSpec::Matchers.define :be_with_diff do |expected|
70
+ def lockfile_should_be(expected)
71
+ should_be_locked
71
72
  spaces = expected[/\A\s+/, 0] || ""
72
73
  expected.gsub!(/^#{spaces}/, '')
73
-
74
- failure_message_for_should do |actual|
75
- "The lockfile did not match.\n=== Expected:\n" <<
76
- expected << "\n=== Got:\n" << actual << "\n===========\n"
77
- end
78
-
79
- match do |actual|
80
- expected == actual
81
- end
82
- end
83
-
84
- def lockfile_should_be(expected)
85
- lock = File.read(bundled_app("Gemfile.lock"))
86
- lock.should be_with_diff(expected)
74
+ bundled_app("Gemfile.lock").read.should == expected
87
75
  end
88
76
  end
89
77
  end
metadata CHANGED
@@ -1,25 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 10
10
- version: 1.0.10
9
+ - 11
10
+ version: 1.0.11
11
11
  platform: ruby
12
12
  authors:
13
- - Carl Lerche
14
- - Yehuda Katz
15
13
  - "Andr\xC3\xA9 Arko"
16
14
  - Terence Lee
15
+ - Carl Lerche
16
+ - Yehuda Katz
17
17
  autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-02-01 00:00:00 -08:00
22
- default_executable: bundle
21
+ date: 2011-04-01 00:00:00 -07:00
22
+ default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: ronn
@@ -51,7 +51,7 @@ dependencies:
51
51
  version_requirements: *id002
52
52
  description: Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably
53
53
  email:
54
- - carlhuda@engineyard.com
54
+ - andre@arko.net
55
55
  executables:
56
56
  - bundle
57
57
  extensions: []