lib/git-up.rb in git-up-0.3.2 vs lib/git-up.rb in git-up-0.4.1
- old
+ new
@@ -41,10 +41,12 @@
checkout(branch.name)
rebase(remote)
end
end
end
+
+ check_bundler
rescue GitError => e
puts e.message
exit 1
end
@@ -115,10 +117,22 @@
unless on_branch?(current_branch.name) and is_fast_forward?(current_branch, target_branch)
raise GitError.new("Failed to rebase #{current_branch.name} onto #{target_branch.name}", output+err)
end
end
+ def check_bundler
+ return unless use_bundler?
+
+ begin
+ require 'bundler'
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile')
+ Bundler.setup
+ rescue Bundler::GemNotFound
+ puts 'Gems are missing. You should `bundle install`.'.yellow
+ end
+ end
+
def is_fast_forward?(a, b)
merge_base(a.name, b.name) == b.commit.sha
end
def merge_base(a, b)
@@ -142,8 +156,14 @@
end
def message
@msg
end
+ end
+
+private
+
+ def use_bundler?
+ ENV['GIT_UP_BUNDLER_CHECK'] == 'true' and File.exists? 'Gemfile'
end
end