Skip to content
Browse files

Add git-up.bundler.autoinstall option. Closes #13.

  • Loading branch information...
1 parent 9cc6d3f commit b5bfee33c725887b0e75f6e0cdb9caa590831595 @aanand committed Mar 1, 2011
Showing with 11 additions and 1 deletion.
  1. +2 −0 README.md
  2. +9 −1 lib/git-up.rb
View
2 README.md
@@ -26,3 +26,5 @@ To set it within a project, run this command inside that project's directory:
git config git-up.bundler.check true
Replace 'true' with 'false' to disable checking.
+
+If you're even lazier, you can tell `git-up` to run `bundle install` for you if it finds missing gems. Simply set `git-up.bundler.autoinstall` to `true`, in the same manner. As above, it works globally or per-project, but make sure `git-up.bundler.check` is also set to `true` or it won't do anything.
View
10 lib/git-up.rb
@@ -147,7 +147,15 @@ def check_bundler
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile')
Bundler.setup
rescue Bundler::GemNotFound, Bundler::GitError
- puts 'Gems are missing. You should `bundle install`.'.yellow
+ puts
+ print 'Gems are missing. '.yellow
+
+ if config("bundler.autoinstall") == 'true'
+ puts "Running `bundle install`.".yellow
+ system "bundle", "install"
+ else
+ puts "You should `bundle install`.".yellow
+ end
end
end

0 comments on commit b5bfee3

Please sign in to comment.
Something went wrong with that request. Please try again.