Sha256: 25caad95204e89c69a04d36dc0d92083387062f68a8ea4413c14eb74c182a3b7

Contents?: true

Size: 866 Bytes

Versions: 1

Compression:

Stored size: 866 Bytes

Contents

module Phare
  module Checks
    class JavaScriptJSCS
      attr_reader :status

      def initialize(directory)
        @config = File.expand_path("#{directory}.jscs.json", __FILE__)
        @path = File.expand_path("#{directory}app/assets", __FILE__)
        @command = "jscs #{@path}"

        puts '---------------------------------------------'
        puts 'Running JSCS to check for JavaScript style…'
        puts '---------------------------------------------'
      end

      def run
        if File.exists?(@config)
          system(@command)
          @status = $CHILD_STATUS.exitstatus

          unless @status == 0
            puts "Something went wrong. Program exited with #{@status}"
          end
        else
          puts 'No `.jscs.json` configuration file found. Skipping it.'
          @status = 0
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phare-0.1 lib/phare/checks/javascript_jscs.rb