-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
72 lines (61 loc) · 1.46 KB
/
Rakefile
File metadata and controls
72 lines (61 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# frozen_string_literal: true
require 'rainbow'
def project_name
'Folkingebrew 🍺'
end
linters = [
{
name: 'ESLint',
language: 'JavaScript',
command: 'node_modules/.bin/eslint source/**/*.js'
},
{
name: 'stylelint',
language: 'CSS/SCSS',
command: 'stylelint **/*.scss'
},
{
name: 'RuboCop',
language: 'Ruby',
command: 'rubocop'
}
]
default_tasks = []
linters.each do |linter|
desc "Check your #{linter[:language]} files with #{linter[:name]}"
task linter[:name].downcase.to_sym do
puts Rainbow(
"Checking your #{linter[:language]} files with #{linter[:name]}..."
).bright.orange
run_linter(linter[:command])
end
default_tasks << linter[:name].downcase.to_sym
end
default_tasks << 'proof'
task default: default_tasks
def run_linter(command)
output = `#{command}`
if output.empty?
puts Rainbow('✔︎ Perfect style!').bright.green
else
system command
end
end
## Serve
task :serve do
puts Rainbow("== Project: #{project_name}").bright.green
puts Rainbow('== Serve').bright.green
system 'bundle exec middleman serve' || exit(1)
end
## Build the website
task :build do
puts Rainbow("== Project: #{project_name}")
puts Rainbow('== Build')
system 'bundle exec middleman build --verbose' || exit(1)
end
# HTML Proofer to test static output
task :proof do
puts Rainbow("== Project: #{project_name}")
system 'bundle exec middleman build --verbose' || exit(1)
system 'ruby proof.rb'
end