Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove standalone #git in the DSL. Instead, use the block form of #gi…

…t and put in the associated gems
  • Loading branch information...
commit d7e1dc1ef387eea787a634382d8f7401bffcdeea 1 parent ce7db1b
@wycats wycats authored
View
3  lib/bundler.rb
@@ -43,8 +43,7 @@ class GemfileError < BundlerError; status_code(4) ; end
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
View
23 lib/bundler/dsl.rb
@@ -80,6 +80,17 @@ def path(path, options = {}, source_options = {}, &blk)
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 @@ def self.deprecate(name, replacement = nil)
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 @@ def _normalize_options(name, version, opts)
["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 @@ def _normalize_options(name, version, opts)
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
View
5 spec/cache/gems_spec.rb
@@ -58,9 +58,10 @@
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
View
31 spec/install/git_spec.rb
@@ -8,8 +8,10 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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"
View
7 spec/lock/flex_spec.rb
@@ -139,8 +139,9 @@ def lockfile_should_be(expected)
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 @@ def lockfile_should_be(expected)
#{Gem::Platform.local.to_generic}
DEPENDENCIES
- foo
+ foo!
G
end
View
2  spec/support/builders.rb
@@ -216,6 +216,8 @@ def build_repo1
build_gem "net_e" do |s|
s.add_dependency "net_d"
end
+
+ build_gem "foo"
end
end
View
5 spec/update/git_spec.rb
@@ -7,8 +7,9 @@
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|
View
5 spec/update/source_spec.rb
@@ -10,8 +10,9 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.