Class: Overcommit::Hook::PostCheckout::BundleCheck

Inherits:
Base
  • Object
show all
Defined in:
lib/overcommit/hook/post_checkout/bundle_check.rb

Overview

If Gemfile dependencies were modified since HEAD was changed, check if currently installed gems satisfy the dependencies.

Instance Method Summary collapse

Methods inherited from Base

#applicable_files, #description, #enabled?, #execute, #in_path?, #initialize, #name, #quiet?, #required?, #run?, #skip?

Constructor Details

This class inherits a constructor from Overcommit::Hook::Base

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/overcommit/hook/post_checkout/bundle_check.rb', line 5

def run
  unless in_path?('bundle')
    return :warn, 'bundler not installed -- run `gem install bundler`'
  end

  if dependencies_changed? && !dependencies_satisfied?
    return :warn, "#{LOCK_FILE} is not up-to-date -- run `bundle check`"
  end

  :good
end