bundler-prehistoric 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +100 -0
- data/CHANGELOG.md +1640 -0
- data/CONTRIBUTING.md +32 -0
- data/DEVELOPMENT.md +117 -0
- data/Gemfile +3 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +46 -0
- data/Rakefile +256 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bin/bundle_ruby +56 -0
- data/bin/bundler +21 -0
- data/bundler.gemspec +33 -0
- data/lib/bundler.rb +442 -0
- data/lib/bundler/backports/time.rb +7 -0
- data/lib/bundler/capistrano.rb +16 -0
- data/lib/bundler/cli.rb +395 -0
- data/lib/bundler/cli/binstubs.rb +38 -0
- data/lib/bundler/cli/cache.rb +34 -0
- data/lib/bundler/cli/check.rb +35 -0
- data/lib/bundler/cli/clean.rb +19 -0
- data/lib/bundler/cli/common.rb +54 -0
- data/lib/bundler/cli/config.rb +84 -0
- data/lib/bundler/cli/console.rb +39 -0
- data/lib/bundler/cli/exec.rb +37 -0
- data/lib/bundler/cli/gem.rb +101 -0
- data/lib/bundler/cli/init.rb +33 -0
- data/lib/bundler/cli/inject.rb +33 -0
- data/lib/bundler/cli/install.rb +133 -0
- data/lib/bundler/cli/open.rb +23 -0
- data/lib/bundler/cli/outdated.rb +80 -0
- data/lib/bundler/cli/package.rb +36 -0
- data/lib/bundler/cli/platform.rb +43 -0
- data/lib/bundler/cli/show.rb +48 -0
- data/lib/bundler/cli/update.rb +73 -0
- data/lib/bundler/cli/viz.rb +27 -0
- data/lib/bundler/constants.rb +5 -0
- data/lib/bundler/current_ruby.rb +155 -0
- data/lib/bundler/definition.rb +604 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +106 -0
- data/lib/bundler/deployment.rb +59 -0
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +305 -0
- data/lib/bundler/endpoint_specification.rb +76 -0
- data/lib/bundler/env.rb +56 -0
- data/lib/bundler/environment.rb +42 -0
- data/lib/bundler/fetcher.rb +396 -0
- data/lib/bundler/friendly_errors.rb +42 -0
- data/lib/bundler/gem_helper.rb +169 -0
- data/lib/bundler/gem_helpers.rb +25 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +169 -0
- data/lib/bundler/index.rb +184 -0
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +332 -0
- data/lib/bundler/lazy_specification.rb +83 -0
- data/lib/bundler/lockfile_parser.rb +146 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/parallel_workers.rb +18 -0
- data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
- data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
- data/lib/bundler/parallel_workers/worker.rb +69 -0
- data/lib/bundler/psyched_yaml.rb +26 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +534 -0
- data/lib/bundler/retry.rb +60 -0
- data/lib/bundler/ruby_dsl.rb +11 -0
- data/lib/bundler/ruby_version.rb +117 -0
- data/lib/bundler/rubygems_ext.rb +171 -0
- data/lib/bundler/rubygems_integration.rb +578 -0
- data/lib/bundler/runtime.rb +310 -0
- data/lib/bundler/settings.rb +176 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +110 -0
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +29 -0
- data/lib/bundler/source/git.rb +289 -0
- data/lib/bundler/source/git/git_proxy.rb +158 -0
- data/lib/bundler/source/path.rb +225 -0
- data/lib/bundler/source/path/installer.rb +38 -0
- data/lib/bundler/source/rubygems.rb +334 -0
- data/lib/bundler/source/svn.rb +260 -0
- data/lib/bundler/source/svn/svn_proxy.rb +110 -0
- data/lib/bundler/spec_set.rb +154 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/.travis.yml.tt +3 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +31 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/consolerc.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +7 -0
- data/lib/bundler/ui/rg_proxy.rb +21 -0
- data/lib/bundler/ui/shell.rb +98 -0
- data/lib/bundler/ui/silent.rb +44 -0
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/bundler/vendor/thor.rb +480 -0
- data/lib/bundler/vendor/thor/actions.rb +319 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
- data/lib/bundler/vendor/thor/base.rb +656 -0
- data/lib/bundler/vendor/thor/command.rb +133 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/bundler/vendor/thor/error.rb +32 -0
- data/lib/bundler/vendor/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/invocation.rb +173 -0
- data/lib/bundler/vendor/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/parser/option.rb +121 -0
- data/lib/bundler/vendor/thor/parser/options.rb +218 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/runner.rb +322 -0
- data/lib/bundler/vendor/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
- data/lib/bundler/vendor/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/util.rb +267 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_persistent.rb +3 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +155 -0
- data/man/bundle-exec.ronn +136 -0
- data/man/bundle-install.ronn +372 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-update.ronn +179 -0
- data/man/bundle.ronn +92 -0
- data/man/gemfile.5.ronn +369 -0
- data/man/index.txt +7 -0
- data/spec/bundler/bundler_spec.rb +74 -0
- data/spec/bundler/cli_spec.rb +16 -0
- data/spec/bundler/definition_spec.rb +21 -0
- data/spec/bundler/dsl_spec.rb +108 -0
- data/spec/bundler/friendly_errors_spec.rb +13 -0
- data/spec/bundler/gem_helper_spec.rb +225 -0
- data/spec/bundler/psyched_yaml_spec.rb +8 -0
- data/spec/bundler/retry_spec.rb +59 -0
- data/spec/bundler/settings_spec.rb +13 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +316 -0
- data/spec/cache/git_spec.rb +188 -0
- data/spec/cache/path_spec.rb +121 -0
- data/spec/cache/platform_spec.rb +53 -0
- data/spec/cache/svn_spec.rb +82 -0
- data/spec/commands/binstubs_spec.rb +246 -0
- data/spec/commands/check_spec.rb +278 -0
- data/spec/commands/clean_spec.rb +652 -0
- data/spec/commands/config_spec.rb +227 -0
- data/spec/commands/console_spec.rb +102 -0
- data/spec/commands/exec_spec.rb +367 -0
- data/spec/commands/help_spec.rb +39 -0
- data/spec/commands/init_spec.rb +39 -0
- data/spec/commands/inject_spec.rb +78 -0
- data/spec/commands/licenses_spec.rb +31 -0
- data/spec/commands/newgem_spec.rb +451 -0
- data/spec/commands/open_spec.rb +80 -0
- data/spec/commands/outdated_spec.rb +168 -0
- data/spec/commands/package_spec.rb +128 -0
- data/spec/commands/show_spec.rb +152 -0
- data/spec/install/binstubs_spec.rb +24 -0
- data/spec/install/bundler_spec.rb +146 -0
- data/spec/install/deploy_spec.rb +237 -0
- data/spec/install/gemfile/gemspec_spec.rb +170 -0
- data/spec/install/gemfile/git_spec.rb +967 -0
- data/spec/install/gemfile/path_spec.rb +480 -0
- data/spec/install/gemfile/svn_spec.rb +582 -0
- data/spec/install/gemfile_spec.rb +44 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +580 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +314 -0
- data/spec/install/gems/groups_spec.rb +308 -0
- data/spec/install/gems/mirror_spec.rb +39 -0
- data/spec/install/gems/platform_spec.rb +221 -0
- data/spec/install/gems/post_install_spec.rb +121 -0
- data/spec/install/gems/resolving_spec.rb +124 -0
- data/spec/install/gems/simple_case_spec.rb +386 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +136 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspecs_spec.rb +50 -0
- data/spec/install/path_spec.rb +150 -0
- data/spec/install/post_bundle_message_spec.rb +142 -0
- data/spec/install/prereleases_spec.rb +43 -0
- data/spec/install/security_policy_spec.rb +77 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +34 -0
- data/spec/lock/lockfile_spec.rb +912 -0
- data/spec/lock/svn_spec.rb +35 -0
- data/spec/other/bundle_ruby_spec.rb +142 -0
- data/spec/other/cli_dispatch_spec.rb +21 -0
- data/spec/other/ext_spec.rb +60 -0
- data/spec/other/platform_spec.rb +1285 -0
- data/spec/other/ssl_cert_spec.rb +10 -0
- data/spec/quality_spec.rb +88 -0
- data/spec/realworld/dependency_api_spec.rb +60 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/realworld/parallel_spec.rb +69 -0
- data/spec/resolver/basic_spec.rb +66 -0
- data/spec/resolver/platform_spec.rb +88 -0
- data/spec/runtime/executable_spec.rb +149 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +332 -0
- data/spec/runtime/setup_spec.rb +856 -0
- data/spec/runtime/with_clean_env_spec.rb +91 -0
- data/spec/spec_helper.rb +114 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +71 -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_creds_diff_host.rb +38 -0
- data/spec/support/artifice/endpoint_extra.rb +31 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +17 -0
- data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
- data/spec/support/artifice/endpoint_timeout.rb +13 -0
- data/spec/support/builders.rb +748 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/hax.rb +22 -0
- data/spec/support/helpers.rb +348 -0
- data/spec/support/indexes.rb +280 -0
- data/spec/support/less_than_proc.rb +14 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +81 -0
- data/spec/support/permissions.rb +10 -0
- data/spec/support/platforms.rb +94 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +39 -0
- data/spec/support/streams.rb +13 -0
- data/spec/support/sudo.rb +16 -0
- data/spec/update/gems_spec.rb +201 -0
- data/spec/update/git_spec.rb +236 -0
- data/spec/update/source_spec.rb +63 -0
- data/spec/update/svn_spec.rb +100 -0
- metadata +486 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Bundler.with_env helpers" do
|
4
|
+
|
5
|
+
shared_examples_for "Bundler.with_*_env" do
|
6
|
+
it "should reset and restore the environment" do
|
7
|
+
gem_path = ENV['GEM_PATH']
|
8
|
+
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
expect(`echo $GEM_PATH`.strip).not_to eq(gem_path)
|
11
|
+
end
|
12
|
+
|
13
|
+
expect(ENV['GEM_PATH']).to eq(gem_path)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
around do |example|
|
18
|
+
env = Bundler::ORIGINAL_ENV.dup
|
19
|
+
Bundler::ORIGINAL_ENV['BUNDLE_PATH'] = "./Gemfile"
|
20
|
+
example.run
|
21
|
+
Bundler::ORIGINAL_ENV.replace env
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "Bundler.with_clean_env" do
|
25
|
+
|
26
|
+
it_should_behave_like "Bundler.with_*_env"
|
27
|
+
|
28
|
+
it "should keep the original GEM_PATH even in sub processes" do
|
29
|
+
gemfile ""
|
30
|
+
bundle "install --path vendor/bundle"
|
31
|
+
|
32
|
+
code = "Bundler.with_clean_env do;" +
|
33
|
+
" print ENV['GEM_PATH'] != '';" +
|
34
|
+
"end"
|
35
|
+
|
36
|
+
result = bundle "exec ruby -e #{code.inspect}"
|
37
|
+
expect(result).to eq("true")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should not pass any bundler environment variables" do
|
41
|
+
Bundler.with_clean_env do
|
42
|
+
expect(`echo $BUNDLE_PATH`.strip).not_to eq('./Gemfile')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should not pass RUBYOPT changes" do
|
47
|
+
lib_path = File.expand_path('../../../lib', __FILE__)
|
48
|
+
Bundler::ORIGINAL_ENV['RUBYOPT'] = " -I#{lib_path} -rbundler/setup"
|
49
|
+
|
50
|
+
Bundler.with_clean_env do
|
51
|
+
expect(`echo $RUBYOPT`.strip).not_to include '-rbundler/setup'
|
52
|
+
expect(`echo $RUBYOPT`.strip).not_to include "-I#{lib_path}"
|
53
|
+
end
|
54
|
+
|
55
|
+
expect(Bundler::ORIGINAL_ENV['RUBYOPT']).to eq(" -I#{lib_path} -rbundler/setup")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should not change ORIGINAL_ENV" do
|
59
|
+
expect(Bundler::ORIGINAL_ENV['BUNDLE_PATH']).to eq('./Gemfile')
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "Bundler.with_original_env" do
|
65
|
+
|
66
|
+
it_should_behave_like "Bundler.with_*_env"
|
67
|
+
|
68
|
+
it "should pass bundler environment variables set before Bundler was run" do
|
69
|
+
Bundler.with_original_env do
|
70
|
+
expect(`echo $BUNDLE_PATH`.strip).to eq('./Gemfile')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "Bundler.clean_system" do
|
76
|
+
it "runs system inside with_clean_env" do
|
77
|
+
Bundler.clean_system(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
|
78
|
+
expect($?.exitstatus).to eq(42)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "Bundler.clean_exec" do
|
83
|
+
it "runs exec inside with_clean_env" do
|
84
|
+
pid = Kernel.fork do
|
85
|
+
Bundler.clean_exec(%{echo 'if [ "$BUNDLE_PATH" = "" ]; then exit 42; else exit 1; fi' | /bin/sh})
|
86
|
+
end
|
87
|
+
Process.wait(pid)
|
88
|
+
expect($?.exitstatus).to eq(42)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
require 'uri'
|
6
|
+
require 'digest/sha1'
|
7
|
+
|
8
|
+
require 'bundler/psyched_yaml'
|
9
|
+
require 'bundler'
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'rubygems'
|
13
|
+
spec = Gem::Specification.load("bundler.gemspec")
|
14
|
+
gem 'rspec', spec.dependencies.last.requirement.to_s
|
15
|
+
require 'rspec'
|
16
|
+
rescue LoadError
|
17
|
+
abort "Run rake spec:deps to install development dependencies"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Require the correct version of popen for the current platform
|
21
|
+
if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
|
22
|
+
begin
|
23
|
+
require 'win32/open3'
|
24
|
+
rescue LoadError
|
25
|
+
abort "Run `gem install win32-open3` to be able to run specs"
|
26
|
+
end
|
27
|
+
else
|
28
|
+
require 'open3'
|
29
|
+
end
|
30
|
+
|
31
|
+
Dir["#{File.expand_path('../support', __FILE__)}/*.rb"].each do |file|
|
32
|
+
require file unless file =~ /fakeweb\/.*\.rb/
|
33
|
+
end
|
34
|
+
|
35
|
+
$debug = false
|
36
|
+
$show_err = true
|
37
|
+
|
38
|
+
Spec::Rubygems.setup
|
39
|
+
FileUtils.rm_rf(Spec::Path.gem_repo1)
|
40
|
+
ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -r#{Spec::Path.root}/spec/support/hax.rb"
|
41
|
+
ENV['BUNDLE_SPEC_RUN'] = "true"
|
42
|
+
|
43
|
+
# Don't wrap output in tests
|
44
|
+
ENV['THOR_COLUMNS'] = '10000'
|
45
|
+
|
46
|
+
RSpec.configure do |config|
|
47
|
+
config.include Spec::Builders
|
48
|
+
config.include Spec::Helpers
|
49
|
+
config.include Spec::Indexes
|
50
|
+
config.include Spec::Matchers
|
51
|
+
config.include Spec::Path
|
52
|
+
config.include Spec::Rubygems
|
53
|
+
config.include Spec::Platforms
|
54
|
+
config.include Spec::Sudo
|
55
|
+
config.include Spec::Permissions
|
56
|
+
|
57
|
+
if ENV['BUNDLER_SUDO_TESTS'] && Spec::Sudo.present?
|
58
|
+
config.filter_run :sudo => true
|
59
|
+
else
|
60
|
+
config.filter_run_excluding :sudo => true
|
61
|
+
end
|
62
|
+
|
63
|
+
if ENV['BUNDLER_REALWORLD_TESTS']
|
64
|
+
config.filter_run :realworld => true
|
65
|
+
else
|
66
|
+
config.filter_run_excluding :realworld => true
|
67
|
+
end
|
68
|
+
|
69
|
+
config.filter_run_excluding :ruby => LessThanProc.with(RUBY_VERSION)
|
70
|
+
config.filter_run_excluding :rubygems => LessThanProc.with(Gem::VERSION)
|
71
|
+
|
72
|
+
config.filter_run :focused => true unless ENV['CI']
|
73
|
+
config.run_all_when_everything_filtered = true
|
74
|
+
config.alias_example_to :fit, :focused => true
|
75
|
+
|
76
|
+
original_wd = Dir.pwd
|
77
|
+
original_path = ENV['PATH']
|
78
|
+
original_gem_home = ENV['GEM_HOME']
|
79
|
+
|
80
|
+
def pending_jruby_shebang_fix
|
81
|
+
pending "JRuby executables do not have a proper shebang" if RUBY_PLATFORM == "java"
|
82
|
+
end
|
83
|
+
|
84
|
+
config.expect_with :rspec do |c|
|
85
|
+
c.syntax = :expect
|
86
|
+
end
|
87
|
+
|
88
|
+
config.before :all do
|
89
|
+
build_repo1
|
90
|
+
end
|
91
|
+
|
92
|
+
config.before :each do
|
93
|
+
reset!
|
94
|
+
system_gems []
|
95
|
+
in_app_root
|
96
|
+
end
|
97
|
+
|
98
|
+
config.after :each do |example|
|
99
|
+
puts @out if example.exception
|
100
|
+
|
101
|
+
Dir.chdir(original_wd)
|
102
|
+
# Reset ENV
|
103
|
+
ENV['PATH'] = original_path
|
104
|
+
ENV['GEM_HOME'] = original_gem_home
|
105
|
+
ENV['GEM_PATH'] = original_gem_home
|
106
|
+
ENV['BUNDLE_PATH'] = nil
|
107
|
+
ENV['BUNDLE_GEMFILE'] = nil
|
108
|
+
ENV['BUNDLE_FROZEN'] = nil
|
109
|
+
ENV['BUNDLE_APP_CONFIG'] = nil
|
110
|
+
ENV['BUNDLER_TEST'] = nil
|
111
|
+
ENV['BUNDLER_SPEC_PLATFORM'] = nil
|
112
|
+
ENV['BUNDLER_SPEC_VERSION'] = nil
|
113
|
+
end
|
114
|
+
end
|
@@ -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,71 @@
|
|
1
|
+
require File.expand_path("../../path.rb", __FILE__)
|
2
|
+
require File.expand_path("../../../../lib/bundler/deprecate", __FILE__)
|
3
|
+
include Spec::Path
|
4
|
+
|
5
|
+
# Set up pretend http gem server with FakeWeb
|
6
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/artifice*/lib")].first}"
|
7
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].first}"
|
8
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/rack-*/lib")].last}"
|
9
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/tilt*/lib")].first}"
|
10
|
+
$LOAD_PATH.unshift "#{Dir[base_system_gems.join("gems/sinatra*/lib")].first}"
|
11
|
+
require 'artifice'
|
12
|
+
require 'sinatra/base'
|
13
|
+
|
14
|
+
class Endpoint < Sinatra::Base
|
15
|
+
|
16
|
+
helpers do
|
17
|
+
def dependencies_for(gem_names, marshal = gem_repo1("specs.4.8"))
|
18
|
+
return [] if gem_names.nil? || gem_names.empty?
|
19
|
+
|
20
|
+
require 'rubygems'
|
21
|
+
require 'bundler'
|
22
|
+
Bundler::Deprecate.skip_during do
|
23
|
+
Marshal.load(File.open(marshal).read).map do |name, version, platform|
|
24
|
+
spec = load_spec(name, version, platform)
|
25
|
+
if gem_names.include?(spec.name)
|
26
|
+
{
|
27
|
+
:name => spec.name,
|
28
|
+
:number => spec.version.version,
|
29
|
+
:platform => spec.platform.to_s,
|
30
|
+
:dependencies => spec.dependencies.select {|dep| dep.type == :runtime }.map do |dep|
|
31
|
+
[dep.name, dep.requirement.requirements.map {|a| a.join(" ") }.join(", ")]
|
32
|
+
end
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end.compact
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def load_spec(name, version, platform)
|
40
|
+
full_name = "#{name}-#{version}"
|
41
|
+
full_name += "-#{platform}" if platform != "ruby"
|
42
|
+
Marshal.load(Gem.inflate(File.open(gem_repo1("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
get "/quick/Marshal.4.8/:id" do
|
47
|
+
redirect "/fetch/actual/gem/#{params[:id]}"
|
48
|
+
end
|
49
|
+
|
50
|
+
get "/fetch/actual/gem/:id" do
|
51
|
+
File.read("#{gem_repo1}/quick/Marshal.4.8/#{params[:id]}")
|
52
|
+
end
|
53
|
+
|
54
|
+
get "/gems/:id" do
|
55
|
+
File.read("#{gem_repo1}/gems/#{params[:id]}")
|
56
|
+
end
|
57
|
+
|
58
|
+
get "/api/v1/dependencies" do
|
59
|
+
Marshal.dump(dependencies_for(params[:gems]))
|
60
|
+
end
|
61
|
+
|
62
|
+
get "/specs.4.8.gz" do
|
63
|
+
File.read("#{gem_repo1}/specs.4.8.gz")
|
64
|
+
end
|
65
|
+
|
66
|
+
get "/prerelease_specs.4.8.gz" do
|
67
|
+
File.read("#{gem_repo1}/prerelease_specs.4.8.gz")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
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,38 @@
|
|
1
|
+
require File.expand_path("../endpoint", __FILE__)
|
2
|
+
|
3
|
+
Artifice.deactivate
|
4
|
+
|
5
|
+
class EndpointCredsDiffHost < Endpoint
|
6
|
+
helpers do
|
7
|
+
def auth
|
8
|
+
@auth ||= Rack::Auth::Basic::Request.new(request.env)
|
9
|
+
end
|
10
|
+
|
11
|
+
def authorized?
|
12
|
+
auth.provided? && auth.basic? && auth.credentials && auth.credentials == ['user', 'pass']
|
13
|
+
end
|
14
|
+
|
15
|
+
def protected!
|
16
|
+
unless authorized?
|
17
|
+
response['WWW-Authenticate'] = %(Basic realm="Testing HTTP Auth")
|
18
|
+
throw(:halt, [401, "Not authorized\n"])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
before do
|
24
|
+
protected! unless request.path_info.include?("/no/creds/")
|
25
|
+
end
|
26
|
+
|
27
|
+
get "/gems/:id" do
|
28
|
+
redirect "http://diffhost.com/no/creds/#{params[:id]}"
|
29
|
+
end
|
30
|
+
|
31
|
+
get "/no/creds/:id" do
|
32
|
+
if request.host.include?("diffhost") && !auth.provided?
|
33
|
+
File.read("#{gem_repo1}/gems/#{params[:id]}")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Artifice.activate_with(EndpointCredsDiffHost)
|
@@ -0,0 +1,31 @@
|
|
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/prerelease_specs.4.8.gz" do
|
15
|
+
File.read("#{gem_repo2}/prerelease_specs.4.8.gz")
|
16
|
+
end
|
17
|
+
|
18
|
+
get "/extra/quick/Marshal.4.8/:id" do
|
19
|
+
redirect "/extra/fetch/actual/gem/#{params[:id]}"
|
20
|
+
end
|
21
|
+
|
22
|
+
get "/extra/fetch/actual/gem/:id" do
|
23
|
+
File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
|
24
|
+
end
|
25
|
+
|
26
|
+
get "/extra/gems/:id" do
|
27
|
+
File.read("#{gem_repo2}/gems/#{params[:id]}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
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)
|