Sha256: 90febc8f0d8d8e264a7ebb9ff5c6d2e0ce2cdb56c4447184af76e8fcc67a64d9

Contents?: true

Size: 573 Bytes

Versions: 2

Compression:

Stored size: 573 Bytes

Contents

module Jshint
  module Cli
    def self.run(reporter_name = :Default, result_file = nil, config_path = nil)
      linter = Jshint::Lint.new(config_path)
      linter.lint
      reporter = Jshint::Reporters.const_get(reporter_name).new(linter.errors)

      printer = lambda do |stream|
        stream.puts reporter.report
      end

      if result_file
        Dir.mkdir(File.dirname(result_file))
        File.open(result_file, 'w') do |stream|
          printer.call(stream)
        end
      else
        printer.call($stdout)
      end

      linter
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jshint-1.5.0 lib/jshint/cli.rb
jshint-1.4.0 lib/jshint/cli.rb