Sha256: d7f89681915eb5106bf943d5325769c5d93688a1f9b2b89e7efc0a829ffd5896

Contents?: true

Size: 484 Bytes

Versions: 11

Compression:

Stored size: 484 Bytes

Contents

require 'pre-commit/checks/plugin'

module PreCommit
  module Checks
    class Local < Plugin

      DEFAULT_LOCATION = "config/pre-commit.rb"

      def call(staged_files, script=Local::DEFAULT_LOCATION)
        return unless File.exist?(script)
        output = `ruby #{script} #{staged_files.join(" ")} 2>&1`
        "#{script} failed:\n#{output}" unless $?.success?
      end

      def self.description
        "Executes 'ruby #{DEFAULT_LOCATION}'."
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pre-commit-0.19.0 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.18.0 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.17.0 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.16.3 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.16.2 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.16.1 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.16.0 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.15.0 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.14.1 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.14.0 lib/plugins/pre_commit/checks/local.rb
pre-commit-0.13.0 lib/plugins/pre_commit/checks/local.rb