Sha256: c709d37f03020977c3c89e9b645aa52f2e952cbd0d93e64f85442b4ab5592e64

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

module Phare
  module Checks
    class ScssLint
      attr_reader :status

      def initialize(directory)
        @path = File.expand_path("#{directory}app/assets/stylesheets", __FILE__)
        @glob = File.join(@path, '**/*.css.scss')
        @command = "scss-lint #{@glob}"
      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 scss-lint`.empty? && Dir.exists?(@path)
      end

      def print_banner
        puts '------------------------------------------'
        puts 'Running SCSS-Lint to check for SCSS style…'
        puts '------------------------------------------'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phare-0.2.1 lib/phare/checks/scss_lint.rb