module Causes::GitHook
  class ScssLint < HookSpecificCheck
    include HookRegistry
    file_type :scss

    def run_check
      begin
        require 'scss-lint'
      rescue LoadError
        return :warn, 'scss-lint not installed -- run `gem install scss-lint`'
      end

      paths = staged.map { |s| s.path }.join(' ')

      output = `scss-lint #{paths} 2>&1`

      staged.each { |s| output = s.filter_string(output) }
      return (output.empty? ? :good : :bad), output
    end
  end
end

module Causes::GitHook
  class ScssLint < HookSpecificCheck
    include HookRegistry
    file_type :scss

    def run_check
      begin
        require 'scss_lint'
      rescue LoadError
        return :warn, 'scss-lint not installed -- run `gem install scss-lint`'
      end

      paths = staged.map { |s| s.path }.join(' ')

      output = `scss-lint #{paths} 2>&1`

      staged.each { |s| output = s.filter_string(output) }
      return (output.empty? ? :good : :bad), output
    end
  end
end

Make scss-lint Git hook actually work
Make scss-lint Git hook actually work

The `require` was failing due to a typo in the name.

Related Story:
  http://www.pivotaltracker.com/story/show/41566653 (fixed)
  ("Make scss-lint Git hook actually work")

Change-Id: I3b828e02816dbd06be4b654e8124d463b87f9d3b
Reviewed-on: https://gerrit.causes.com/16762
Reviewed-by: Henric Trotzig <f5a3082dfc399666895f58d2777281f9ac20aad5@causes.com>
Tested-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
