rkh-bundler 1.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. data/.gitignore +22 -0
  2. data/.travis.yml +42 -0
  3. data/CHANGELOG.md +1105 -0
  4. data/ISSUES.md +67 -0
  5. data/LICENSE +23 -0
  6. data/README.md +31 -0
  7. data/Rakefile +208 -0
  8. data/UPGRADING.md +103 -0
  9. data/bin/bundle +31 -0
  10. data/bundler.gemspec +31 -0
  11. data/lib/bundler.rb +353 -0
  12. data/lib/bundler/capistrano.rb +11 -0
  13. data/lib/bundler/cli.rb +693 -0
  14. data/lib/bundler/definition.rb +568 -0
  15. data/lib/bundler/dep_proxy.rb +43 -0
  16. data/lib/bundler/dependency.rb +134 -0
  17. data/lib/bundler/deployment.rb +58 -0
  18. data/lib/bundler/dsl.rb +256 -0
  19. data/lib/bundler/endpoint_specification.rb +78 -0
  20. data/lib/bundler/environment.rb +47 -0
  21. data/lib/bundler/fetcher.rb +225 -0
  22. data/lib/bundler/gem_helper.rb +162 -0
  23. data/lib/bundler/gem_helpers.rb +23 -0
  24. data/lib/bundler/gem_installer.rb +9 -0
  25. data/lib/bundler/gem_tasks.rb +2 -0
  26. data/lib/bundler/graph.rb +148 -0
  27. data/lib/bundler/index.rb +187 -0
  28. data/lib/bundler/installer.rb +190 -0
  29. data/lib/bundler/lazy_specification.rb +79 -0
  30. data/lib/bundler/lockfile_parser.rb +127 -0
  31. data/lib/bundler/match_platform.rb +13 -0
  32. data/lib/bundler/psyched_yaml.rb +15 -0
  33. data/lib/bundler/remote_specification.rb +57 -0
  34. data/lib/bundler/resolver.rb +486 -0
  35. data/lib/bundler/ruby_version.rb +94 -0
  36. data/lib/bundler/rubygems_ext.rb +153 -0
  37. data/lib/bundler/rubygems_integration.rb +394 -0
  38. data/lib/bundler/runtime.rb +233 -0
  39. data/lib/bundler/settings.rb +128 -0
  40. data/lib/bundler/setup.rb +23 -0
  41. data/lib/bundler/shared_helpers.rb +71 -0
  42. data/lib/bundler/source.rb +869 -0
  43. data/lib/bundler/spec_set.rb +137 -0
  44. data/lib/bundler/templates/Executable +16 -0
  45. data/lib/bundler/templates/Executable.standalone +12 -0
  46. data/lib/bundler/templates/Gemfile +4 -0
  47. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  48. data/lib/bundler/templates/newgem/LICENSE.tt +22 -0
  49. data/lib/bundler/templates/newgem/README.md.tt +29 -0
  50. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  51. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  52. data/lib/bundler/templates/newgem/gitignore.tt +17 -0
  53. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
  54. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  55. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -0
  56. data/lib/bundler/ui.rb +88 -0
  57. data/lib/bundler/vendor/net/http/faster.rb +27 -0
  58. data/lib/bundler/vendor/net/http/persistent.rb +468 -0
  59. data/lib/bundler/vendor/thor.rb +358 -0
  60. data/lib/bundler/vendor/thor/actions.rb +314 -0
  61. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  62. data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
  63. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  64. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  65. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
  66. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
  67. data/lib/bundler/vendor/thor/base.rb +576 -0
  68. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  69. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  70. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  71. data/lib/bundler/vendor/thor/error.rb +30 -0
  72. data/lib/bundler/vendor/thor/group.rb +273 -0
  73. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  74. data/lib/bundler/vendor/thor/parser.rb +4 -0
  75. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  76. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  77. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  78. data/lib/bundler/vendor/thor/parser/options.rb +172 -0
  79. data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
  80. data/lib/bundler/vendor/thor/runner.rb +309 -0
  81. data/lib/bundler/vendor/thor/shell.rb +88 -0
  82. data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
  83. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  84. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  85. data/lib/bundler/vendor/thor/task.rb +113 -0
  86. data/lib/bundler/vendor/thor/util.rb +229 -0
  87. data/lib/bundler/vendor/thor/version.rb +3 -0
  88. data/lib/bundler/vendored_thor.rb +7 -0
  89. data/lib/bundler/version.rb +6 -0
  90. data/lib/bundler/vlad.rb +11 -0
  91. data/man/bundle-config.ronn +130 -0
  92. data/man/bundle-exec.ronn +111 -0
  93. data/man/bundle-install.ronn +335 -0
  94. data/man/bundle-package.ronn +59 -0
  95. data/man/bundle-update.ronn +176 -0
  96. data/man/bundle.ronn +83 -0
  97. data/man/gemfile.5.ronn +324 -0
  98. data/man/index.txt +6 -0
  99. data/spec/bundler/dsl_spec.rb +48 -0
  100. data/spec/bundler/gem_helper_spec.rb +174 -0
  101. data/spec/bundler/source_spec.rb +25 -0
  102. data/spec/cache/gems_spec.rb +239 -0
  103. data/spec/cache/git_spec.rb +124 -0
  104. data/spec/cache/path_spec.rb +103 -0
  105. data/spec/cache/platform_spec.rb +57 -0
  106. data/spec/install/deploy_spec.rb +211 -0
  107. data/spec/install/gems/c_ext_spec.rb +48 -0
  108. data/spec/install/gems/dependency_api_spec.rb +402 -0
  109. data/spec/install/gems/env_spec.rb +107 -0
  110. data/spec/install/gems/flex_spec.rb +313 -0
  111. data/spec/install/gems/groups_spec.rb +268 -0
  112. data/spec/install/gems/packed_spec.rb +84 -0
  113. data/spec/install/gems/platform_spec.rb +208 -0
  114. data/spec/install/gems/post_install_spec.rb +47 -0
  115. data/spec/install/gems/resolving_spec.rb +72 -0
  116. data/spec/install/gems/simple_case_spec.rb +814 -0
  117. data/spec/install/gems/standalone_spec.rb +260 -0
  118. data/spec/install/gems/sudo_spec.rb +74 -0
  119. data/spec/install/gems/win32_spec.rb +26 -0
  120. data/spec/install/gemspec_spec.rb +170 -0
  121. data/spec/install/git_spec.rb +796 -0
  122. data/spec/install/invalid_spec.rb +35 -0
  123. data/spec/install/path_spec.rb +405 -0
  124. data/spec/install/upgrade_spec.rb +26 -0
  125. data/spec/lock/git_spec.rb +35 -0
  126. data/spec/lock/lockfile_spec.rb +809 -0
  127. data/spec/other/check_spec.rb +265 -0
  128. data/spec/other/clean_spec.rb +492 -0
  129. data/spec/other/config_spec.rb +138 -0
  130. data/spec/other/console_spec.rb +54 -0
  131. data/spec/other/exec_spec.rb +229 -0
  132. data/spec/other/ext_spec.rb +37 -0
  133. data/spec/other/help_spec.rb +39 -0
  134. data/spec/other/init_spec.rb +40 -0
  135. data/spec/other/newgem_spec.rb +87 -0
  136. data/spec/other/open_spec.rb +35 -0
  137. data/spec/other/outdated_spec.rb +93 -0
  138. data/spec/other/platform_spec.rb +881 -0
  139. data/spec/other/show_spec.rb +88 -0
  140. data/spec/quality_spec.rb +62 -0
  141. data/spec/realworld/edgecases_spec.rb +177 -0
  142. data/spec/resolver/basic_spec.rb +20 -0
  143. data/spec/resolver/platform_spec.rb +82 -0
  144. data/spec/runtime/executable_spec.rb +120 -0
  145. data/spec/runtime/load_spec.rb +107 -0
  146. data/spec/runtime/platform_spec.rb +90 -0
  147. data/spec/runtime/require_spec.rb +261 -0
  148. data/spec/runtime/setup_spec.rb +755 -0
  149. data/spec/runtime/with_clean_env_spec.rb +80 -0
  150. data/spec/spec_helper.rb +98 -0
  151. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
  152. data/spec/support/artifice/endpoint.rb +54 -0
  153. data/spec/support/artifice/endpoint_500.rb +37 -0
  154. data/spec/support/artifice/endpoint_api_missing.rb +16 -0
  155. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  156. data/spec/support/artifice/endpoint_extra.rb +27 -0
  157. data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
  158. data/spec/support/artifice/endpoint_fallback.rb +18 -0
  159. data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
  160. data/spec/support/artifice/endpoint_redirect.rb +15 -0
  161. data/spec/support/builders.rb +604 -0
  162. data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
  163. data/spec/support/fakeweb/windows.rb +23 -0
  164. data/spec/support/helpers.rb +317 -0
  165. data/spec/support/indexes.rb +112 -0
  166. data/spec/support/matchers.rb +77 -0
  167. data/spec/support/path.rb +73 -0
  168. data/spec/support/platforms.rb +86 -0
  169. data/spec/support/ruby_ext.rb +20 -0
  170. data/spec/support/rubygems_ext.rb +37 -0
  171. data/spec/support/rubygems_hax/platform.rb +22 -0
  172. data/spec/support/sudo.rb +21 -0
  173. data/spec/update/gems_spec.rb +134 -0
  174. data/spec/update/git_spec.rb +196 -0
  175. data/spec/update/source_spec.rb +51 -0
  176. metadata +338 -0
@@ -0,0 +1,138 @@
1
+ require "spec_helper"
2
+
3
+ describe ".bundle/config" do
4
+ before :each do
5
+ gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem "rack", "1.0.0"
8
+ G
9
+ end
10
+
11
+ describe "BUNDLE_APP_CONFIG" do
12
+ it "can be moved with an environment variable" do
13
+ ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
14
+ bundle "install --path vendor/bundle"
15
+
16
+ bundled_app('.bundle').should_not exist
17
+ tmp('foo/bar/config').should exist
18
+ should_be_installed "rack 1.0.0"
19
+ end
20
+
21
+ it "can provide a relative path with the environment variable" do
22
+ FileUtils.mkdir_p bundled_app('omg')
23
+ Dir.chdir bundled_app('omg')
24
+
25
+ ENV['BUNDLE_APP_CONFIG'] = "../foo"
26
+ bundle "install --path vendor/bundle"
27
+
28
+ bundled_app(".bundle").should_not exist
29
+ bundled_app("../foo/config").should exist
30
+ should_be_installed "rack 1.0.0"
31
+ end
32
+
33
+ it "removes environment.rb from BUNDLE_APP_CONFIG's path" do
34
+ FileUtils.mkdir_p(tmp('foo/bar'))
35
+ ENV['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
36
+ bundle "install"
37
+ FileUtils.touch tmp('foo/bar/environment.rb')
38
+ should_be_installed "rack 1.0.0"
39
+ tmp('foo/bar/environment.rb').should_not exist
40
+ end
41
+ end
42
+
43
+ describe "global" do
44
+ before(:each) { bundle :install }
45
+
46
+ it "is the default" do
47
+ bundle "config foo global"
48
+ run "puts Bundler.settings[:foo]"
49
+ out.should == "global"
50
+ end
51
+
52
+ it "can also be set explicitly" do
53
+ bundle "config --global foo global"
54
+ run "puts Bundler.settings[:foo]"
55
+ out.should == "global"
56
+ end
57
+
58
+ it "has lower precedence than local" do
59
+ bundle "config --local foo local"
60
+
61
+ bundle "config --global foo global"
62
+ out.should =~ /Your application has set foo to "local"/
63
+
64
+ run "puts Bundler.settings[:foo]"
65
+ out.should == "local"
66
+ end
67
+
68
+ it "has lower precedence than env" do
69
+ begin
70
+ ENV["BUNDLE_FOO"] = "env"
71
+
72
+ bundle "config --global foo global"
73
+ out.should =~ /You have a bundler environment variable for foo set to "env"/
74
+
75
+ run "puts Bundler.settings[:foo]"
76
+ out.should == "env"
77
+ ensure
78
+ ENV.delete("BUNDLE_FOO")
79
+ end
80
+ end
81
+
82
+ it "can be deleted" do
83
+ bundle "config --global foo global"
84
+ bundle "config --delete foo"
85
+
86
+ run "puts Bundler.settings[:foo] == nil"
87
+ out.should == "true"
88
+ end
89
+
90
+ it "warns when overriding" do
91
+ bundle "config --global foo previous"
92
+ bundle "config --global foo global"
93
+ out.should =~ /You are replacing the current global value of foo/
94
+
95
+ run "puts Bundler.settings[:foo]"
96
+ out.should == "global"
97
+ end
98
+ end
99
+
100
+ describe "local" do
101
+ before(:each) { bundle :install }
102
+
103
+ it "can also be set explicitly" do
104
+ bundle "config --local foo local"
105
+ run "puts Bundler.settings[:foo]"
106
+ out.should == "local"
107
+ end
108
+
109
+ it "has higher precedence than env" do
110
+ begin
111
+ ENV["BUNDLE_FOO"] = "env"
112
+ bundle "config --local foo local"
113
+
114
+ run "puts Bundler.settings[:foo]"
115
+ out.should == "local"
116
+ ensure
117
+ ENV.delete("BUNDLE_FOO")
118
+ end
119
+ end
120
+
121
+ it "can be deleted" do
122
+ bundle "config --local foo local"
123
+ bundle "config --delete foo"
124
+
125
+ run "puts Bundler.settings[:foo] == nil"
126
+ out.should == "true"
127
+ end
128
+
129
+ it "warns when overriding" do
130
+ bundle "config --local foo previous"
131
+ bundle "config --local foo local"
132
+ out.should =~ /You are replacing the current local value of foo/
133
+
134
+ run "puts Bundler.settings[:foo]"
135
+ out.should == "local"
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,54 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle console" do
4
+ before :each do
5
+ install_gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem "rack"
8
+ gem "activesupport", :group => :test
9
+ gem "rack_middleware", :group => :development
10
+ G
11
+ end
12
+
13
+ it "starts IRB with the default group loaded" do
14
+ bundle "console" do |input|
15
+ input.puts("puts RACK")
16
+ input.puts("exit")
17
+ end
18
+ out.should include("0.9.1")
19
+ end
20
+
21
+ it "doesn't load any other groups" do
22
+ bundle "console" do |input|
23
+ input.puts("puts ACTIVESUPPORT")
24
+ input.puts("exit")
25
+ end
26
+ out.should include("NameError")
27
+ end
28
+
29
+ describe "when given a group" do
30
+ it "loads the given group" do
31
+ bundle "console test" do |input|
32
+ input.puts("puts ACTIVESUPPORT")
33
+ input.puts("exit")
34
+ end
35
+ out.should include("2.3.5")
36
+ end
37
+
38
+ it "loads the default group" do
39
+ bundle "console test" do |input|
40
+ input.puts("puts RACK")
41
+ input.puts("exit")
42
+ end
43
+ out.should include("0.9.1")
44
+ end
45
+
46
+ it "doesn't load other groups" do
47
+ bundle "console test" do |input|
48
+ input.puts("puts RACK_MIDDLEWARE")
49
+ input.puts("exit")
50
+ end
51
+ out.should include("NameError")
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,229 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle exec" do
4
+ before :each do
5
+ system_gems "rack-1.0.0", "rack-0.9.1"
6
+ end
7
+
8
+ it "activates the correct gem" do
9
+ gemfile <<-G
10
+ gem "rack", "0.9.1"
11
+ G
12
+
13
+ bundle "exec rackup"
14
+ out.should == "0.9.1"
15
+ end
16
+
17
+ it "works when the bins are in ~/.bundle" do
18
+ install_gemfile <<-G
19
+ gem "rack"
20
+ G
21
+
22
+ bundle "exec rackup"
23
+ out.should == "1.0.0"
24
+ end
25
+
26
+ it "works when running from a random directory" do
27
+ install_gemfile <<-G
28
+ gem "rack"
29
+ G
30
+
31
+ bundle "exec 'cd #{tmp('gems')} && rackup'"
32
+
33
+ out.should == "1.0.0"
34
+ end
35
+
36
+ it "works when exec'ing something else" do
37
+ install_gemfile 'gem "rack"'
38
+ bundle "exec echo exec"
39
+ out.should == "exec"
40
+ end
41
+
42
+ it "handles different versions in different bundles" do
43
+ build_repo2 do
44
+ build_gem "rack_two", "1.0.0" do |s|
45
+ s.executables = "rackup"
46
+ end
47
+ end
48
+
49
+ install_gemfile <<-G
50
+ source "file://#{gem_repo1}"
51
+ gem "rack", "0.9.1"
52
+ G
53
+
54
+ Dir.chdir bundled_app2 do
55
+ install_gemfile bundled_app2('Gemfile'), <<-G
56
+ source "file://#{gem_repo2}"
57
+ gem "rack_two", "1.0.0"
58
+ G
59
+ end
60
+
61
+ bundle "exec rackup"
62
+
63
+ out.should eq("0.9.1")
64
+
65
+ Dir.chdir bundled_app2 do
66
+ bundle "exec rackup"
67
+ out.should == "1.0.0"
68
+ end
69
+ end
70
+
71
+ it "handles gems installed with --without" do
72
+ install_gemfile <<-G, :without => :middleware
73
+ source "file://#{gem_repo1}"
74
+ gem "rack" # rack 0.9.1 and 1.0 exist
75
+
76
+ group :middleware do
77
+ gem "rack_middleware" # rack_middleware depends on rack 0.9.1
78
+ end
79
+ G
80
+
81
+ bundle "exec rackup"
82
+
83
+ out.should eq("0.9.1")
84
+ should_not_be_installed "rack_middleware 1.0"
85
+ end
86
+
87
+ it "should not duplicate already exec'ed RUBYOPT or PATH" do
88
+ install_gemfile <<-G
89
+ gem "rack"
90
+ G
91
+
92
+ rubyopt = ENV['RUBYOPT']
93
+ rubyopt = "-I#{bundler_path} -rbundler/setup #{rubyopt}"
94
+
95
+ bundle "exec 'echo $RUBYOPT'"
96
+ out.should have_rubyopts(rubyopt)
97
+
98
+ bundle "exec 'echo $RUBYOPT'", :env => {"RUBYOPT" => rubyopt}
99
+ out.should have_rubyopts(rubyopt)
100
+ end
101
+
102
+ it "errors nicely when the argument doesn't exist" do
103
+ install_gemfile <<-G
104
+ gem "rack"
105
+ G
106
+
107
+ bundle "exec foobarbaz", :exitstatus => true
108
+ exitstatus.should eq(127)
109
+ out.should include("bundler: command not found: foobarbaz")
110
+ out.should include("Install missing gem executables with `bundle install`")
111
+ end
112
+
113
+ it "errors nicely when the argument is not executable" do
114
+ install_gemfile <<-G
115
+ gem "rack"
116
+ G
117
+
118
+ bundle "exec touch foo"
119
+ bundle "exec ./foo", :exitstatus => true
120
+ exitstatus.should eq(126)
121
+ out.should include("bundler: not executable: ./foo")
122
+ end
123
+
124
+ it "errors nicely when no arguments are passed" do
125
+ install_gemfile <<-G
126
+ gem "rack"
127
+ G
128
+
129
+ bundle "exec", :exitstatus => true
130
+ # exitstatus.should eq(128)
131
+ out.should include("bundler: exec needs a command to run")
132
+ end
133
+
134
+ describe "with gem executables" do
135
+ describe "run from a random directory" do
136
+ before(:each) do
137
+ install_gemfile <<-G
138
+ gem "rack"
139
+ G
140
+ end
141
+
142
+ it "works when unlocked" do
143
+ bundle "exec 'cd #{tmp('gems')} && rackup'"
144
+ out.should == "1.0.0"
145
+ end
146
+
147
+ it "works when locked" do
148
+ bundle "lock"
149
+ should_be_locked
150
+ bundle "exec 'cd #{tmp('gems')} && rackup'"
151
+ out.should == "1.0.0"
152
+ end
153
+ end
154
+
155
+ describe "from gems bundled via :path" do
156
+ before(:each) do
157
+ build_lib "fizz", :path => home("fizz") do |s|
158
+ s.executables = "fizz"
159
+ end
160
+
161
+ install_gemfile <<-G
162
+ gem "fizz", :path => "#{File.expand_path(home("fizz"))}"
163
+ G
164
+ end
165
+
166
+ it "works when unlocked" do
167
+ bundle "exec fizz"
168
+ out.should == "1.0"
169
+ end
170
+
171
+ it "works when locked" do
172
+ bundle "lock"
173
+ should_be_locked
174
+
175
+ bundle "exec fizz"
176
+ out.should == "1.0"
177
+ end
178
+ end
179
+
180
+ describe "from gems bundled via :git" do
181
+ before(:each) do
182
+ build_git "fizz_git" do |s|
183
+ s.executables = "fizz_git"
184
+ end
185
+
186
+ install_gemfile <<-G
187
+ gem "fizz_git", :git => "#{lib_path('fizz_git-1.0')}"
188
+ G
189
+ end
190
+
191
+ it "works when unlocked" do
192
+ bundle "exec fizz_git"
193
+ out.should == "1.0"
194
+ end
195
+
196
+ it "works when locked" do
197
+ bundle "lock"
198
+ should_be_locked
199
+ bundle "exec fizz_git"
200
+ out.should == "1.0"
201
+ end
202
+ end
203
+
204
+ describe "from gems bundled via :git with no gemspec" do
205
+ before(:each) do
206
+ build_git "fizz_no_gemspec", :gemspec => false do |s|
207
+ s.executables = "fizz_no_gemspec"
208
+ end
209
+
210
+ install_gemfile <<-G
211
+ gem "fizz_no_gemspec", "1.0", :git => "#{lib_path('fizz_no_gemspec-1.0')}"
212
+ G
213
+ end
214
+
215
+ it "works when unlocked" do
216
+ bundle "exec fizz_no_gemspec"
217
+ out.should == "1.0"
218
+ end
219
+
220
+ it "works when locked" do
221
+ bundle "lock"
222
+ should_be_locked
223
+ bundle "exec fizz_no_gemspec"
224
+ out.should == "1.0"
225
+ end
226
+ end
227
+
228
+ end
229
+ end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Gem::Specification#match_platform" do
4
+ it "does not match platforms other than the gem platform" do
5
+ darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10"
6
+ darwin.match_platform(pl('java')).should be_false
7
+ end
8
+ end
9
+
10
+ describe "Bundler::GemHelpers#generic" do
11
+ include Bundler::GemHelpers
12
+
13
+ it "converts non-windows platforms into ruby" do
14
+ generic(pl('x86-darwin-10')).should == pl('ruby')
15
+ end
16
+ end
17
+
18
+ describe "Gem::SourceIndex#refresh!" do
19
+ rubygems_1_7 = Gem::Version.new(Gem::VERSION) >= Gem::Version.new("1.7.0")
20
+
21
+ before do
22
+ install_gemfile <<-G
23
+ source "file://#{gem_repo1}"
24
+ gem "rack"
25
+ G
26
+ end
27
+
28
+ it "does not explode when called", :if => rubygems_1_7 do
29
+ run "Gem.source_index.refresh!"
30
+ run "Gem::SourceIndex.new([]).refresh!"
31
+ end
32
+
33
+ it "does not explode when called", :unless => rubygems_1_7 do
34
+ run "Gem.source_index.refresh!"
35
+ run "Gem::SourceIndex.from_gems_in([]).refresh!"
36
+ end
37
+ end