summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/cli.rb5
-rw-r--r--lib/bundler/source.rb28
2 files changed, 26 insertions, 7 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index 3a26a3be9d..32d68f1be5 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -175,8 +175,9 @@ module Bundler
desc "cache", "Cache all the gems to vendor/cache", :hide => true
method_option "no-prune", :type => :boolean, :banner => "Don't remove stale gems from the cache."
def cache
- Bundler.load.cache
- Bundler.load.prune_cache unless options[:no_prune]
+ environment = Bundler.load
+ environment.cache
+ environment.prune_cache unless options[:no_prune]
rescue GemNotFound => e
Bundler.ui.error(e.message)
Bundler.ui.warn "Run `bundle install` to install missing gems."
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index 68c49ef3a1..210d12349a 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -553,12 +553,18 @@ module Bundler
private
def git(command)
- out = %x{git #{command}}
+ if allow_git_ops?
+ out = %x{git #{command}}
- if $? != 0
- raise GitError, "An error has occurred in git. Cannot complete bundling."
+ if $? != 0
+ raise GitError, "An error has occurred in git. Cannot complete bundling."
+ end
+ out
+ else
+ raise GitError, "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, " \
+ "this error message could probably be more useful. Please submit a ticket at http://github.com/carlhuda/bundler/issues " \
+ "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
end
- out
end
def base_name
@@ -627,8 +633,20 @@ module Bundler
$? == 0
end
+ def allow_git_ops?
+ STDERR.puts "----"
+ STDERR.puts [@allow_remote, @allow_cache].inspect
+ STDERR.puts caller
+ STDERR.puts "----"
+ @allow_remote || @allow_cache
+ end
+
def revision
- @revision ||= in_cache { git("rev-parse #{ref}").strip }
+ if allow_git_ops?
+ @revision ||= in_cache { git("rev-parse #{ref}").strip }
+ else
+ raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
+ end
end
def cached?