Sha256: fbb74723dfc5a5321a1394bcb464f632940e1dd32f5b1138ae460e6835247cee

Contents?: true

Size: 512 Bytes

Versions: 8

Compression:

Stored size: 512 Bytes

Contents

module Overcommit::GitHook
  class HamlSyntax < HookSpecificCheck
    include HookRegistry
    file_type :haml

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

      staged.each do |path|
        begin
          Haml::Engine.new(File.read(path), :check_syntax => true)
        rescue Haml::Error => e
          return :bad, e.message
        end
      end
      return :good, nil
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
overcommit-0.1.7 lib/overcommit/plugins/pre_commit/haml_syntax.rb
overcommit-0.1.6 lib/overcommit/plugins/pre_commit/haml_syntax.rb
overcommit-0.1.5 lib/overcommit/plugins/pre_commit/haml_syntax.rb
overcommit-0.1.4 lib/overcommit/plugins/pre_commit/haml_syntax.rb
overcommit-0.1.3 lib/overcommit/plugins/pre_commit/haml_syntax.rb
overcommit-0.1.2 lib/overcommit/plugins/pre_commit/haml_syntax.rb
overcommit-0.1.1 lib/overcommit/plugins/pre_commit/haml_syntax.rb
overcommit-0.1.0 lib/overcommit/plugins/pre_commit/haml_syntax.rb