bundler 1.7.15 → 1.8.0.pre

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.

Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -14
  3. data/.rspec +1 -0
  4. data/.travis.yml +22 -15
  5. data/CHANGELOG.md +43 -13
  6. data/CODE_OF_CONDUCT.md +40 -0
  7. data/CONTRIBUTING.md +14 -12
  8. data/DEVELOPMENT.md +4 -2
  9. data/ISSUES.md +1 -1
  10. data/README.md +10 -14
  11. data/Rakefile +10 -10
  12. data/bin/bundle +1 -1
  13. data/bundler.gemspec +5 -4
  14. data/lib/bundler.rb +22 -3
  15. data/lib/bundler/anonymizable_uri.rb +24 -8
  16. data/lib/bundler/cli.rb +103 -66
  17. data/lib/bundler/cli/cache.rb +1 -0
  18. data/lib/bundler/cli/clean.rb +11 -4
  19. data/lib/bundler/cli/common.rb +2 -0
  20. data/lib/bundler/cli/console.rb +22 -26
  21. data/lib/bundler/cli/exec.rb +29 -22
  22. data/lib/bundler/cli/gem.rb +125 -37
  23. data/lib/bundler/cli/install.rb +22 -9
  24. data/lib/bundler/cli/outdated.rb +1 -1
  25. data/lib/bundler/cli/package.rb +8 -1
  26. data/lib/bundler/cli/show.rb +29 -3
  27. data/lib/bundler/cli/update.rb +2 -2
  28. data/lib/bundler/cli/viz.rb +1 -1
  29. data/lib/bundler/definition.rb +14 -22
  30. data/lib/bundler/dependency.rb +8 -1
  31. data/lib/bundler/dsl.rb +17 -4
  32. data/lib/bundler/endpoint_specification.rb +1 -1
  33. data/lib/bundler/env.rb +44 -25
  34. data/lib/bundler/fetcher.rb +33 -25
  35. data/lib/bundler/friendly_errors.rb +38 -5
  36. data/lib/bundler/gem_helper.rb +16 -10
  37. data/lib/bundler/gem_helpers.rb +1 -0
  38. data/lib/bundler/graph.rb +4 -1
  39. data/lib/bundler/index.rb +15 -25
  40. data/lib/bundler/installer.rb +6 -6
  41. data/lib/bundler/lockfile_parser.rb +7 -7
  42. data/lib/bundler/resolver.rb +2 -1
  43. data/lib/bundler/ruby_version.rb +1 -1
  44. data/lib/bundler/rubygems_ext.rb +1 -0
  45. data/lib/bundler/rubygems_integration.rb +1 -1
  46. data/lib/bundler/runtime.rb +22 -40
  47. data/lib/bundler/settings.rb +14 -5
  48. data/lib/bundler/setup.rb +2 -1
  49. data/lib/bundler/shared_helpers.rb +56 -4
  50. data/lib/bundler/source.rb +8 -9
  51. data/lib/bundler/source/git.rb +5 -1
  52. data/lib/bundler/source/git/git_proxy.rb +4 -0
  53. data/lib/bundler/source/path.rb +8 -11
  54. data/lib/bundler/source/path/installer.rb +0 -2
  55. data/lib/bundler/source/rubygems.rb +58 -72
  56. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
  57. data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
  58. data/lib/bundler/templates/newgem/README.md.tt +9 -1
  59. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  60. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  61. data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
  62. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  63. data/lib/bundler/templates/newgem/gitignore.tt +2 -0
  64. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
  66. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
  67. data/lib/bundler/ui/shell.rb +1 -1
  68. data/lib/bundler/version.rb +1 -1
  69. data/lib/bundler/worker.rb +73 -0
  70. data/man/bundle-config.ronn +17 -15
  71. data/man/bundle-install.ronn +102 -93
  72. data/man/bundle-update.ronn +39 -30
  73. data/man/bundle.ronn +6 -0
  74. data/man/gemfile.5.ronn +74 -13
  75. metadata +10 -231
  76. data/lib/bundler/parallel_workers.rb +0 -18
  77. data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
  78. data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
  79. data/lib/bundler/parallel_workers/worker.rb +0 -69
  80. data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
  81. data/spec/bundler/anonymizable_uri_spec.rb +0 -32
  82. data/spec/bundler/bundler_spec.rb +0 -72
  83. data/spec/bundler/cli_spec.rb +0 -16
  84. data/spec/bundler/definition_spec.rb +0 -22
  85. data/spec/bundler/dsl_spec.rb +0 -82
  86. data/spec/bundler/friendly_errors_spec.rb +0 -13
  87. data/spec/bundler/gem_helper_spec.rb +0 -226
  88. data/spec/bundler/psyched_yaml_spec.rb +0 -8
  89. data/spec/bundler/retry_spec.rb +0 -59
  90. data/spec/bundler/settings_spec.rb +0 -13
  91. data/spec/bundler/source/rubygems_spec.rb +0 -25
  92. data/spec/bundler/source_list_spec.rb +0 -361
  93. data/spec/cache/gems_spec.rb +0 -284
  94. data/spec/cache/git_spec.rb +0 -188
  95. data/spec/cache/path_spec.rb +0 -121
  96. data/spec/cache/platform_spec.rb +0 -57
  97. data/spec/commands/binstubs_spec.rb +0 -219
  98. data/spec/commands/check_spec.rb +0 -278
  99. data/spec/commands/clean_spec.rb +0 -592
  100. data/spec/commands/config_spec.rb +0 -263
  101. data/spec/commands/console_spec.rb +0 -76
  102. data/spec/commands/exec_spec.rb +0 -309
  103. data/spec/commands/help_spec.rb +0 -39
  104. data/spec/commands/init_spec.rb +0 -39
  105. data/spec/commands/inject_spec.rb +0 -78
  106. data/spec/commands/licenses_spec.rb +0 -18
  107. data/spec/commands/newgem_spec.rb +0 -428
  108. data/spec/commands/open_spec.rb +0 -68
  109. data/spec/commands/outdated_spec.rb +0 -156
  110. data/spec/commands/package_spec.rb +0 -114
  111. data/spec/commands/show_spec.rb +0 -125
  112. data/spec/install/binstubs_spec.rb +0 -24
  113. data/spec/install/bundler_spec.rb +0 -146
  114. data/spec/install/deploy_spec.rb +0 -250
  115. data/spec/install/gemfile/gemspec_spec.rb +0 -170
  116. data/spec/install/gemfile/git_spec.rb +0 -967
  117. data/spec/install/gemfile/path_spec.rb +0 -500
  118. data/spec/install/gemfile_spec.rb +0 -44
  119. data/spec/install/gems/c_ext_spec.rb +0 -48
  120. data/spec/install/gems/dependency_api_spec.rb +0 -652
  121. data/spec/install/gems/env_spec.rb +0 -107
  122. data/spec/install/gems/flex_spec.rb +0 -314
  123. data/spec/install/gems/groups_spec.rb +0 -308
  124. data/spec/install/gems/mirror_spec.rb +0 -39
  125. data/spec/install/gems/platform_spec.rb +0 -195
  126. data/spec/install/gems/post_install_spec.rb +0 -121
  127. data/spec/install/gems/resolving_spec.rb +0 -124
  128. data/spec/install/gems/simple_case_spec.rb +0 -377
  129. data/spec/install/gems/sources_spec.rb +0 -386
  130. data/spec/install/gems/standalone_spec.rb +0 -260
  131. data/spec/install/gems/sudo_spec.rb +0 -136
  132. data/spec/install/gems/win32_spec.rb +0 -26
  133. data/spec/install/gemspecs_spec.rb +0 -50
  134. data/spec/install/path_spec.rb +0 -150
  135. data/spec/install/post_bundle_message_spec.rb +0 -142
  136. data/spec/install/prereleases_spec.rb +0 -43
  137. data/spec/install/security_policy_spec.rb +0 -77
  138. data/spec/install/upgrade_spec.rb +0 -26
  139. data/spec/lock/git_spec.rb +0 -34
  140. data/spec/lock/lockfile_spec.rb +0 -924
  141. data/spec/other/bundle_ruby_spec.rb +0 -142
  142. data/spec/other/cli_dispatch_spec.rb +0 -21
  143. data/spec/other/ext_spec.rb +0 -60
  144. data/spec/other/platform_spec.rb +0 -1285
  145. data/spec/other/ssl_cert_spec.rb +0 -23
  146. data/spec/quality_spec.rb +0 -88
  147. data/spec/realworld/dependency_api_spec.rb +0 -60
  148. data/spec/realworld/edgecases_spec.rb +0 -212
  149. data/spec/realworld/parallel_spec.rb +0 -71
  150. data/spec/resolver/basic_spec.rb +0 -66
  151. data/spec/resolver/platform_spec.rb +0 -88
  152. data/spec/runtime/executable_spec.rb +0 -149
  153. data/spec/runtime/load_spec.rb +0 -107
  154. data/spec/runtime/platform_spec.rb +0 -90
  155. data/spec/runtime/require_spec.rb +0 -332
  156. data/spec/runtime/setup_spec.rb +0 -853
  157. data/spec/runtime/with_clean_env_spec.rb +0 -91
  158. data/spec/spec_helper.rb +0 -123
  159. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
  160. data/spec/support/artifice/endpoint.rb +0 -71
  161. data/spec/support/artifice/endpoint_500.rb +0 -37
  162. data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
  163. data/spec/support/artifice/endpoint_api_missing.rb +0 -16
  164. data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
  165. data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
  166. data/spec/support/artifice/endpoint_extra.rb +0 -31
  167. data/spec/support/artifice/endpoint_extra_api.rb +0 -32
  168. data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
  169. data/spec/support/artifice/endpoint_fallback.rb +0 -17
  170. data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
  171. data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
  172. data/spec/support/artifice/endpoint_redirect.rb +0 -15
  173. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
  174. data/spec/support/artifice/endpoint_timeout.rb +0 -13
  175. data/spec/support/builders.rb +0 -693
  176. data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
  177. data/spec/support/fakeweb/windows.rb +0 -23
  178. data/spec/support/hax.rb +0 -22
  179. data/spec/support/helpers.rb +0 -361
  180. data/spec/support/indexes.rb +0 -280
  181. data/spec/support/matchers.rb +0 -77
  182. data/spec/support/path.rb +0 -85
  183. data/spec/support/permissions.rb +0 -10
  184. data/spec/support/platforms.rb +0 -94
  185. data/spec/support/ruby_ext.rb +0 -20
  186. data/spec/support/rubygems_ext.rb +0 -39
  187. data/spec/support/streams.rb +0 -13
  188. data/spec/support/sudo.rb +0 -16
  189. data/spec/update/gems_spec.rb +0 -201
  190. data/spec/update/git_spec.rb +0 -283
  191. data/spec/update/path_spec.rb +0 -18
@@ -1,91 +0,0 @@
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
@@ -1,123 +0,0 @@
1
- $:.unshift File.expand_path('..', __FILE__)
2
- $:.unshift File.expand_path('../../lib', __FILE__)
3
- # stdlib first
4
- require 'uri'
5
- require 'digest/sha1'
6
- require 'fileutils'
7
- require 'bundler/psyched_yaml'
8
- require 'rubygems'
9
- require 'rspec'
10
- require 'bundler'
11
-
12
- # Require the correct version of popen for the current platform
13
- if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
14
- begin
15
- require 'win32/open3'
16
- rescue LoadError
17
- abort "Run `gem install win32-open3` to be able to run specs"
18
- end
19
- else
20
- require 'open3'
21
- end
22
-
23
- Dir["#{File.expand_path('../support', __FILE__)}/*.rb"].each do |file|
24
- require file unless file =~ /fakeweb\/.*\.rb/
25
- end
26
-
27
- $debug = false
28
- $show_err = true
29
-
30
- Spec::Rubygems.setup
31
- FileUtils.rm_rf(Spec::Path.gem_repo1)
32
- ENV['RUBYOPT'] = "#{ENV['RUBYOPT']} -r#{Spec::Path.root}/spec/support/hax.rb"
33
- ENV['BUNDLE_SPEC_RUN'] = "true"
34
-
35
- # Don't wrap output in tests
36
- ENV['THOR_COLUMNS'] = '10000'
37
-
38
- RSpec.configure do |config|
39
- config.include Spec::Builders
40
- config.include Spec::Helpers
41
- config.include Spec::Indexes
42
- config.include Spec::Matchers
43
- config.include Spec::Path
44
- config.include Spec::Rubygems
45
- config.include Spec::Platforms
46
- config.include Spec::Sudo
47
- config.include Spec::Permissions
48
-
49
- if ENV['BUNDLER_SUDO_TESTS'] && Spec::Sudo.present?
50
- config.filter_run :sudo => true
51
- else
52
- config.filter_run_excluding :sudo => true
53
- end
54
-
55
- if ENV['BUNDLER_REALWORLD_TESTS']
56
- config.filter_run :realworld => true
57
- else
58
- config.filter_run_excluding :realworld => true
59
- end
60
-
61
- if RUBY_VERSION >= "1.9"
62
- config.filter_run_excluding :ruby => "1.8"
63
- else
64
- config.filter_run_excluding :ruby => "1.9"
65
- end
66
-
67
- if RUBY_VERSION >= "2.0"
68
- config.filter_run_excluding :ruby => "1.8"
69
- config.filter_run_excluding :ruby => "1.9"
70
- else
71
- config.filter_run_excluding :ruby => "2.0"
72
- config.filter_run_excluding :ruby => "2.1"
73
- end
74
-
75
- if Gem::VERSION < "2.2"
76
- config.filter_run_excluding :rubygems => "2.2"
77
- end
78
-
79
- config.filter_run_excluding :rubygems_master => (ENV['RGV'] != "master")
80
-
81
- config.filter_run :focused => true unless ENV['CI']
82
- config.run_all_when_everything_filtered = true
83
- config.alias_example_to :fit, :focused => true
84
-
85
- original_wd = Dir.pwd
86
- original_path = ENV['PATH']
87
- original_gem_home = ENV['GEM_HOME']
88
-
89
- def pending_jruby_shebang_fix
90
- pending "JRuby executables do not have a proper shebang" if RUBY_PLATFORM == "java"
91
- end
92
-
93
- config.expect_with :rspec do |c|
94
- c.syntax = :expect
95
- end
96
-
97
- config.before :all do
98
- build_repo1
99
- end
100
-
101
- config.before :each do
102
- reset!
103
- system_gems []
104
- in_app_root
105
- end
106
-
107
- config.after :each do |example|
108
- puts @out if defined?(@out) && example.exception
109
-
110
- Dir.chdir(original_wd)
111
- # Reset ENV
112
- ENV['PATH'] = original_path
113
- ENV['GEM_HOME'] = original_gem_home
114
- ENV['GEM_PATH'] = original_gem_home
115
- ENV['BUNDLE_PATH'] = nil
116
- ENV['BUNDLE_GEMFILE'] = nil
117
- ENV['BUNDLER_TEST'] = nil
118
- ENV['BUNDLE_FROZEN'] = nil
119
- ENV['BUNDLER_SPEC_PLATFORM'] = nil
120
- ENV['BUNDLER_SPEC_VERSION'] = nil
121
- ENV['BUNDLE_APP_CONFIG'] = nil
122
- end
123
- end
@@ -1,13 +0,0 @@
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)
@@ -1,71 +0,0 @@
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, gem_repo = gem_repo1)
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(gem_repo.join("specs.4.8")).read).map do |name, version, platform|
24
- spec = load_spec(name, version, platform, gem_repo)
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, gem_repo)
40
- full_name = "#{name}-#{version}"
41
- full_name += "-#{platform}" if platform != "ruby"
42
- Marshal.load(Gem.inflate(File.open(gem_repo.join("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)
@@ -1,37 +0,0 @@
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)
@@ -1,11 +0,0 @@
1
- require File.expand_path("../endpoint", __FILE__)
2
-
3
- Artifice.deactivate
4
-
5
- class EndpointApiForbidden < Endpoint
6
- get "/api/v1/dependencies" do
7
- halt 403
8
- end
9
- end
10
-
11
- Artifice.activate_with(EndpointApiForbidden)
@@ -1,16 +0,0 @@
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)
@@ -1,13 +0,0 @@
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)
@@ -1,38 +0,0 @@
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)
@@ -1,31 +0,0 @@
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)