diff options
author | André Arko <mail@arko.net> | 2014-10-10 17:54:39 -0700 |
---|---|---|
committer | André Arko <mail@arko.net> | 2014-10-10 17:54:39 -0700 |
commit | fe158e6aaaa133d838377687e3a185f9c0825f96 (patch) | |
tree | 97494604d28e98b917a615e81b329c7cd7e9635c | |
parent | 954ffb3c65d3598b055b27c5f4a5fa680dc482c1 (diff) | |
parent | b41557ad54d4d3a501a811ecb7ed339321848189 (diff) | |
download | bundler-fe158e6aaaa133d838377687e3a185f9c0825f96.tar.gz |
Merge pull request #3199 from danfinnie/stable-1-6-source-warning
Add warning message when Gemfiles use source with a block.
-rw-r--r-- | lib/bundler/dsl.rb | 7 | ||||
-rw-r--r-- | spec/install/gemfile_spec.rb | 25 |
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 |