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,124 @@
1
+ require "spec_helper"
2
+
3
+ describe "git base name" do
4
+ it "base_name should strip private repo uris" do
5
+ source = Bundler::Source::Git.new("uri" => "git@github.com:bundler.git")
6
+ source.send(:base_name).should == "bundler"
7
+ end
8
+
9
+ it "base_name should strip network share paths" do
10
+ source = Bundler::Source::Git.new("uri" => "//MachineName/ShareFolder")
11
+ source.send(:base_name).should == "ShareFolder"
12
+ end
13
+ end
14
+
15
+ %w(cache package).each do |cmd|
16
+ describe "bundle #{cmd} with git" do
17
+ it "copies repository to vendor cache and uses it" do
18
+ git = build_git "foo"
19
+ ref = git.ref_for("master", 11)
20
+
21
+ install_gemfile <<-G
22
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
23
+ G
24
+
25
+ bundle "#{cmd} --all"
26
+ bundled_app("vendor/cache/foo-1.0-#{ref}").should exist
27
+ bundled_app("vendor/cache/foo-1.0-#{ref}/.git").should_not exist
28
+
29
+ FileUtils.rm_rf lib_path("foo-1.0")
30
+ should_be_installed "foo 1.0"
31
+ end
32
+
33
+ it "runs twice without exploding" do
34
+ build_git "foo"
35
+
36
+ install_gemfile <<-G
37
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
38
+ G
39
+
40
+ bundle "#{cmd} --all"
41
+ bundle "#{cmd} --all"
42
+
43
+ err.should == ""
44
+ FileUtils.rm_rf lib_path("foo-1.0")
45
+ should_be_installed "foo 1.0"
46
+ end
47
+
48
+ it "tracks updates" do
49
+ git = build_git "foo"
50
+ old_ref = git.ref_for("master", 11)
51
+
52
+ install_gemfile <<-G
53
+ gem "foo", :git => '#{lib_path("foo-1.0")}'
54
+ G
55
+
56
+ bundle "#{cmd} --all"
57
+
58
+ update_git "foo" do |s|
59
+ s.write "lib/foo.rb", "puts :CACHE"
60
+ end
61
+
62
+ ref = git.ref_for("master", 11)
63
+ ref.should_not == old_ref
64
+
65
+ bundle "update"
66
+ bundle "#{cmd} --all"
67
+
68
+ bundled_app("vendor/cache/foo-1.0-#{ref}").should exist
69
+
70
+ FileUtils.rm_rf lib_path("foo-1.0")
71
+ run "require 'foo'"
72
+ out.should == "CACHE"
73
+ end
74
+
75
+ it "uses the local repository to generate the cache" do
76
+ git = build_git "foo"
77
+ ref = git.ref_for("master", 11)
78
+
79
+ gemfile <<-G
80
+ gem "foo", :git => '#{lib_path("foo-invalid")}', :branch => :master
81
+ G
82
+
83
+ bundle %|config local.foo #{lib_path('foo-1.0')}|
84
+ bundle "install"
85
+ bundle "#{cmd} --all"
86
+
87
+ bundled_app("vendor/cache/foo-invalid-#{ref}").should exist
88
+
89
+ # Updating the local still uses the local.
90
+ update_git "foo" do |s|
91
+ s.write "lib/foo.rb", "puts :LOCAL"
92
+ end
93
+
94
+ run "require 'foo'"
95
+ out.should == "LOCAL"
96
+ end
97
+
98
+ it "copies repository to vendor cache, including submodules" do
99
+ build_git "submodule", "1.0"
100
+
101
+ git = build_git "has_submodule", "1.0" do |s|
102
+ s.add_dependency "submodule"
103
+ end
104
+
105
+ Dir.chdir(lib_path('has_submodule-1.0')) do
106
+ `git submodule add #{lib_path('submodule-1.0')} submodule-1.0`
107
+ `git commit -m "submodulator"`
108
+ end
109
+
110
+ install_gemfile <<-G
111
+ git "#{lib_path('has_submodule-1.0')}", :submodules => true do
112
+ gem "has_submodule"
113
+ end
114
+ G
115
+
116
+ ref = git.ref_for("master", 11)
117
+ bundle "#{cmd} --all"
118
+
119
+ bundled_app("vendor/cache/has_submodule-1.0-#{ref}").should exist
120
+ bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0").should exist
121
+ should_be_installed "has_submodule 1.0"
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,103 @@
1
+ require "spec_helper"
2
+
3
+ %w(cache package).each do |cmd|
4
+ describe "bundle #{cmd} with path" do
5
+ it "is no-op 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 "#{cmd} --all"
13
+ bundled_app("vendor/cache/foo-1.0").should_not exist
14
+ should_be_installed "foo 1.0"
15
+ end
16
+
17
+ it "copies when the path is outside the bundle " do
18
+ build_lib "foo"
19
+
20
+ install_gemfile <<-G
21
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
22
+ G
23
+
24
+ bundle "#{cmd} --all"
25
+ bundled_app("vendor/cache/foo-1.0").should exist
26
+
27
+ FileUtils.rm_rf lib_path("foo-1.0")
28
+ should_be_installed "foo 1.0"
29
+ end
30
+
31
+ it "updates the path on each cache" do
32
+ build_lib "foo"
33
+
34
+ install_gemfile <<-G
35
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
36
+ G
37
+
38
+ bundle "#{cmd} --all"
39
+
40
+ build_lib "foo" do |s|
41
+ s.write "lib/foo.rb", "puts :CACHE"
42
+ end
43
+
44
+ bundle "#{cmd} --all"
45
+
46
+ bundled_app("vendor/cache/foo-1.0").should exist
47
+ FileUtils.rm_rf lib_path("foo-1.0")
48
+
49
+ run "require 'foo'"
50
+ out.should == "CACHE"
51
+ end
52
+
53
+ it "raises a warning without --all" do
54
+ build_lib "foo"
55
+
56
+ install_gemfile <<-G
57
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
58
+ G
59
+
60
+ bundle cmd
61
+ out.should =~ /please pass the \-\-all flag/
62
+ bundled_app("vendor/cache/foo-1.0").should_not exist
63
+ end
64
+
65
+ it "stores the given flag" do
66
+ build_lib "foo"
67
+
68
+ install_gemfile <<-G
69
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
70
+ G
71
+
72
+ bundle "#{cmd} --all"
73
+ build_lib "bar"
74
+
75
+ install_gemfile <<-G
76
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
77
+ gem "bar", :path => '#{lib_path("bar-1.0")}'
78
+ G
79
+
80
+ bundle cmd
81
+ bundled_app("vendor/cache/bar-1.0").should exist
82
+ end
83
+
84
+ it "can rewind chosen configuration" do
85
+ build_lib "foo"
86
+
87
+ install_gemfile <<-G
88
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
89
+ G
90
+
91
+ bundle "#{cmd} --all"
92
+ build_lib "baz"
93
+
94
+ gemfile <<-G
95
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
96
+ gem "baz", :path => '#{lib_path("baz-1.0")}'
97
+ G
98
+
99
+ bundle "#{cmd} --no-all"
100
+ bundled_app("vendor/cache/baz-1.0").should_not exist
101
+ end
102
+ end
103
+ 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,211 @@
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 "works after you try to deploy without a lock" do
22
+ bundle "install --deployment"
23
+ bundle :install, :exitstatus => true
24
+ exitstatus.should eq(0)
25
+ should_be_installed "rack 1.0"
26
+ end
27
+
28
+ it "still works if you are not in the app directory and specify --gemfile" do
29
+ bundle "install"
30
+ Dir.chdir tmp
31
+ simulate_new_machine
32
+ bundle "install --gemfile #{tmp}/bundled_app/Gemfile --deployment"
33
+ Dir.chdir bundled_app
34
+ should_be_installed "rack 1.0"
35
+ end
36
+
37
+ it "works if you exclude a group with a git gem" do
38
+ build_git "foo"
39
+ gemfile <<-G
40
+ group :test do
41
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
42
+ end
43
+ G
44
+ bundle :install
45
+ bundle "install --deployment --without test", :exitstatus => true
46
+ exitstatus.should == 0
47
+ end
48
+
49
+ it "works when you bundle exec bundle" do
50
+ bundle :install
51
+ bundle "install --deployment"
52
+ bundle "exec bundle check", :exitstatus => true
53
+ exitstatus.should == 0
54
+ end
55
+
56
+ it "works when using path gems from the same path and the version is specified" do
57
+ build_lib "foo", :path => lib_path("nested/foo")
58
+ build_lib "bar", :path => lib_path("nested/bar")
59
+ gemfile <<-G
60
+ gem "foo", "1.0", :path => "#{lib_path("nested")}"
61
+ gem "bar", :path => "#{lib_path("nested")}"
62
+ G
63
+
64
+ bundle :install
65
+ bundle "install --deployment", :exitstatus => true
66
+
67
+ exitstatus.should == 0
68
+ end
69
+
70
+ describe "with an existing lockfile" do
71
+ before do
72
+ bundle "install"
73
+ end
74
+
75
+ it "works with the --deployment flag if you didn't change anything" do
76
+ bundle "install --deployment", :exitstatus => true
77
+ exitstatus.should == 0
78
+ end
79
+
80
+ it "works with the --frozen flag if you didn't change anything" do
81
+ bundle "install --frozen", :exitstatus => true
82
+ exitstatus.should == 0
83
+ end
84
+
85
+ it "explodes with the --deployment flag if you make a change and don't check in the lockfile" do
86
+ gemfile <<-G
87
+ source "file://#{gem_repo1}"
88
+ gem "rack"
89
+ gem "rack-obama"
90
+ G
91
+
92
+ bundle "install --deployment"
93
+ out.should include("deployment mode")
94
+ out.should include("You have added to the Gemfile")
95
+ out.should include("* rack-obama")
96
+ out.should_not include("You have deleted from the Gemfile")
97
+ out.should_not include("You have changed in the Gemfile")
98
+ end
99
+
100
+ it "can have --frozen set via an environment variable" do
101
+ gemfile <<-G
102
+ source "file://#{gem_repo1}"
103
+ gem "rack"
104
+ gem "rack-obama"
105
+ G
106
+
107
+ ENV['BUNDLE_FROZEN'] = '1'
108
+ bundle "install"
109
+ out.should include("deployment mode")
110
+ out.should include("You have added to the Gemfile")
111
+ out.should include("* rack-obama")
112
+ out.should_not include("You have deleted from the Gemfile")
113
+ out.should_not include("You have changed in the Gemfile")
114
+ end
115
+
116
+ it "explodes with the --frozen flag if you make a change and don't check in the lockfile" do
117
+ gemfile <<-G
118
+ source "file://#{gem_repo1}"
119
+ gem "rack"
120
+ gem "rack-obama"
121
+ G
122
+
123
+ bundle "install --frozen"
124
+ out.should include("deployment mode")
125
+ out.should include("You have added to the Gemfile")
126
+ out.should include("* rack-obama")
127
+ out.should_not include("You have deleted from the Gemfile")
128
+ out.should_not include("You have changed in the Gemfile")
129
+ end
130
+
131
+ it "explodes if you remove a gem and don't check in the lockfile" do
132
+ gemfile <<-G
133
+ source "file://#{gem_repo1}"
134
+ gem "activesupport"
135
+ G
136
+
137
+ bundle "install --deployment"
138
+ out.should include("deployment mode")
139
+ out.should include("You have added to the Gemfile:\n* activesupport\n\n")
140
+ out.should include("You have deleted from the Gemfile:\n* rack")
141
+ out.should_not include("You have changed in the Gemfile")
142
+ end
143
+
144
+ it "explodes if you add a source" do
145
+ gemfile <<-G
146
+ source "file://#{gem_repo1}"
147
+ gem "rack", :git => "git://hubz.com"
148
+ G
149
+
150
+ bundle "install --deployment"
151
+ out.should include("deployment mode")
152
+ out.should include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
153
+ out.should_not include("You have changed in the Gemfile")
154
+ end
155
+
156
+ it "explodes if you unpin a source" do
157
+ build_git "rack"
158
+
159
+ install_gemfile <<-G
160
+ source "file://#{gem_repo1}"
161
+ gem "rack", :git => "#{lib_path("rack-1.0")}"
162
+ G
163
+
164
+ gemfile <<-G
165
+ source "file://#{gem_repo1}"
166
+ gem "rack"
167
+ G
168
+
169
+ bundle "install --deployment"
170
+ out.should include("deployment mode")
171
+ out.should include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master)")
172
+ out.should_not include("You have added to the Gemfile")
173
+ out.should_not include("You have changed in the Gemfile")
174
+ end
175
+
176
+ it "explodes if you unpin a source, leaving it pinned somewhere else" do
177
+ build_lib "foo", :path => lib_path("rack/foo")
178
+ build_git "rack", :path => lib_path("rack")
179
+
180
+ install_gemfile <<-G
181
+ source "file://#{gem_repo1}"
182
+ gem "rack", :git => "#{lib_path("rack")}"
183
+ gem "foo", :git => "#{lib_path("rack")}"
184
+ G
185
+
186
+ gemfile <<-G
187
+ source "file://#{gem_repo1}"
188
+ gem "rack"
189
+ gem "foo", :git => "#{lib_path("rack")}"
190
+ G
191
+
192
+ bundle "install --deployment"
193
+ out.should include("deployment mode")
194
+ out.should include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master)`")
195
+ out.should_not include("You have added to the Gemfile")
196
+ out.should_not include("You have deleted from the Gemfile")
197
+ end
198
+
199
+ it "remembers that the bundle is frozen at runtime" do
200
+ bundle "install --deployment"
201
+
202
+ gemfile <<-G
203
+ source "file://#{gem_repo1}"
204
+ gem "rack", "1.0.0"
205
+ gem "rack-obama"
206
+ G
207
+
208
+ should_be_installed "rack 1.0.0"
209
+ end
210
+ end
211
+ end