Sha256: efa6823db46276ec5efc653add0301a16528a10b5018dbfef47ea1ed0a7daac9

Contents?: true

Size: 810 Bytes

Versions: 1

Compression:

Stored size: 810 Bytes

Contents

require "coffeelint/version"
require 'execjs'
require 'coffee-script'

module Coffeelint
  require 'coffeelint/railtie' if defined?(Rails)

  def self.path()
    @path ||= File.expand_path('../../coffeelint/src/coffeelint.coffee', __FILE__)
  end

  def self.lint(script)
    coffeescriptSource = File.read(CoffeeScript::Source.path)
    coffeelintSource = CoffeeScript.compile(File.read(Coffeelint.path))
    context = ExecJS.compile(coffeescriptSource + coffeelintSource)
    context.call('coffeelint.lint', script)
  end

  def self.lint_file(filename)
    Coffeelint.lint(File.read(filename))
  end

  def self.lint_dir(directory)
    retval = {}
    Dir.glob("#{directory}/**/*.coffee") do |name|
      retval[name] = Coffeelint.lint_file(name)
      yield name, retval[name]
    end
    retval
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
coffeelint-0.0.1 lib/coffeelint.rb