Sha256: 8b6b337302b62d383c84179aa7eb8fa37170585b8a612caf28035450065a51e6
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module Phare module Checks class JavaScriptJSHint attr_reader :status def initialize(directory) @config = File.expand_path("#{directory}.jshintrc", __FILE__) @path = File.expand_path("#{directory}app/assets/javascripts/**/*", __FILE__) @command = "jshint --config #{@config} --extra-ext .js,.es6.js #{@path}" end def run if should_run? print_banner system(@command) @status = $CHILD_STATUS.exitstatus if @status == 0 puts 'No code style errors found.' else puts "Something went wrong. Program exited with #{@status}" end puts '' else @status = 0 end end protected def should_run? !`which jshint`.empty? && File.exists?(@config) end def print_banner puts '---------------------------------------------' puts 'Running JSHint to check for JavaScript style…' puts '---------------------------------------------' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phare-0.2 | lib/phare/checks/javascript_jshint.rb |
phare-0.1.2 | lib/phare/checks/javascript_jshint.rb |