class BestPracticeProject::ScssLintHandler

Public Instance Methods

command() click to toggle source
# File lib/best_practice_project/scss_lint_handler.rb, line 24
def command
  "bundle exec scss-lint --config .scss-lint.yml app/assets/stylesheets/"
end
execute() click to toggle source
# File lib/best_practice_project/scss_lint_handler.rb, line 28
def execute
  system(command)
end
generate_config() click to toggle source
# File lib/best_practice_project/scss_lint_handler.rb, line 11
def generate_config
  return unless @scss_config_path
  return puts "SCSS-Lint config already exists in #{@scss_config_path}" if File.exist?(@scss_config_path)

  config = `bundle exec scss-lint --format=Config`

  File.open(config_path, "w") do |fp|
    fp.write(config)
  end

  puts "ScssLintHandler: Generated SCSS-Lint config in #{@scss_config_path}"
end
installed?() click to toggle source
# File lib/best_practice_project/scss_lint_handler.rb, line 2
def installed?
  return false unless rails?

  require "scss_lint"
  true
rescue LoadError
  false
end

Private Instance Methods

config_path() click to toggle source
# File lib/best_practice_project/scss_lint_handler.rb, line 34
def config_path
  @config_path ||= ".scss-lint.yml"
end