Class: PolishGeeks::DevTools::Commands::HamlLint

Inherits:
Base
  • Object
show all
Defined in:
lib/polish_geeks/dev_tools/commands/haml_lint.rb

Overview

Command wrapper for Haml lint validation It informs us if haml is formatted in a proper way

Constant Summary

Constants inherited from Base

Base::TYPES

Instance Attribute Summary

Attributes inherited from Base

#output, #stored_output

Instance Method Summary collapse

Methods inherited from Base

#ensure_executable!, #error_message

Instance Method Details

#executeString

Executes this command

Returns:

  • (String)

    command output



12
13
14
15
16
17
18
19
# File 'lib/polish_geeks/dev_tools/commands/haml_lint.rb', line 12

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

#valid?Boolean

Returns true if there were no Rubocop offenses detected.

Returns:

  • (Boolean)

    true if there were no Rubocop offenses detected



22
23
24
# File 'lib/polish_geeks/dev_tools/commands/haml_lint.rb', line 22

def valid?
  @output.to_s.empty?
end