Sha256: c08d0fc0eb57883ac8f2f181a18f1eb1977d8e2f0de2c48a3d9bf99d8e258230
Contents?: true
Size: 608 Bytes
Versions: 3
Compression:
Stored size: 608 Bytes
Contents
require 'pre-commit/utils' module PreCommit class LocalCheck DEFAULT_LOCATION = "config/pre-commit.rb" attr_accessor :error_message def self.call(quiet=false) check = new result = check.run(DEFAULT_LOCATION, Utils.staged_files(".")) puts check.error_message if !result && !quiet result end def run(file, staged_files) return true unless File.exist?(file) output = `ruby #{file} #{staged_files} 2>&1` if $?.success? true else self.error_message = "#{file} failed:\n#{output}" false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pre-commit-0.8.1 | lib/pre-commit/checks/local_check.rb |
pre-commit-0.8.0 | lib/pre-commit/checks/local_check.rb |
pre-commit-0.7.0 | lib/pre-commit/checks/local_check.rb |