bundler 1.1.pre.10 → 1.1.rc

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.

@@ -7,6 +7,7 @@ end
7
7
 
8
8
  require 'rubygems'
9
9
  require 'rubygems/specification'
10
+ require 'bundler/match_platform'
10
11
 
11
12
  module Gem
12
13
  @loaded_stacks = Hash.new { |h,k| h[k] = [] }
@@ -143,79 +144,10 @@ module Gem
143
144
 
144
145
  alias eql? ==
145
146
  end
146
-
147
- end
148
-
149
- module Bundler
150
- class DepProxy
151
-
152
- attr_reader :required_by, :__platform, :dep
153
-
154
- def initialize(dep, platform)
155
- @dep, @__platform, @required_by = dep, platform, []
156
- end
157
-
158
- def hash
159
- @hash ||= dep.hash
160
- end
161
-
162
- def ==(o)
163
- dep == o.dep && __platform == o.__platform
164
- end
165
-
166
- alias eql? ==
167
-
168
- def type
169
- @dep.type
170
- end
171
-
172
- def to_s
173
- "#{name} (#{requirement}) #{__platform}"
174
- end
175
-
176
- private
177
-
178
- def method_missing(*args)
179
- @dep.send(*args)
180
- end
181
-
182
- end
183
-
184
- module GemHelpers
185
-
186
- GENERIC_CACHE = {}
187
- GENERICS = [
188
- Gem::Platform::JAVA,
189
- Gem::Platform::MSWIN,
190
- Gem::Platform::MINGW,
191
- Gem::Platform::RUBY
192
- ]
193
-
194
- def generic(p)
195
- return p if p == Gem::Platform::RUBY
196
-
197
- GENERIC_CACHE[p] ||= begin
198
- found = GENERICS.find do |p2|
199
- p2.is_a?(Gem::Platform) && p.os == p2.os
200
- end
201
- found || Gem::Platform::RUBY
202
- end
203
- end
204
- end
205
-
206
- module MatchPlatform
207
- include GemHelpers
208
-
209
- def match_platform(p)
210
- Gem::Platform::RUBY == platform or
211
- platform.nil? or p == platform or
212
- generic(Gem::Platform.new(platform)) == p
213
- end
214
- end
215
147
  end
216
148
 
217
149
  module Gem
218
150
  class Specification
219
- include Bundler::MatchPlatform
151
+ include ::Bundler::MatchPlatform
220
152
  end
221
153
  end
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env <%= RbConfig::CONFIG['ruby_install_name'] %>
1
+ #!/usr/bin/env <%= Bundler.settings[:shebang] || RbConfig::CONFIG['ruby_install_name'] %>
2
2
  #
3
3
  # This file was generated by Bundler.
4
4
  #
@@ -17,7 +17,7 @@ module Bundler
17
17
  def confirm(message, newline = nil)
18
18
  end
19
19
 
20
- def debugging?
20
+ def debug?
21
21
  false
22
22
  end
23
23
 
@@ -50,8 +50,9 @@ module Bundler
50
50
  @quiet = true
51
51
  end
52
52
 
53
- def debugging?
54
- @debug && !@quiet
53
+ def debug?
54
+ # needs to be false instead of nil to be newline param to other methods
55
+ !!@debug && !@quiet
55
56
  end
56
57
 
57
58
  def debug!
@@ -59,7 +60,7 @@ module Bundler
59
60
  end
60
61
 
61
62
  def debug(msg, newline = nil)
62
- tell_me(msg, nil, newline) if debugging?
63
+ tell_me(msg, nil, newline) if debug?
63
64
  end
64
65
 
65
66
  private
@@ -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.10" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.1.rc" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -45,19 +45,19 @@ Each _gem_ `MAY` have one or more version specifiers.
45
45
 
46
46
  ### REQUIRE AS (:require)
47
47
 
48
- Each _gem_ `MAY` specify its main file, which should be used when autorequiring
49
- (`Bundler.require`).
48
+ Each _gem_ `MAY` specify files that should be used when autorequiring via
49
+ `Bundler.require`. You may pass an array with multiple files, or `false` to
50
+ prevent any file from being autorequired.
50
51
 
51
52
  gem "sqlite3-ruby", :require => "sqlite3"
53
+ gem "redis", :require => ["redis/connection/hiredis", "redis"]
54
+ gem "webmock", :require => false
52
55
 
53
- This defaults to the name of the gem itself. For instance, these are identical:
56
+ The argument defaults to the name of the gem. For example, these are identical:
54
57
 
55
58
  gem "nokogiri"
56
59
  gem "nokogiri", :require => "nokogiri"
57
60
 
58
- Specify `:require => false` to prevent bundler from requiring the gem, but still
59
- install it and maintain dependencies.
60
-
61
61
  ### GROUPS (:group or :groups)
62
62
 
63
63
  Each _gem_ `MAY` specify membership in one or more groups. Any _gem_ that does
@@ -10,7 +10,7 @@ describe "gemcutter's dependency API" do
10
10
  G
11
11
 
12
12
  bundle :install, :artifice => "endpoint"
13
- out.should include("Fetching dependency information from the API at #{source_uri}")
13
+ out.should include("Fetching gem metadata from #{source_uri}")
14
14
  should_be_installed "rack 1.0.0"
15
15
  end
16
16
 
@@ -21,7 +21,7 @@ describe "gemcutter's dependency API" do
21
21
  G
22
22
 
23
23
  bundle :install, :artifice => "endpoint"
24
- out.should include("Fetching dependency information from the API at #{source_uri}/...")
24
+ out.should include("Fetching gem metadata from #{source_uri}/...")
25
25
  should_be_installed(
26
26
  "rails 2.3.2",
27
27
  "actionpack 2.3.2",
@@ -49,22 +49,7 @@ describe "gemcutter's dependency API" do
49
49
  bundle :install, :artifice => "endpoint"
50
50
 
51
51
  bundle "install --deployment", :artifice => "endpoint"
52
- out.should include("Fetching dependency information from the API at #{source_uri}")
53
- should_be_installed "rack 1.0.0"
54
- end
55
-
56
- it "passes basic authentication details" do
57
- uri = URI.parse(source_uri)
58
- uri.user = "hello"
59
- uri.password = "there"
60
-
61
- gemfile <<-G
62
- source "#{uri}"
63
- gem "rack"
64
- G
65
-
66
- bundle :install, :artifice => "endpoint_basic_authentication"
67
- out.should include("Fetching dependency information from the API at #{uri}")
52
+ out.should include("Fetching gem metadata from #{source_uri}")
68
53
  should_be_installed "rack 1.0.0"
69
54
  end
70
55
 
@@ -113,7 +98,7 @@ describe "gemcutter's dependency API" do
113
98
  G
114
99
 
115
100
  bundle :install, :fakeweb => "windows"
116
- out.should include("\nError using the API\nFetching source index for #{source_uri}")
101
+ out.should include("\nFetching full source index from #{source_uri}")
117
102
  should_be_installed "rcov 1.0.0"
118
103
  end
119
104
 
@@ -129,7 +114,7 @@ describe "gemcutter's dependency API" do
129
114
  gem "rails"
130
115
  G
131
116
  bundle :install, :artifice => "endpoint_fallback"
132
- out.should include("\nError using the API\nFetching source index for #{source_uri}")
117
+ out.should include("\nFetching full source index from #{source_uri}")
133
118
 
134
119
  should_be_installed(
135
120
  "activesupport 2.3.2",
@@ -149,7 +134,7 @@ describe "gemcutter's dependency API" do
149
134
  G
150
135
 
151
136
  bundle :install, :artifice => "endpoint_marshal_fail"
152
- out.should include("\nError using the API\nFetching source index for #{source_uri}")
137
+ out.should include("\nFetching full source index from #{source_uri}")
153
138
  should_be_installed "rack 1.0.0"
154
139
  end
155
140
 
@@ -170,7 +155,7 @@ describe "gemcutter's dependency API" do
170
155
  G
171
156
 
172
157
  bundle "install --full-index", :artifice => "endpoint"
173
- out.should include("Fetching source index for #{source_uri}")
158
+ out.should include("Fetching source index from #{source_uri}")
174
159
  should_be_installed "rack 1.0.0"
175
160
  end
176
161
 
@@ -192,6 +177,29 @@ describe "gemcutter's dependency API" do
192
177
  should_be_installed "back_deps 1.0"
193
178
  end
194
179
 
180
+ it "prints API output properly with back deps" do
181
+ build_repo2 do
182
+ build_gem "back_deps" do |s|
183
+ s.add_dependency "foo"
184
+ end
185
+ FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
186
+ end
187
+
188
+ gemfile <<-G
189
+ source "#{source_uri}"
190
+ source "#{source_uri}/extra"
191
+ gem "back_deps"
192
+ G
193
+
194
+ bundle :install, :artifice => "endpoint_extra"
195
+
196
+ output = <<OUTPUT
197
+ Fetching gem metadata from http://localgemserver.test/..
198
+ Fetching gem metadata from http://localgemserver.test/extra/.
199
+ OUTPUT
200
+ out.should include(output)
201
+ end
202
+
195
203
  it "does not fetch every specs if the index of gems is large when doing back deps" do
196
204
  build_repo2 do
197
205
  build_gem "back_deps" do |s|
@@ -255,7 +263,7 @@ describe "gemcutter's dependency API" do
255
263
  G
256
264
 
257
265
  bundle :install, :artifice => "endpoint"
258
- out.scan(/Fetching dependency information from the API/).size.should == 1
266
+ out.should include("Fetching gem metadata from #{source_uri}")
259
267
  end
260
268
 
261
269
  it "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do
@@ -281,4 +289,70 @@ describe "gemcutter's dependency API" do
281
289
  gembin "rackup"
282
290
  out.should == "1.0.0"
283
291
  end
292
+
293
+ it "installs the bins when using --path and uses autoclean" do
294
+ gemfile <<-G
295
+ source "#{source_uri}"
296
+ gem "rack"
297
+ G
298
+
299
+ bundle "install --path vendor/bundle", :artifice => "endpoint"
300
+
301
+ vendored_gems("bin/rackup").should exist
302
+ end
303
+
304
+ it "installs the bins when using --path and uses bundle clean" do
305
+ gemfile <<-G
306
+ source "#{source_uri}"
307
+ gem "rack"
308
+ G
309
+
310
+ bundle "install --path vendor/bundle --no-clean", :artifice => "endpoint"
311
+
312
+ vendored_gems("bin/rackup").should exist
313
+ end
314
+
315
+ context "when using basic authentication" do
316
+ let(:user) { "user" }
317
+ let(:password) { "pass" }
318
+ let(:basic_auth_source_uri) do
319
+ uri = URI.parse(source_uri)
320
+ uri.user = user
321
+ uri.password = password
322
+
323
+ uri
324
+ end
325
+
326
+ it "passes basic authentication details and strips out creds" do
327
+ gemfile <<-G
328
+ source "#{basic_auth_source_uri}"
329
+ gem "rack"
330
+ G
331
+
332
+ bundle :install, :artifice => "endpoint_basic_authentication"
333
+ out.should_not include("#{user}:#{password}")
334
+ should_be_installed "rack 1.0.0"
335
+ end
336
+
337
+ it "strips http basic authentication creds for modern index" do
338
+ gemfile <<-G
339
+ source "#{basic_auth_source_uri}"
340
+ gem "rack"
341
+ G
342
+
343
+ bundle :install, :artifice => "endopint_marshal_fail_basic_authentication"
344
+ out.should_not include("#{user}:#{password}")
345
+ should_be_installed "rack 1.0.0"
346
+ end
347
+
348
+ it "strips http basic auth creds when it can't reach the server" do
349
+ gemfile <<-G
350
+ source "#{basic_auth_source_uri}"
351
+ gem "rack"
352
+ G
353
+
354
+ bundle :install, :artifice => "endpoint_500"
355
+ out.should_not include("#{user}:#{password}")
356
+ end
357
+ end
284
358
  end
@@ -193,7 +193,7 @@ describe "bundle flex_install" do
193
193
 
194
194
  it "suggests bundle update when the Gemfile requires different versions than the lock" do
195
195
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
196
- Fetching source index for file:#{gem_repo2}/
196
+ Fetching source index from file:#{gem_repo2}/
197
197
  Bundler could not find compatible versions for gem "rack":
198
198
  In snapshot (Gemfile.lock):
199
199
  rack (0.9.1)
@@ -21,16 +21,23 @@ describe "bundle install with gem sources" do
21
21
  it "installs gems in a group block into that group" do
22
22
  should_be_installed "activesupport 2.3.5"
23
23
 
24
- run("require 'activesupport'; puts ACTIVESUPPORT",
25
- :default, :expect_err => true)
26
- @err.should =~ /no such file to load -- activesupport/
24
+ load_error_run <<-R, 'activesupport', :default
25
+ require 'activesupport'
26
+ puts ACTIVESUPPORT
27
+ R
28
+
29
+ err.should == "ZOMG LOAD ERROR"
27
30
  end
28
31
 
29
32
  it "installs gems with inline :groups into those groups" do
30
33
  should_be_installed "thin 1.0"
31
34
 
32
- run("require 'thin'; puts THIN", :default, :expect_err => true)
33
- @err.should =~ /no such file to load -- thin/
35
+ load_error_run <<-R, 'thin', :default
36
+ require 'thin'
37
+ puts THIN
38
+ R
39
+
40
+ err.should == "ZOMG LOAD ERROR"
34
41
  end
35
42
 
36
43
  it "sets up everything if Bundler.setup is used with no groups" do
@@ -45,11 +52,13 @@ describe "bundle install with gem sources" do
45
52
  end
46
53
 
47
54
  it "removes old groups when new groups are set up" do
48
- run <<-RUBY, :emo, :expect_err => true
55
+ load_error_run <<-RUBY, 'thin', :emo
49
56
  Bundler.setup(:default)
50
- require 'thin'; puts THIN
57
+ require 'thin'
58
+ puts THIN
51
59
  RUBY
52
- @err.should =~ /no such file to load -- thin/i
60
+
61
+ err.should == "ZOMG LOAD ERROR"
53
62
  end
54
63
 
55
64
  it "sets up old groups when they have previously been removed" do
@@ -610,7 +610,7 @@ describe "bundle install with gem sources" do
610
610
  G
611
611
 
612
612
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
613
- Fetching source index for file:#{gem_repo2}/
613
+ Fetching source index from file:#{gem_repo2}/
614
614
  Bundler could not find compatible versions for gem "bundler":
615
615
  In Gemfile:
616
616
  bundler (= 0.9.2) ruby
@@ -667,7 +667,7 @@ describe "bundle install with gem sources" do
667
667
  G
668
668
 
669
669
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
670
- Fetching source index for file:#{gem_repo2}/
670
+ Fetching source index from file:#{gem_repo2}/
671
671
  Bundler could not find compatible versions for gem "activesupport":
672
672
  In Gemfile:
673
673
  activemerchant (>= 0) ruby depends on
@@ -687,7 +687,7 @@ describe "bundle install with gem sources" do
687
687
  G
688
688
 
689
689
  nice_error = <<-E.strip.gsub(/^ {8}/, '')
690
- Fetching source index for file:#{gem_repo2}/
690
+ Fetching source index from file:#{gem_repo2}/
691
691
  Bundler could not find compatible versions for gem "activesupport":
692
692
  In Gemfile:
693
693
  rails_fail (>= 0) ruby depends on
@@ -113,7 +113,7 @@ describe "bundle install --standalone" do
113
113
  it "allows creating a standalone file with limited groups" do
114
114
  bundle "install --standalone default"
115
115
 
116
- ruby <<-RUBY, :no_lib => true, :expect_err => true
116
+ load_error_ruby <<-RUBY, 'spec', :no_lib => true
117
117
  $:.unshift File.expand_path("bundle")
118
118
  require "bundler/setup"
119
119
 
@@ -123,13 +123,13 @@ describe "bundle install --standalone" do
123
123
  RUBY
124
124
 
125
125
  out.should be == "2.3.2"
126
- err.should =~ /no such file to load.*spec/
126
+ err.should == "ZOMG LOAD ERROR"
127
127
  end
128
128
 
129
129
  it "allows --without to limit the groups used in a standalone" do
130
130
  bundle "install --standalone --without test"
131
131
 
132
- ruby <<-RUBY, :no_lib => true, :expect_err => true
132
+ load_error_ruby <<-RUBY, 'spec', :no_lib => true
133
133
  $:.unshift File.expand_path("bundle")
134
134
  require "bundler/setup"
135
135
 
@@ -139,7 +139,7 @@ describe "bundle install --standalone" do
139
139
  RUBY
140
140
 
141
141
  out.should be == "2.3.2"
142
- err.should =~ /no such file to load.*spec/
142
+ err.should == "ZOMG LOAD ERROR"
143
143
  end
144
144
 
145
145
  it "allows --path to change the location of the standalone bundle" do
@@ -160,7 +160,7 @@ describe "bundle install --standalone" do
160
160
  bundle "install --without test"
161
161
  bundle "install --standalone"
162
162
 
163
- ruby <<-RUBY, :no_lib => true, :expect_err => true
163
+ load_error_ruby <<-RUBY, 'spec', :no_lib => true
164
164
  $:.unshift File.expand_path("bundle")
165
165
  require "bundler/setup"
166
166
 
@@ -170,7 +170,7 @@ describe "bundle install --standalone" do
170
170
  RUBY
171
171
 
172
172
  out.should be == "2.3.2"
173
- err.should =~ /no such file to load.*spec/
173
+ err.should == "ZOMG LOAD ERROR"
174
174
  end
175
175
  end
176
176