summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-02-10 23:19:21 -0800
committerCarl Lerche <carllerche@mac.com>2010-02-10 23:19:21 -0800
commit6984aa16c2d6f467f8824f91946e5b0af8935f46 (patch)
treed1e39d25da749187c21363111f7cf0a0bdb4fcc6
parenteb07f845a4f5c93ceb9c4a0e29ddc432312d391b (diff)
downloadbundler-6984aa16c2d6f467f8824f91946e5b0af8935f46.tar.gz
Have the bundle command explode with a helpful error message if older versions of bundler exist.
-rw-r--r--bin/bundle7
-rw-r--r--lib/bundler/cli.rb1
-rw-r--r--spec/other/help_spec.rb10
-rw-r--r--spec/other/init_spec.rb4
-rw-r--r--spec/support/builders.rb5
5 files changed, 22 insertions, 5 deletions
diff --git a/bin/bundle b/bin/bundle
index ea45509380..6fab300466 100644
--- a/bin/bundle
+++ b/bin/bundle
@@ -1,3 +1,10 @@
+# Check if an older version of bundler is installed
+require 'bundler'
+$:.each do |path|
+ if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
+ abort "Please remove older versions of bundler. This can by running `gem cleanup`."
+ end
+end
require 'bundler/cli'
begin
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 034dec14a8..4d63b334e5 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -1,6 +1,5 @@
$:.unshift File.expand_path('../vendor', __FILE__)
require 'thor'
-require 'bundler'
require 'rubygems/config_file'
# Work around a RubyGems bug
diff --git a/spec/other/help_spec.rb b/spec/other/help_spec.rb
new file mode 100644
index 0000000000..fd49503a12
--- /dev/null
+++ b/spec/other/help_spec.rb
@@ -0,0 +1,10 @@
+require File.expand_path('../../spec_helper', __FILE__)
+
+describe "bundle help" do
+ it "complains if older versions of bundler are installed" do
+ system_gems "bundler-0.8.1"
+
+ bundle "help"
+ err.should == "Please remove older versions of bundler. This can by running `gem cleanup`."
+ end
+end \ No newline at end of file
diff --git a/spec/other/init_spec.rb b/spec/other/init_spec.rb
index eb70eb4d53..99cb552953 100644
--- a/spec/other/init_spec.rb
+++ b/spec/other/init_spec.rb
@@ -1,10 +1,6 @@
require File.expand_path('../../spec_helper', __FILE__)
describe "bundle init" do
- before :each do
- in_app_root
- end
-
it "generates a Gemfile" do
bundle :init
bundled_app("Gemfile").should exist
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index ebcf741c50..a50cb82267 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -96,6 +96,11 @@ module Spec
}
C
end
+
+ build_gem "bundler", "0.8.1" do |s|
+ s.write "lib/bundler/omg.rb", ""
+ s.write "lib/rubygems_plugin.rb", "require 'bundler/omg' ; puts 'FAIL'"
+ end
end
end