Sha256: 902879032905ee05710cb7cd8cad3b3ff62623c533f0539cb6ddc64285a6f8fd

Contents?: true

Size: 644 Bytes

Versions: 25

Compression:

Stored size: 644 Bytes

Contents

# frozen_string_literal: true

module Overcommit::Hook::PreCommit
  # Check if local Berksfile.lock matches Berksfile when either changes, unless
  # Berksfile.lock is ignored by git.
  #
  # @see http://berkshelf.com/
  class BerksfileCheck < Base
    LOCK_FILE = 'Berksfile.lock'.freeze

    def run
      # Ignore if Berksfile.lock is not tracked by git
      ignored_files = execute(%w[git ls-files -o -i --exclude-standard]).stdout.split("\n")
      return :pass if ignored_files.include?(LOCK_FILE)

      result = execute(command)
      unless result.success?
        return :fail, result.stderr
      end

      :pass
    end
  end
end

Version data entries

25 entries across 23 versions & 2 rubygems

Version Path
overcommit-0.47.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/berksfile_check.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/berksfile_check.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/berksfile_check.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.46.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.45.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.44.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.43.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.42.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.41.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.40.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.39.1 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.39.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.38.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.37.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.36.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.35.0 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.34.2 lib/overcommit/hook/pre_commit/berksfile_check.rb
overcommit-0.34.1 lib/overcommit/hook/pre_commit/berksfile_check.rb