template-dir/hooks/post-rewrite in overcommit-0.30.0 vs template-dir/hooks/post-rewrite in overcommit-0.31.0
- old
+ new
@@ -28,10 +28,18 @@
# Check if Overcommit should invoke a Bundler context for loading gems
require 'yaml'
# rubocop:disable Style/RescueModifier
if gemfile = YAML.load_file('.overcommit.yml')['gemfile'] rescue nil
ENV['BUNDLE_GEMFILE'] = gemfile
- require 'bundler/setup'
+ require 'bundler'
+
+ begin
+ Bundler.setup
+ rescue Bundler::BundlerError => ex
+ puts "Problem loading '#{gemfile}': #{ex.message}"
+ puts "Try running:\nbundle install --gemfile=#{gemfile}" if ex.is_a?(Bundler::GemNotFound)
+ exit 78 # EX_CONFIG
+ end
end
# rubocop:enable Style/RescueModifier
begin
require 'overcommit'