honkster-bundler 1.1.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/.gitignore +14 -0
  2. data/CHANGELOG.md +547 -0
  3. data/ISSUES.md +32 -0
  4. data/LICENSE +20 -0
  5. data/README.md +29 -0
  6. data/Rakefile +150 -0
  7. data/UPGRADING.md +103 -0
  8. data/bin/bundle +21 -0
  9. data/bundler.gemspec +30 -0
  10. data/lib/bundler.rb +268 -0
  11. data/lib/bundler/capistrano.rb +11 -0
  12. data/lib/bundler/cli.rb +515 -0
  13. data/lib/bundler/definition.rb +427 -0
  14. data/lib/bundler/dependency.rb +114 -0
  15. data/lib/bundler/deployment.rb +37 -0
  16. data/lib/bundler/dsl.rb +245 -0
  17. data/lib/bundler/environment.rb +47 -0
  18. data/lib/bundler/gem_helper.rb +145 -0
  19. data/lib/bundler/graph.rb +130 -0
  20. data/lib/bundler/index.rb +114 -0
  21. data/lib/bundler/installer.rb +84 -0
  22. data/lib/bundler/lazy_specification.rb +71 -0
  23. data/lib/bundler/lockfile_parser.rb +108 -0
  24. data/lib/bundler/remote_specification.rb +59 -0
  25. data/lib/bundler/resolver.rb +454 -0
  26. data/lib/bundler/rubygems_ext.rb +203 -0
  27. data/lib/bundler/runtime.rb +148 -0
  28. data/lib/bundler/settings.rb +117 -0
  29. data/lib/bundler/setup.rb +15 -0
  30. data/lib/bundler/shared_helpers.rb +151 -0
  31. data/lib/bundler/source.rb +662 -0
  32. data/lib/bundler/spec_set.rb +134 -0
  33. data/lib/bundler/templates/Executable +16 -0
  34. data/lib/bundler/templates/Gemfile +4 -0
  35. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  36. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  37. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  38. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  39. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -0
  40. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  41. data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -0
  42. data/lib/bundler/ui.rb +60 -0
  43. data/lib/bundler/vendor/thor.rb +319 -0
  44. data/lib/bundler/vendor/thor/actions.rb +297 -0
  45. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  46. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  47. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  48. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +229 -0
  49. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +104 -0
  50. data/lib/bundler/vendor/thor/base.rb +556 -0
  51. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  52. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  53. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  54. data/lib/bundler/vendor/thor/error.rb +30 -0
  55. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  56. data/lib/bundler/vendor/thor/parser.rb +4 -0
  57. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  58. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  59. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  60. data/lib/bundler/vendor/thor/parser/options.rb +174 -0
  61. data/lib/bundler/vendor/thor/shell.rb +88 -0
  62. data/lib/bundler/vendor/thor/shell/basic.rb +275 -0
  63. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  64. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  65. data/lib/bundler/vendor/thor/task.rb +114 -0
  66. data/lib/bundler/vendor/thor/util.rb +229 -0
  67. data/lib/bundler/vendor/thor/version.rb +3 -0
  68. data/lib/bundler/version.rb +6 -0
  69. data/lib/bundler/vlad.rb +9 -0
  70. data/man/bundle-config.ronn +90 -0
  71. data/man/bundle-exec.ronn +98 -0
  72. data/man/bundle-install.ronn +310 -0
  73. data/man/bundle-package.ronn +59 -0
  74. data/man/bundle-update.ronn +176 -0
  75. data/man/bundle.ronn +77 -0
  76. data/man/gemfile.5.ronn +273 -0
  77. data/man/index.txt +6 -0
  78. data/spec/cache/gems_spec.rb +205 -0
  79. data/spec/cache/git_spec.rb +9 -0
  80. data/spec/cache/path_spec.rb +27 -0
  81. data/spec/cache/platform_spec.rb +57 -0
  82. data/spec/install/deploy_spec.rb +197 -0
  83. data/spec/install/deprecated_spec.rb +43 -0
  84. data/spec/install/gems/c_ext_spec.rb +48 -0
  85. data/spec/install/gems/env_spec.rb +107 -0
  86. data/spec/install/gems/flex_spec.rb +272 -0
  87. data/spec/install/gems/groups_spec.rb +228 -0
  88. data/spec/install/gems/packed_spec.rb +72 -0
  89. data/spec/install/gems/platform_spec.rb +195 -0
  90. data/spec/install/gems/resolving_spec.rb +72 -0
  91. data/spec/install/gems/simple_case_spec.rb +749 -0
  92. data/spec/install/gems/sudo_spec.rb +77 -0
  93. data/spec/install/gems/win32_spec.rb +26 -0
  94. data/spec/install/gemspec_spec.rb +96 -0
  95. data/spec/install/git_spec.rb +553 -0
  96. data/spec/install/invalid_spec.rb +17 -0
  97. data/spec/install/path_spec.rb +329 -0
  98. data/spec/install/upgrade_spec.rb +26 -0
  99. data/spec/lock/flex_spec.rb +650 -0
  100. data/spec/lock/git_spec.rb +35 -0
  101. data/spec/other/check_spec.rb +221 -0
  102. data/spec/other/config_spec.rb +40 -0
  103. data/spec/other/console_spec.rb +54 -0
  104. data/spec/other/exec_spec.rb +241 -0
  105. data/spec/other/ext_spec.rb +16 -0
  106. data/spec/other/gem_helper_spec.rb +126 -0
  107. data/spec/other/help_spec.rb +36 -0
  108. data/spec/other/init_spec.rb +40 -0
  109. data/spec/other/newgem_spec.rb +24 -0
  110. data/spec/other/open_spec.rb +35 -0
  111. data/spec/other/show_spec.rb +82 -0
  112. data/spec/pack/gems_spec.rb +22 -0
  113. data/spec/quality_spec.rb +55 -0
  114. data/spec/resolver/basic_spec.rb +20 -0
  115. data/spec/resolver/platform_spec.rb +57 -0
  116. data/spec/runtime/environment_rb_spec.rb +162 -0
  117. data/spec/runtime/executable_spec.rb +110 -0
  118. data/spec/runtime/load_spec.rb +102 -0
  119. data/spec/runtime/platform_spec.rb +90 -0
  120. data/spec/runtime/require_spec.rb +231 -0
  121. data/spec/runtime/setup_spec.rb +412 -0
  122. data/spec/runtime/with_clean_env_spec.rb +15 -0
  123. data/spec/spec_helper.rb +82 -0
  124. data/spec/support/builders.rb +566 -0
  125. data/spec/support/helpers.rb +243 -0
  126. data/spec/support/indexes.rb +113 -0
  127. data/spec/support/matchers.rb +89 -0
  128. data/spec/support/path.rb +71 -0
  129. data/spec/support/platforms.rb +49 -0
  130. data/spec/support/ruby_ext.rb +19 -0
  131. data/spec/support/rubygems_ext.rb +30 -0
  132. data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
  133. data/spec/support/sudo.rb +21 -0
  134. data/spec/update/gems_spec.rb +112 -0
  135. data/spec/update/git_spec.rb +159 -0
  136. data/spec/update/source_spec.rb +50 -0
  137. metadata +251 -0
@@ -0,0 +1,228 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with gem sources" do
4
+ describe "with groups" do
5
+ describe "installing with no options" do
6
+ before :each do
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo1}"
9
+ gem "rack"
10
+ group :emo do
11
+ gem "activesupport", "2.3.5"
12
+ end
13
+ gem "thin", :groups => [:emo]
14
+ G
15
+ end
16
+
17
+ it "installs gems in the default group" do
18
+ should_be_installed "rack 1.0.0"
19
+ end
20
+
21
+ it "installs gems in a group block into that group" do
22
+ should_be_installed "activesupport 2.3.5"
23
+
24
+ run("require 'activesupport'; puts ACTIVESUPPORT",
25
+ :default, :expect_err => true)
26
+ @err.should =~ /no such file to load -- activesupport/
27
+ end
28
+
29
+ it "installs gems with inline :groups into those groups" do
30
+ should_be_installed "thin 1.0"
31
+
32
+ run("require 'thin'; puts THIN", :default, :expect_err => true)
33
+ @err.should =~ /no such file to load -- thin/
34
+ end
35
+
36
+ it "sets up everything if Bundler.setup is used with no groups" do
37
+ out = run("require 'rack'; puts RACK")
38
+ check out.should == '1.0.0'
39
+
40
+ out = run("require 'activesupport'; puts ACTIVESUPPORT")
41
+ out.should == '2.3.5'
42
+
43
+ out = run("require 'thin'; puts THIN")
44
+ out.should == '1.0'
45
+ end
46
+ end
47
+
48
+ describe "installing --without" do
49
+ describe "with gems assigned to a single group" do
50
+ before :each do
51
+ gemfile <<-G
52
+ source "file://#{gem_repo1}"
53
+ gem "rack"
54
+ group :emo do
55
+ gem "activesupport", "2.3.5"
56
+ end
57
+ G
58
+ end
59
+
60
+ it "installs gems in the default group" do
61
+ bundle :install, :without => "emo"
62
+ should_be_installed "rack 1.0.0", :groups => [:default]
63
+ end
64
+
65
+ it "does not install gems from the excluded group" do
66
+ bundle :install, :without => "emo"
67
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
68
+ end
69
+
70
+ it "does not install gems from the previously excluded group" do
71
+ bundle :install, :without => "emo"
72
+ should_not_be_installed "activesupport 2.3.5"
73
+ bundle :install
74
+ should_not_be_installed "activesupport 2.3.5"
75
+ end
76
+
77
+ it "does not say it installed gems from the excluded group" do
78
+ bundle :install, :without => "emo"
79
+ out.should_not include("activesupport")
80
+ end
81
+
82
+ it "allows Bundler.setup for specific groups" do
83
+ bundle :install, :without => "emo"
84
+ run("require 'rack'; puts RACK", :default)
85
+ out.should == '1.0.0'
86
+ end
87
+
88
+ it "does not effect the resolve" do
89
+ gemfile <<-G
90
+ source "file://#{gem_repo1}"
91
+ gem "activesupport"
92
+ group :emo do
93
+ gem "rails", "2.3.2"
94
+ end
95
+ G
96
+
97
+ bundle :install, :without => "emo"
98
+ should_be_installed "activesupport 2.3.2", :groups => [:default]
99
+ end
100
+
101
+ it "still works on a different machine and excludes gems" do
102
+ bundle :install, :without => "emo"
103
+
104
+ simulate_new_machine
105
+ bundle :install, :without => "emo"
106
+
107
+ should_be_installed "rack 1.0.0", :groups => [:default]
108
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
109
+ end
110
+
111
+ it "still works when BUNDLE_WITHOUT is set" do
112
+ ENV["BUNDLE_WITHOUT"] = "emo"
113
+
114
+ bundle :install
115
+ out.should_not include("activesupport")
116
+
117
+ should_be_installed "rack 1.0.0", :groups => [:default]
118
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
119
+
120
+ ENV["BUNDLE_WITHOUT"] = nil
121
+ end
122
+ end
123
+
124
+ describe "with gems assigned to multiple groups" do
125
+ before :each do
126
+ gemfile <<-G
127
+ source "file://#{gem_repo1}"
128
+ gem "rack"
129
+ group :emo, :lolercoaster do
130
+ gem "activesupport", "2.3.5"
131
+ end
132
+ G
133
+ end
134
+
135
+ it "installs gems in the default group" do
136
+ bundle :install, :without => "emo lolercoaster"
137
+ should_be_installed "rack 1.0.0"
138
+ end
139
+
140
+ it "installs the gem if any of its groups are installed" do
141
+ bundle "install --without emo"
142
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
143
+ end
144
+
145
+ it "works when locked as well" do
146
+ bundle "install --without emo"
147
+ bundle "lock"
148
+
149
+ simulate_new_machine
150
+
151
+ bundle "install --without lolercoaster"
152
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
153
+ end
154
+
155
+ describe "with a gem defined multiple times in different groups" do
156
+ before :each do
157
+ gemfile <<-G
158
+ source "file://#{gem_repo1}"
159
+ gem "rack"
160
+
161
+ group :emo do
162
+ gem "activesupport", "2.3.5"
163
+ end
164
+
165
+ group :lolercoaster do
166
+ gem "activesupport", "2.3.5"
167
+ end
168
+ G
169
+ end
170
+
171
+ it "installs the gem w/ option --without emo" do
172
+ bundle "install --without emo"
173
+ should_be_installed "activesupport 2.3.5"
174
+ end
175
+
176
+ it "installs the gem w/ option --without lolercoaster" do
177
+ bundle "install --without lolercoaster"
178
+ should_be_installed "activesupport 2.3.5"
179
+ end
180
+
181
+ it "does not install the gem w/ option --without emo lolercoaster" do
182
+ bundle "install --without emo lolercoaster"
183
+ should_not_be_installed "activesupport 2.3.5"
184
+ end
185
+
186
+ it "does not install the gem w/ option --without 'emo lolercoaster'" do
187
+ bundle "install --without 'emo lolercoaster'"
188
+ should_not_be_installed "activesupport 2.3.5"
189
+ end
190
+ end
191
+ end
192
+
193
+ describe "nesting groups" do
194
+ before :each do
195
+ gemfile <<-G
196
+ source "file://#{gem_repo1}"
197
+ gem "rack"
198
+ group :emo do
199
+ group :lolercoaster do
200
+ gem "activesupport", "2.3.5"
201
+ end
202
+ end
203
+ G
204
+ end
205
+
206
+ it "installs gems in the default group" do
207
+ bundle :install, :without => "emo lolercoaster"
208
+ should_be_installed "rack 1.0.0"
209
+ end
210
+
211
+ it "installs the gem if any of its groups are installed" do
212
+ bundle "install --without emo"
213
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
214
+ end
215
+
216
+ it "works when locked as well" do
217
+ bundle "install --without emo"
218
+ bundle "lock"
219
+
220
+ simulate_new_machine
221
+
222
+ bundle "install --without lolercoaster"
223
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
@@ -0,0 +1,72 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with gem sources" do
4
+ describe "when cached and locked" do
5
+ it "does not hit the remote at all" do
6
+ build_repo2
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo2}"
9
+ gem "rack"
10
+ G
11
+
12
+ bundle :pack
13
+ simulate_new_machine
14
+ FileUtils.rm_rf gem_repo2
15
+
16
+ bundle "install --local"
17
+ should_be_installed "rack 1.0.0"
18
+ end
19
+
20
+ it "does not hit the remote at all" do
21
+ build_repo2
22
+ install_gemfile <<-G
23
+ source "file://#{gem_repo2}"
24
+ gem "rack"
25
+ G
26
+
27
+ bundle :pack
28
+ simulate_new_machine
29
+ FileUtils.rm_rf gem_repo2
30
+
31
+ bundle "install --deployment"
32
+ should_be_installed "rack 1.0.0"
33
+ end
34
+
35
+ it "does not reinstall already-installed gems" do
36
+ install_gemfile <<-G
37
+ source "file://#{gem_repo1}"
38
+ gem "rack"
39
+ G
40
+ bundle :pack
41
+
42
+ build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
43
+ s.write "lib/rack.rb", "raise 'omg'"
44
+ end
45
+
46
+ bundle :install
47
+ err.should be_empty
48
+ should_be_installed "rack 1.0"
49
+ end
50
+
51
+ it "ignores cached gems for the wrong platform" do
52
+ simulate_platform "java" do
53
+ install_gemfile <<-G
54
+ source "file://#{gem_repo1}"
55
+ gem "platform_specific"
56
+ G
57
+ bundle :pack
58
+ end
59
+
60
+ simulate_new_machine
61
+
62
+ simulate_platform "ruby" do
63
+ install_gemfile <<-G
64
+ source "file://#{gem_repo1}"
65
+ gem "platform_specific"
66
+ G
67
+ run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
68
+ out.should == "1.0.0 RUBY"
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,195 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install across platforms" do
4
+ it "maintains the same lockfile if all gems are compatible across platforms" do
5
+ lockfile <<-G
6
+ GEM
7
+ remote: file:#{gem_repo1}/
8
+ specs:
9
+ rack (0.9.1)
10
+
11
+ PLATFORMS
12
+ #{not_local}
13
+
14
+ DEPENDENCIES
15
+ rack
16
+ G
17
+
18
+ install_gemfile <<-G
19
+ source "file://#{gem_repo1}"
20
+
21
+ gem "rack"
22
+ G
23
+
24
+ should_be_installed "rack 0.9.1"
25
+ end
26
+
27
+ it "pulls in the correct platform specific gem" do
28
+ lockfile <<-G
29
+ GEM
30
+ remote: file:#{gem_repo1}
31
+ specs:
32
+ platform_specific (1.0)
33
+ platform_specific (1.0-java)
34
+ platform_specific (1.0-x86-mswin32)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ platform_specific
41
+ G
42
+
43
+ simulate_platform "java"
44
+ install_gemfile <<-G
45
+ source "file://#{gem_repo1}"
46
+
47
+ gem "platform_specific"
48
+ G
49
+
50
+ should_be_installed "platform_specific 1.0 JAVA"
51
+ end
52
+
53
+ it "works with gems that have different dependencies" do
54
+ simulate_platform "java"
55
+ install_gemfile <<-G
56
+ source "file://#{gem_repo1}"
57
+
58
+ gem "nokogiri"
59
+ G
60
+
61
+ should_be_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3"
62
+
63
+ simulate_new_machine
64
+
65
+ simulate_platform "ruby"
66
+ install_gemfile <<-G
67
+ source "file://#{gem_repo1}"
68
+
69
+ gem "nokogiri"
70
+ G
71
+
72
+ should_be_installed "nokogiri 1.4.2"
73
+ should_not_be_installed "weakling"
74
+ end
75
+
76
+ it "works the other way with gems that have different dependencies" do
77
+ simulate_platform "ruby"
78
+ install_gemfile <<-G
79
+ source "file://#{gem_repo1}"
80
+
81
+ gem "nokogiri"
82
+ G
83
+
84
+ simulate_platform "java"
85
+ bundle "install"
86
+
87
+ should_be_installed "nokogiri 1.4.2 JAVA", "weakling 0.0.3"
88
+ end
89
+
90
+ it "fetches gems again after changing the version of Ruby" do
91
+ gemfile <<-G
92
+ source "file://#{gem_repo1}"
93
+
94
+ gem "rack", "1.0.0"
95
+ G
96
+
97
+ bundle "install --path vendor"
98
+
99
+ vendored_gems("gems/rack-1.0.0").should exist
100
+ end
101
+
102
+ it "works after switching Rubies" do
103
+ gemfile <<-G
104
+ source "file://#{gem_repo1}"
105
+
106
+ gem "rack", "1.0.0"
107
+ G
108
+
109
+ bundle "install --path vendor"
110
+
111
+ new_version = Gem::ConfigMap[:ruby_version] == "1.8" ? "1.9.1" : "1.8"
112
+ FileUtils.mv(vendored_gems, bundled_app("vendor/#{Gem.ruby_engine}/#{new_version}"))
113
+
114
+ bundle "install ./vendor"
115
+ vendored_gems("gems/rack-1.0.0").should exist
116
+ end
117
+ end
118
+
119
+ describe "bundle install with platform conditionals" do
120
+ it "installs gems tagged w/ the current platforms" do
121
+ install_gemfile <<-G
122
+ source "file://#{gem_repo1}"
123
+
124
+ platforms :#{local_tag} do
125
+ gem "nokogiri"
126
+ end
127
+ G
128
+
129
+ should_be_installed "nokogiri 1.4.2"
130
+ end
131
+
132
+ it "does not install gems tagged w/ another platforms" do
133
+ install_gemfile <<-G
134
+ source "file://#{gem_repo1}"
135
+
136
+ gem "rack"
137
+
138
+ platforms :#{not_local_tag} do
139
+ gem "nokogiri"
140
+ end
141
+ G
142
+
143
+ should_be_installed "rack 1.0"
144
+ should_not_be_installed "nokogiri 1.4.2"
145
+ end
146
+
147
+ it "does not install gems tagged w/ another platform" do
148
+ install_gemfile <<-G
149
+ source "file://#{gem_repo1}"
150
+
151
+ gem "rack"
152
+
153
+ platform :#{not_local_tag} do
154
+ gem "nokogiri"
155
+ end
156
+ G
157
+
158
+ should_be_installed "rack 1.0"
159
+ should_not_be_installed "nokogiri 1.4.2"
160
+ end
161
+
162
+ it "installs gems tagged w/ the current platforms inline" do
163
+ install_gemfile <<-G
164
+ source "file://#{gem_repo1}"
165
+ gem "nokogiri", :platforms => :#{local_tag}
166
+ G
167
+ should_be_installed "nokogiri 1.4.2"
168
+ end
169
+
170
+ it "does not install gems tagged w/ another platforms inline" do
171
+ install_gemfile <<-G
172
+ source "file://#{gem_repo1}"
173
+ gem "rack"
174
+ gem "nokogiri", :platforms => :#{not_local_tag}
175
+ G
176
+ should_be_installed "rack 1.0"
177
+ should_not_be_installed "nokogiri 1.4.2"
178
+ end
179
+
180
+ it "installs gems tagged w/ the current platform inline" do
181
+ install_gemfile <<-G
182
+ source "file://#{gem_repo1}"
183
+ gem "nokogiri", :platform => :#{local_tag}
184
+ G
185
+ should_be_installed "nokogiri 1.4.2"
186
+ end
187
+
188
+ it "doesn't install gems tagged w/ another platform inline" do
189
+ install_gemfile <<-G
190
+ source "file://#{gem_repo1}"
191
+ gem "nokogiri", :platform => :#{not_local_tag}
192
+ G
193
+ should_not_be_installed "nokogiri 1.4.2"
194
+ end
195
+ end