bundler 1.2.0 → 1.2.1

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.2.1
2
+
3
+ Bugfixes:
4
+
5
+ - `bundle clean` now works with BUNDLE_WITHOUT groups again
6
+ - have a net/http read timeout around the Gemcutter API Endpoint
7
+
1
8
  ## 1.2.0 (Aug 30, 2012)
2
9
 
3
10
  Bugfixes:
data/ISSUES.md CHANGED
@@ -4,7 +4,7 @@ So! You're having problems with Bundler. This file is here to help. If you're ru
4
4
 
5
5
  ## Documentation
6
6
 
7
- Instructions for common Bundler uses can be found on the [Bundler documentation site](http://gembundler.com/v1.1/).
7
+ Instructions for common Bundler uses can be found on the [Bundler documentation site](http://gembundler.com/).
8
8
 
9
9
  Detailed information about each Bundler command, including help with common problems, can be found in the [Bundler man pages](http://gembundler.com/man/bundle.1.html).
10
10
 
@@ -30,7 +30,7 @@ module Bundler
30
30
  specs, then we can try to resolve locally.
31
31
  =end
32
32
 
33
- def initialize(lockfile, dependencies, sources, unlock, ruby_version = "")
33
+ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil)
34
34
  @unlocking = unlock == true || !unlock.empty?
35
35
 
36
36
  @dependencies, @sources, @unlock = dependencies, sources, unlock
@@ -108,9 +108,9 @@ module Bundler
108
108
  specs
109
109
  end
110
110
 
111
- def specs(deps = requested_dependencies)
111
+ def specs
112
112
  @specs ||= begin
113
- specs = resolve.materialize(deps)
113
+ specs = resolve.materialize(requested_dependencies)
114
114
 
115
115
  unless specs["bundler"].any?
116
116
  local = Bundler.settings[:frozen] ? rubygems_index : index
@@ -130,10 +130,6 @@ module Bundler
130
130
  @locked_specs - specs
131
131
  end
132
132
 
133
- def all_specs
134
- specs(dependencies)
135
- end
136
-
137
133
  def new_platform?
138
134
  @new_platform
139
135
  end
@@ -5,6 +5,8 @@ module Bundler
5
5
  # Handles all the fetching with the rubygems server
6
6
  class Fetcher
7
7
  REDIRECT_LIMIT = 5
8
+ # how long to wait for each gemcutter API call
9
+ API_TIMEOUT = 10
8
10
 
9
11
  attr_reader :has_api
10
12
 
@@ -44,6 +46,7 @@ module Bundler
44
46
  @remote_uri = remote_uri
45
47
  @has_api = true # will be set to false if the rubygems index is ever fetched
46
48
  @@connection ||= Net::HTTP::Persistent.new nil, :ENV
49
+ @@connection.read_timeout = API_TIMEOUT
47
50
  end
48
51
 
49
52
  # fetch a gem specification
@@ -142,6 +145,7 @@ module Bundler
142
145
 
143
146
  begin
144
147
  Bundler.ui.debug "Fetching from: #{uri}"
148
+ response = nil
145
149
  response = @@connection.request(uri)
146
150
  rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
147
151
  SocketError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
@@ -123,12 +123,12 @@ module Bundler
123
123
  gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
124
124
  spec_gem_paths = []
125
125
  # need to keep git sources around
126
- spec_git_paths = []
126
+ spec_git_paths = @definition.sources.select {|s| s.is_a?(Bundler::Source::Git) }.map {|s| s.path.to_s }
127
127
  spec_git_cache_dirs = []
128
128
  spec_gem_executables = []
129
129
  spec_cache_paths = []
130
130
  spec_gemspec_paths = []
131
- @definition.all_specs.each do |spec|
131
+ specs.each do |spec|
132
132
  spec_gem_paths << spec.full_gem_path
133
133
  # need to check here in case gems are nested like for the rails git repo
134
134
  md = %r{(.+bundler/gems/.+-[a-f0-9]{7,12})}.match(spec.full_gem_path)
@@ -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.2.0" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.2.1" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -158,6 +158,50 @@ describe "gemcutter's dependency API" do
158
158
  out.should match(/Too many redirects/)
159
159
  end
160
160
 
161
+ context "when Gemcutter API takes too long to respond" do
162
+ let(:port) { 2000 }
163
+ let(:server_uri) { "http://localhost:2000" }
164
+
165
+ before do
166
+ # need to hack, so we can require rack
167
+ old_gem_home = ENV['GEM_HOME']
168
+ ENV['GEM_HOME'] = Spec::Path.base_system_gems.to_s
169
+ require 'rack'
170
+ ENV['GEM_HOME'] = old_gem_home
171
+
172
+ require File.expand_path('../../../support/artifice/endpoint_timeout', __FILE__)
173
+ require 'thread'
174
+ @t = Thread.new {
175
+ server = Rack::Server.start(:app => EndpointTimeout,
176
+ :Host => '0.0.0.0',
177
+ :Port => port,
178
+ :server => 'webrick',
179
+ :AccessLog => [])
180
+ server.start
181
+ }
182
+ @t.run
183
+
184
+ # ensure server is started
185
+ require 'timeout'
186
+ Timeout.timeout(15) { sleep(0.1) until @t.status == "sleep" }
187
+ end
188
+
189
+ after do
190
+ @t.kill
191
+ end
192
+
193
+ it "times out and falls back on the modern index" do
194
+ gemfile <<-G
195
+ source "#{server_uri}"
196
+ gem "rack"
197
+ G
198
+
199
+ bundle :install
200
+ out.should include("\nFetching full source index from #{server_uri}")
201
+ should_be_installed "rack 1.0.0"
202
+ end
203
+ end
204
+
161
205
  context "when --full-index is specified" do
162
206
  it "should use the modern index for install" do
163
207
  gemfile <<-G
@@ -100,6 +100,29 @@ describe "bundle clean" do
100
100
  vendored_gems("bin/rackup").should exist
101
101
  end
102
102
 
103
+ it "remove gems in bundle without groups" do
104
+ gemfile <<-G
105
+ source "file://#{gem_repo1}"
106
+
107
+ gem "foo"
108
+
109
+ group :test_group do
110
+ gem "rack", "1.0.0"
111
+ end
112
+ G
113
+
114
+ bundle "install --path vendor/bundle"
115
+ bundle "install --without test_group"
116
+ bundle :clean
117
+
118
+ out.should eq("Removing rack (1.0.0)")
119
+
120
+ should_have_gems 'foo-1.0'
121
+ should_not_have_gems 'rack-1.0.0'
122
+
123
+ vendored_gems("bin/rackup").should_not exist
124
+ end
125
+
103
126
  it "does not remove cached git dir if it's being used" do
104
127
  build_git "foo"
105
128
  revision = revision_for(lib_path("foo-1.0"))
@@ -231,9 +254,27 @@ describe "bundle clean" do
231
254
  out.should eq("")
232
255
  vendored_gems("bundler/gems/foo-#{revision[0..11]}").should exist
233
256
  digest = Digest::SHA1.hexdigest(git_path.to_s)
234
- vendored_gems("cache/bundler/git/foo-#{digest}").should exist
257
+ vendored_gems("cache/bundler/git/foo-#{digest}").should_not exist
235
258
  end
236
259
 
260
+ it "does not blow up when using without groups" do
261
+ gemfile <<-G
262
+ source "file://#{gem_repo1}"
263
+
264
+ gem "rack"
265
+
266
+ group :development do
267
+ gem "foo"
268
+ end
269
+ G
270
+
271
+ bundle "install --path vendor/bundle --without development"
272
+
273
+ bundle :clean, :exitstatus => true
274
+ exitstatus.should == 0
275
+ end
276
+
277
+
237
278
  it "displays an error when used without --path" do
238
279
  install_gemfile <<-G
239
280
  source "file://#{gem_repo1}"
@@ -158,6 +158,19 @@ G
158
158
 
159
159
  exitstatus.should_not == 0
160
160
  end
161
+
162
+ it "should print if no ruby version is specified" do
163
+ gemfile <<-G
164
+ source "file://#{gem_repo1}"
165
+
166
+ gem "foo"
167
+ G
168
+
169
+ bundle "platform --ruby"
170
+ puts err
171
+
172
+ out.should eq("No ruby version specified")
173
+ end
161
174
  end
162
175
 
163
176
  let(:ruby_version_correct) { "ruby \"#{RUBY_VERSION}\", :engine => \"#{local_ruby_engine}\", :engine_version => \"#{local_engine_version}\"" }
@@ -0,0 +1,13 @@
1
+ require File.expand_path("../endpoint_fallback", __FILE__)
2
+
3
+ Artifice.deactivate
4
+
5
+ class EndpointTimeout < EndpointFallback
6
+ SLEEP_TIMEOUT = 15
7
+
8
+ get "/api/v1/dependencies" do
9
+ sleep(SLEEP_TIMEOUT)
10
+ end
11
+ end
12
+
13
+ Artifice.activate_with(EndpointTimeout)
@@ -11,13 +11,14 @@ module Spec
11
11
 
12
12
  unless File.exist?("#{Path.base_system_gems}")
13
13
  FileUtils.mkdir_p(Path.base_system_gems)
14
- puts "fetching fakeweb, artifice, sinatra, rake, and builder for the tests to use..."
14
+ puts "fetching fakeweb, artifice, sinatra, rake, rack, and builder for the tests to use..."
15
15
  `gem install fakeweb artifice --no-rdoc --no-ri`
16
16
  `gem install sinatra --version 1.2.7 --no-rdoc --no-ri`
17
17
  # Rake version has to be consistent for tests to pass
18
18
  `gem install rake --version 0.8.7 --no-rdoc --no-ri`
19
19
  # 3.0.0 breaks 1.9.2 specs
20
20
  `gem install builder --version 2.1.2 --no-rdoc --no-ri`
21
+ `gem install rack --no-rdoc --no-ri`
21
22
  end
22
23
 
23
24
  ENV['HOME'] = Path.home.to_s
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Andr\xC3\xA9 Arko"
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-08-30 00:00:00 Z
21
+ date: 2012-09-19 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: ronn
@@ -225,6 +225,7 @@ files:
225
225
  - spec/support/artifice/endpoint_fallback.rb
226
226
  - spec/support/artifice/endpoint_marshal_fail.rb
227
227
  - spec/support/artifice/endpoint_redirect.rb
228
+ - spec/support/artifice/endpoint_timeout.rb
228
229
  - spec/support/builders.rb
229
230
  - spec/support/fakeweb/rack-1.0.0.marshal
230
231
  - spec/support/fakeweb/windows.rb