summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2012-07-17 15:20:20 -0500
committerTerence Lee <hone02@gmail.com>2012-07-17 15:20:20 -0500
commit4f9f810fa52abf3923442d6dad070607daeb3d64 (patch)
tree3bf7bcd9d47a2fcc336b9f6d2e3b1f2009443360
parent1a9aefb24b49895392bb9d670f916d18ddb559cd (diff)
downloadbundler-4f9f810fa52abf3923442d6dad070607daeb3d64.tar.gz
special case `ruby` directive
This is light of the upcoming 1.2.0 release which adds this feature. This way people still using 1.1.x can run 1.2.0 Gemfiles that employ this feature and get a notification about upgrading.
-rw-r--r--lib/bundler/dsl.rb6
-rw-r--r--spec/bundler/dsl_spec.rb21
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 286b6d493e..dd2148cc99 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -163,6 +163,12 @@ module Bundler
@env = old
end
+ def ruby(*args)
+ msg = "Ignoring `ruby` directive. This is a feature added to Bundler 1.2.0 \n" \
+ "and higher. Please upgrade if you would like to use it. \n\n"
+ Bundler.ui.warn msg
+ end
+
# Deprecated methods
def self.deprecate(name, replacement = nil)
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index 4f50c3c6bb..29b4b32c4e 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -26,5 +26,26 @@ describe Bundler::Dsl do
lambda { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }.
should raise_error(Bundler::GemfileError)
end
+
+ it "should special case the ruby directive" do
+ gemfile <<-G
+ ruby "1.9.3"
+ G
+ lambda { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }.
+ should_not raise_error(Bundler::GemfileError)
+ end
+
+ it "should special case the ruby directive and throws a warning" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+
+ ruby "1.9.3"
+
+ gem "foo"
+ G
+
+ out.should include("Ignoring `ruby` directive")
+ bundled_app("Gemfile.lock").should exist
+ end
end
end