bundler 1.2.2 → 1.2.3

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,9 @@
1
+ ## 1.2.3 (Nov 29, 2012)
2
+
3
+ Bugfixes:
4
+
5
+ - fix exceptions while loading some gemspecs
6
+
1
7
  ## 1.2.2 (Nov 14, 2012)
2
8
 
3
9
  Bugfixes:
@@ -290,23 +290,15 @@ module Bundler
290
290
  # Eval the gemspec from its parent directory
291
291
  Dir.chdir(path.dirname.to_s) do
292
292
  contents = File.read(path.basename.to_s)
293
- begin
294
- Gem::Specification.from_yaml(contents)
295
- rescue YamlSyntaxError, Gem::EndOfYAMLException, Gem::Exception
293
+
294
+ if contents =~ /\A---/ # try YAML
296
295
  begin
297
- eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
298
- rescue LoadError, SyntaxError => e
299
- original_line = e.backtrace.find { |line| line.include?(path.to_s) }
300
- msg = "There was a #{e.class} while evaluating #{path.basename}: \n#{e.message}"
301
- msg << " from\n #{original_line}" if original_line
302
- msg << "\n"
303
-
304
- if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
305
- msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
306
- end
307
-
308
- raise GemspecError, msg
296
+ Gem::Specification.from_yaml(contents)
297
+ rescue ArgumentError, YamlSyntaxError, Gem::EndOfYAMLException, Gem::Exception
298
+ eval_gemspec(path, contents)
309
299
  end
300
+ else
301
+ eval_gemspec(path, contents)
310
302
  end
311
303
  end
312
304
  end
@@ -317,6 +309,21 @@ module Bundler
317
309
 
318
310
  private
319
311
 
312
+ def eval_gemspec(path, contents)
313
+ eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
314
+ rescue LoadError, SyntaxError => e
315
+ original_line = e.backtrace.find { |line| line.include?(path.to_s) }
316
+ msg = "There was a #{e.class} while evaluating #{path.basename}: \n#{e.message}"
317
+ msg << " from\n #{original_line}" if original_line
318
+ msg << "\n"
319
+
320
+ if e.is_a?(LoadError) && RUBY_VERSION >= "1.9"
321
+ msg << "\nDoes it try to require a relative path? That's been removed in Ruby 1.9."
322
+ end
323
+
324
+ raise GemspecError, msg
325
+ end
326
+
320
327
  def configure_gem_home_and_path
321
328
  blank_home = ENV['GEM_HOME'].nil? || ENV['GEM_HOME'].empty?
322
329
 
@@ -13,15 +13,14 @@ rescue LoadError
13
13
  end
14
14
 
15
15
  # At least load the YAML stdlib, whatever that may be
16
- require 'yaml'
16
+ require 'yaml' unless defined?(YAML)
17
17
 
18
18
  module Bundler
19
19
  # On encountering invalid YAML,
20
20
  # Psych raises Psych::SyntaxError
21
- # Syck raises ArgumentError
22
21
  if defined?(::Psych::SyntaxError)
23
22
  YamlSyntaxError = ::Psych::SyntaxError
24
- else
23
+ else # Syck raises ArgumentError
25
24
  YamlSyntaxError = ::ArgumentError
26
25
  end
27
26
  end
@@ -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.2" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.2.3" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -159,9 +159,6 @@ describe "gemcutter's dependency API" do
159
159
  end
160
160
 
161
161
  context "when Gemcutter API takes too long to respond" do
162
- let(:port) { 2000 }
163
- let(:server_uri) { "http://localhost:2000" }
164
-
165
162
  before do
166
163
  # need to hack, so we can require rack
167
164
  old_gem_home = ENV['GEM_HOME']
@@ -169,6 +166,10 @@ describe "gemcutter's dependency API" do
169
166
  require 'rack'
170
167
  ENV['GEM_HOME'] = old_gem_home
171
168
 
169
+ port = 21453
170
+ port += 1 while TCPSocket.new("127.0.0.1", port) rescue false
171
+ @server_uri = "http://127.0.0.1:#{port}"
172
+
172
173
  require File.expand_path('../../../support/artifice/endpoint_timeout', __FILE__)
173
174
  require 'thread'
174
175
  @t = Thread.new {
@@ -192,12 +193,16 @@ describe "gemcutter's dependency API" do
192
193
 
193
194
  it "times out and falls back on the modern index" do
194
195
  gemfile <<-G
195
- source "#{server_uri}"
196
+ source "#{@server_uri}"
196
197
  gem "rack"
198
+
199
+ old_v, $VERBOSE = $VERBOSE, nil
200
+ Bundler::Fetcher::API_TIMEOUT = 1
201
+ $VERBOSE = old_v
197
202
  G
198
203
 
199
204
  bundle :install
200
- out.should include("\nFetching full source index from #{server_uri}")
205
+ expect(out).to include("\nFetching full source index from #{@server_uri}")
201
206
  should_be_installed "rack 1.0.0"
202
207
  end
203
208
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-11-15 00:00:00.000000000 Z
15
+ date: 2012-11-30 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: ronn