Sha256: 37389bb4cd2d8ffc2fccf6545b0da2db87aadc1a2dbcda1dbc180939b7fd5e2b
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
# encoding: utf-8 module Phare class Check class Stylelint < Check GLOBAL_BINARY = 'stylelint'.freeze LOCAL_BINARY = 'node_modules/.bin/stylelint'.freeze attr_reader :config, :path def initialize(directory, options = {}) @directory = directory @config = File.expand_path("#{directory}.stylelintrc", __FILE__) @path = File.expand_path("#{directory}app/assets/stylesheets", __FILE__) @extensions = %w(.scss) @options = options super end def command "#{binary} #{input}" end protected def configuration_exists? File.exist?(@config) end def binary local_binary_exists? ? @directory + LOCAL_BINARY : GLOBAL_BINARY end def binary_exists? local_binary_exists? || global_binary_exists? end def local_binary_exists? !Phare.system_output("which #{@directory}#{LOCAL_BINARY}").empty? end def global_binary_exists? !Phare.system_output("which #{GLOBAL_BINARY}").empty? end def input @tree.changed? ? files_to_check.join(' ') : "'#{@path}/**/*#{@extensions.first}'" end def arguments_exists? @tree.changed? || Dir.exist?(@path) end def print_banner Phare.banner 'Running Stylelint to check for SCSS style…' end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phare-1.0.1 | lib/phare/check/stylelint.rb |
phare-1.0.0 | lib/phare/check/stylelint.rb |