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,32 +0,0 @@
1
- require File.expand_path("../endpoint", __FILE__)
2
-
3
- Artifice.deactivate
4
-
5
- class EndpointExtraApi < Endpoint
6
- get "/extra/api/v1/dependencies" do
7
- deps = dependencies_for(params[:gems], gem_repo4)
8
- Marshal.dump(deps)
9
- end
10
-
11
- get "/extra/specs.4.8.gz" do
12
- File.read("#{gem_repo4}/specs.4.8.gz")
13
- end
14
-
15
- get "/extra/prerelease_specs.4.8.gz" do
16
- File.read("#{gem_repo4}/prerelease_specs.4.8.gz")
17
- end
18
-
19
- get "/extra/quick/Marshal.4.8/:id" do
20
- redirect "/extra/fetch/actual/gem/#{params[:id]}"
21
- end
22
-
23
- get "/extra/fetch/actual/gem/:id" do
24
- File.read("#{gem_repo4}/quick/Marshal.4.8/#{params[:id]}")
25
- end
26
-
27
- get "/extra/gems/:id" do
28
- File.read("#{gem_repo4}/gems/#{params[:id]}")
29
- end
30
- end
31
-
32
- Artifice.activate_with(EndpointExtraApi)
@@ -1,15 +0,0 @@
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)
@@ -1,17 +0,0 @@
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] && params[:gems].size <= DEPENDENCY_LIMIT
10
- Marshal.dump(dependencies_for(params[:gems]))
11
- else
12
- halt 413, "Too many gems to resolve, please request less than #{DEPENDENCY_LIMIT} gems"
13
- end
14
- end
15
- end
16
-
17
- Artifice.activate_with(EndpointFallback)
@@ -1,15 +0,0 @@
1
- require File.expand_path("../endpoint", __FILE__)
2
-
3
- Artifice.deactivate
4
-
5
- class EndpointHostRedirect < Endpoint
6
- get "/fetch/actual/gem/:id", :host_name => 'localgemserver.test' do
7
- redirect "http://bundler.localgemserver.test#{request.path_info}"
8
- end
9
-
10
- get "/api/v1/dependencies" do
11
- status 404
12
- end
13
- end
14
-
15
- Artifice.activate_with(EndpointHostRedirect)
@@ -1,11 +0,0 @@
1
- require File.expand_path("../endpoint_fallback", __FILE__)
2
-
3
- Artifice.deactivate
4
-
5
- class EndpointMarshalFail < EndpointFallback
6
- get "/api/v1/dependencies" do
7
- "f0283y01hasf"
8
- end
9
- end
10
-
11
- Artifice.activate_with(EndpointMarshalFail)
@@ -1,15 +0,0 @@
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)
@@ -1,18 +0,0 @@
1
- require File.expand_path("../endpoint", __FILE__)
2
-
3
- Artifice.deactivate
4
-
5
- class EndpointStrictBasicAuthentication < Endpoint
6
- before do
7
- unless env["HTTP_AUTHORIZATION"]
8
- halt 401, "Authentication info not supplied"
9
- end
10
-
11
- # Only accepts password == "password"
12
- unless env["HTTP_AUTHORIZATION"] == "Basic dXNlcjpwYXNz"
13
- halt 403, "Authentication failed"
14
- end
15
- end
16
- end
17
-
18
- Artifice.activate_with(EndpointStrictBasicAuthentication)
@@ -1,13 +0,0 @@
1
- require File.expand_path("../endpoint_fallback", __FILE__)
2
-
3
- Artifice.deactivate
4
-
5
- class EndpointTimeout < EndpointFallback
6
- SLEEP_TIMEOUT = 15
7
-
8
- get "/api/v1/dependencies" do
9
- sleep(SLEEP_TIMEOUT)
10
- end
11
- end
12
-
13
- Artifice.activate_with(EndpointTimeout)
@@ -1,693 +0,0 @@
1
- require 'bundler/shared_helpers'
2
-
3
- module Spec
4
- module Builders
5
- def self.constantize(name)
6
- name.gsub('-', '').upcase
7
- end
8
-
9
- def v(version)
10
- Gem::Version.new(version)
11
- end
12
-
13
- def pl(platform)
14
- Gem::Platform.new(platform)
15
- end
16
-
17
- def build_repo1
18
- build_repo gem_repo1 do
19
- build_gem "rack", %w(0.9.1 1.0.0) do |s|
20
- s.executables = "rackup"
21
- s.post_install_message = "Rack's post install message"
22
- end
23
-
24
- build_gem "thin" do |s|
25
- s.add_dependency "rack"
26
- s.post_install_message = "Thin's post install message"
27
- end
28
-
29
- build_gem "rack-obama" do |s|
30
- s.add_dependency "rack"
31
- s.post_install_message = "Rack-obama's post install message"
32
- end
33
-
34
- build_gem "rack_middleware", "1.0" do |s|
35
- s.add_dependency "rack", "0.9.1"
36
- end
37
-
38
- build_gem "rails", "2.3.2" do |s|
39
- s.executables = "rails"
40
- s.add_dependency "rake", "10.0.2"
41
- s.add_dependency "actionpack", "2.3.2"
42
- s.add_dependency "activerecord", "2.3.2"
43
- s.add_dependency "actionmailer", "2.3.2"
44
- s.add_dependency "activeresource", "2.3.2"
45
- end
46
- build_gem "actionpack", "2.3.2" do |s|
47
- s.add_dependency "activesupport", "2.3.2"
48
- end
49
- build_gem "activerecord", ["2.3.1", "2.3.2"] do |s|
50
- s.add_dependency "activesupport", "2.3.2"
51
- end
52
- build_gem "actionmailer", "2.3.2" do |s|
53
- s.add_dependency "activesupport", "2.3.2"
54
- end
55
- build_gem "activeresource", "2.3.2" do |s|
56
- s.add_dependency "activesupport", "2.3.2"
57
- end
58
- build_gem "activesupport", %w(1.2.3 2.3.2 2.3.5)
59
-
60
- build_gem "activemerchant" do |s|
61
- s.add_dependency "activesupport", ">= 2.0.0"
62
- end
63
-
64
- build_gem "rails_fail" do |s|
65
- s.add_dependency "activesupport", "= 1.2.3"
66
- end
67
-
68
- build_gem "missing_dep" do |s|
69
- s.add_dependency "not_here"
70
- end
71
-
72
- build_gem "rspec", "1.2.7", :no_default => true do |s|
73
- s.write "lib/spec.rb", "SPEC = '1.2.7'"
74
- end
75
-
76
- build_gem "rack-test", :no_default => true do |s|
77
- s.write "lib/rack/test.rb", "RACK_TEST = '1.0'"
78
- end
79
-
80
- build_gem "platform_specific" do |s|
81
- s.platform = Gem::Platform.local
82
- s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 #{Gem::Platform.local}'"
83
- end
84
-
85
- build_gem "platform_specific" do |s|
86
- s.platform = "java"
87
- s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 JAVA'"
88
- end
89
-
90
- build_gem "platform_specific" do |s|
91
- s.platform = "ruby"
92
- s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 RUBY'"
93
- end
94
-
95
- build_gem "platform_specific" do |s|
96
- s.platform = "x86-mswin32"
97
- s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 MSWIN'"
98
- end
99
-
100
- build_gem "platform_specific" do |s|
101
- s.platform = "x86-darwin-100"
102
- s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 x86-darwin-100'"
103
- end
104
-
105
- build_gem "only_java" do |s|
106
- s.platform = "java"
107
- end
108
-
109
- build_gem "nokogiri", "1.4.2"
110
- build_gem "nokogiri", "1.4.2" do |s|
111
- s.platform = "java"
112
- s.write "lib/nokogiri.rb", "NOKOGIRI = '1.4.2 JAVA'"
113
- s.add_dependency "weakling", ">= 0.0.3"
114
- end
115
-
116
- build_gem "weakling", "0.0.3"
117
-
118
- build_gem "multiple_versioned_deps" do |s|
119
- s.add_dependency "weakling", ">= 0.0.1", "< 0.1"
120
- end
121
-
122
- build_gem "not_released", "1.0.pre"
123
-
124
- build_gem "has_prerelease", "1.0"
125
- build_gem "has_prerelease", "1.1.pre"
126
-
127
- build_gem "with_development_dependency" do |s|
128
- s.add_development_dependency "activesupport", "= 2.3.5"
129
- end
130
-
131
- build_gem "with_license" do |s|
132
- s.license = "MIT"
133
- end
134
-
135
- build_gem "with_implicit_rake_dep" do |s|
136
- s.extensions << "Rakefile"
137
- s.write "Rakefile", <<-RUBY
138
- task :default do
139
- path = File.expand_path("../lib", __FILE__)
140
- FileUtils.mkdir_p(path)
141
- File.open("\#{path}/implicit_rake_dep.rb", "w") do |f|
142
- f.puts "IMPLICIT_RAKE_DEP = 'YES'"
143
- end
144
- end
145
- RUBY
146
- end
147
-
148
- build_gem "another_implicit_rake_dep" do |s|
149
- s.extensions << "Rakefile"
150
- s.write "Rakefile", <<-RUBY
151
- task :default do
152
- path = File.expand_path("../lib", __FILE__)
153
- FileUtils.mkdir_p(path)
154
- File.open("\#{path}/another_implicit_rake_dep.rb", "w") do |f|
155
- f.puts "ANOTHER_IMPLICIT_RAKE_DEP = 'YES'"
156
- end
157
- end
158
- RUBY
159
- end
160
-
161
- build_gem "very_simple_binary" do |s|
162
- s.add_c_extension
163
- end
164
-
165
- build_gem "bundler", "0.9" do |s|
166
- s.executables = "bundle"
167
- s.write "bin/bundle", "puts 'FAIL'"
168
- end
169
-
170
- # The bundler 0.8 gem has a rubygems plugin that always loads :(
171
- build_gem "bundler", "0.8.1" do |s|
172
- s.write "lib/bundler/omg.rb", ""
173
- s.write "lib/rubygems_plugin.rb", "require 'bundler/omg' ; puts 'FAIL'"
174
- end
175
-
176
- build_gem "bundler_dep" do |s|
177
- s.add_dependency "bundler"
178
- end
179
-
180
- # The yard gem iterates over Gem.source_index looking for plugins
181
- build_gem "yard" do |s|
182
- s.write "lib/yard.rb", <<-Y
183
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.8.10")
184
- specs = Gem::Specification
185
- else
186
- specs = Gem.source_index.find_name('')
187
- end
188
- specs.each do |gem|
189
- puts gem.full_name
190
- end
191
- Y
192
- end
193
-
194
- # The rcov gem is platform mswin32, but has no arch
195
- build_gem "rcov" do |s|
196
- s.platform = Gem::Platform.new([nil, "mswin32", nil])
197
- s.write "lib/rcov.rb", "RCOV = '1.0.0'"
198
- end
199
-
200
- build_gem "net-ssh"
201
- build_gem "net-sftp", "1.1.1" do |s|
202
- s.add_dependency "net-ssh", ">= 1.0.0", "< 1.99.0"
203
- end
204
-
205
- # Test comlicated gem dependencies for install
206
- build_gem "net_a" do |s|
207
- s.add_dependency "net_b"
208
- s.add_dependency "net_build_extensions"
209
- end
210
-
211
- build_gem "net_b"
212
-
213
- build_gem "net_build_extensions" do |s|
214
- s.add_dependency "rake"
215
- s.extensions << "Rakefile"
216
- s.write "Rakefile", <<-RUBY
217
- task :default do
218
- path = File.expand_path("../lib", __FILE__)
219
- FileUtils.mkdir_p(path)
220
- File.open("\#{path}/net_build_extensions.rb", "w") do |f|
221
- f.puts "NET_BUILD_EXTENSIONS = 'YES'"
222
- end
223
- end
224
- RUBY
225
- end
226
-
227
- build_gem "net_c" do |s|
228
- s.add_dependency "net_a"
229
- s.add_dependency "net_d"
230
- end
231
-
232
- build_gem "net_d"
233
-
234
- build_gem "net_e" do |s|
235
- s.add_dependency "net_d"
236
- end
237
-
238
- # Capistrano did this (at least until version 2.5.10)
239
- # Rubygems 2.2 doesn't allow the specifying of a dependency twice
240
- # See https://github.com/rubygems/rubygems/commit/03dbac93a3396a80db258d9bc63500333c25bd2f
241
- build_gem "double_deps", "1.0", :skip_validation => true do |s|
242
- s.add_dependency "net-ssh", ">= 1.0.0"
243
- s.add_dependency "net-ssh"
244
- end
245
-
246
- build_gem "foo"
247
- end
248
- end
249
-
250
- def build_repo2(&blk)
251
- FileUtils.rm_rf gem_repo2
252
- FileUtils.cp_r gem_repo1, gem_repo2
253
- update_repo2(&blk) if block_given?
254
- end
255
-
256
- def build_repo3
257
- build_repo gem_repo3 do
258
- build_gem "rack"
259
- end
260
- FileUtils.rm_rf Dir[gem_repo3("prerelease*")]
261
- end
262
-
263
- # A repo that has no pre-installed gems included. (The caller completely
264
- # determines the contents with the block.)
265
- def build_repo4
266
- FileUtils.rm_rf gem_repo4
267
- build_repo(gem_repo4) { yield }
268
- end
269
-
270
- def update_repo4
271
- update_repo(gem_repo4) { yield }
272
- end
273
-
274
- def update_repo2
275
- update_repo gem_repo2 do
276
- build_gem "rack", "1.2" do |s|
277
- s.executables = "rackup"
278
- end
279
- yield if block_given?
280
- end
281
- end
282
-
283
- def build_security_repo
284
- build_repo security_repo do
285
- build_gem "rack"
286
-
287
- build_gem "signed_gem" do |s|
288
- cert = 'signing-cert.pem'
289
- pkey = 'signing-pkey.pem'
290
- s.write cert, TEST_CERT
291
- s.write pkey, TEST_PKEY
292
- s.signing_key = pkey
293
- s.cert_chain = [cert]
294
- end
295
- end
296
-
297
- end
298
-
299
- def build_repo(path, &blk)
300
- return if File.directory?(path)
301
- rake_path = Dir["#{Path.base_system_gems}/**/rake*.gem"].first
302
- if rake_path
303
- FileUtils.mkdir_p("#{path}/gems")
304
- FileUtils.cp rake_path, "#{path}/gems/"
305
- else
306
- abort "You need to `rm -rf #{tmp}`"
307
- end
308
- update_repo(path, &blk)
309
- end
310
-
311
- def update_repo(path)
312
- @_build_path = "#{path}/gems"
313
- yield
314
- @_build_path = nil
315
- with_gem_path_as Path.base_system_gems do
316
- Dir.chdir(path) { gem_command :generate_index }
317
- end
318
- end
319
-
320
- def build_index(&block)
321
- index = Bundler::Index.new
322
- IndexBuilder.run(index, &block) if block_given?
323
- index
324
- end
325
-
326
- def build_spec(name, version, platform = nil, &block)
327
- Array(version).map do |v|
328
- Gem::Specification.new do |s|
329
- s.name = name
330
- s.version = Gem::Version.new(v)
331
- s.platform = platform
332
- DepBuilder.run(s, &block) if block_given?
333
- end
334
- end
335
- end
336
-
337
- def build_dep(name, requirements = Gem::Requirement.default, type = :runtime)
338
- Bundler::Dependency.new(name, :version => requirements)
339
- end
340
-
341
- def build_lib(name, *args, &blk)
342
- build_with(LibBuilder, name, args, &blk)
343
- end
344
-
345
- def build_gem(name, *args, &blk)
346
- build_with(GemBuilder, name, args, &blk)
347
- end
348
-
349
- def build_git(name, *args, &block)
350
- opts = args.last.is_a?(Hash) ? args.last : {}
351
- builder = opts[:bare] ? GitBareBuilder : GitBuilder
352
- spec = build_with(builder, name, args, &block)
353
- GitReader.new(opts[:path] || lib_path(spec.full_name))
354
- end
355
-
356
- def update_git(name, *args, &block)
357
- spec = build_with(GitUpdater, name, args, &block)
358
- GitReader.new lib_path(spec.full_name)
359
- end
360
-
361
- private
362
-
363
- def build_with(builder, name, args, &blk)
364
- @_build_path ||= nil
365
- options = args.last.is_a?(Hash) ? args.pop : {}
366
- versions = args.last || "1.0"
367
- spec = nil
368
-
369
- options[:path] ||= @_build_path
370
-
371
- Array(versions).each do |version|
372
- spec = builder.new(self, name, version)
373
- if !spec.authors or spec.authors.empty?
374
- spec.authors = ["no one"]
375
- end
376
- yield spec if block_given?
377
- spec._build(options)
378
- end
379
-
380
- spec
381
- end
382
-
383
- class IndexBuilder
384
- include Builders
385
-
386
- def self.run(index, &block)
387
- new(index).run(&block)
388
- end
389
-
390
- def initialize(index)
391
- @index = index
392
- end
393
-
394
- def run(&block)
395
- instance_eval(&block)
396
- end
397
-
398
- def gem(*args, &block)
399
- build_spec(*args, &block).each do |s|
400
- @index << s
401
- end
402
- end
403
-
404
- def platforms(platforms)
405
- platforms.split(/\s+/).each do |platform|
406
- platform.gsub!(/^(mswin32)$/, 'x86-\1')
407
- yield Gem::Platform.new(platform)
408
- end
409
- end
410
-
411
- def versions(versions)
412
- versions.split(/\s+/).each { |version| yield v(version) }
413
- end
414
- end
415
-
416
- class DepBuilder
417
- include Builders
418
-
419
- def self.run(spec, &block)
420
- new(spec).run(&block)
421
- end
422
-
423
- def initialize(spec)
424
- @spec = spec
425
- end
426
-
427
- def run(&block)
428
- instance_eval(&block)
429
- end
430
-
431
- def runtime(name, requirements)
432
- @spec.add_runtime_dependency(name, requirements)
433
- end
434
-
435
- alias dep runtime
436
- end
437
-
438
- class LibBuilder
439
- def initialize(context, name, version)
440
- @context = context
441
- @name = name
442
- @spec = Gem::Specification.new do |s|
443
- s.name = name
444
- s.version = version
445
- s.summary = "This is just a fake gem for testing"
446
- end
447
- @files = {}
448
- end
449
-
450
- def method_missing(*args, &blk)
451
- @spec.send(*args, &blk)
452
- end
453
-
454
- def write(file, source = "")
455
- @files[file] = source
456
- end
457
-
458
- def executables=(val)
459
- Array(val).each do |file|
460
- write "#{@spec.bindir}/#{file}", "require '#{@name}' ; puts #{@name.upcase}"
461
- end
462
- @spec.executables = Array(val)
463
- end
464
-
465
- def add_c_extension
466
- require_paths << 'ext'
467
- extensions << "ext/extconf.rb"
468
- write "ext/extconf.rb", <<-RUBY
469
- require "mkmf"
470
-
471
- # exit 1 unless with_config("simple")
472
-
473
- extension_name = "very_simple_binary_c"
474
- dir_config extension_name
475
- create_makefile extension_name
476
- RUBY
477
- write "ext/very_simple_binary.c", <<-C
478
- #include "ruby.h"
479
-
480
- void Init_very_simple_binary_c() {
481
- rb_define_module("VerySimpleBinaryInC");
482
- }
483
- C
484
- end
485
-
486
- def _build(options)
487
- path = options[:path] || _default_path
488
-
489
- if options[:rubygems_version]
490
- @spec.rubygems_version = options[:rubygems_version]
491
- def @spec.mark_version; end
492
- def @spec.validate; end
493
- end
494
-
495
- case options[:gemspec]
496
- when false
497
- # do nothing
498
- when :yaml
499
- @files["#{name}.gemspec"] = @spec.to_yaml
500
- else
501
- @files["#{name}.gemspec"] = @spec.to_ruby
502
- end
503
-
504
- unless options[:no_default]
505
- @files = _default_files.merge(@files)
506
- end
507
-
508
- @spec.authors = ["no one"]
509
-
510
- @files.each do |file, source|
511
- file = Pathname.new(path).join(file)
512
- FileUtils.mkdir_p(file.dirname)
513
- File.open(file, 'w') { |f| f.puts source }
514
- end
515
- @spec.files = @files.keys
516
- path
517
- end
518
-
519
- def _default_files
520
- @_default_files ||= { "lib/#{name}.rb" => "#{Builders.constantize(name)} = '#{version}'" }
521
- end
522
-
523
- def _default_path
524
- @context.tmp('libs', @spec.full_name)
525
- end
526
- end
527
-
528
- class GitBuilder < LibBuilder
529
- def _build(options)
530
- path = options[:path] || _default_path
531
- super(options.merge(:path => path))
532
- Dir.chdir(path) do
533
- `git init`
534
- `git add *`
535
- `git config user.email "lol@wut.com"`
536
- `git config user.name "lolwut"`
537
- `git commit -m 'OMG INITIAL COMMIT'`
538
- end
539
- end
540
- end
541
-
542
- class GitBareBuilder < LibBuilder
543
- def _build(options)
544
- path = options[:path] || _default_path
545
- super(options.merge(:path => path))
546
- Dir.chdir(path) do
547
- `git init --bare`
548
- end
549
- end
550
- end
551
-
552
- class GitUpdater < LibBuilder
553
- def silently(str)
554
- `#{str} 2>#{Bundler::NULL}`
555
- end
556
-
557
- def _build(options)
558
- libpath = options[:path] || _default_path
559
-
560
- Dir.chdir(libpath) do
561
- silently "git checkout master"
562
-
563
- if branch = options[:branch]
564
- raise "You can't specify `master` as the branch" if branch == "master"
565
-
566
- if `git branch | grep #{branch}`.empty?
567
- silently("git branch #{branch}")
568
- end
569
-
570
- silently("git checkout #{branch}")
571
- elsif tag = options[:tag]
572
- `git tag #{tag}`
573
- elsif options[:remote]
574
- silently("git remote add origin file://#{options[:remote]}")
575
- elsif options[:push]
576
- silently("git push origin #{options[:push]}")
577
- end
578
-
579
- current_ref = `git rev-parse HEAD`.strip
580
- _default_files.keys.each do |path|
581
- _default_files[path] << "\n#{Builders.constantize(name)}_PREV_REF = '#{current_ref}'"
582
- end
583
- super(options.merge(:path => libpath, :gemspec => false))
584
- `git add *`
585
- `git commit -m "BUMP"`
586
- end
587
- end
588
- end
589
-
590
- class GitReader
591
- attr_reader :path
592
-
593
- def initialize(path)
594
- @path = path
595
- end
596
-
597
- def ref_for(ref, len = nil)
598
- ref = git "rev-parse #{ref}"
599
- ref = ref[0..len] if len
600
- ref
601
- end
602
-
603
- private
604
-
605
- def git(cmd)
606
- Bundler::SharedHelpers.with_clean_git_env do
607
- Dir.chdir(@path) { `git #{cmd}`.strip }
608
- end
609
- end
610
-
611
- end
612
-
613
- class GemBuilder < LibBuilder
614
-
615
- def _build(opts)
616
- lib_path = super(opts.merge(:path => @context.tmp(".tmp/#{@spec.full_name}"), :no_default => opts[:no_default]))
617
- Dir.chdir(lib_path) do
618
- destination = opts[:path] || _default_path
619
- FileUtils.mkdir_p(destination)
620
-
621
- if !@spec.authors or @spec.authors.empty?
622
- @spec.authors = ["that guy"]
623
- end
624
-
625
- Bundler.rubygems.build(@spec, opts[:skip_validation])
626
- if opts[:to_system]
627
- `gem install --ignore-dependencies #{@spec.full_name}.gem`
628
- else
629
- FileUtils.mv("#{@spec.full_name}.gem", opts[:path] || _default_path)
630
- end
631
- end
632
- end
633
-
634
- def _default_path
635
- @context.gem_repo1('gems')
636
- end
637
- end
638
-
639
- TEST_CERT = <<-CERT.gsub /^\s*/, ''
640
- -----BEGIN CERTIFICATE-----
641
- MIIDMjCCAhqgAwIBAgIBATANBgkqhkiG9w0BAQUFADAnMQwwCgYDVQQDDAN5b3Ux
642
- FzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTE1MDIwODAwMTIyM1oXDTQyMDYy
643
- NTAwMTIyM1owJzEMMAoGA1UEAwwDeW91MRcwFQYKCZImiZPyLGQBGRYHZXhhbXBs
644
- ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANlvFdpN43c4DMS9Jo06
645
- m0a7k3bQ3HWQ1yrYhZMi77F1F73NpBknYHIzDktQpGn6hs/4QFJT4m4zNEBF47UL
646
- jHU5nTK5rjkS3niGYUjvh3ZEzVeo9zHUlD/UwflDo4ALl3TSo2KY/KdPS/UTdLXL
647
- ajkQvaVJtEDgBPE3DPhlj5whp+Ik3mDHej7qpV6F502leAwYaFyOtlEG/ZGNG+nZ
648
- L0clH0j77HpP42AylHDi+vakEM3xcjo9BeWQ6Vkboic93c9RTt6CWBWxMQP7Nol1
649
- MOebz9XOSQclxpxWteXNfPRtMdAhmRl76SMI8ywzThNPpa4EH/yz34ftebVOgKyM
650
- nd0CAwEAAaNpMGcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFA7D
651
- n9qo0np23qi3aOYuAAPn/5IdMBYGA1UdEQQPMA2BC3lvdUBleGFtcGxlMBYGA1Ud
652
- EgQPMA2BC3lvdUBleGFtcGxlMA0GCSqGSIb3DQEBBQUAA4IBAQA7Gyk62sWOUX/N
653
- vk4tJrgKESph6Ns8+E36A7n3jt8zCep8ldzMvwTWquf9iqhsC68FilEoaDnUlWw7
654
- d6oNuaFkv7zfrWGLlvqQJC+cu2X5EpcCksg5oRp8VNbwJysJ6JgwosxzROII8eXc
655
- R+j1j6mDvQYqig2QOnzf480pjaqbP+tspfDFZbhKPrgM3Blrb3ZYuFpv4zkqI7aB
656
- 6fuk2DUhNO1CuwrJA84TqC+jGo73bDKaT5hrIDiaJRrN5+zcWja2uEWrj5jSbep4
657
- oXdEdyH73hOHMBP40uds3PqnUsxEJhzjB2sCCe1geV24kw9J4m7EQXPVkUKDgKrt
658
- LlpDmOoo
659
- -----END CERTIFICATE-----
660
- CERT
661
-
662
- TEST_PKEY = <<-PKEY.gsub /^\s*/, ''
663
- -----BEGIN RSA PRIVATE KEY-----
664
- MIIEowIBAAKCAQEA2W8V2k3jdzgMxL0mjTqbRruTdtDcdZDXKtiFkyLvsXUXvc2k
665
- GSdgcjMOS1CkafqGz/hAUlPibjM0QEXjtQuMdTmdMrmuORLeeIZhSO+HdkTNV6j3
666
- MdSUP9TB+UOjgAuXdNKjYpj8p09L9RN0tctqORC9pUm0QOAE8TcM+GWPnCGn4iTe
667
- YMd6PuqlXoXnTaV4DBhoXI62UQb9kY0b6dkvRyUfSPvsek/jYDKUcOL69qQQzfFy
668
- Oj0F5ZDpWRuiJz3dz1FO3oJYFbExA/s2iXUw55vP1c5JByXGnFa15c189G0x0CGZ
669
- GXvpIwjzLDNOE0+lrgQf/LPfh+15tU6ArIyd3QIDAQABAoIBACbDqz20TS1gDMa2
670
- gj0DidNedbflHKjJHdNBru7Ad8NHgOgR1YO2hXdWquG6itVqGMbTF4SV9/R1pIcg
671
- 7qvEV1I+50u31tvOBWOvcYCzU48+TO2n7gowQA3xPHPYHzog1uu48fAOHl0lwgD7
672
- av9OOK3b0jO5pC08wyTOD73pPWU0NrkTh2+N364leIi1pNuI1z4V+nEuIIm7XpVd
673
- 5V4sXidMTiEMJwE6baEDfTjHKaoRndXrrPo3ryIXmcX7Ag1SwAQwF5fBCRToCgIx
674
- dszEZB1bJD5gA6r+eGnJLB/F60nK607az5o3EdguoB2LKa6q6krpaRCmZU5svvoF
675
- J7xgBPECgYEA8RIzHAQ3zbaibKdnllBLIgsqGdSzebTLKheFuigRotEV3Or/z5Lg
676
- k/nVnThWVkTOSRqXTNpJAME6a4KTdcVSxYP+SdZVO1esazHrGb7xPVb7MWSE1cqp
677
- WEk3Yy8OUOPoPQMc4dyGzd30Mi8IBB6gnFIYOTrpUo0XtkBv8rGGhfsCgYEA5uYn
678
- 6QgL4NqNT84IXylmMb5ia3iBt6lhxI/A28CDtQvfScl4eYK0IjBwdfG6E1vJgyzg
679
- nJzv3xEVo9bz+Kq7CcThWpK5JQaPnsV0Q74Wjk0ShHet15txOdJuKImnh5F6lylC
680
- GTLR9gnptytfMH/uuw4ws0Q2kcg4l5NHKOWOnAcCgYEAvAwIVkhsB0n59Wu4gCZu
681
- FUZENxYWUk/XUyQ6KnZrG2ih90xQ8+iMyqFOIm/52R2fFKNrdoWoALC6E3ct8+ZS
682
- pMRLrelFXx8K3it4SwMJR2H8XBEfFW4bH0UtsW7Zafv+AunUs9LETP5gKG1LgXsq
683
- qgXX43yy2LQ61O365YPZfdUCgYBVbTvA3MhARbvYldrFEnUL3GtfZbNgdxuD9Mee
684
- xig0eJMBIrgfBLuOlqtVB70XYnM4xAbKCso4loKSHnofO1N99siFkRlM2JOUY2tz
685
- kMWZmmxKdFjuF0WZ5f/5oYxI/QsFGC+rUQEbbWl56mMKd5qkvEhKWudxoklF0yiV
686
- ufC8SwKBgDWb8iWqWN5a/kfvKoxFcDM74UHk/SeKMGAL+ujKLf58F+CbweM5pX9C
687
- EUsxeoUEraVWTiyFVNqD81rCdceus9TdBj0ZIK1vUttaRZyrMAwF0uQSfjtxsOpd
688
- l69BkyvzjgDPkmOHVGiSZDLi3YDvypbUpo6LOy4v5rVg5U2F/A0v
689
- -----END RSA PRIVATE KEY-----
690
- PKEY
691
-
692
- end
693
- end