Sha256: 2f288899cab1ef1db5ed3ba8afb33c9cf61943847841db58eb3f28d7d98e3bd6

Contents?: true

Size: 1018 Bytes

Versions: 2

Compression:

Stored size: 1018 Bytes

Contents

class BestPracticeProject::CoffeeLintHandler < BestPracticeProject::BaseHandler
  def command
    "bundle exec coffeelint.rb -f coffeelint.json -r app/assets/javascripts/" if rails?
  end

  def execute
    require "coffeelint"

    dirs = ENV["DIRS"].split(":").map(&:strip) if ENV["DIRS"]
    dirs ||= ["app/assets/javascripts"]
    status = true

    dirs.each do |dir|
      dir = dir.strip

      puts "Running CoffeeLint on: #{dir}"
      result = Coffeelint.run_test_suite(dir)

      puts "Result: #{result}"
      status = false if result.positive?
    end

    status
  end

  def installed?
    require "coffeelint"
    true
  rescue LoadError
    false
  end

  def generate_config
    return unless @coffee_lint_config_path
    return puts "Coffee-Lint config already exists in #{@coffee_lint_config_path}" if File.exist?(@coffee_lint_config_path)

    puts "CoffeeLintHandler: FIXME: Generate Coffee-Lint configuration!"
  end

private

  def config_path
    @config_path ||= "coffeelint.json"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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