Class: BestPracticeProject::ScssLintHandler
Instance Method Summary
collapse
Methods inherited from BaseHandler
#initialize, #rails?
Instance Method Details
#command ⇒ Object
23
24
25
|
# File 'lib/best_practice_project/scss_lint_handler.rb', line 23
def command
"bundle exec scss-lint --config .scss-lint.yml app/assets/stylesheets/"
end
|
#execute ⇒ Object
27
28
29
|
# File 'lib/best_practice_project/scss_lint_handler.rb', line 27
def execute
system(command)
end
|
#generate_config ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/best_practice_project/scss_lint_handler.rb', line 10
def generate_config
return unless @scss_config_path
return puts "SCSS-Lint config already exists in #{@scss_config_path}" if File.exist?(@scss_config_path)
config = `bundle exec scss-lint --format=Config`
File.open(config_path, "w") do |fp|
fp.write(config)
end
puts "ScssLintHandler: Generated SCSS-Lint config in #{@scss_config_path}"
end
|
#installed? ⇒ Boolean
2
3
4
5
6
7
8
|
# File 'lib/best_practice_project/scss_lint_handler.rb', line 2
def installed?
return false unless rails?
require "scss_lint"
true
rescue LoadError
false
end
|