Sha256: a770f5eebc3d56175500b46eaeabd129308a880c2545ce61f26d2a217936a7f7
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
module Guard module Sass module Lint class Linter OUTPUT_FILE = 'tmp/sass_lint_results.json'.freeze def initialize(config_location = nil) @config_location = config_location @results = {} end def lint(file) clear_results system lint_command(file) result_data end private def root File.expand_path('../../../../..', __FILE__) end def sass_lint_dir @sass_lint_dir ||= File.join(root, 'node_modules', 'sass-lint') end def lint_command(filename) [linter, config, format, output, additional, filename, quiet].join(' ') end def linter File.join(sass_lint_dir, 'bin', 'sass-lint.js') end def config "-c #{config_file}" end def config_file @config_location || default_config end def default_config File.join(sass_lint_dir, 'docs', 'sass-lint.yml') end def format '-f json' end def additional '--no-exit --verbose' end def output "-o #{OUTPUT_FILE}" end def quiet ' >/dev/null 2>&1' end def result_data @result_data ||= result_json_file || [] end def clear_results File.delete(OUTPUT_FILE) if File.exists?(OUTPUT_FILE) @result_data = nil end def result_json_file JSON.parse(File.new(OUTPUT_FILE).read) if File.exists?(OUTPUT_FILE) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
guard-sass-lint-0.1.2 | lib/guard/sass/lint/linter.rb |
guard-sass-lint-0.1.1 | lib/guard/sass/lint/linter.rb |
guard-sass-lint-0.1.0 | lib/guard/sass/lint/linter.rb |