bundler 1.0.0 → 1.0.2

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 (108) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGELOG.md +28 -6
  3. data/ISSUES.md +1 -1
  4. data/README.md +7 -5
  5. data/Rakefile +173 -0
  6. data/UPGRADING.md +103 -0
  7. data/bundler.gemspec +28 -0
  8. data/lib/bundler.rb +1 -0
  9. data/lib/bundler/capistrano.rb +2 -31
  10. data/lib/bundler/cli.rb +18 -16
  11. data/lib/bundler/deployment.rb +37 -0
  12. data/lib/bundler/dsl.rb +3 -3
  13. data/lib/bundler/gem_helper.rb +4 -7
  14. data/lib/bundler/graph.rb +3 -3
  15. data/lib/bundler/installer.rb +1 -0
  16. data/lib/bundler/lockfile_parser.rb +1 -1
  17. data/lib/bundler/man/bundle +1 -1
  18. data/lib/bundler/man/bundle-config +92 -0
  19. data/lib/bundler/man/bundle-config.txt +72 -30
  20. data/lib/bundler/man/bundle-exec +1 -1
  21. data/lib/bundler/man/bundle-exec.txt +1 -1
  22. data/lib/bundler/man/bundle-install +1 -1
  23. data/lib/bundler/man/bundle-install.txt +1 -1
  24. data/lib/bundler/man/bundle-package +1 -1
  25. data/lib/bundler/man/bundle-package.txt +1 -1
  26. data/lib/bundler/man/bundle-update +1 -1
  27. data/lib/bundler/man/bundle-update.txt +1 -1
  28. data/lib/bundler/man/bundle.txt +1 -1
  29. data/lib/bundler/man/gemfile.5 +2 -2
  30. data/lib/bundler/man/gemfile.5.txt +2 -2
  31. data/lib/bundler/settings.rb +2 -2
  32. data/lib/bundler/source.rb +2 -3
  33. data/lib/bundler/templates/Executable +1 -1
  34. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  35. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  36. data/lib/bundler/templates/newgem/newgem.gemspec.tt +11 -12
  37. data/lib/bundler/version.rb +1 -1
  38. data/lib/bundler/vlad.rb +9 -0
  39. data/man/bundle-config.ronn +90 -0
  40. data/man/bundle-exec.ronn +98 -0
  41. data/man/bundle-install.ronn +310 -0
  42. data/man/bundle-package.ronn +59 -0
  43. data/man/bundle-update.ronn +176 -0
  44. data/man/bundle.ronn +77 -0
  45. data/man/gemfile.5.ronn +254 -0
  46. data/man/index.txt +6 -0
  47. data/spec/cache/gems_spec.rb +205 -0
  48. data/spec/cache/git_spec.rb +9 -0
  49. data/spec/cache/path_spec.rb +27 -0
  50. data/spec/cache/platform_spec.rb +57 -0
  51. data/spec/install/deploy_spec.rb +171 -0
  52. data/spec/install/deprecated_spec.rb +43 -0
  53. data/spec/install/gems/c_ext_spec.rb +48 -0
  54. data/spec/install/gems/env_spec.rb +107 -0
  55. data/spec/install/gems/flex_spec.rb +272 -0
  56. data/spec/install/gems/groups_spec.rb +209 -0
  57. data/spec/install/gems/locked_spec.rb +48 -0
  58. data/spec/install/gems/packed_spec.rb +72 -0
  59. data/spec/install/gems/platform_spec.rb +181 -0
  60. data/spec/install/gems/resolving_spec.rb +72 -0
  61. data/spec/install/gems/simple_case_spec.rb +709 -0
  62. data/spec/install/gems/sudo_spec.rb +77 -0
  63. data/spec/install/gems/win32_spec.rb +26 -0
  64. data/spec/install/gemspec_spec.rb +96 -0
  65. data/spec/install/git_spec.rb +552 -0
  66. data/spec/install/invalid_spec.rb +17 -0
  67. data/spec/install/path_spec.rb +335 -0
  68. data/spec/install/upgrade_spec.rb +26 -0
  69. data/spec/lock/flex_spec.rb +625 -0
  70. data/spec/lock/git_spec.rb +35 -0
  71. data/spec/other/check_spec.rb +221 -0
  72. data/spec/other/config_spec.rb +40 -0
  73. data/spec/other/console_spec.rb +102 -0
  74. data/spec/other/exec_spec.rb +241 -0
  75. data/spec/other/ext_spec.rb +16 -0
  76. data/spec/other/gem_helper_spec.rb +116 -0
  77. data/spec/other/help_spec.rb +36 -0
  78. data/spec/other/init_spec.rb +40 -0
  79. data/spec/other/newgem_spec.rb +24 -0
  80. data/spec/other/open_spec.rb +51 -0
  81. data/spec/other/show_spec.rb +99 -0
  82. data/spec/pack/gems_spec.rb +22 -0
  83. data/spec/quality_spec.rb +55 -0
  84. data/spec/resolver/basic_spec.rb +20 -0
  85. data/spec/resolver/platform_spec.rb +57 -0
  86. data/spec/runtime/environment_rb_spec.rb +170 -0
  87. data/spec/runtime/executable_spec.rb +110 -0
  88. data/spec/runtime/load_spec.rb +107 -0
  89. data/spec/runtime/platform_spec.rb +90 -0
  90. data/spec/runtime/require_spec.rb +261 -0
  91. data/spec/runtime/setup_spec.rb +412 -0
  92. data/spec/runtime/with_clean_env_spec.rb +15 -0
  93. data/spec/spec_helper.rb +81 -0
  94. data/spec/support/builders.rb +566 -0
  95. data/spec/support/helpers.rb +243 -0
  96. data/spec/support/indexes.rb +113 -0
  97. data/spec/support/matchers.rb +89 -0
  98. data/spec/support/path.rb +71 -0
  99. data/spec/support/platforms.rb +49 -0
  100. data/spec/support/ruby_ext.rb +19 -0
  101. data/spec/support/rubygems_ext.rb +30 -0
  102. data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
  103. data/spec/support/sudo.rb +21 -0
  104. data/spec/update/gems_spec.rb +86 -0
  105. data/spec/update/git_spec.rb +159 -0
  106. data/spec/update/source_spec.rb +50 -0
  107. metadata +170 -32
  108. data/ROADMAP.md +0 -36
@@ -0,0 +1,209 @@
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
+ G
14
+ end
15
+
16
+ it "installs gems in the default group" do
17
+ should_be_installed "rack 1.0.0"
18
+ end
19
+
20
+ it "installs gems in other groups" do
21
+ should_be_installed "activesupport 2.3.5"
22
+ end
23
+
24
+ it "sets up everything if Bundler.setup is used with no groups" do
25
+ out = run("require 'rack'; puts RACK")
26
+ check out.should == '1.0.0'
27
+
28
+ out = run("require 'activesupport'; puts ACTIVESUPPORT")
29
+ out.should == '2.3.5'
30
+ end
31
+ end
32
+
33
+ describe "installing --without" do
34
+ describe "with gems assigned to a single group" do
35
+ before :each do
36
+ gemfile <<-G
37
+ source "file://#{gem_repo1}"
38
+ gem "rack"
39
+ group :emo do
40
+ gem "activesupport", "2.3.5"
41
+ end
42
+ G
43
+ end
44
+
45
+ it "installs gems in the default group" do
46
+ bundle :install, :without => "emo"
47
+ should_be_installed "rack 1.0.0", :groups => [:default]
48
+ end
49
+
50
+ it "does not install gems from the excluded group" do
51
+ bundle :install, :without => "emo"
52
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
53
+ end
54
+
55
+ it "does not install gems from the previously excluded group" do
56
+ bundle :install, :without => "emo"
57
+ should_not_be_installed "activesupport 2.3.5"
58
+ bundle :install
59
+ should_not_be_installed "activesupport 2.3.5"
60
+ end
61
+
62
+ it "does not say it installed gems from the excluded group" do
63
+ bundle :install, :without => "emo"
64
+ out.should_not include("activesupport")
65
+ end
66
+
67
+ it "allows Bundler.setup for specific groups" do
68
+ bundle :install, :without => "emo"
69
+ run("require 'rack'; puts RACK", :default)
70
+ out.should == '1.0.0'
71
+ end
72
+
73
+ it "does not effect the resolve" do
74
+ gemfile <<-G
75
+ source "file://#{gem_repo1}"
76
+ gem "activesupport"
77
+ group :emo do
78
+ gem "rails", "2.3.2"
79
+ end
80
+ G
81
+
82
+ bundle :install, :without => "emo"
83
+ should_be_installed "activesupport 2.3.2", :groups => [:default]
84
+ end
85
+
86
+ it "still works when locked" do
87
+ bundle :install, :without => "emo"
88
+ bundle :lock
89
+
90
+ simulate_new_machine
91
+ bundle :install, :without => "emo"
92
+
93
+ should_be_installed "rack 1.0.0", :groups => [:default]
94
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
95
+ end
96
+
97
+ it "still works when BUNDLE_WITHOUT is set" do
98
+ ENV["BUNDLE_WITHOUT"] = "emo"
99
+
100
+ bundle :install
101
+ out.should_not include("activesupport")
102
+
103
+ should_be_installed "rack 1.0.0", :groups => [:default]
104
+ should_not_be_installed "activesupport 2.3.5", :groups => [:default]
105
+
106
+ ENV["BUNDLE_WITHOUT"] = nil
107
+ end
108
+ end
109
+
110
+ describe "with gems assigned to multiple groups" do
111
+ before :each do
112
+ gemfile <<-G
113
+ source "file://#{gem_repo1}"
114
+ gem "rack"
115
+ group :emo, :lolercoaster do
116
+ gem "activesupport", "2.3.5"
117
+ end
118
+ G
119
+ end
120
+
121
+ it "installs gems in the default group" do
122
+ bundle :install, :without => "emo lolercoaster"
123
+ should_be_installed "rack 1.0.0"
124
+ end
125
+
126
+ it "installs the gem if any of its groups are installed" do
127
+ bundle "install --without emo"
128
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
129
+ end
130
+
131
+ it "works when locked as well" do
132
+ bundle "install --without emo"
133
+ bundle "lock"
134
+
135
+ simulate_new_machine
136
+
137
+ bundle "install --without lolercoaster"
138
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
139
+ end
140
+
141
+ describe "with a gem defined multiple times in different groups" do
142
+ before :each do
143
+ gemfile <<-G
144
+ source "file://#{gem_repo1}"
145
+ gem "rack"
146
+
147
+ group :emo do
148
+ gem "activesupport", "2.3.5"
149
+ end
150
+
151
+ group :lolercoaster do
152
+ gem "activesupport", "2.3.5"
153
+ end
154
+ G
155
+ end
156
+
157
+ it "installs the gem w/ option --without emo" do
158
+ bundle "install --without emo"
159
+ should_be_installed "activesupport 2.3.5"
160
+ end
161
+
162
+ it "installs the gem w/ option --without lolercoaster" do
163
+ bundle "install --without lolercoaster"
164
+ should_be_installed "activesupport 2.3.5"
165
+ end
166
+
167
+ it "does not install the gem w/ option --without emo lolercoaster" do
168
+ bundle "install --without emo lolercoaster"
169
+ should_not_be_installed "activesupport 2.3.5"
170
+ end
171
+ end
172
+ end
173
+
174
+ describe "nesting groups" do
175
+ before :each do
176
+ gemfile <<-G
177
+ source "file://#{gem_repo1}"
178
+ gem "rack"
179
+ group :emo do
180
+ group :lolercoaster do
181
+ gem "activesupport", "2.3.5"
182
+ end
183
+ end
184
+ G
185
+ end
186
+
187
+ it "installs gems in the default group" do
188
+ bundle :install, :without => "emo lolercoaster"
189
+ should_be_installed "rack 1.0.0"
190
+ end
191
+
192
+ it "installs the gem if any of its groups are installed" do
193
+ bundle "install --without emo"
194
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
195
+ end
196
+
197
+ it "works when locked as well" do
198
+ bundle "install --without emo"
199
+ bundle "lock"
200
+
201
+ simulate_new_machine
202
+
203
+ bundle "install --without lolercoaster"
204
+ should_be_installed "rack 1.0.0", "activesupport 2.3.5"
205
+ end
206
+ end
207
+ end
208
+ end
209
+ end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle install with gem sources" do
4
+ describe "when locked and installed with --without" do
5
+ before(:each) do
6
+ build_repo2
7
+ system_gems "rack-0.9.1" do
8
+ install_gemfile <<-G, :without => :rack
9
+ source "file://#{gem_repo2}"
10
+ gem "rack"
11
+
12
+ group :rack do
13
+ gem "rack_middleware"
14
+ end
15
+ G
16
+
17
+ bundle :lock
18
+ end
19
+ end
20
+
21
+ it "uses the correct versions even if --without was used on the original" do
22
+ should_be_installed "rack 0.9.1"
23
+ should_not_be_installed "rack_middleware 1.0"
24
+ simulate_new_machine
25
+
26
+ bundle :install
27
+
28
+ should_be_installed "rack 0.9.1"
29
+ should_be_installed "rack_middleware 1.0"
30
+ end
31
+
32
+ it "regenerates the environment.rb if install is called twice on a locked repo" do
33
+ run "begin; require 'rack_middleware'; rescue LoadError; puts 'WIN'; end", :lite_runtime => true
34
+ check out.should == "WIN"
35
+
36
+ bundle :install
37
+
38
+ run "require 'rack_middleware'; puts RACK_MIDDLEWARE", :lite_runtime => true
39
+ out.should == "1.0"
40
+ end
41
+
42
+ it "does not hit the remote a second time" do
43
+ FileUtils.rm_rf gem_repo2
44
+ bundle "install --without rack"
45
+ err.should be_empty
46
+ end
47
+ end
48
+ 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,181 @@
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
+ # TODO: Don't make the tests hardcoded to a platform
120
+ describe "bundle install with platform conditionals" do
121
+ it "installs gems tagged w/ the current platform" do
122
+ install_gemfile <<-G
123
+ source "file://#{gem_repo1}"
124
+
125
+ platforms :#{local_tag} do
126
+ gem "nokogiri"
127
+ end
128
+ G
129
+
130
+ should_be_installed "nokogiri 1.4.2"
131
+ end
132
+
133
+ it "does not install gems tagged w/ another platform" do
134
+ install_gemfile <<-G
135
+ source "file://#{gem_repo1}"
136
+
137
+ gem "rack"
138
+
139
+ platforms :#{not_local_tag} do
140
+ gem "nokogiri"
141
+ end
142
+ G
143
+
144
+ should_be_installed "rack 1.0"
145
+ should_not_be_installed "nokogiri 1.4.2"
146
+ end
147
+
148
+ it "installs gems tagged w/ the current platform" do
149
+ install_gemfile <<-G
150
+ source "file://#{gem_repo1}"
151
+
152
+ gem "nokogiri", :platforms => :#{local_tag}
153
+ G
154
+
155
+ should_be_installed "nokogiri 1.4.2"
156
+ end
157
+
158
+ it "doesn't install gems tagged w/ a different platform" do
159
+ install_gemfile <<-G
160
+ source "file://#{gem_repo1}"
161
+
162
+ platforms :#{not_local_tag} do
163
+ gem "nokogiri"
164
+ end
165
+ G
166
+
167
+ should_not_be_installed "nokogiri"
168
+ end
169
+
170
+ it "does not install gems tagged w/ another platform" do
171
+ install_gemfile <<-G
172
+ source "file://#{gem_repo1}"
173
+
174
+ gem "rack"
175
+ gem "nokogiri", :platforms => :#{not_local_tag}
176
+ G
177
+
178
+ should_be_installed "rack 1.0"
179
+ should_not_be_installed "nokogiri 1.4.2"
180
+ end
181
+ end