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
|
@@ -1,15 +1,68 @@
|
|
|
1
1
|
require "spec_helper"
|
|
2
2
|
|
|
3
|
-
describe "Bundler.
|
|
3
|
+
describe "Bundler.with_env helpers" do
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
shared_examples_for "Bundler.with_*_env" do
|
|
6
|
+
it "should reset and restore the environment" do
|
|
7
|
+
gem_path = ENV['GEM_PATH']
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
Bundler.with_clean_env do
|
|
10
|
+
`echo $GEM_PATH`.strip.should_not == gem_path
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
ENV['GEM_PATH'].should == gem_path
|
|
10
14
|
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
around do |example|
|
|
18
|
+
bundle_path = Bundler::ORIGINAL_ENV['BUNDLE_PATH']
|
|
19
|
+
Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = "./Gemfile"
|
|
20
|
+
example.run
|
|
21
|
+
Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = bundle_path
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe "Bundler.with_clean_env" do
|
|
25
|
+
|
|
26
|
+
it_should_behave_like "Bundler.with_*_env"
|
|
11
27
|
|
|
12
|
-
|
|
28
|
+
it "should not pass any bundler environment variables" do
|
|
29
|
+
Bundler.with_clean_env do
|
|
30
|
+
`echo $BUNDLE_PATH`.strip.should_not == './Gemfile'
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it "should not change ORIGINAL_ENV" do
|
|
35
|
+
Bundler::ORIGINAL_ENV['BUNDLE_PATH'].should == './Gemfile'
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe "Bundler.with_original_env" do
|
|
41
|
+
|
|
42
|
+
it_should_behave_like "Bundler.with_*_env"
|
|
43
|
+
|
|
44
|
+
it "should pass bundler environment variables set before Bundler was run" do
|
|
45
|
+
Bundler.with_original_env do
|
|
46
|
+
`echo $BUNDLE_PATH`.strip.should == './Gemfile'
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
describe "Bundler.clean_system" do
|
|
52
|
+
it "runs system inside with_clean_env" do
|
|
53
|
+
Bundler.clean_system(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
|
|
54
|
+
$?.exitstatus.should == 42
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe "Bundler.clean_exec" do
|
|
59
|
+
it "runs exec inside with_clean_env" do
|
|
60
|
+
pid = Kernel.fork do
|
|
61
|
+
Bundler.clean_exec(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
|
|
62
|
+
end
|
|
63
|
+
Process.wait(pid)
|
|
64
|
+
$?.exitstatus.should == 42
|
|
65
|
+
end
|
|
13
66
|
end
|
|
14
67
|
|
|
15
|
-
end
|
|
68
|
+
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -12,6 +12,7 @@ require 'fileutils'
|
|
|
12
12
|
require 'rubygems'
|
|
13
13
|
require 'bundler'
|
|
14
14
|
require 'rspec'
|
|
15
|
+
require 'uri'
|
|
15
16
|
|
|
16
17
|
# Require the correct version of popen for the current platform
|
|
17
18
|
if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
|
|
@@ -25,7 +26,7 @@ else
|
|
|
25
26
|
end
|
|
26
27
|
|
|
27
28
|
Dir["#{File.expand_path('../support', __FILE__)}/*.rb"].each do |file|
|
|
28
|
-
require file
|
|
29
|
+
require file unless file =~ /fakeweb\/.*\.rb/
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
$debug = false
|
|
@@ -52,6 +53,12 @@ RSpec.configure do |config|
|
|
|
52
53
|
config.filter_run_excluding :sudo => true
|
|
53
54
|
end
|
|
54
55
|
|
|
56
|
+
if ENV['BUNDLER_REALWORLD_TESTS']
|
|
57
|
+
config.filter_run :realworld => true
|
|
58
|
+
else
|
|
59
|
+
config.filter_run_excluding :realworld => true
|
|
60
|
+
end
|
|
61
|
+
|
|
55
62
|
config.filter_run :focused => true unless ENV['CI']
|
|
56
63
|
config.run_all_when_everything_filtered = true
|
|
57
64
|
config.alias_example_to :fit, :focused => true
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require File.expand_path("../endpoint_marshal_fail", __FILE__)
|
|
2
|
+
|
|
3
|
+
Artifice.deactivate
|
|
4
|
+
|
|
5
|
+
class EndpointMarshalFailBasicAuthentication < EndpointMarshalFail
|
|
6
|
+
before do
|
|
7
|
+
unless env["HTTP_AUTHORIZATION"]
|
|
8
|
+
halt 401, "Authentication info not supplied"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Artifice.activate_with(EndpointMarshalFailBasicAuthentication)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
require File.expand_path("../../path.rb", __FILE__)
|
|
2
|
+
include Spec::Path
|
|
3
|
+
|
|
4
|
+
# Set up pretend http gem server with FakeWeb
|
|
5
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/artifice*/lib")].first}"
|
|
6
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].first}"
|
|
7
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].last}"
|
|
8
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/tilt*/lib")].first}"
|
|
9
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/sinatra*/lib")].first}"
|
|
10
|
+
require 'artifice'
|
|
11
|
+
require 'sinatra/base'
|
|
12
|
+
|
|
13
|
+
class Endpoint < Sinatra::Base
|
|
14
|
+
|
|
15
|
+
helpers do
|
|
16
|
+
def dependencies_for(gem_names, marshal = gem_repo1("Marshal.4.8"))
|
|
17
|
+
require 'rubygems'
|
|
18
|
+
Marshal.load(File.open(marshal).read).map do |gem, spec|
|
|
19
|
+
if gem_names.include?(spec.name)
|
|
20
|
+
{
|
|
21
|
+
:name => spec.name,
|
|
22
|
+
:number => spec.version.version,
|
|
23
|
+
:platform => spec.platform.to_s,
|
|
24
|
+
:dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
|
|
25
|
+
[dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
|
|
26
|
+
end
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
end.compact
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
get "/quick/Marshal.4.8/:id" do
|
|
34
|
+
redirect "/fetch/actual/gem/#{params[:id]}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
get "/fetch/actual/gem/:id" do
|
|
38
|
+
File.read("#{gem_repo1}/quick/Marshal.4.8/#{params[:id]}")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
get "/gems/:id" do
|
|
42
|
+
File.read("#{gem_repo1}/gems/#{params[:id]}")
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
get "/api/v1/dependencies" do
|
|
46
|
+
Marshal.dump(dependencies_for(params[:gems]))
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
get "/specs.4.8.gz" do
|
|
50
|
+
File.read("#{gem_repo1}/specs.4.8.gz")
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Artifice.activate_with(Endpoint)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require File.expand_path("../../path.rb", __FILE__)
|
|
2
|
+
include Spec::Path
|
|
3
|
+
|
|
4
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/artifice*/lib")].first}"
|
|
5
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].first}"
|
|
6
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].last}"
|
|
7
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/tilt*/lib")].first}"
|
|
8
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/sinatra*/lib")].first}"
|
|
9
|
+
|
|
10
|
+
require 'artifice'
|
|
11
|
+
require 'sinatra/base'
|
|
12
|
+
|
|
13
|
+
Artifice.deactivate
|
|
14
|
+
|
|
15
|
+
class Endpoint500 < Sinatra::Base
|
|
16
|
+
get "/quick/Marshal.4.8/:id" do
|
|
17
|
+
halt 500
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
get "/fetch/actual/gem/:id" do
|
|
21
|
+
halt 500
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
get "/gems/:id" do
|
|
25
|
+
halt 500
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
get "/api/v1/dependencies" do
|
|
29
|
+
halt 500
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
get "/specs.4.8.gz" do
|
|
33
|
+
halt 500
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Artifice.activate_with(Endpoint500)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require File.expand_path("../endpoint", __FILE__)
|
|
2
|
+
|
|
3
|
+
Artifice.deactivate
|
|
4
|
+
|
|
5
|
+
class EndpointApiMissing < Endpoint
|
|
6
|
+
get "/fetch/actual/gem/:id" do
|
|
7
|
+
$stderr.puts params[:id]
|
|
8
|
+
if params[:id] == 'rack-1.0.gemspec.rz'
|
|
9
|
+
halt 404
|
|
10
|
+
else
|
|
11
|
+
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Artifice.activate_with(EndpointApiMissing)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require File.expand_path("../endpoint", __FILE__)
|
|
2
|
+
|
|
3
|
+
Artifice.deactivate
|
|
4
|
+
|
|
5
|
+
class EndpointBasicAuthentication < Endpoint
|
|
6
|
+
before do
|
|
7
|
+
unless env["HTTP_AUTHORIZATION"]
|
|
8
|
+
halt 401, "Authentication info not supplied"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Artifice.activate_with(EndpointBasicAuthentication)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require File.expand_path("../endpoint", __FILE__)
|
|
2
|
+
|
|
3
|
+
Artifice.deactivate
|
|
4
|
+
|
|
5
|
+
class EndpointExtra < Endpoint
|
|
6
|
+
get "/extra/api/v1/dependencies" do
|
|
7
|
+
halt 404
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
get "/extra/specs.4.8.gz" do
|
|
11
|
+
File.read("#{gem_repo2}/specs.4.8.gz")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
get "/extra/quick/Marshal.4.8/:id" do
|
|
15
|
+
redirect "/extra/fetch/actual/gem/#{params[:id]}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
get "/extra/fetch/actual/gem/:id" do
|
|
19
|
+
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
get "/extra/gems/:id" do
|
|
23
|
+
File.read("#{gem_repo2}/gems/#{params[:id]}")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Artifice.activate_with(EndpointExtra)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require File.expand_path("../endpoint_extra", __FILE__)
|
|
2
|
+
|
|
3
|
+
Artifice.deactivate
|
|
4
|
+
|
|
5
|
+
class EndpointExtraMissing < EndpointExtra
|
|
6
|
+
get "/extra/fetch/actual/gem/:id" do
|
|
7
|
+
if params[:id] == 'missing-1.0.gemspec.rz'
|
|
8
|
+
halt 404
|
|
9
|
+
else
|
|
10
|
+
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Artifice.activate_with(EndpointExtraMissing)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require File.expand_path("../endpoint", __FILE__)
|
|
2
|
+
|
|
3
|
+
Artifice.deactivate
|
|
4
|
+
|
|
5
|
+
class EndpointFallback < Endpoint
|
|
6
|
+
DEPENDENCY_LIMIT = 60
|
|
7
|
+
|
|
8
|
+
get "/api/v1/dependencies" do
|
|
9
|
+
if params[:gems].size <= DEPENDENCY_LIMIT
|
|
10
|
+
Marshal.dump(dependencies_for(params[:gems]))
|
|
11
|
+
else
|
|
12
|
+
status 413
|
|
13
|
+
"Too many gems to resolve, please request less than #{DEPENDENCY_LIMIT} gems"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Artifice.activate_with(EndpointFallback)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require File.expand_path("../endpoint", __FILE__)
|
|
2
|
+
|
|
3
|
+
Artifice.deactivate
|
|
4
|
+
|
|
5
|
+
class EndpointRedirect < Endpoint
|
|
6
|
+
get "/fetch/actual/gem/:id" do
|
|
7
|
+
redirect "/fetch/actual/gem/#{params[:id]}"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
get "/api/v1/dependencies" do
|
|
11
|
+
status 404
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Artifice.activate_with(EndpointRedirect)
|
data/spec/support/builders.rb
CHANGED
|
@@ -16,14 +16,17 @@ module Spec
|
|
|
16
16
|
build_repo gem_repo1 do
|
|
17
17
|
build_gem "rack", %w(0.9.1 1.0.0) do |s|
|
|
18
18
|
s.executables = "rackup"
|
|
19
|
+
s.post_install_message = "Rack's post install message"
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
build_gem "thin" do |s|
|
|
22
23
|
s.add_dependency "rack"
|
|
24
|
+
s.post_install_message = "Thin's post install message"
|
|
23
25
|
end
|
|
24
26
|
|
|
25
27
|
build_gem "rack-obama" do |s|
|
|
26
28
|
s.add_dependency "rack"
|
|
29
|
+
s.post_install_message = "Rack-obama's post install message"
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
build_gem "rack_middleware", "1.0" do |s|
|
|
@@ -164,6 +167,10 @@ module Spec
|
|
|
164
167
|
s.write "lib/rubygems_plugin.rb", "require 'bundler/omg' ; puts 'FAIL'"
|
|
165
168
|
end
|
|
166
169
|
|
|
170
|
+
build_gem "bundler_dep" do |s|
|
|
171
|
+
s.add_dependency "bundler"
|
|
172
|
+
end
|
|
173
|
+
|
|
167
174
|
# The yard gem iterates over Gem.source_index looking for plugins
|
|
168
175
|
build_gem "yard" do |s|
|
|
169
176
|
s.write "lib/yard.rb", <<-Y
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require File.expand_path("../../path.rb", __FILE__)
|
|
2
|
+
include Spec::Path
|
|
3
|
+
|
|
4
|
+
files = [ 'specs.4.8.gz',
|
|
5
|
+
'prerelease_specs.4.8.gz',
|
|
6
|
+
'quick/Marshal.4.8/rcov-1.0-mswin32.gemspec.rz',
|
|
7
|
+
'gems/rcov-1.0-mswin32.gem' ]
|
|
8
|
+
|
|
9
|
+
# Set up pretend http gem server with FakeWeb
|
|
10
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/fakeweb*/lib")].first}"
|
|
11
|
+
require 'fakeweb'
|
|
12
|
+
|
|
13
|
+
FakeWeb.allow_net_connect = false
|
|
14
|
+
|
|
15
|
+
files.each do |file|
|
|
16
|
+
FakeWeb.register_uri(:get, "http://localgemserver.test/#{file}",
|
|
17
|
+
:body => File.read("#{gem_repo1}/#{file}"))
|
|
18
|
+
end
|
|
19
|
+
FakeWeb.register_uri(:get, "http://localgemserver.test/gems/rcov-1.0-x86-mswin32.gem",
|
|
20
|
+
:status => ["404", "Not Found"])
|
|
21
|
+
|
|
22
|
+
FakeWeb.register_uri(:get, "http://localgemserver.test/api/v1/dependencies?gems=rcov",
|
|
23
|
+
:status => ["404", "Not Found"])
|
data/spec/support/helpers.rb
CHANGED
|
@@ -35,6 +35,20 @@ module Spec
|
|
|
35
35
|
@out = ruby(setup + cmd, :expect_err => expect_err, :env => env)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
def load_error_run(ruby, gem, *args)
|
|
39
|
+
cmd = <<-R
|
|
40
|
+
begin
|
|
41
|
+
#{ruby}
|
|
42
|
+
rescue LoadError => e
|
|
43
|
+
$stderr.puts "ZOMG LOAD ERROR" if e.message.include?("-- #{gem}")
|
|
44
|
+
end
|
|
45
|
+
R
|
|
46
|
+
opts = args.last.is_a?(Hash) ? args.pop : {}
|
|
47
|
+
opts.merge!(:expect_err => true)
|
|
48
|
+
args += [opts]
|
|
49
|
+
run(cmd, *args)
|
|
50
|
+
end
|
|
51
|
+
|
|
38
52
|
def lib
|
|
39
53
|
File.expand_path('../../../lib', __FILE__)
|
|
40
54
|
end
|
|
@@ -44,12 +58,19 @@ module Spec
|
|
|
44
58
|
exitstatus = options.delete(:exitstatus)
|
|
45
59
|
options["no-color"] = true unless options.key?("no-color") || cmd.to_s[0..3] == "exec"
|
|
46
60
|
|
|
61
|
+
bundle_bin = File.expand_path('../../../bin/bundle', __FILE__)
|
|
62
|
+
|
|
63
|
+
requires = options.delete(:requires) || []
|
|
64
|
+
requires << File.expand_path('../fakeweb/'+options.delete(:fakeweb)+'.rb', __FILE__) if options.key?(:fakeweb)
|
|
65
|
+
requires << File.expand_path('../artifice/'+options.delete(:artifice)+'.rb', __FILE__) if options.key?(:artifice)
|
|
66
|
+
requires_str = requires.map{|r| "-r#{r}"}.join(" ")
|
|
67
|
+
|
|
47
68
|
env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
|
|
48
69
|
args = options.map do |k,v|
|
|
49
70
|
v == true ? " --#{k}" : " --#{k} #{v}" if v
|
|
50
71
|
end.join
|
|
51
|
-
|
|
52
|
-
cmd = "#{env}#{Gem.ruby} -I#{lib} #{
|
|
72
|
+
|
|
73
|
+
cmd = "#{env}#{Gem.ruby} -I#{lib} #{requires_str} #{bundle_bin} #{cmd}#{args}"
|
|
53
74
|
|
|
54
75
|
if exitstatus
|
|
55
76
|
sys_status(cmd)
|
|
@@ -62,7 +83,19 @@ module Spec
|
|
|
62
83
|
expect_err = options.delete(:expect_err)
|
|
63
84
|
env = (options.delete(:env) || {}).map{|k,v| "#{k}='#{v}' "}.join
|
|
64
85
|
ruby.gsub!(/["`\$]/) {|m| "\\#{m}" }
|
|
65
|
-
|
|
86
|
+
lib_option = options[:no_lib] ? "" : " -I#{lib}"
|
|
87
|
+
sys_exec(%{#{env}#{Gem.ruby}#{lib_option} -e "#{ruby}"}, expect_err)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def load_error_ruby(ruby, gem, opts = {})
|
|
91
|
+
cmd = <<-R
|
|
92
|
+
begin
|
|
93
|
+
#{ruby}
|
|
94
|
+
rescue LoadError => e
|
|
95
|
+
$stderr.puts "ZOMG LOAD ERROR"# if e.message.include?("-- #{gem}")
|
|
96
|
+
end
|
|
97
|
+
R
|
|
98
|
+
ruby(cmd, opts.merge(:expect_err => true))
|
|
66
99
|
end
|
|
67
100
|
|
|
68
101
|
def gembin(cmd)
|
data/spec/support/path.rb
CHANGED
|
@@ -11,12 +11,12 @@ module Spec
|
|
|
11
11
|
|
|
12
12
|
unless File.exist?("#{Path.base_system_gems}")
|
|
13
13
|
FileUtils.mkdir_p(Path.base_system_gems)
|
|
14
|
-
puts "
|
|
15
|
-
`gem install fakeweb --no-rdoc --no-ri`
|
|
14
|
+
puts "fetching fakeweb, artifice, sinatra, rake, and builder for the tests to use..."
|
|
15
|
+
`gem install fakeweb artifice --no-rdoc --no-ri`
|
|
16
|
+
`gem install sinatra --version 1.2.7 --no-rdoc --no-ri`
|
|
16
17
|
# Rake version has to be consistent for tests to pass
|
|
17
18
|
`gem install rake --version 0.8.7 --no-rdoc --no-ri`
|
|
18
19
|
# 3.0.0 breaks 1.9.2 specs
|
|
19
|
-
puts "running `gem install builder --version 2.1.2 --no-rdoc --no-ri`"
|
|
20
20
|
`gem install builder --version 2.1.2 --no-rdoc --no-ri`
|
|
21
21
|
end
|
|
22
22
|
|