Skip to content

Commit

Permalink
Add git-up.bundler.autoinstall option. Closes aanand#13.
Browse files Browse the repository at this point in the history
  • Loading branch information
aanand committed Mar 1, 2011
1 parent 9cc6d3f commit b5bfee3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -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.
10 changes: 9 additions & 1 deletion lib/git-up.rb
Expand Up @@ -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

Expand Down

0 comments on commit b5bfee3

Please sign in to comment.