bundler 1.0.21 → 1.1.rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +7 -0
- data/CHANGELOG.md +153 -1
- data/README.md +3 -3
- data/Rakefile +15 -27
- data/bin/bundle +7 -0
- data/bundler.gemspec +1 -1
- data/lib/bundler/cli.rb +126 -45
- data/lib/bundler/definition.rb +22 -5
- data/lib/bundler/dep_proxy.rb +35 -0
- data/lib/bundler/dsl.rb +17 -34
- data/lib/bundler/endpoint_specification.rb +69 -0
- data/lib/bundler/fetcher.rb +221 -0
- data/lib/bundler/gem_helper.rb +0 -1
- data/lib/bundler/gem_helpers.rb +23 -0
- data/lib/bundler/index.rb +77 -38
- data/lib/bundler/installer.rb +43 -1
- data/lib/bundler/man/bundle-benchmark +19 -0
- data/lib/bundler/man/bundle-benchmark.txt +27 -0
- data/lib/bundler/man/bundle-config +1 -1
- data/lib/bundler/man/bundle-config.txt +3 -3
- data/lib/bundler/man/bundle-install +288 -0
- data/lib/bundler/man/bundle-install.txt +74 -79
- data/lib/bundler/man/bundle-package +1 -1
- data/lib/bundler/man/bundle-package.txt +1 -1
- data/lib/bundler/man/bundle-update +1 -1
- data/lib/bundler/man/bundle-update.txt +41 -41
- data/lib/bundler/man/gemfile.5 +6 -7
- data/lib/bundler/man/gemfile.5.txt +9 -9
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/remote_specification.rb +6 -8
- data/lib/bundler/resolver.rb +32 -19
- data/lib/bundler/rubygems_ext.rb +2 -86
- data/lib/bundler/rubygems_integration.rb +35 -0
- data/lib/bundler/runtime.rb +84 -1
- data/lib/bundler/source.rb +85 -88
- data/lib/bundler/spec_set.rb +2 -0
- data/lib/bundler/templates/Executable +1 -1
- data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
- data/lib/bundler/templates/newgem/Rakefile.tt +1 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +1 -1
- data/lib/bundler/templates/newgem/gitignore.tt +14 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -20
- data/lib/bundler/ui.rb +32 -17
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +468 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler.rb +56 -23
- data/man/bundle-install.ronn +7 -0
- data/man/bundle.ronn +3 -0
- data/man/gemfile.5.ronn +6 -6
- data/spec/bundler/dsl_spec.rb +22 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/install/deprecated_spec.rb +2 -3
- data/spec/install/gems/dependency_api_spec.rb +358 -0
- data/spec/install/gems/flex_spec.rb +1 -1
- data/spec/install/gems/groups_spec.rb +17 -8
- data/spec/install/gems/platform_spec.rb +16 -0
- data/spec/install/gems/post_install_spec.rb +47 -0
- data/spec/install/gems/simple_case_spec.rb +61 -64
- data/spec/install/gems/standalone_spec.rb +238 -0
- data/spec/install/git_spec.rb +62 -0
- data/spec/other/check_spec.rb +30 -0
- data/spec/other/clean_spec.rb +397 -0
- data/spec/other/exec_spec.rb +0 -29
- data/spec/other/newgem_spec.rb +39 -0
- data/spec/other/outdated_spec.rb +93 -0
- data/spec/other/show_spec.rb +6 -0
- data/spec/quality_spec.rb +1 -1
- data/spec/realworld/edgecases_spec.rb +12 -0
- data/spec/runtime/executable_spec.rb +10 -0
- data/spec/runtime/require_spec.rb +8 -9
- data/spec/runtime/with_clean_env_spec.rb +60 -7
- data/spec/spec_helper.rb +8 -1
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +54 -0
- data/spec/support/artifice/endpoint_500.rb +37 -0
- data/spec/support/artifice/endpoint_api_missing.rb +16 -0
- data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint_extra.rb +27 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +18 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/builders.rb +7 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/helpers.rb +36 -3
- data/spec/support/path.rb +2 -0
- data/spec/support/rubygems_ext.rb +3 -3
- metadata +48 -74
data/lib/bundler.rb
CHANGED
|
@@ -16,26 +16,31 @@ require 'bundler/version'
|
|
|
16
16
|
module Bundler
|
|
17
17
|
ORIGINAL_ENV = ENV.to_hash
|
|
18
18
|
|
|
19
|
-
autoload :Definition,
|
|
20
|
-
autoload :Dependency,
|
|
21
|
-
autoload :
|
|
22
|
-
autoload :
|
|
23
|
-
autoload :
|
|
24
|
-
autoload :
|
|
25
|
-
autoload :
|
|
26
|
-
autoload :
|
|
27
|
-
autoload :
|
|
28
|
-
autoload :
|
|
29
|
-
autoload :
|
|
30
|
-
autoload :
|
|
31
|
-
autoload :
|
|
32
|
-
autoload :
|
|
33
|
-
autoload :
|
|
34
|
-
autoload :
|
|
35
|
-
autoload :
|
|
36
|
-
autoload :
|
|
37
|
-
autoload :
|
|
38
|
-
autoload :
|
|
19
|
+
autoload :Definition, 'bundler/definition'
|
|
20
|
+
autoload :Dependency, 'bundler/dependency'
|
|
21
|
+
autoload :DepProxy, 'bundler/dep_proxy'
|
|
22
|
+
autoload :Dsl, 'bundler/dsl'
|
|
23
|
+
autoload :EndpointSpecification, 'bundler/endpoint_specification'
|
|
24
|
+
autoload :Environment, 'bundler/environment'
|
|
25
|
+
autoload :Fetcher, 'bundler/fetcher'
|
|
26
|
+
autoload :GemHelper, 'bundler/gem_helper'
|
|
27
|
+
autoload :GemHelpers, 'bundler/gem_helpers'
|
|
28
|
+
autoload :GemInstaller, 'bundler/gem_installer'
|
|
29
|
+
autoload :Graph, 'bundler/graph'
|
|
30
|
+
autoload :Index, 'bundler/index'
|
|
31
|
+
autoload :Installer, 'bundler/installer'
|
|
32
|
+
autoload :LazySpecification, 'bundler/lazy_specification'
|
|
33
|
+
autoload :LockfileParser, 'bundler/lockfile_parser'
|
|
34
|
+
autoload :MatchPlatform, 'bundler/match_platform'
|
|
35
|
+
autoload :RemoteSpecification, 'bundler/remote_specification'
|
|
36
|
+
autoload :Resolver, 'bundler/resolver'
|
|
37
|
+
autoload :Runtime, 'bundler/runtime'
|
|
38
|
+
autoload :Settings, 'bundler/settings'
|
|
39
|
+
autoload :SharedHelpers, 'bundler/shared_helpers'
|
|
40
|
+
autoload :SpecSet, 'bundler/spec_set'
|
|
41
|
+
autoload :Source, 'bundler/source'
|
|
42
|
+
autoload :Specification, 'bundler/shared_helpers'
|
|
43
|
+
autoload :UI, 'bundler/ui'
|
|
39
44
|
|
|
40
45
|
class BundlerError < StandardError
|
|
41
46
|
def self.status_code(code)
|
|
@@ -54,6 +59,7 @@ module Bundler
|
|
|
54
59
|
class DslError < BundlerError; status_code(15) ; end
|
|
55
60
|
class ProductionError < BundlerError; status_code(16) ; end
|
|
56
61
|
class InvalidOption < DslError ; end
|
|
62
|
+
class HTTPError < BundlerError; status_code(17) ; end
|
|
57
63
|
|
|
58
64
|
|
|
59
65
|
WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
|
|
@@ -185,7 +191,7 @@ module Bundler
|
|
|
185
191
|
@settings ||= Settings.new(app_config_path)
|
|
186
192
|
end
|
|
187
193
|
|
|
188
|
-
def
|
|
194
|
+
def with_original_env
|
|
189
195
|
bundled_env = ENV.to_hash
|
|
190
196
|
ENV.replace(ORIGINAL_ENV)
|
|
191
197
|
yield
|
|
@@ -193,6 +199,21 @@ module Bundler
|
|
|
193
199
|
ENV.replace(bundled_env.to_hash)
|
|
194
200
|
end
|
|
195
201
|
|
|
202
|
+
def with_clean_env
|
|
203
|
+
with_original_env do
|
|
204
|
+
ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }
|
|
205
|
+
yield
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
def clean_system(*args)
|
|
210
|
+
with_clean_env { Kernel.system(*args) }
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def clean_exec(*args)
|
|
214
|
+
with_clean_env { Kernel.exec(*args) }
|
|
215
|
+
end
|
|
216
|
+
|
|
196
217
|
def default_gemfile
|
|
197
218
|
SharedHelpers.default_gemfile
|
|
198
219
|
end
|
|
@@ -201,15 +222,27 @@ module Bundler
|
|
|
201
222
|
SharedHelpers.default_lockfile
|
|
202
223
|
end
|
|
203
224
|
|
|
225
|
+
def system_bindir
|
|
226
|
+
# Gem.bindir doesn't always return the location that Rubygems will install
|
|
227
|
+
# system binaries. If you put '-n foo' in your .gemrc, Rubygems will
|
|
228
|
+
# install binstubs there instead. Unfortunately, Rubygems doesn't expose
|
|
229
|
+
# that directory at all, so rather than parse .gemrc ourselves, we allow
|
|
230
|
+
# the directory to be set as well, via `bundle config bindir foo`.
|
|
231
|
+
Bundler.settings[:system_bindir] || Bundler.rubygems.gem_bindir
|
|
232
|
+
end
|
|
233
|
+
|
|
204
234
|
def requires_sudo?
|
|
205
|
-
return @requires_sudo if defined?(@checked_for_sudo)
|
|
235
|
+
return @requires_sudo if defined?(@checked_for_sudo)
|
|
206
236
|
|
|
207
237
|
path = bundle_path
|
|
208
238
|
path = path.parent until path.exist?
|
|
209
239
|
sudo_present = !(`which sudo` rescue '').empty?
|
|
240
|
+
bin_dir = Pathname.new(Bundler.system_bindir)
|
|
241
|
+
bin_dir = bin_dir.parent until bin_dir.exist?
|
|
210
242
|
|
|
211
243
|
@checked_for_sudo = true
|
|
212
|
-
|
|
244
|
+
sudo_gems = !File.writable?(path) || !File.writable?(bin_dir)
|
|
245
|
+
@requires_sudo = settings.allow_sudo? && sudo_gems && sudo_present
|
|
213
246
|
end
|
|
214
247
|
|
|
215
248
|
def mkdir_p(path)
|
data/man/bundle-install.ronn
CHANGED
|
@@ -8,6 +8,7 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
|
|
|
8
8
|
[--without=GROUP1[ GROUP2...]]
|
|
9
9
|
[--local] [--deployment]
|
|
10
10
|
[--binstubs[=DIRECTORY]]
|
|
11
|
+
[--standalone[=GROUP1[ GROUP2...]]]
|
|
11
12
|
[--quiet]
|
|
12
13
|
|
|
13
14
|
## DESCRIPTION
|
|
@@ -69,6 +70,12 @@ update process below under [CONSERVATIVE UPDATING][].
|
|
|
69
70
|
a `bin/rails` executable that ensures that all dependencies used
|
|
70
71
|
come from the bundled gems.
|
|
71
72
|
|
|
73
|
+
* `--standalone[=<list>]`:
|
|
74
|
+
Make a bundle that can work without Ruby Gems or Bundler at runtime.
|
|
75
|
+
It takes a space separated list of groups to install. It creates a
|
|
76
|
+
`bundle` directory and installs the bundle there. It also generates
|
|
77
|
+
a `bundle/bundler/setup.rb` file to replace Bundler's own setup.
|
|
78
|
+
|
|
72
79
|
## DEPLOYMENT MODE
|
|
73
80
|
|
|
74
81
|
Bundler's defaults are optimized for development. To switch to
|
data/man/bundle.ronn
CHANGED
|
@@ -55,6 +55,9 @@ We divide `bundle` subcommands into primary commands and utilities.
|
|
|
55
55
|
* `bundle show(1)`:
|
|
56
56
|
Show the source location of a particular gem in the bundle
|
|
57
57
|
|
|
58
|
+
* `bundle outdated(1)`:
|
|
59
|
+
Show all of the outdated gems in the current bundle
|
|
60
|
+
|
|
58
61
|
* `bundle console(1)`:
|
|
59
62
|
Start an IRB session in the context of the current bundle
|
|
60
63
|
|
data/man/gemfile.5.ronn
CHANGED
|
@@ -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
|
|
49
|
-
|
|
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
|
-
|
|
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
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Bundler::Dsl do
|
|
4
|
+
describe '#_normalize_options' do
|
|
5
|
+
before do
|
|
6
|
+
@rubygems = mock("rubygems")
|
|
7
|
+
Bundler::Source::Rubygems.stub(:new){ @rubygems }
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it "should convert :github to :git" do
|
|
11
|
+
subject.gem("sparks", :github => "indirect/sparks")
|
|
12
|
+
github_uri = "git://github.com/indirect/sparks.git"
|
|
13
|
+
subject.dependencies.first.source.uri.should == github_uri
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should convert 'rails' to 'rails/rails'" do
|
|
17
|
+
subject.gem("rails", :github => "rails")
|
|
18
|
+
github_uri = "git://github.com/rails/rails.git"
|
|
19
|
+
subject.dependencies.first.source.uri.should == github_uri
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Bundler::Source::Rubygems do
|
|
4
|
+
before do
|
|
5
|
+
Bundler.stub(:root){ Pathname.new("root") }
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe "caches" do
|
|
9
|
+
it "should include Bundler.app_cache" do
|
|
10
|
+
subject.caches.should include(Bundler.app_cache)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it "should include GEM_PATH entries" do
|
|
14
|
+
Gem.path.each do |path|
|
|
15
|
+
subject.caches.should include(File.expand_path("#{path}/cache"))
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "should be an array of strings or pathnames" do
|
|
20
|
+
subject.caches.each do |cache|
|
|
21
|
+
[String, Pathname].should include(cache.class)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -5,8 +5,7 @@ describe "bundle install with deprecated features" do
|
|
|
5
5
|
in_app_root
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
%w(
|
|
9
|
-
clear_sources bundle_path bin_path ).each do |deprecated|
|
|
8
|
+
%w().each do |deprecated|
|
|
10
9
|
|
|
11
10
|
it "reports that #{deprecated} is deprecated" do
|
|
12
11
|
gemfile <<-G
|
|
@@ -21,7 +20,7 @@ describe "bundle install with deprecated features" do
|
|
|
21
20
|
end
|
|
22
21
|
|
|
23
22
|
|
|
24
|
-
%w(
|
|
23
|
+
%w().each do |deprecated|
|
|
25
24
|
|
|
26
25
|
it "reports that :#{deprecated} is deprecated" do
|
|
27
26
|
gemfile <<-G
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe "gemcutter's dependency API" do
|
|
4
|
+
let(:source_uri) { "http://localgemserver.test" }
|
|
5
|
+
|
|
6
|
+
it "should use the API" do
|
|
7
|
+
gemfile <<-G
|
|
8
|
+
source "#{source_uri}"
|
|
9
|
+
gem "rack"
|
|
10
|
+
G
|
|
11
|
+
|
|
12
|
+
bundle :install, :artifice => "endpoint"
|
|
13
|
+
out.should include("Fetching gem metadata from #{source_uri}")
|
|
14
|
+
should_be_installed "rack 1.0.0"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should handle nested dependencies" do
|
|
18
|
+
gemfile <<-G
|
|
19
|
+
source "#{source_uri}"
|
|
20
|
+
gem "rails"
|
|
21
|
+
G
|
|
22
|
+
|
|
23
|
+
bundle :install, :artifice => "endpoint"
|
|
24
|
+
out.should include("Fetching gem metadata from #{source_uri}/...")
|
|
25
|
+
should_be_installed(
|
|
26
|
+
"rails 2.3.2",
|
|
27
|
+
"actionpack 2.3.2",
|
|
28
|
+
"activerecord 2.3.2",
|
|
29
|
+
"actionmailer 2.3.2",
|
|
30
|
+
"activeresource 2.3.2",
|
|
31
|
+
"activesupport 2.3.2")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should handle multiple gem dependencies on the same gem" do
|
|
35
|
+
gemfile <<-G
|
|
36
|
+
source "#{source_uri}"
|
|
37
|
+
gem "net-sftp"
|
|
38
|
+
G
|
|
39
|
+
|
|
40
|
+
bundle :install, :artifice => "endpoint"
|
|
41
|
+
should_be_installed "net-sftp 1.1.1"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "should use the endpoint when using --deployment" do
|
|
45
|
+
gemfile <<-G
|
|
46
|
+
source "#{source_uri}"
|
|
47
|
+
gem "rack"
|
|
48
|
+
G
|
|
49
|
+
bundle :install, :artifice => "endpoint"
|
|
50
|
+
|
|
51
|
+
bundle "install --deployment", :artifice => "endpoint"
|
|
52
|
+
out.should include("Fetching gem metadata from #{source_uri}")
|
|
53
|
+
should_be_installed "rack 1.0.0"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "handles git dependencies that are in rubygems" do
|
|
57
|
+
build_git "foo" do |s|
|
|
58
|
+
s.executables = "foobar"
|
|
59
|
+
s.add_dependency "rails", "2.3.2"
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
gemfile <<-G
|
|
63
|
+
source "#{source_uri}"
|
|
64
|
+
git "file:///#{lib_path('foo-1.0')}" do
|
|
65
|
+
gem 'foo'
|
|
66
|
+
end
|
|
67
|
+
G
|
|
68
|
+
|
|
69
|
+
bundle :install, :artifice => "endpoint"
|
|
70
|
+
|
|
71
|
+
should_be_installed("rails 2.3.2")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it "handles git dependencies that are in rubygems using --deployment" do
|
|
75
|
+
build_git "foo" do |s|
|
|
76
|
+
s.executables = "foobar"
|
|
77
|
+
s.add_dependency "rails", "2.3.2"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
gemfile <<-G
|
|
81
|
+
source "#{source_uri}"
|
|
82
|
+
gem 'foo', :git => "file:///#{lib_path('foo-1.0')}"
|
|
83
|
+
G
|
|
84
|
+
|
|
85
|
+
bundle :install, :artifice => "endpoint"
|
|
86
|
+
|
|
87
|
+
bundle "install --deployment", :artifice => "endpoint"
|
|
88
|
+
|
|
89
|
+
should_be_installed("rails 2.3.2")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it "falls back when the API errors out" do
|
|
93
|
+
simulate_platform mswin
|
|
94
|
+
|
|
95
|
+
gemfile <<-G
|
|
96
|
+
source "#{source_uri}"
|
|
97
|
+
gem "rcov"
|
|
98
|
+
G
|
|
99
|
+
|
|
100
|
+
bundle :install, :fakeweb => "windows"
|
|
101
|
+
out.should include("\nFetching full source index from #{source_uri}")
|
|
102
|
+
should_be_installed "rcov 1.0.0"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it "falls back when hitting the Gemcutter Dependency Limit" do
|
|
106
|
+
gemfile <<-G
|
|
107
|
+
source "#{source_uri}"
|
|
108
|
+
gem "activesupport"
|
|
109
|
+
gem "actionpack"
|
|
110
|
+
gem "actionmailer"
|
|
111
|
+
gem "activeresource"
|
|
112
|
+
gem "thin"
|
|
113
|
+
gem "rack"
|
|
114
|
+
gem "rails"
|
|
115
|
+
G
|
|
116
|
+
bundle :install, :artifice => "endpoint_fallback"
|
|
117
|
+
out.should include("\nFetching full source index from #{source_uri}")
|
|
118
|
+
|
|
119
|
+
should_be_installed(
|
|
120
|
+
"activesupport 2.3.2",
|
|
121
|
+
"actionpack 2.3.2",
|
|
122
|
+
"actionmailer 2.3.2",
|
|
123
|
+
"activeresource 2.3.2",
|
|
124
|
+
"activesupport 2.3.2",
|
|
125
|
+
"thin 1.0.0",
|
|
126
|
+
"rack 1.0.0",
|
|
127
|
+
"rails 2.3.2")
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
it "falls back when Gemcutter API doesn't return proper Marshal format" do
|
|
131
|
+
gemfile <<-G
|
|
132
|
+
source "#{source_uri}"
|
|
133
|
+
gem "rack"
|
|
134
|
+
G
|
|
135
|
+
|
|
136
|
+
bundle :install, :artifice => "endpoint_marshal_fail"
|
|
137
|
+
out.should include("\nFetching full source index from #{source_uri}")
|
|
138
|
+
should_be_installed "rack 1.0.0"
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
it "timeouts when Bundler::Fetcher redirects too much" do
|
|
142
|
+
gemfile <<-G
|
|
143
|
+
source "#{source_uri}"
|
|
144
|
+
gem "rack"
|
|
145
|
+
G
|
|
146
|
+
|
|
147
|
+
bundle :install, :artifice => "endpoint_redirect"
|
|
148
|
+
out.should match(/Too many redirects/)
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it "should use the modern index when the --full-index" do
|
|
152
|
+
gemfile <<-G
|
|
153
|
+
source "#{source_uri}"
|
|
154
|
+
gem "rack"
|
|
155
|
+
G
|
|
156
|
+
|
|
157
|
+
bundle "install --full-index", :artifice => "endpoint"
|
|
158
|
+
out.should include("Fetching source index from #{source_uri}")
|
|
159
|
+
should_be_installed "rack 1.0.0"
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "fetches again when more dependencies are found in subsequent sources" do
|
|
163
|
+
build_repo2 do
|
|
164
|
+
build_gem "back_deps" do |s|
|
|
165
|
+
s.add_dependency "foo"
|
|
166
|
+
end
|
|
167
|
+
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
gemfile <<-G
|
|
171
|
+
source "#{source_uri}"
|
|
172
|
+
source "#{source_uri}/extra"
|
|
173
|
+
gem "back_deps"
|
|
174
|
+
G
|
|
175
|
+
|
|
176
|
+
bundle :install, :artifice => "endpoint_extra"
|
|
177
|
+
should_be_installed "back_deps 1.0"
|
|
178
|
+
end
|
|
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
|
+
|
|
203
|
+
it "does not fetch every specs if the index of gems is large when doing back deps" do
|
|
204
|
+
build_repo2 do
|
|
205
|
+
build_gem "back_deps" do |s|
|
|
206
|
+
s.add_dependency "foo"
|
|
207
|
+
end
|
|
208
|
+
build_gem "missing"
|
|
209
|
+
# need to hit the limit
|
|
210
|
+
1.upto(Bundler::Source::Rubygems::FORCE_MODERN_INDEX_LIMIT) do |i|
|
|
211
|
+
build_gem "gem#{i}"
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
gemfile <<-G
|
|
218
|
+
source "#{source_uri}"
|
|
219
|
+
source "#{source_uri}/extra"
|
|
220
|
+
gem "back_deps"
|
|
221
|
+
G
|
|
222
|
+
|
|
223
|
+
bundle :install, :artifice => "endpoint_extra_missing"
|
|
224
|
+
should_be_installed "back_deps 1.0"
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it "uses the endpoint if all sources support it" do
|
|
228
|
+
gemfile <<-G
|
|
229
|
+
source "#{source_uri}"
|
|
230
|
+
|
|
231
|
+
gem 'foo'
|
|
232
|
+
G
|
|
233
|
+
|
|
234
|
+
bundle :install, :artifice => "endpoint_api_missing"
|
|
235
|
+
should_be_installed "foo 1.0"
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
it "fetches again when more dependencies are found in subsequent sources using --deployment" do
|
|
239
|
+
build_repo2 do
|
|
240
|
+
build_gem "back_deps" do |s|
|
|
241
|
+
s.add_dependency "foo"
|
|
242
|
+
end
|
|
243
|
+
FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")]
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
gemfile <<-G
|
|
247
|
+
source "#{source_uri}"
|
|
248
|
+
source "#{source_uri}/extra"
|
|
249
|
+
gem "back_deps"
|
|
250
|
+
G
|
|
251
|
+
|
|
252
|
+
bundle :install, :artifice => "endpoint_extra"
|
|
253
|
+
|
|
254
|
+
bundle "install --deployment", :artifice => "endpoint_extra"
|
|
255
|
+
should_be_installed "back_deps 1.0"
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
it "does not refetch if the only unmet dependency is bundler" do
|
|
259
|
+
gemfile <<-G
|
|
260
|
+
source "#{source_uri}"
|
|
261
|
+
|
|
262
|
+
gem "bundler_dep"
|
|
263
|
+
G
|
|
264
|
+
|
|
265
|
+
bundle :install, :artifice => "endpoint"
|
|
266
|
+
out.should include("Fetching gem metadata from #{source_uri}")
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
it "should install when EndpointSpecification with a bin dir owned by root", :sudo => true do
|
|
270
|
+
sudo "mkdir -p #{system_gem_path("bin")}"
|
|
271
|
+
sudo "chown -R root #{system_gem_path("bin")}"
|
|
272
|
+
|
|
273
|
+
gemfile <<-G
|
|
274
|
+
source "#{source_uri}"
|
|
275
|
+
gem "rails"
|
|
276
|
+
G
|
|
277
|
+
bundle :install, :artifice => "endpoint"
|
|
278
|
+
should_be_installed "rails 2.3.2"
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
it "installs the binstubs" do
|
|
282
|
+
gemfile <<-G
|
|
283
|
+
source "#{source_uri}"
|
|
284
|
+
gem "rack"
|
|
285
|
+
G
|
|
286
|
+
|
|
287
|
+
bundle "install --binstubs", :artifice => "endpoint"
|
|
288
|
+
|
|
289
|
+
gembin "rackup"
|
|
290
|
+
out.should == "1.0.0"
|
|
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
|
|
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
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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
|
-
|
|
55
|
+
load_error_run <<-RUBY, 'thin', :emo
|
|
49
56
|
Bundler.setup(:default)
|
|
50
|
-
require 'thin'
|
|
57
|
+
require 'thin'
|
|
58
|
+
puts THIN
|
|
51
59
|
RUBY
|
|
52
|
-
|
|
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
|
|
@@ -190,3 +190,19 @@ describe "bundle install with platform conditionals" do
|
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
end
|
|
193
|
+
|
|
194
|
+
describe "when a gem has an architecture in its platform" do
|
|
195
|
+
it "still installs correctly" do
|
|
196
|
+
simulate_platform mswin
|
|
197
|
+
|
|
198
|
+
gemfile <<-G
|
|
199
|
+
# Try to install gem with nil arch
|
|
200
|
+
source "http://localgemserver.test/"
|
|
201
|
+
gem "rcov"
|
|
202
|
+
G
|
|
203
|
+
|
|
204
|
+
bundle :install, :fakeweb => "windows"
|
|
205
|
+
should_be_installed "rcov 1.0.0"
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|