Sha256: f2bebd56d7145905d6d59fedd5cd3c6ba5c4f2ada6df4ff8cdaa961c482bdf21

Contents?: true

Size: 787 Bytes

Versions: 3

Compression:

Stored size: 787 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

3 entries across 3 versions & 1 rubygems

Version Path
best_practice_project-0.0.10 lib/best_practice_project/scss_lint_handler.rb
best_practice_project-0.0.9 lib/best_practice_project/scss_lint_handler.rb
best_practice_project-0.0.8 lib/best_practice_project/scss_lint_handler.rb