Sha256: cf226c532fd86eb866e336deb5bd24fe0ad0c078e65d89a20b1d35b81e802fbf

Contents?: true

Size: 852 Bytes

Versions: 5

Compression:

Stored size: 852 Bytes

Contents

module PolishGeeks
  module DevTools
    module Commands
      # Command wrapper for Haml lint validation
      # It informs us if haml is formatted in a proper way
      # @see https://github.com/causes/haml-lint
      class HamlLint < Base
        self.type = :validator

        # Executes this command
        # @return [String] command output
        def execute
          loc_config = File.join(DevTools.gem_root, 'config', 'haml-lint.yml')
          app_config = File.join(DevTools.app_root, '.haml-lint.yml')

          config = File.exist?(app_config) ? app_config : loc_config

          @output = Shell.new.execute("bundle exec haml-lint -c #{config} app/views")
        end

        # @return [Boolean] true if there were no Rubocop offenses detected
        def valid?
          @output.to_s.empty?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
polishgeeks-dev-tools-1.4.0 lib/polish_geeks/dev_tools/commands/haml_lint.rb
polishgeeks-dev-tools-1.3.2 lib/polish_geeks/dev_tools/commands/haml_lint.rb
polishgeeks-dev-tools-1.3.1 lib/polish_geeks/dev_tools/commands/haml_lint.rb
polishgeeks-dev-tools-1.3.0 lib/polish_geeks/dev_tools/commands/haml_lint.rb
polishgeeks-dev-tools-1.2.1 lib/polishgeeks/dev-tools/commands/haml_lint.rb