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,6 @@
1
+ Gemfile(5) gemfile.5
2
+ bundle-install bundle-install.1
3
+ bundle-update bundle-update.1
4
+ bundle-package bundle-package.1
5
+ bundle-exec bundle-exec.1
6
+ bundle-config bundle-config.1
@@ -0,0 +1,205 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle cache" do
4
+
5
+ describe "when there are only gemsources" do
6
+ before :each do
7
+ gemfile <<-G
8
+ gem 'rack'
9
+ G
10
+
11
+ system_gems "rack-1.0.0"
12
+ bundle :cache
13
+ end
14
+
15
+ it "copies the .gem file to vendor/cache" do
16
+ bundled_app("vendor/cache/rack-1.0.0.gem").should exist
17
+ end
18
+
19
+ it "uses the cache as a source when installing gems" do
20
+ build_gem "omg", :path => bundled_app('vendor/cache')
21
+
22
+ install_gemfile <<-G
23
+ source "file://#{gem_repo1}"
24
+ gem "omg"
25
+ G
26
+
27
+ should_be_installed "omg 1.0.0"
28
+ end
29
+
30
+ it "uses the cache as a source when installing gems with --local" do
31
+ system_gems []
32
+ bundle "install --local"
33
+
34
+ should_be_installed("rack 1.0.0")
35
+ end
36
+
37
+ it "does not reinstall gems from the cache if they exist on the system" do
38
+ build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
39
+ s.write "lib/rack.rb", "RACK = 'FAIL'"
40
+ end
41
+
42
+ install_gemfile <<-G
43
+ gem "rack"
44
+ G
45
+
46
+ should_be_installed("rack 1.0.0")
47
+ end
48
+
49
+ it "does not reinstall gems from the cache if they exist in the bundle" do
50
+ system_gems "rack-1.0.0"
51
+
52
+ gemfile <<-G
53
+ gem "rack"
54
+ G
55
+
56
+ build_gem "rack", "1.0.0", :path => bundled_app('vendor/cache') do |s|
57
+ s.write "lib/rack.rb", "RACK = 'FAIL'"
58
+ end
59
+
60
+ bundle "install --local"
61
+ should_be_installed("rack 1.0.0")
62
+ end
63
+
64
+ it "creates a lockfile" do
65
+ cache_gems "rack-1.0.0"
66
+
67
+ gemfile <<-G
68
+ gem "rack"
69
+ G
70
+
71
+ bundle "cache"
72
+
73
+ bundled_app("Gemfile.lock").should exist
74
+ end
75
+ end
76
+
77
+ describe "when there are also git sources" do
78
+ before do
79
+ build_git "foo"
80
+ system_gems "rack-1.0.0"
81
+
82
+ install_gemfile <<-G
83
+ source "file://#{gem_repo1}"
84
+ git "#{lib_path("foo-1.0")}" do
85
+ gem 'foo'
86
+ end
87
+ gem 'rack'
88
+ G
89
+ end
90
+
91
+ it "still works" do
92
+ bundle :cache
93
+
94
+ system_gems []
95
+ bundle "install --local"
96
+
97
+ should_be_installed("rack 1.0.0", "foo 1.0")
98
+ end
99
+
100
+ it "should not explode if the lockfile is not present" do
101
+ FileUtils.rm(bundled_app("Gemfile.lock"))
102
+
103
+ bundle :cache
104
+
105
+ bundled_app("Gemfile.lock").should exist
106
+ end
107
+ end
108
+
109
+ describe "when previously cached" do
110
+ before :each do
111
+ build_repo2
112
+ install_gemfile <<-G
113
+ source "file://#{gem_repo2}"
114
+ gem "rack"
115
+ gem "actionpack"
116
+ G
117
+ bundle :cache
118
+ cached_gem("rack-1.0.0").should exist
119
+ cached_gem("actionpack-2.3.2").should exist
120
+ cached_gem("activesupport-2.3.2").should exist
121
+ end
122
+
123
+ it "re-caches during install" do
124
+ cached_gem("rack-1.0.0").rmtree
125
+ bundle :install
126
+ out.should include("Updating .gem files in vendor/cache")
127
+ cached_gem("rack-1.0.0").should exist
128
+ end
129
+
130
+ it "adds and removes when gems are updated" do
131
+ update_repo2
132
+ bundle 'update'
133
+ cached_gem("rack-1.2").should exist
134
+ cached_gem("rack-1.0.0").should_not exist
135
+ end
136
+
137
+ it "adds new gems and dependencies" do
138
+ install_gemfile <<-G
139
+ source "file://#{gem_repo2}"
140
+ gem "rails"
141
+ G
142
+ cached_gem("rails-2.3.2").should exist
143
+ cached_gem("activerecord-2.3.2").should exist
144
+ end
145
+
146
+ it "removes .gems for removed gems and dependencies" do
147
+ install_gemfile <<-G
148
+ source "file://#{gem_repo2}"
149
+ gem "rack"
150
+ G
151
+ cached_gem("rack-1.0.0").should exist
152
+ cached_gem("actionpack-2.3.2").should_not exist
153
+ cached_gem("activesupport-2.3.2").should_not exist
154
+ end
155
+
156
+ it "doesn't remove gems that are for another platform" do
157
+ simulate_platform "java" do
158
+ install_gemfile <<-G
159
+ source "file://#{gem_repo1}"
160
+ gem "platform_specific"
161
+ G
162
+
163
+ bundle :cache
164
+ cached_gem("platform_specific-1.0-java").should exist
165
+ end
166
+
167
+ simulate_new_machine
168
+ install_gemfile <<-G
169
+ source "file://#{gem_repo1}"
170
+ gem "platform_specific"
171
+ G
172
+
173
+ cached_gem("platform_specific-1.0-#{Gem::Platform.local}").should exist
174
+ cached_gem("platform_specific-1.0-java").should exist
175
+ end
176
+
177
+ it "doesn't remove gems with mismatched :rubygems_version or :date" do
178
+ cached_gem("rack-1.0.0").rmtree
179
+ build_gem "rack", "1.0.0",
180
+ :path => bundled_app('vendor/cache'),
181
+ :rubygems_version => "1.3.2"
182
+ simulate_new_machine
183
+
184
+ bundle :install
185
+ cached_gem("rack-1.0.0").should exist
186
+ end
187
+
188
+ it "handles directories and non .gem files in the cache" do
189
+ bundled_app("vendor/cache/foo").mkdir
190
+ File.open(bundled_app("vendor/cache/bar"), 'w'){|f| f.write("not a gem") }
191
+ bundle :cache
192
+ end
193
+
194
+ it "does not say that it is removing gems when it isn't actually doing so" do
195
+ install_gemfile <<-G
196
+ source "file://#{gem_repo1}"
197
+ gem "rack"
198
+ G
199
+ bundle "cache"
200
+ bundle "install"
201
+ out.should_not =~ /removing/i
202
+ end
203
+ end
204
+
205
+ end
@@ -0,0 +1,9 @@
1
+ require "spec_helper"
2
+ describe "bundle cache with git" do
3
+ it "base_name should strip private repo uris" do
4
+ source = Bundler::Source::Git.new("uri" => "git@gitthub.com:bundler.git")
5
+ source.send(:base_name).should == "bundler"
6
+ end
7
+ end
8
+
9
+
@@ -0,0 +1,27 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle cache" do
4
+ describe "with path sources" do
5
+ it "is silent when the path is within the bundle" do
6
+ build_lib "foo", :path => bundled_app("lib/foo")
7
+
8
+ install_gemfile <<-G
9
+ gem "foo", :path => '#{bundled_app("lib/foo")}'
10
+ G
11
+
12
+ bundle "cache"
13
+ out.should == "Updating .gem files in vendor/cache"
14
+ end
15
+
16
+ it "warns when the path is outside of the bundle" do
17
+ build_lib "foo"
18
+
19
+ install_gemfile <<-G
20
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
21
+ G
22
+
23
+ bundle "cache"
24
+ out.should include("foo at `#{lib_path("foo-1.0")}` will not be cached")
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,57 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle cache with multiple platforms" do
4
+ before :each do
5
+ gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+
8
+ platforms :ruby, :ruby_18, :ruby_19 do
9
+ gem "rack", "1.0.0"
10
+ end
11
+
12
+ platforms :jruby do
13
+ gem "activesupport", "2.3.5"
14
+ end
15
+
16
+ platforms :mri, :mri_18, :mri_19 do
17
+ gem "activerecord", "2.3.2"
18
+ end
19
+ G
20
+
21
+ lockfile <<-G
22
+ GEM
23
+ remote: file:#{gem_repo1}/
24
+ specs:
25
+ rack (1.0.0)
26
+ activesupport (2.3.5)
27
+ activerecord (2.3.2)
28
+
29
+ PLATFORMS
30
+ ruby
31
+ java
32
+
33
+ DEPENDENCIES
34
+ rack (1.0.0)
35
+ activesupport (2.3.5)
36
+ activerecord (2.3.2)
37
+ G
38
+
39
+ cache_gems "rack-1.0.0", "activesupport-2.3.5", "activerecord-2.3.2"
40
+ end
41
+
42
+ it "ensures that bundle install does not delete gems for other platforms" do
43
+ bundle "install"
44
+
45
+ bundled_app("vendor/cache/rack-1.0.0.gem").should exist
46
+ bundled_app("vendor/cache/activesupport-2.3.5.gem").should exist
47
+ bundled_app("vendor/cache/activerecord-2.3.2.gem").should exist
48
+ end
49
+
50
+ it "ensures that bundle update does not delete gems for other platforms" do
51
+ bundle "update"
52
+
53
+ bundled_app("vendor/cache/rack-1.0.0.gem").should exist
54
+ bundled_app("vendor/cache/activesupport-2.3.5.gem").should exist
55
+ bundled_app("vendor/cache/activerecord-2.3.2.gem").should exist
56
+ end
57
+ end
@@ -0,0 +1,171 @@
1
+ require "spec_helper"
2
+
3
+ describe "install with --deployment or --frozen" do
4
+ before do
5
+ gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem "rack"
8
+ G
9
+ end
10
+
11
+ it "fails without a lockfile and says that --deployment requires a lock" do
12
+ bundle "install --deployment"
13
+ out.should include("The --deployment flag requires a Gemfile.lock")
14
+ end
15
+
16
+ it "fails without a lockfile and says that --frozen requires a lock" do
17
+ bundle "install --frozen"
18
+ out.should include("The --frozen flag requires a Gemfile.lock")
19
+ end
20
+
21
+ it "still works if you are not in the app directory and specify --gemfile" do
22
+ bundle "install"
23
+ Dir.chdir tmp
24
+ simulate_new_machine
25
+ bundle "install --gemfile #{tmp}/bundled_app/Gemfile --deployment"
26
+ Dir.chdir bundled_app
27
+ should_be_installed "rack 1.0"
28
+ end
29
+
30
+ describe "with an existing lockfile" do
31
+ before do
32
+ bundle "install"
33
+ end
34
+
35
+ it "works with the --deployment flag if you didn't change anything" do
36
+ bundle "install --deployment", :exit_status => true
37
+ exitstatus.should == 0
38
+ end
39
+
40
+ it "works with the --frozen flag if you didn't change anything" do
41
+ bundle "install --frozen", :exit_status => true
42
+ exitstatus.should == 0
43
+ end
44
+
45
+ it "explodes with the --deployment flag if you make a change and don't check in the lockfile" do
46
+ gemfile <<-G
47
+ source "file://#{gem_repo1}"
48
+ gem "rack"
49
+ gem "rack-obama"
50
+ G
51
+
52
+ bundle "install --deployment"
53
+ out.should include("You have modified your Gemfile")
54
+ out.should include("You have added to the Gemfile")
55
+ out.should include("* rack-obama")
56
+ out.should_not include("You have deleted from the Gemfile")
57
+ out.should_not include("You have changed in the Gemfile")
58
+ end
59
+
60
+ it "can have --frozen set via an environment variable" do
61
+ gemfile <<-G
62
+ source "file://#{gem_repo1}"
63
+ gem "rack"
64
+ gem "rack-obama"
65
+ G
66
+
67
+ ENV['BUNDLE_FROZEN'] = '1'
68
+ bundle "install"
69
+ out.should include("You have modified your Gemfile")
70
+ out.should include("You have added to the Gemfile")
71
+ out.should include("* rack-obama")
72
+ out.should_not include("You have deleted from the Gemfile")
73
+ out.should_not include("You have changed in the Gemfile")
74
+ end
75
+
76
+ it "explodes with the --frozen flag if you make a change and don't check in the lockfile" do
77
+ gemfile <<-G
78
+ source "file://#{gem_repo1}"
79
+ gem "rack"
80
+ gem "rack-obama"
81
+ G
82
+
83
+ bundle "install --frozen"
84
+ out.should include("You have modified your Gemfile")
85
+ out.should include("You have added to the Gemfile")
86
+ out.should include("* rack-obama")
87
+ out.should_not include("You have deleted from the Gemfile")
88
+ out.should_not include("You have changed in the Gemfile")
89
+ end
90
+
91
+ it "explodes if you remove a gem and don't check in the lockfile" do
92
+ gemfile <<-G
93
+ source "file://#{gem_repo1}"
94
+ gem "activesupport"
95
+ G
96
+
97
+ bundle "install --deployment"
98
+ out.should include("You have modified your Gemfile")
99
+ out.should include("You have added to the Gemfile:\n* activesupport\n\n")
100
+ out.should include("You have deleted from the Gemfile:\n* rack")
101
+ out.should_not include("You have changed in the Gemfile")
102
+ end
103
+
104
+ it "explodes if you add a source" do
105
+ gemfile <<-G
106
+ source "file://#{gem_repo1}"
107
+ gem "rack", :git => "git://hubz.com"
108
+ G
109
+
110
+ bundle "install --deployment"
111
+ out.should include("You have modified your Gemfile")
112
+ out.should include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
113
+ out.should_not include("You have changed in the Gemfile")
114
+ end
115
+
116
+ it "explodes if you unpin a source" do
117
+ build_git "rack"
118
+
119
+ install_gemfile <<-G
120
+ source "file://#{gem_repo1}"
121
+ gem "rack", :git => "#{lib_path("rack-1.0")}"
122
+ G
123
+
124
+ gemfile <<-G
125
+ source "file://#{gem_repo1}"
126
+ gem "rack"
127
+ G
128
+
129
+ bundle "install --deployment"
130
+ out.should include("You have modified your Gemfile")
131
+ out.should include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master)")
132
+ out.should_not include("You have added to the Gemfile")
133
+ out.should_not include("You have changed in the Gemfile")
134
+ end
135
+
136
+ it "explodes if you unpin a source, leaving it pinned somewhere else" do
137
+ build_lib "foo", :path => lib_path("rack/foo")
138
+ build_git "rack", :path => lib_path("rack")
139
+
140
+ install_gemfile <<-G
141
+ source "file://#{gem_repo1}"
142
+ gem "rack", :git => "#{lib_path("rack")}"
143
+ gem "foo", :git => "#{lib_path("rack")}"
144
+ G
145
+
146
+ gemfile <<-G
147
+ source "file://#{gem_repo1}"
148
+ gem "rack"
149
+ gem "foo", :git => "#{lib_path("rack")}"
150
+ G
151
+
152
+ bundle "install --deployment"
153
+ out.should include("You have modified your Gemfile")
154
+ out.should include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master)`")
155
+ out.should_not include("You have added to the Gemfile")
156
+ out.should_not include("You have deleted from the Gemfile")
157
+ end
158
+
159
+ it "remembers that the bundle is frozen at runtime" do
160
+ bundle "install --deployment"
161
+
162
+ gemfile <<-G
163
+ source "file://#{gem_repo1}"
164
+ gem "rack", "1.0.0"
165
+ gem "rack-obama"
166
+ G
167
+
168
+ should_be_installed "rack 1.0.0"
169
+ end
170
+ end
171
+ end