diff options
author | wycats <wycats@gmail.com> | 2010-07-09 13:00:20 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-07-09 13:00:20 -0700 |
commit | d7e1dc1ef387eea787a634382d8f7401bffcdeea (patch) | |
tree | 15b86b493db537bbea3d3635afe7587b2160cc48 | |
parent | ce7db1b17ffe43582258b18fb196aad0ec67bc42 (diff) | |
download | bundler-d7e1dc1ef387eea787a634382d8f7401bffcdeea.tar.gz |
Remove standalone #git in the DSL. Instead, use the block form of #git and put in the associated gems
-rw-r--r-- | lib/bundler.rb | 3 | ||||
-rw-r--r-- | lib/bundler/dsl.rb | 23 | ||||
-rw-r--r-- | spec/cache/gems_spec.rb | 5 | ||||
-rw-r--r-- | spec/install/git_spec.rb | 31 | ||||
-rw-r--r-- | spec/lock/flex_spec.rb | 7 | ||||
-rw-r--r-- | spec/support/builders.rb | 2 | ||||
-rw-r--r-- | spec/update/git_spec.rb | 5 | ||||
-rw-r--r-- | spec/update/source_spec.rb | 5 |
8 files changed, 52 insertions, 29 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 090a42e2fb..6c0fb990b5 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -43,8 +43,7 @@ module Bundler class PathError < BundlerError; status_code(13) ; end class GitError < BundlerError; status_code(11) ; end class GemspecError < BundlerError; status_code(14) ; end - class DeprecatedMethod < BundlerError; status_code(12) ; end - class DeprecatedOption < BundlerError; status_code(12) ; end + class DeprecatedError < BundlerError; status_code(12) ; end class GemspecError < BundlerError; status_code(14) ; end class InvalidOption < BundlerError; status_code(15) ; end diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index c4ab1a691f..9be847d583 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -80,6 +80,17 @@ module Bundler end def git(uri, options = {}, source_options = {}, &blk) + unless block_given? + msg = "You can no longer specify a git source by itself. Instead, \n" \ + "either use the :git option on a gem, or specify the gems that \n" \ + "bundler should find in the git source by passing a block to \n" \ + "the git method, like: \n\n" \ + " git 'git://github.com/rails/rails.git' do\n" \ + " gem 'rails'\n" \ + " end" + raise DeprecatedError, msg + end + source Source::Git.new(_normalize_hash(options).merge("uri" => uri)), source_options, &blk end @@ -121,7 +132,7 @@ module Bundler message << "and is no longer supported." end message << "\nSee the README for more information on upgrading from Bundler 0.8." - raise DeprecatedMethod, message + raise DeprecatedError, message end end @@ -186,7 +197,7 @@ module Bundler ["git", "path"].each do |type| if param = opts[type] options = _version?(version) ? opts.merge("name" => name, "version" => version) : opts.dup - source = send(type, param, options, :prepend => true) + source = send(type, param, options, :prepend => true) {} opts["source"] = source end end @@ -199,13 +210,13 @@ module Bundler def _deprecated_options(options) if options.include?(:require_as) - raise DeprecatedOption, "Please replace :require_as with :require" + raise DeprecatedError, "Please replace :require_as with :require" elsif options.include?(:vendored_at) - raise DeprecatedOption, "Please replace :vendored_at with :path" + raise DeprecatedError, "Please replace :vendored_at with :path" elsif options.include?(:only) - raise DeprecatedOption, "Please replace :only with :group" + raise DeprecatedError, "Please replace :only with :group" elsif options.include?(:except) - raise DeprecatedOption, "The :except option is no longer supported" + raise DeprecatedError, "The :except option is no longer supported" end end end diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb index 3a9bb773db..8f80b6e5cc 100644 --- a/spec/cache/gems_spec.rb +++ b/spec/cache/gems_spec.rb @@ -58,9 +58,10 @@ describe "bundle cache" do install_gemfile <<-G source "file://#{gem_repo1}" - git "#{lib_path("foo-1.0")}" + git "#{lib_path("foo-1.0")}" do + gem 'foo' + end gem 'rack' - gem 'foo' G bundle :cache diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index ca67dd59d7..0c85cacb12 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -8,8 +8,10 @@ describe "bundle install with git sources" do end install_gemfile <<-G - git "#{lib_path('foo-1.0')}" - gem 'foo' + source "file://#{gem_repo1}" + git "#{lib_path('foo-1.0')}" do + gem 'foo' + end G end @@ -33,8 +35,9 @@ describe "bundle install with git sources" do in_app_root2 do install_gemfile bundled_app2("Gemfile"), <<-G - git "#{lib_path('foo-1.0')}" - gem 'foo' + git "#{lib_path('foo-1.0')}" do + gem 'foo' + end G end @@ -72,8 +75,9 @@ describe "bundle install with git sources" do update_git "foo" install_gemfile <<-G - git "#{lib_path('foo-1.0')}", :ref => "#{@revision}" - gem "foo" + git "#{lib_path('foo-1.0')}", :ref => "#{@revision}" do + gem "foo" + end G run <<-RUBY @@ -264,8 +268,9 @@ describe "bundle install with git sources" do build_git "forced", "1.0" install_gemfile <<-G - git "#{lib_path('forced-1.0')}" - gem 'forced' + git "#{lib_path('forced-1.0')}" do + gem 'forced' + end G should_be_installed "forced 1.0" @@ -295,8 +300,9 @@ describe "bundle install with git sources" do end install_gemfile <<-G, :expect_err => true - git "#{lib_path('has_submodule-1.0')}" - gem "has_submodule" + git "#{lib_path('has_submodule-1.0')}" do + gem "has_submodule" + end G should_not_be_installed "has_submodule 1.0", :expect_err => true @@ -314,8 +320,9 @@ describe "bundle install with git sources" do end install_gemfile <<-G - git "#{lib_path('has_submodule-1.0')}", :submodules => true - gem "has_submodule" + git "#{lib_path('has_submodule-1.0')}", :submodules => true do + gem "has_submodule" + end G should_be_installed "has_submodule 1.0" diff --git a/spec/lock/flex_spec.rb b/spec/lock/flex_spec.rb index dfece0cd89..4c878c4bcb 100644 --- a/spec/lock/flex_spec.rb +++ b/spec/lock/flex_spec.rb @@ -139,8 +139,9 @@ describe "the lockfile format" do git = build_git "foo" install_gemfile <<-G - git "#{lib_path('foo-1.0')}" - gem "foo" + git "#{lib_path('foo-1.0')}" do + gem "foo" + end G lockfile_should_be <<-G @@ -157,7 +158,7 @@ describe "the lockfile format" do #{Gem::Platform.local.to_generic} DEPENDENCIES - foo + foo! G end diff --git a/spec/support/builders.rb b/spec/support/builders.rb index 65d0cf8f06..4e40385924 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -216,6 +216,8 @@ module Spec build_gem "net_e" do |s| s.add_dependency "net_d" end + + build_gem "foo" end end diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb index 238550f5df..8f9f125c52 100644 --- a/spec/update/git_spec.rb +++ b/spec/update/git_spec.rb @@ -7,8 +7,9 @@ describe "bundle update" do update_git "foo", :branch => "omg" install_gemfile <<-G - git "#{lib_path('foo-1.0')}", :branch => "omg" - gem 'foo' + git "#{lib_path('foo-1.0')}", :branch => "omg" do + gem 'foo' + end G update_git "foo", :branch => "omg" do |s| diff --git a/spec/update/source_spec.rb b/spec/update/source_spec.rb index 1d554a9563..4831369f44 100644 --- a/spec/update/source_spec.rb +++ b/spec/update/source_spec.rb @@ -10,8 +10,9 @@ describe "bundle update" do install_gemfile <<-G source "file://#{gem_repo2}" - git "#{lib_path('foo')}" - gem 'foo' + git "#{lib_path('foo')}" do + gem 'foo' + end gem 'rack' G end |