diff options
author | Andre Arko <andre@arko.net> | 2014-04-07 14:59:33 +0900 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2014-04-07 14:59:33 +0900 |
commit | d7d0f7907179969b91c97e3ca75b8374ba27deaf (patch) | |
tree | d4dac9a1041d9e2e22bd777efb6a8a5b1c3c6173 | |
parent | 8ed40526d137397462674c7efa92d9c5badffa71 (diff) | |
download | bundler-d7d0f7907179969b91c97e3ca75b8374ba27deaf.tar.gz |
weirdest use of a closure ever
switch to an explicit circular reference, instead of an implicit
one via the closure. still not happy about it, though.
-rw-r--r-- | lib/bundler/source/git.rb | 10 | ||||
-rw-r--r-- | lib/bundler/source/git/git_proxy.rb | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 3a42202302..ee435b8a87 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -211,6 +211,10 @@ module Bundler git_proxy.revision end + def allow_git_ops? + @allow_remote || @allow_cached + end + private def serialize_gemspecs_in(destination) @@ -267,10 +271,6 @@ module Bundler Digest::SHA1.hexdigest(input) end - def allow_git_ops? - @allow_remote || @allow_cached - end - def cached_revision options["revision"] end @@ -280,7 +280,7 @@ module Bundler end def git_proxy - @git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision){ allow_git_ops? } + @git_proxy ||= GitProxy.new(cache_path, uri, ref, cached_revision, self) end end diff --git a/lib/bundler/source/git/git_proxy.rb b/lib/bundler/source/git/git_proxy.rb index 198176416f..67e772f349 100644 --- a/lib/bundler/source/git/git_proxy.rb +++ b/lib/bundler/source/git/git_proxy.rb @@ -34,12 +34,12 @@ module Bundler attr_accessor :path, :uri, :ref attr_writer :revision - def initialize(path, uri, ref, revision=nil, &allow) + def initialize(path, uri, ref, revision = nil, git = nil) @path = path @uri = uri @ref = ref @revision = revision - @allow = allow || Proc.new { true } + @git = git raise GitNotInstalledError.new if allow? && !Bundler.git_present? end @@ -138,7 +138,7 @@ module Bundler end def allow? - @allow.call + @git.allow_git_ops? end def in_path(&blk) |