Sha256: 5fbd8d4badb23d44c325f58f17bcac00f02cffc179077ef2c6defb272b9a8536

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

class BestPracticeProject::ScssLintHandler < BestPracticeProject::BaseHandler
  def installed?
    return false unless rails?

    require "scss_lint"
    true
  rescue LoadError
    false
  end

  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

  def command
    "bundle exec scss-lint --config .scss-lint.yml app/assets/stylesheets/"
  end

  def execute
    system(command)
  end

private

  def config_path
    @config_path ||= ".scss-lint.yml"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
best_practice_project-0.0.12 lib/best_practice_project/scss_lint_handler.rb
best_practice_project-0.0.11 lib/best_practice_project/scss_lint_handler.rb