class BestPracticeProject::CoffeeLintHandler

Public Instance Methods

command() click to toggle source
# File lib/best_practice_project/coffee_lint_handler.rb, line 2
def command
  "bundle exec coffeelint.rb -f coffeelint.json -r app/assets/javascripts/" if rails?
end
execute() click to toggle source
# File lib/best_practice_project/coffee_lint_handler.rb, line 6
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
generate_config() click to toggle source
# File lib/best_practice_project/coffee_lint_handler.rb, line 33
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
installed?() click to toggle source
# File lib/best_practice_project/coffee_lint_handler.rb, line 26
def installed?
  require "coffeelint"
  true
rescue LoadError
  false
end

Private Instance Methods

config_path() click to toggle source
# File lib/best_practice_project/coffee_lint_handler.rb, line 42
def config_path
  @config_path ||= "coffeelint.json"
end