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,88 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle show" do
4
+ before :each do
5
+ install_gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem "rails"
8
+ G
9
+ end
10
+
11
+ it "creates a Gemfile.lock if one did not exist" do
12
+ FileUtils.rm("Gemfile.lock")
13
+
14
+ bundle "show"
15
+
16
+ bundled_app("Gemfile.lock").should exist
17
+ end
18
+
19
+ it "creates a Gemfile.lock when invoked with a gem name" do
20
+ FileUtils.rm("Gemfile.lock")
21
+
22
+ bundle "show rails"
23
+
24
+ bundled_app("Gemfile.lock").should exist
25
+ end
26
+
27
+ it "prints path if gem exists in bundle" do
28
+ bundle "show rails"
29
+ out.should == default_bundle_path('gems', 'rails-2.3.2').to_s
30
+ end
31
+
32
+ it "prints the path to the running bundler" do
33
+ bundle "show bundler"
34
+ out.should == File.expand_path('../../../', __FILE__)
35
+ end
36
+
37
+ it "complains if gem not in bundle" do
38
+ bundle "show missing"
39
+ out.should =~ /could not find gem 'missing'/i
40
+ end
41
+
42
+ it "prints path of all gems in bundle" do
43
+ bundle "show --paths"
44
+ out.should include(default_bundle_path('gems', 'rake-0.8.7').to_s)
45
+ out.should include(default_bundle_path('gems', 'rails-2.3.2').to_s)
46
+ end
47
+ end
48
+
49
+ describe "bundle show with a git repo" do
50
+ before :each do
51
+ @git = build_git "foo", "1.0"
52
+ end
53
+
54
+ it "prints out git info" do
55
+ install_gemfile <<-G
56
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
57
+ G
58
+ should_be_installed "foo 1.0"
59
+
60
+ bundle :show
61
+ out.should include("foo (1.0 #{@git.ref_for('master', 6)}")
62
+ end
63
+
64
+ it "prints out branch names other than master" do
65
+ update_git "foo", :branch => "omg" do |s|
66
+ s.write "lib/foo.rb", "FOO = '1.0.omg'"
67
+ end
68
+ @revision = revision_for(lib_path("foo-1.0"))[0...6]
69
+
70
+ install_gemfile <<-G
71
+ gem "foo", :git => "#{lib_path('foo-1.0')}", :branch => "omg"
72
+ G
73
+ should_be_installed "foo 1.0.omg"
74
+
75
+ bundle :show
76
+ out.should include("foo (1.0 #{@git.ref_for('omg', 6)}")
77
+ end
78
+
79
+ it "doesn't print the branch when tied to a ref" do
80
+ sha = revision_for(lib_path("foo-1.0"))
81
+ install_gemfile <<-G
82
+ gem "foo", :git => "#{lib_path('foo-1.0')}", :ref => "#{sha}"
83
+ G
84
+
85
+ bundle :show
86
+ out.should include("foo (1.0 #{sha[0..6]})")
87
+ end
88
+ end
@@ -0,0 +1,62 @@
1
+ require "spec_helper"
2
+
3
+ if defined?(Encoding) && Encoding.default_external != "UTF-8"
4
+ Encoding.default_external = "UTF-8"
5
+ end
6
+
7
+ describe "The library itself" do
8
+ def check_for_tab_characters(filename)
9
+ failing_lines = []
10
+ File.readlines(filename).each_with_index do |line,number|
11
+ failing_lines << number + 1 if line =~ /\t/
12
+ end
13
+
14
+ unless failing_lines.empty?
15
+ "#{filename} has tab characters on lines #{failing_lines.join(', ')}"
16
+ end
17
+ end
18
+
19
+ def check_for_extra_spaces(filename)
20
+ failing_lines = []
21
+ File.readlines(filename).each_with_index do |line,number|
22
+ next if line =~ /^\s+#.*\s+\n$/
23
+ failing_lines << number + 1 if line =~ /\s+\n$/
24
+ end
25
+
26
+ unless failing_lines.empty?
27
+ "#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}"
28
+ end
29
+ end
30
+
31
+ RSpec::Matchers.define :be_well_formed do
32
+ failure_message_for_should do |actual|
33
+ actual.join("\n")
34
+ end
35
+
36
+ match do |actual|
37
+ actual.empty?
38
+ end
39
+ end
40
+
41
+ it "has no malformed whitespace" do
42
+ error_messages = []
43
+ Dir.chdir(File.expand_path("../..", __FILE__)) do
44
+ `git ls-files`.split("\n").each do |filename|
45
+ next if filename =~ /\.gitmodules|\.marshal|fixtures|vendor/
46
+ error_messages << check_for_tab_characters(filename)
47
+ error_messages << check_for_extra_spaces(filename)
48
+ end
49
+ end
50
+ error_messages.compact.should be_well_formed
51
+ end
52
+
53
+ it "can still be built" do
54
+ Dir.chdir(root) do
55
+ `gem build bundler.gemspec`
56
+ $?.should eq(0)
57
+
58
+ # clean up the .gem generated
59
+ system("rm bundler-#{Bundler::VERSION}.gem")
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,177 @@
1
+ require 'spec_helper'
2
+
3
+ describe "real world edgecases", :realworld => true do
4
+ # there is no rbx-relative-require gem that will install on 1.9
5
+ it "ignores extra gems with bad platforms", :ruby => "1.8" do
6
+ install_gemfile <<-G
7
+ source :rubygems
8
+ gem "linecache", "0.46"
9
+ G
10
+ err.should eq("")
11
+ end
12
+
13
+ # https://github.com/carlhuda/bundler/issues/1202
14
+ it "bundle cache works with rubygems 1.3.7 and pre gems" do
15
+ install_gemfile <<-G
16
+ source :rubygems
17
+ gem "rack", "1.3.0.beta2"
18
+ gem "will_paginate", "3.0.pre2"
19
+ G
20
+ bundle :cache
21
+ out.should_not include("Removing outdated .gem files from vendor/cache")
22
+ end
23
+
24
+ # https://github.com/carlhuda/bundler/issues/1486
25
+ # this is a hash collision that only manifests on 1.8.7
26
+ it "finds the correct child versions" do
27
+ install_gemfile <<-G
28
+ source :rubygems
29
+
30
+ gem 'i18n', '~> 0.4'
31
+ gem 'activesupport', '~> 3.0'
32
+ gem 'activerecord', '~> 3.0'
33
+ gem 'builder', '~> 2.1.2'
34
+ G
35
+ out.should include("activemodel (3.0.5)")
36
+ end
37
+
38
+ # https://github.com/carlhuda/bundler/issues/1500
39
+ it "does not fail install because of gem plugins" do
40
+ realworld_system_gems("open_gem --version 1.4.2", "rake --version 0.9.2")
41
+ gemfile <<-G
42
+ source :rubygems
43
+
44
+ gem 'rack', '1.0.0'
45
+ G
46
+
47
+ bundle "install --path vendor/bundle", :expect_err => true
48
+ err.should_not include("Could not find rake")
49
+ err.should be_empty
50
+ end
51
+
52
+ it "checks out git repos when the lockfile is corrupted" do
53
+ gemfile <<-G
54
+ source :rubygems
55
+
56
+ gem 'activerecord', :github => 'carlhuda/rails-bundler-test', :branch => 'master'
57
+ gem 'activesupport', :github => 'carlhuda/rails-bundler-test', :branch => 'master'
58
+ gem 'actionpack', :github => 'carlhuda/rails-bundler-test', :branch => 'master'
59
+ G
60
+
61
+ lockfile <<-L
62
+ GIT
63
+ remote: git://github.com/carlhuda/rails-bundler-test.git
64
+ revision: 369e28a87419565f1940815219ea9200474589d4
65
+ branch: master
66
+ specs:
67
+ actionpack (3.2.2)
68
+ activemodel (= 3.2.2)
69
+ activesupport (= 3.2.2)
70
+ builder (~> 3.0.0)
71
+ erubis (~> 2.7.0)
72
+ journey (~> 1.0.1)
73
+ rack (~> 1.4.0)
74
+ rack-cache (~> 1.2)
75
+ rack-test (~> 0.6.1)
76
+ sprockets (~> 2.1.2)
77
+ activemodel (3.2.2)
78
+ activesupport (= 3.2.2)
79
+ builder (~> 3.0.0)
80
+ activerecord (3.2.2)
81
+ activemodel (= 3.2.2)
82
+ activesupport (= 3.2.2)
83
+ arel (~> 3.0.2)
84
+ tzinfo (~> 0.3.29)
85
+ activesupport (3.2.2)
86
+ i18n (~> 0.6)
87
+ multi_json (~> 1.0)
88
+
89
+ GIT
90
+ remote: git://github.com/carlhuda/rails-bundler-test.git
91
+ revision: 369e28a87419565f1940815219ea9200474589d4
92
+ branch: master
93
+ specs:
94
+ actionpack (3.2.2)
95
+ activemodel (= 3.2.2)
96
+ activesupport (= 3.2.2)
97
+ builder (~> 3.0.0)
98
+ erubis (~> 2.7.0)
99
+ journey (~> 1.0.1)
100
+ rack (~> 1.4.0)
101
+ rack-cache (~> 1.2)
102
+ rack-test (~> 0.6.1)
103
+ sprockets (~> 2.1.2)
104
+ activemodel (3.2.2)
105
+ activesupport (= 3.2.2)
106
+ builder (~> 3.0.0)
107
+ activerecord (3.2.2)
108
+ activemodel (= 3.2.2)
109
+ activesupport (= 3.2.2)
110
+ arel (~> 3.0.2)
111
+ tzinfo (~> 0.3.29)
112
+ activesupport (3.2.2)
113
+ i18n (~> 0.6)
114
+ multi_json (~> 1.0)
115
+
116
+ GIT
117
+ remote: git://github.com/carlhuda/rails-bundler-test.git
118
+ revision: 369e28a87419565f1940815219ea9200474589d4
119
+ branch: master
120
+ specs:
121
+ actionpack (3.2.2)
122
+ activemodel (= 3.2.2)
123
+ activesupport (= 3.2.2)
124
+ builder (~> 3.0.0)
125
+ erubis (~> 2.7.0)
126
+ journey (~> 1.0.1)
127
+ rack (~> 1.4.0)
128
+ rack-cache (~> 1.2)
129
+ rack-test (~> 0.6.1)
130
+ sprockets (~> 2.1.2)
131
+ activemodel (3.2.2)
132
+ activesupport (= 3.2.2)
133
+ builder (~> 3.0.0)
134
+ activerecord (3.2.2)
135
+ activemodel (= 3.2.2)
136
+ activesupport (= 3.2.2)
137
+ arel (~> 3.0.2)
138
+ tzinfo (~> 0.3.29)
139
+ activesupport (3.2.2)
140
+ i18n (~> 0.6)
141
+ multi_json (~> 1.0)
142
+
143
+ GEM
144
+ remote: http://rubygems.org/
145
+ specs:
146
+ arel (3.0.2)
147
+ builder (3.0.0)
148
+ erubis (2.7.0)
149
+ hike (1.2.1)
150
+ i18n (0.6.0)
151
+ journey (1.0.3)
152
+ multi_json (1.1.0)
153
+ rack (1.4.1)
154
+ rack-cache (1.2)
155
+ rack (>= 0.4)
156
+ rack-test (0.6.1)
157
+ rack (>= 1.0)
158
+ sprockets (2.1.2)
159
+ hike (~> 1.2)
160
+ rack (~> 1.0)
161
+ tilt (~> 1.1, != 1.3.0)
162
+ tilt (1.3.3)
163
+ tzinfo (0.3.32)
164
+
165
+ PLATFORMS
166
+ ruby
167
+
168
+ DEPENDENCIES
169
+ actionpack!
170
+ activerecord!
171
+ activesupport!
172
+ L
173
+
174
+ bundle :install, :exitstatus => true
175
+ exitstatus.should == 0
176
+ end
177
+ end
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe "Resolving" do
4
+
5
+ before :each do
6
+ @index = an_awesome_index
7
+ end
8
+
9
+ it "resolves a single gem" do
10
+ dep "rack"
11
+
12
+ should_resolve_as %w(rack-1.1)
13
+ end
14
+
15
+ it "resolves a gem with dependencies" do
16
+ dep "actionpack"
17
+
18
+ should_resolve_as %w(actionpack-2.3.5 activesupport-2.3.5 rack-1.0)
19
+ end
20
+ end
@@ -0,0 +1,82 @@
1
+ require "spec_helper"
2
+
3
+ describe "Resolving platform craziness" do
4
+ describe "with cross-platform gems" do
5
+ before :each do
6
+ @index = an_awesome_index
7
+ end
8
+
9
+ it "resolves a simple multi platform gem" do
10
+ dep "nokogiri"
11
+ platforms "ruby", "java"
12
+
13
+ should_resolve_as %w(nokogiri-1.4.2 nokogiri-1.4.2-java weakling-0.0.3)
14
+ end
15
+
16
+ it "doesn't pull gems that don't exist for the current platform" do
17
+ dep "nokogiri"
18
+ platforms "ruby"
19
+
20
+ should_resolve_as %w(nokogiri-1.4.2)
21
+ end
22
+
23
+ it "doesn't pull gems when the version is available for all requested platforms" do
24
+ dep "nokogiri"
25
+ platforms "mswin32"
26
+
27
+ should_resolve_as %w(nokogiri-1.4.2.1-x86-mswin32)
28
+ end
29
+ end
30
+
31
+ describe "with mingw32" do
32
+
33
+ before :each do
34
+ @index = build_index do
35
+ platforms "mingw32 mswin32" do |platform|
36
+ gem "thin", "1.2.7", platform
37
+ end
38
+ end
39
+ end
40
+
41
+ it "finds mswin gems" do
42
+ # win32 is hardcoded to get CPU x86 in rubygems
43
+ platforms "mswin32"
44
+ dep "thin"
45
+ should_resolve_as %w(thin-1.2.7-x86-mswin32)
46
+ end
47
+
48
+ it "finds mingw gems" do
49
+ # mingw is _not_ hardcoded to add CPU x86 in rubygems
50
+ platforms "x86-mingw32"
51
+ dep "thin"
52
+ should_resolve_as %w(thin-1.2.7-x86-mingw32)
53
+ end
54
+ end
55
+
56
+ describe "with conflicting cases" do
57
+ before :each do
58
+ @index = build_index do
59
+ gem "foo", "1.0.0" do
60
+ dep "bar", ">= 0"
61
+ end
62
+
63
+ gem 'bar', "1.0.0" do
64
+ dep "baz", "~> 1.0.0"
65
+ end
66
+
67
+ gem "bar", "1.0.0", "java" do
68
+ dep "baz", " ~> 1.1.0"
69
+ end
70
+
71
+ gem "baz", %w(1.0.0 1.1.0 1.2.0)
72
+ end
73
+ end
74
+
75
+ it "reports on the conflict" do
76
+ platforms "ruby", "java"
77
+ dep "foo"
78
+
79
+ should_conflict_on "baz"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,120 @@
1
+ require "spec_helper"
2
+
3
+ describe "Running bin/* commands" do
4
+ before :each do
5
+ gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem "rack"
8
+ G
9
+ end
10
+
11
+ it "runs the bundled command when in the bundle" do
12
+ bundle "install --binstubs"
13
+
14
+ build_gem "rack", "2.0", :to_system => true do |s|
15
+ s.executables = "rackup"
16
+ end
17
+
18
+ gembin "rackup"
19
+ out.should == "1.0.0"
20
+ end
21
+
22
+ it "allows the location of the gem stubs to be specified" do
23
+ bundle "install --binstubs gbin"
24
+
25
+ bundled_app("bin").should_not exist
26
+ bundled_app("gbin/rackup").should exist
27
+
28
+ gembin bundled_app("gbin/rackup")
29
+ out.should == "1.0.0"
30
+ end
31
+
32
+ it "allows absolute paths as a specification of where to install bin stubs" do
33
+ bundle "install --binstubs #{tmp}/bin"
34
+
35
+ gembin tmp("bin/rackup")
36
+ out.should == "1.0.0"
37
+ end
38
+
39
+ it "uses the default ruby install name when shebang is not specified" do
40
+ bundle "install --binstubs"
41
+ File.open("bin/rackup").gets.should == "#!/usr/bin/env #{RbConfig::CONFIG['ruby_install_name']}\n"
42
+ end
43
+
44
+ it "allows the name of the shebang executable to be specified" do
45
+ bundle "install --binstubs --shebang ruby-foo"
46
+ File.open("bin/rackup").gets.should == "#!/usr/bin/env ruby-foo\n"
47
+ end
48
+
49
+ it "runs the bundled command when out of the bundle" do
50
+ bundle "install --binstubs"
51
+
52
+ build_gem "rack", "2.0", :to_system => true do |s|
53
+ s.executables = "rackup"
54
+ end
55
+
56
+ Dir.chdir(tmp) do
57
+ gembin "rackup"
58
+ out.should == "1.0.0"
59
+ end
60
+ end
61
+
62
+ it "works with gems in path" do
63
+ build_lib "rack", :path => lib_path("rack") do |s|
64
+ s.executables = 'rackup'
65
+ end
66
+
67
+ gemfile <<-G
68
+ gem "rack", :path => "#{lib_path('rack')}"
69
+ G
70
+
71
+ bundle "install --binstubs"
72
+
73
+ build_gem 'rack', '2.0', :to_system => true do |s|
74
+ s.executables = 'rackup'
75
+ end
76
+
77
+ gembin "rackup"
78
+ out.should == '1.0'
79
+ end
80
+
81
+ it "don't bundle da bundla" do
82
+ build_gem "bundler", Bundler::VERSION, :to_system => true do |s|
83
+ s.executables = "bundle"
84
+ end
85
+
86
+ gemfile <<-G
87
+ source "file://#{gem_repo1}"
88
+ gem "bundler"
89
+ G
90
+
91
+ bundle "install --binstubs"
92
+
93
+ bundled_app("bin/bundle").should_not exist
94
+ end
95
+
96
+ it "does not generate bin stubs if the option was not specified" do
97
+ bundle "install"
98
+
99
+ bundled_app("bin/rackup").should_not exist
100
+ end
101
+
102
+ it "remembers that the option was specified" do
103
+ gemfile <<-G
104
+ source "file://#{gem_repo1}"
105
+ gem "activesupport"
106
+ G
107
+
108
+ bundle "install --binstubs"
109
+
110
+ gemfile <<-G
111
+ source "file://#{gem_repo1}"
112
+ gem "activesupport"
113
+ gem "rack"
114
+ G
115
+
116
+ bundle "install"
117
+
118
+ bundled_app("bin/rackup").should exist
119
+ end
120
+ end