summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Finnie <dan@danfinnie.com>2014-10-03 22:28:01 -0700
committerDan Finnie <dan@danfinnie.com>2014-10-03 22:29:42 -0700
commitb41557ad54d4d3a501a811ecb7ed339321848189 (patch)
tree97494604d28e98b917a615e81b329c7cd7e9635c
parent954ffb3c65d3598b055b27c5f4a5fa680dc482c1 (diff)
downloadbundler-b41557ad54d4d3a501a811ecb7ed339321848189.tar.gz
Add warning message when Gemfiles use source with a block.
-rw-r--r--lib/bundler/dsl.rb7
-rw-r--r--spec/install/gemfile_spec.rb25
2 files changed, 32 insertions, 0 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb
index 5a985a6791..3f3e99af65 100644
--- a/lib/bundler/dsl.rb
+++ b/lib/bundler/dsl.rb
@@ -125,6 +125,13 @@ module Bundler
return
when String
rubygems_source.add_remote source
+
+ if block_given?
+ Bundler.ui.warn "A block was passed to `source`, but Bundler versions " \
+ "prior to 1.7 ignore the block. Please upgrade Bundler to 1.7 or " \
+ "specify your dependencies outside of the block passed to `source`."
+ end
+
return
else
@source = source
diff --git a/spec/install/gemfile_spec.rb b/spec/install/gemfile_spec.rb
index 267a7f55db..4ebd5f4895 100644
--- a/spec/install/gemfile_spec.rb
+++ b/spec/install/gemfile_spec.rb
@@ -41,4 +41,29 @@ describe "bundle install" do
end
end
+ context "with future features" do
+ context "when source is used with a block" do
+ it "reports that sources with a block is not supported" do
+ gemfile <<-G
+ source 'http://rubygems.example.org' do
+ gem 'rack'
+ end
+ G
+
+ bundle :install
+ expect(out).to match(/A block was passed to `source`/)
+ end
+ end
+
+ context "when source is used without a block" do
+ it "prints no warnings" do
+ gemfile <<-G
+ source 'http://rubygems.example.org'
+ G
+
+ bundle :install
+ expect(out).not_to match(/A block was passed to `source`/)
+ end
+ end
+ end
end