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,77 @@
1
+ module Spec
2
+ module Matchers
3
+ RSpec::Matchers.define :have_dep do |*args|
4
+ dep = Bundler::Dependency.new(*args)
5
+
6
+ match do |actual|
7
+ actual.length == 1 && actual.all? { |d| d == dep }
8
+ end
9
+ end
10
+
11
+ RSpec::Matchers.define :have_gem do |*args|
12
+ match do |actual|
13
+ actual.length == args.length && actual.all? { |a| args.include?(a.full_name) }
14
+ end
15
+ end
16
+
17
+ RSpec::Matchers.define :have_rubyopts do |*args|
18
+ args = args.flatten
19
+ args = args.first.split(/\s+/) if args.size == 1
20
+
21
+ #failure_message_for_should "Expected RUBYOPT to have options #{args.join(" ")}. It was #{ENV["RUBYOPT"]}"
22
+
23
+ match do |actual|
24
+ actual = actual.split(/\s+/) if actual.is_a?(String)
25
+ args.all? {|arg| actual.include?(arg) } && actual.uniq.size == actual.size
26
+ end
27
+ end
28
+
29
+ def should_be_installed(*names)
30
+ opts = names.last.is_a?(Hash) ? names.pop : {}
31
+ groups = Array(opts[:groups])
32
+ groups << opts
33
+ names.each do |name|
34
+ name, version, platform = name.split(/\s+/)
35
+ version_const = name == 'bundler' ? 'Bundler::VERSION' : Spec::Builders.constantize(name)
36
+ run "require '#{name}.rb'; puts #{version_const}", *groups
37
+ actual_version, actual_platform = out.split(/\s+/)
38
+ Gem::Version.new(actual_version).should eq(Gem::Version.new(version))
39
+ actual_platform.should == platform
40
+ end
41
+ end
42
+
43
+ alias should_be_available should_be_installed
44
+
45
+ def should_not_be_installed(*names)
46
+ opts = names.last.is_a?(Hash) ? names.pop : {}
47
+ groups = Array(opts[:groups]) || []
48
+ names.each do |name|
49
+ name, version = name.split(/\s+/)
50
+ run <<-R, *(groups + [opts])
51
+ begin
52
+ require '#{name}'
53
+ puts #{Spec::Builders.constantize(name)}
54
+ rescue LoadError, NameError
55
+ puts "WIN"
56
+ end
57
+ R
58
+ if version.nil? || out == "WIN"
59
+ out.should == "WIN"
60
+ else
61
+ Gem::Version.new(out).should_not == Gem::Version.new(version)
62
+ end
63
+ end
64
+ end
65
+
66
+ def should_be_locked
67
+ bundled_app("Gemfile.lock").should exist
68
+ end
69
+
70
+ def lockfile_should_be(expected)
71
+ should_be_locked
72
+ spaces = expected[/\A\s+/, 0] || ""
73
+ expected.gsub!(/^#{spaces}/, '')
74
+ bundled_app("Gemfile.lock").read.should == expected
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,73 @@
1
+ require 'pathname'
2
+
3
+ module Spec
4
+ module Path
5
+ def root
6
+ @root ||= Pathname.new(File.expand_path("../../..", __FILE__))
7
+ end
8
+
9
+ def tmp(*path)
10
+ root.join("tmp", *path)
11
+ end
12
+
13
+ def home(*path)
14
+ tmp.join("home", *path)
15
+ end
16
+
17
+ def default_bundle_path(*path)
18
+ system_gem_path(*path)
19
+ end
20
+
21
+ def bundled_app(*path)
22
+ root = tmp.join("bundled_app")
23
+ FileUtils.mkdir_p(root)
24
+ root.join(*path)
25
+ end
26
+
27
+ alias bundled_app1 bundled_app
28
+
29
+ def bundled_app2(*path)
30
+ root = tmp.join("bundled_app2")
31
+ FileUtils.mkdir_p(root)
32
+ root.join(*path)
33
+ end
34
+
35
+ def vendored_gems(path = nil)
36
+ bundled_app("vendor/bundle/#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}/#{path}")
37
+ end
38
+
39
+ def cached_gem(path)
40
+ bundled_app("vendor/cache/#{path}.gem")
41
+ end
42
+
43
+ def base_system_gems
44
+ tmp.join("gems/base")
45
+ end
46
+
47
+ def gem_repo1(*args)
48
+ tmp("gems/remote1", *args)
49
+ end
50
+
51
+ def gem_repo2(*args)
52
+ tmp("gems/remote2", *args)
53
+ end
54
+
55
+ def gem_repo3(*args)
56
+ tmp("gems/remote3", *args)
57
+ end
58
+
59
+ def system_gem_path(*path)
60
+ tmp("gems/system", *path)
61
+ end
62
+
63
+ def lib_path(*args)
64
+ tmp("libs", *args)
65
+ end
66
+
67
+ def bundler_path
68
+ Pathname.new(File.expand_path('../../../lib', __FILE__))
69
+ end
70
+
71
+ extend self
72
+ end
73
+ end
@@ -0,0 +1,86 @@
1
+ module Spec
2
+ module Platforms
3
+ include Bundler::GemHelpers
4
+
5
+ def rb
6
+ Gem::Platform::RUBY
7
+ end
8
+
9
+ def mac
10
+ Gem::Platform.new('x86-darwin-10')
11
+ end
12
+
13
+ def java
14
+ Gem::Platform.new([nil, "java", nil])
15
+ end
16
+
17
+ def linux
18
+ Gem::Platform.new(['x86', 'linux', nil])
19
+ end
20
+
21
+ def mswin
22
+ Gem::Platform.new(['x86', 'mswin32', nil])
23
+ end
24
+
25
+ def mingw
26
+ Gem::Platform.new(['x86', 'mingw32', nil])
27
+ end
28
+
29
+ def all_platforms
30
+ [rb, java, linux, mswin, mingw]
31
+ end
32
+
33
+ def local
34
+ generic(Gem::Platform.local)
35
+ end
36
+
37
+ def not_local
38
+ all_platforms.find { |p| p != generic(Gem::Platform.local) }
39
+ end
40
+
41
+ def local_tag
42
+ if RUBY_PLATFORM == "java"
43
+ :jruby
44
+ else
45
+ :ruby
46
+ end
47
+ end
48
+
49
+ def not_local_tag
50
+ [:ruby, :jruby].find { |tag| tag != local_tag }
51
+ end
52
+
53
+ def local_ruby_engine
54
+ ENV["BUNDLER_SPEC_RUBY_ENGINE"] || (defined?(RUBY_ENGINE) ? RUBY_ENGINE : "ruby")
55
+ end
56
+
57
+ def local_engine_version
58
+ return ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"] if ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
59
+
60
+ case local_ruby_engine
61
+ when "ruby"
62
+ RUBY_VERSION
63
+ when "rbx"
64
+ Rubinius::VERSION
65
+ when "jruby"
66
+ JRUBY_VERSION
67
+ else
68
+ raise BundlerError, "That RUBY_ENGINE is not recognized"
69
+ nil
70
+ end
71
+ end
72
+
73
+ def not_local_engine_version
74
+ case not_local_tag
75
+ when :ruby
76
+ not_local_ruby_version
77
+ when :jruby
78
+ "1.6.1"
79
+ end
80
+ end
81
+
82
+ def not_local_ruby_version
83
+ "1.12"
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,20 @@
1
+ class IO
2
+ def read_available_bytes(chunk_size = 16384, select_timeout = 0.02)
3
+ buffer = []
4
+
5
+ return "" if closed? || eof?
6
+ # IO.select cannot be used here due to the fact that it
7
+ # just does not work on windows
8
+ while true
9
+ begin
10
+ IO.select([self], nil, nil, select_timeout)
11
+ break if eof? # stop raising :-(
12
+ buffer << self.readpartial(chunk_size)
13
+ rescue(EOFError)
14
+ break
15
+ end
16
+ end
17
+
18
+ return buffer.join
19
+ end
20
+ end
@@ -0,0 +1,37 @@
1
+ require 'rubygems/user_interaction'
2
+
3
+ module Spec
4
+ module Rubygems
5
+ def self.setup
6
+ Gem.clear_paths
7
+
8
+ ENV['BUNDLE_PATH'] = nil
9
+ ENV['GEM_HOME'] = ENV['GEM_PATH'] = Path.base_system_gems.to_s
10
+ ENV['PATH'] = ["#{Path.root}/bin", "#{Path.system_gem_path}/bin", ENV['PATH']].join(File::PATH_SEPARATOR)
11
+
12
+ unless File.exist?("#{Path.base_system_gems}")
13
+ FileUtils.mkdir_p(Path.base_system_gems)
14
+ puts "fetching fakeweb, artifice, sinatra, rake, and builder for the tests to use..."
15
+ `gem install fakeweb artifice --no-rdoc --no-ri`
16
+ `gem install sinatra --version 1.2.7 --no-rdoc --no-ri`
17
+ # Rake version has to be consistent for tests to pass
18
+ `gem install rake --version 0.8.7 --no-rdoc --no-ri`
19
+ # 3.0.0 breaks 1.9.2 specs
20
+ `gem install builder --version 2.1.2 --no-rdoc --no-ri`
21
+ end
22
+
23
+ ENV['HOME'] = Path.home.to_s
24
+
25
+ Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
26
+ end
27
+
28
+ def gem_command(command, args = "", options = {})
29
+ if command == :exec && !options[:no_quote]
30
+ args = args.gsub(/(?=")/, "\\")
31
+ args = %["#{args}"]
32
+ end
33
+ lib = File.join(File.dirname(__FILE__), '..', '..', 'lib')
34
+ %x{#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}}.strip
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+
3
+ class Gem::Platform
4
+ @local = new(ENV['BUNDLER_SPEC_PLATFORM']) if ENV['BUNDLER_SPEC_PLATFORM']
5
+ end
6
+
7
+ if ENV['BUNDLER_SPEC_VERSION']
8
+ module Bundler
9
+ VERSION = ENV['BUNDLER_SPEC_VERSION'].dup
10
+ end
11
+ end
12
+
13
+ class Object
14
+ if ENV['BUNDLER_SPEC_RUBY_ENGINE']
15
+ remove_const :RUBY_ENGINE if defined?(RUBY_ENGINE)
16
+ RUBY_ENGINE = ENV['BUNDLER_SPEC_RUBY_ENGINE']
17
+
18
+ if RUBY_ENGINE == "jruby"
19
+ JRUBY_VERSION = ENV["BUNDLER_SPEC_RUBY_ENGINE_VERSION"]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ module Spec
2
+ module Sudo
3
+ def self.present?
4
+ @which_sudo ||= (`which sudo`.chomp rescue '')
5
+ !@which_sudo.empty?
6
+ end
7
+
8
+ def self.test_sudo?
9
+ present? && ENV['BUNDLER_SUDO_TESTS']
10
+ end
11
+
12
+ def sudo(cmd)
13
+ raise "sudo not present" unless Sudo.present?
14
+ sys_exec("sudo #{cmd}")
15
+ end
16
+
17
+ def chown_system_gems_to_root
18
+ sudo "chown -R root #{system_gem_path}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,134 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle update" do
4
+ before :each do
5
+ build_repo2
6
+
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo2}"
9
+ gem "activesupport"
10
+ gem "rack-obama"
11
+ G
12
+ end
13
+
14
+ describe "with no arguments" do
15
+ it "updates the entire bundle" do
16
+ update_repo2 do
17
+ build_gem "activesupport", "3.0"
18
+ end
19
+
20
+ bundle "update"
21
+ should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
22
+ end
23
+
24
+ it "doesn't delete the Gemfile.lock file if something goes wrong" do
25
+ gemfile <<-G
26
+ source "file://#{gem_repo2}"
27
+ gem "activesupport"
28
+ gem "rack-obama"
29
+ exit!
30
+ G
31
+ bundle "update"
32
+ bundled_app("Gemfile.lock").should exist
33
+ end
34
+ end
35
+
36
+ describe "--quiet argument" do
37
+ it 'shows UI messages without --quiet argument' do
38
+ bundle "update"
39
+ out.should include("Fetching source")
40
+ end
41
+
42
+ it 'does not show UI messages with --quiet argument' do
43
+ bundle "update --quiet"
44
+ out.should_not include("Fetching source")
45
+ end
46
+ end
47
+
48
+ describe "with a top level dependency" do
49
+ it "unlocks all child dependencies that are unrelated to other locked dependencies" do
50
+ update_repo2 do
51
+ build_gem "activesupport", "3.0"
52
+ end
53
+
54
+ bundle "update rack-obama"
55
+ should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 2.3.5"
56
+ end
57
+ end
58
+
59
+ describe "with --local option" do
60
+ it "doesn't hit repo2" do
61
+ FileUtils.rm_rf(gem_repo2)
62
+
63
+ bundle "update --local"
64
+ out.should_not match(/Fetching source index/)
65
+ end
66
+ end
67
+ end
68
+
69
+ describe "bundle update in more complicated situations" do
70
+ before :each do
71
+ build_repo2
72
+ end
73
+
74
+ it "will eagerly unlock dependencies of a specified gem" do
75
+ install_gemfile <<-G
76
+ source "file://#{gem_repo2}"
77
+
78
+ gem "thin"
79
+ gem "rack-obama"
80
+ G
81
+
82
+ update_repo2 do
83
+ build_gem "thin" , '2.0' do |s|
84
+ s.add_dependency "rack"
85
+ end
86
+ end
87
+
88
+ bundle "update thin"
89
+ should_be_installed "thin 2.0", "rack 1.2", "rack-obama 1.0"
90
+ end
91
+ end
92
+
93
+ describe "bundle update without a Gemfile.lock" do
94
+ it "should not explode" do
95
+ build_repo2
96
+
97
+ gemfile <<-G
98
+ source "file://#{gem_repo2}"
99
+
100
+ gem "rack", "1.0"
101
+ G
102
+
103
+ bundle "update"
104
+
105
+ should_be_installed "rack 1.0.0"
106
+ end
107
+ end
108
+
109
+ describe "bundle update when a gem depends on a newer version of bundler" do
110
+ before(:each) do
111
+ build_repo2 do
112
+ build_gem "rails", "3.0.1" do |s|
113
+ s.add_dependency "bundler", Bundler::VERSION.succ
114
+ end
115
+ end
116
+
117
+ gemfile <<-G
118
+ source "file://#{gem_repo2}"
119
+ gem "rails", "3.0.1"
120
+ G
121
+ end
122
+
123
+ it "should not explode" do
124
+ bundle "update"
125
+ err.should be_empty
126
+ end
127
+
128
+ it "should explain that bundler conflicted" do
129
+ bundle "update"
130
+ out.should_not =~ /in snapshot/i
131
+ out.should =~ /current Bundler version/i
132
+ out.should =~ /perhaps you need to update bundler/i
133
+ end
134
+ end