bundler 1.1.pre.7 → 1.1.pre.8

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,8 +1,18 @@
1
+ ## 1.1.pre.8 (Aug 13, 2011)
2
+
3
+ Bugfixes:
4
+
5
+ - Fix `bundle check` to not print fatal error message (@cldwalker, #1347)
6
+ - Fix require_sudo when Gem.bindir isn't writeable (#1352)
7
+ - Fix not asking Gemcutter API for dependency chain of git gems in --deployment (#1254)
8
+ - Fix `install --binstubs` when using --path (#1332)
9
+
1
10
  ## 1.1.pre.7 (Aug 8, 2011)
2
11
 
3
12
  Bugfixes:
4
13
 
5
14
  - Fixed invalid byte sequence error while installing gem on Ruby 1.9 (#1341)
15
+ - Fixed exception when sudo was needed to install gems (@spastorino)
6
16
 
7
17
  ## 1.1.pre.6 (Aug 8, 2011)
8
18
 
@@ -90,6 +100,20 @@ Removed:
90
100
  - Removed bundle install --production
91
101
  - Removed bundle install --disable-shared-gems
92
102
 
103
+ ## 1.0.18 (Aug 13, 2011)
104
+
105
+ Bugfixes:
106
+
107
+ - Fix typo in DEBUG_RESOLVER (@geemus)
108
+ - Fixes rake 0.9.x warning (@mtylty, #1333)
109
+
110
+ Features:
111
+
112
+ - Run the bundle install earlier in a Capistrano deployment (@cgriego, #1300)
113
+ - Support hidden gemspec (@trans, @cldwalker, #827)
114
+ - Make fetch_specs faster (@zeha, #1294)
115
+ - Allow overriding development deps loaded by #gemspec (@lgierth, #1245)
116
+
93
117
  ## 1.0.17 (Aug 8, 2011)
94
118
 
95
119
  Bugfixes:
data/bin/bundle CHANGED
@@ -19,6 +19,8 @@ rescue Interrupt => e
19
19
  Bundler.ui.error "\nQuitting..."
20
20
  Bundler.ui.debug e.backtrace.join("\n")
21
21
  exit 1
22
+ rescue SystemExit => e
23
+ exit e.status
22
24
  rescue Exception => e
23
25
  Bundler.ui.error "Unfortunately, a fatal error has occurred. " +
24
26
  "Please report this error to the Bundler issue tracker at " +
@@ -223,9 +223,12 @@ module Bundler
223
223
  path = bundle_path
224
224
  path = path.parent until path.exist?
225
225
  sudo_present = !(`which sudo` rescue '').empty?
226
+ bin_dir = Pathname.new(Bundler.rubygems.gem_bindir)
227
+ bin_dir = bin_dir.parent until bin_dir.exist?
226
228
 
227
229
  @checked_for_sudo = true
228
- @requires_sudo = settings.allow_sudo? && !File.writable?(path) && sudo_present
230
+ can_write_gems = !File.writable?(path) || !File.writable?(bin_dir)
231
+ @requires_sudo = settings.allow_sudo? && can_write_gems && sudo_present
229
232
  end
230
233
 
231
234
  def mkdir_p(path)
@@ -5,7 +5,7 @@
5
5
  require 'bundler/deployment'
6
6
 
7
7
  Capistrano::Configuration.instance(:must_exist).load do
8
- after "deploy:update_code", "bundle:install"
8
+ after "deploy:finalize_update", "bundle:install"
9
9
  Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
10
10
  set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" }
11
11
  end
@@ -24,7 +24,8 @@ module Bundler
24
24
  }.freeze
25
25
 
26
26
  def initialize(name, version, options = {}, &blk)
27
- super(name, version)
27
+ type = options["type"] || :runtime
28
+ super(name, version, type)
28
29
 
29
30
  @autorequire = nil
30
31
  @groups = Array(options["group"] || :default).map { |g| g.to_sym }
@@ -22,7 +22,7 @@ module Bundler
22
22
 
23
23
  def gemspec(opts = nil)
24
24
  path = opts && opts[:path] || '.'
25
- name = opts && opts[:name] || '*'
25
+ name = opts && opts[:name] || '{,*}'
26
26
  development_group = opts && opts[:development_group] || :development
27
27
  path = File.expand_path(path, Bundler.default_gemfile.dirname)
28
28
  gemspecs = Dir[File.join(path, "#{name}.gemspec")]
@@ -34,7 +34,7 @@ module Bundler
34
34
  gem spec.name, :path => path
35
35
  group(development_group) do
36
36
  spec.development_dependencies.each do |dep|
37
- gem dep.name, *dep.requirement.as_list
37
+ gem dep.name, *(dep.requirement.as_list + [:type => :development])
38
38
  end
39
39
  end
40
40
  when 0
@@ -57,20 +57,34 @@ module Bundler
57
57
 
58
58
  dep = Dependency.new(name, version, options)
59
59
 
60
+ # if there's already a dependency with this name we try to prefer one
60
61
  if current = @dependencies.find { |d| d.name == dep.name }
61
62
  if current.requirement != dep.requirement
62
- raise DslError, "You cannot specify the same gem twice with different version requirements. " \
63
- "You specified: #{current.name} (#{current.requirement}) and " \
64
- "#{dep.name} (#{dep.requirement})"
63
+ if current.type == :development
64
+ @dependencies.delete current
65
+ elsif dep.type == :development
66
+ return
67
+ else
68
+ raise DslError, "You cannot specify the same gem twice with different version requirements. " \
69
+ "You specified: #{current.name} (#{current.requirement}) and " \
70
+ "#{dep.name} (#{dep.requirement})"
71
+ end
65
72
  end
66
73
 
67
74
  if current.source != dep.source
68
- raise DslError, "You cannot specify the same gem twice coming from different sources. You " \
69
- "specified that #{dep.name} (#{dep.requirement}) should come from " \
70
- "#{current.source || 'an unspecfied source'} and #{dep.source}"
75
+ if current.type == :development
76
+ @dependencies.delete current
77
+ elsif dep.type == :development
78
+ return
79
+ else
80
+ raise DslError, "You cannot specify the same gem twice coming from different sources. You " \
81
+ "specified that #{dep.name} (#{dep.requirement}) should come from " \
82
+ "#{current.source || 'an unspecfied source'} and #{dep.source}"
83
+ end
71
84
  end
72
85
  end
73
- @dependencies << Dependency.new(name, version, options)
86
+
87
+ @dependencies << dep
74
88
  end
75
89
 
76
90
  def source(source, options = {})
@@ -177,7 +191,7 @@ module Bundler
177
191
  def _normalize_options(name, version, opts)
178
192
  _normalize_hash(opts)
179
193
 
180
- invalid_keys = opts.keys - %w(group groups git github path name branch ref tag require submodules platform platforms)
194
+ invalid_keys = opts.keys - %w(group groups git github path name branch ref tag require submodules platform platforms type)
181
195
  if invalid_keys.any?
182
196
  plural = invalid_keys.size > 1
183
197
  message = "You passed #{invalid_keys.map{|k| ':'+k }.join(", ")} "
@@ -22,20 +22,37 @@ module Bundler
22
22
  # needed for standalone, load required_paths from local gemspec
23
23
  # after the gem in installed
24
24
  def require_paths
25
- if _local_specification
25
+ if @remote_specification
26
+ @remote_specification.require_paths
27
+ elsif _local_specification
26
28
  _local_specification.require_paths
27
29
  else
28
30
  super
29
31
  end
30
32
  end
31
33
 
34
+ # needed for binstubs
35
+ def executables
36
+ if @remote_specification
37
+ @remote_specification.executables
38
+ elsif _local_specification
39
+ _local_specification.executables
40
+ else
41
+ super
42
+ end
43
+ end
44
+
32
45
  def _local_specification
33
46
  eval(File.read(local_specification_path)) if @loaded_from && File.exists?(local_specification_path)
34
47
  end
35
48
 
49
+ def __swap__(spec)
50
+ @remote_specification = spec
51
+ end
52
+
36
53
  private
37
54
  def local_specification_path
38
- "#{installation_path}/specifications/#{full_name}.gemspec"
55
+ "#{base_dir}/specifications/#{full_name}.gemspec"
39
56
  end
40
57
  end
41
58
  end
@@ -16,7 +16,7 @@ module Bundler
16
16
  def initialize(base, name = nil)
17
17
  Bundler.ui = UI::Shell.new(Thor::Base.shell.new)
18
18
  @base = base
19
- gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "*.gemspec")]
19
+ gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
20
20
  raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
21
21
  @spec_path = gemspecs.first
22
22
  @gemspec = Bundler.load_gemspec(@spec_path)
@@ -90,10 +90,13 @@ module Bundler
90
90
  dependency_names.select{|name| specs_by_name(name).empty? }
91
91
  end
92
92
 
93
- def use(other)
93
+ def use(other, override_dupes = false)
94
94
  return unless other
95
95
  other.each do |s|
96
- next if search_by_spec(s).any?
96
+ if (dupes = search_by_spec(s)) && dupes.any?
97
+ next unless override_dupes
98
+ @specs[s.name] -= dupes
99
+ end
97
100
  @specs[s.name] << s
98
101
  end
99
102
  self
@@ -145,7 +145,7 @@ module Bundler
145
145
  def debug
146
146
  if ENV['DEBUG_RESOLVER']
147
147
  debug_info = yield
148
- debug_info = debug_info.inpsect unless debug_info.is_a?(String)
148
+ debug_info = debug_info.inspect unless debug_info.is_a?(String)
149
149
  $stderr.puts debug_info
150
150
  end
151
151
  end
@@ -260,8 +260,21 @@ module Bundler
260
260
  end
261
261
  end
262
262
 
263
+ # This backports base_dir which replaces installation path
264
+ # Rubygems 1.8+
265
+ def backport_base_dir
266
+ Gem::Specification.send(:define_method, :base_dir) do
267
+ installation_path
268
+ end
269
+ end
270
+
263
271
  # Rubygems 1.4 through 1.6
264
272
  class Legacy < RubygemsIntegration
273
+ def initialize
274
+ super
275
+ backport_base_dir
276
+ end
277
+
265
278
  def stub_rubygems(specs)
266
279
  stub_source_index137(specs)
267
280
  end
@@ -149,11 +149,17 @@ module Bundler
149
149
  end
150
150
 
151
151
  def fetch_specs
152
- Index.build do |idx|
153
- idx.use installed_specs
154
- idx.use cached_specs if @allow_cached || @allow_remote
155
- idx.use remote_specs if @allow_remote
152
+ # remote_specs usually generates a way larger Index than the other
153
+ # sources, and large_idx.use small_idx is way faster than
154
+ # small_idx.use large_idx.
155
+ if @allow_remote
156
+ idx = remote_specs.dup
157
+ else
158
+ idx = Index.new
156
159
  end
160
+ idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
161
+ idx.use(installed_specs, :override_dupes)
162
+ idx
157
163
  end
158
164
 
159
165
  def installed_specs
@@ -256,7 +262,7 @@ module Bundler
256
262
  attr_writer :name
257
263
  attr_accessor :version
258
264
 
259
- DEFAULT_GLOB = "{,*/}*.gemspec"
265
+ DEFAULT_GLOB = "{,*,*/*}.gemspec"
260
266
 
261
267
  def initialize(options)
262
268
  @options = options
@@ -79,9 +79,10 @@ module Bundler
79
79
 
80
80
  def materialize(deps, missing_specs = nil)
81
81
  materialized = self.for(deps, [], false, true).to_a
82
+ deps = materialized.map {|s| s.name }.uniq
82
83
  materialized.map! do |s|
83
84
  next s unless s.is_a?(LazySpecification)
84
- s.source.dependency_names = deps.map {|d| d.name } if s.source.respond_to?(:dependency_names=)
85
+ s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=)
85
86
  spec = s.__materialize__
86
87
  if missing_specs
87
88
  missing_specs << s unless spec
@@ -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.pre.7" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.1.pre.8" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -4,6 +4,8 @@
4
4
  # include the vlad:bundle:install task in your vlad:deploy task.
5
5
  require 'bundler/deployment'
6
6
 
7
+ include Rake::DSL if defined? Rake::DSL
8
+
7
9
  namespace :vlad do
8
10
  Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, :roles => :app)
9
11
  end
@@ -69,19 +69,39 @@ describe "gemcutter's dependency API" do
69
69
  end
70
70
 
71
71
  it "handles git dependencies that are in rubygems" do
72
- build_git "foo" do |s|
73
- s.executables = "foobar"
74
- s.add_dependency "rails", "2.3.2"
72
+ build_git "foo" do |s|
73
+ s.executables = "foobar"
74
+ s.add_dependency "rails", "2.3.2"
75
+ end
76
+
77
+ gemfile <<-G
78
+ source "#{source_uri}"
79
+ git "file:///#{lib_path('foo-1.0')}" do
80
+ gem 'foo'
75
81
  end
82
+ G
76
83
 
77
- install_gemfile <<-G
78
- source "file://#{gem_repo1}"
79
- git "#{lib_path('foo-1.0')}" do
80
- gem 'foo'
81
- end
82
- G
84
+ bundle :install, :artifice => "endpoint"
83
85
 
84
- should_be_installed("rails 2.3.2")
86
+ should_be_installed("rails 2.3.2")
87
+ end
88
+
89
+ it "handles git dependencies that are in rubygems using --deployment" do
90
+ build_git "foo" do |s|
91
+ s.executables = "foobar"
92
+ s.add_dependency "rails", "2.3.2"
93
+ end
94
+
95
+ gemfile <<-G
96
+ source "#{source_uri}"
97
+ gem 'foo', :git => "file:///#{lib_path('foo-1.0')}"
98
+ G
99
+
100
+ bundle :install, :artifice => "endpoint"
101
+
102
+ bundle "install --deployment", :artifice => "endpoint"
103
+
104
+ should_be_installed("rails 2.3.2")
85
105
  end
86
106
 
87
107
  it "falls back when the API errors out" do
@@ -206,4 +226,48 @@ describe "gemcutter's dependency API" do
206
226
  bundle :install, :artifice => "endpoint_api_missing"
207
227
  should_be_installed "foo 1.0"
208
228
  end
229
+
230
+ it "fetches again when more dependencies are found in subsequent sources using --deployment" do
231
+ build_repo2 do
232
+ build_gem "back_deps" do |s|
233
+ s.add_dependency "foo"
234
+ end
235
+ FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
236
+ end
237
+
238
+ gemfile <<-G
239
+ source "#{source_uri}"
240
+ source "#{source_uri}/extra"
241
+ gem "back_deps"
242
+ G
243
+
244
+ bundle :install, :artifice => "endpoint_extra"
245
+
246
+ bundle "install --deployment", :artifice => "endpoint_extra"
247
+ should_be_installed "back_deps 1.0"
248
+ end
249
+
250
+ it "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do
251
+ sys_exec "mkdir -p #{system_gem_path("bin")}"
252
+ sudo "chown -R root #{system_gem_path("bin")}"
253
+
254
+ gemfile <<-G
255
+ source "#{source_uri}"
256
+ gem "rails"
257
+ G
258
+ bundle :install, :artifice => "endpoint"
259
+ should_be_installed "rails 2.3.2"
260
+ end
261
+
262
+ it "installs the binstubs" do
263
+ gemfile <<-G
264
+ source "#{source_uri}"
265
+ gem "rack"
266
+ G
267
+
268
+ bundle "install --binstubs", :artifice => "endpoint"
269
+
270
+ gembin "rackup"
271
+ out.should == "1.0.0"
272
+ end
209
273
  end
@@ -22,6 +22,23 @@ describe "bundle install from an existing gemspec" do
22
22
  should_be_installed "bar-dev 1.0.0", :groups => :development
23
23
  end
24
24
 
25
+ it "that is hidden should install runtime and development dependencies" do
26
+ build_lib("foo", :path => tmp.join("foo")) do |s|
27
+ s.write("Gemfile", "source :rubygems\ngemspec")
28
+ s.add_dependency "bar", "=1.0.0"
29
+ s.add_development_dependency "bar-dev", '=1.0.0'
30
+ end
31
+ FileUtils.mv tmp.join('foo', 'foo.gemspec'), tmp.join('foo', '.gemspec')
32
+
33
+ install_gemfile <<-G
34
+ source "file://#{gem_repo2}"
35
+ gemspec :path => '#{tmp.join("foo")}'
36
+ G
37
+
38
+ should_be_installed "bar 1.0.0"
39
+ should_be_installed "bar-dev 1.0.0", :groups => :development
40
+ end
41
+
25
42
  it "should handle a list of requirements" do
26
43
  build_gem "baz", "1.0", :to_system => true
27
44
  build_gem "baz", "1.1", :to_system => true
@@ -179,6 +179,12 @@ describe "bundle check" do
179
179
  out.should include("Could not locate Gemfile")
180
180
  end
181
181
 
182
+ it "does not output fatal error message" do
183
+ bundle :check, :exitstatus => true
184
+ @exitstatus.should eq(10)
185
+ out.should_not include("Unfortunately, a fatal error has occurred. ")
186
+ end
187
+
182
188
  it "should not crash when called multiple times on a new machine" do
183
189
  gemfile <<-G
184
190
  gem 'rails', '3.0.0.beta3'
@@ -10,6 +10,14 @@ describe "Bundler::GemHelper tasks" do
10
10
  helper.gemspec.name.should == 'test'
11
11
  end
12
12
 
13
+ it "interpolates the name for a hidden gemspec" do
14
+ bundle 'gem test'
15
+ app = bundled_app("test")
16
+ FileUtils.mv app.join('test.gemspec'), app.join('.gemspec')
17
+ helper = Bundler::GemHelper.new(app.to_s)
18
+ helper.gemspec.name.should == 'test'
19
+ end
20
+
13
21
  it "should fail when there is no gemspec" do
14
22
  bundle 'gem test'
15
23
  app = bundled_app("test")
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: 1923831887
4
+ hash: 1923831889
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
9
  - pre
10
- - 7
11
- version: 1.1.pre.7
10
+ - 8
11
+ version: 1.1.pre.8
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-08-08 00:00:00 -05:00
22
+ date: 2011-08-15 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency