Class: BestPracticeProject::ScssLintHandler
Instance Method Summary
collapse
Methods inherited from BaseHandler
#initialize, #rails?
Instance Method Details
#command ⇒ Object
24
25
26
|
# File 'lib/best_practice_project/scss_lint_handler.rb', line 24
def command
"bundle exec scss-lint --config .scss-lint.yml app/assets/stylesheets/"
end
|
#execute ⇒ Object
28
29
30
|
# File 'lib/best_practice_project/scss_lint_handler.rb', line 28
def execute
system(command)
end
|
#generate_config ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/best_practice_project/scss_lint_handler.rb', line 11
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
9
|
# 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
|