-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRakefile
78 lines (61 loc) · 1.73 KB
/
Rakefile
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
73
74
75
76
77
78
desc 'Install the dependencies'
task :bootstrap do
sh 'git submodule update --init'
sh 'bundle install'
end
begin
require 'rubygems'
require 'bundler/setup'
task :env do
$LOAD_PATH.unshift(File.expand_path('../', __FILE__))
require 'config/init'
end
task :rack_env do
ENV['RACK_ENV'] ||= 'development'
end
desc 'Starts a interactive console with the model env loaded'
task :console do
exec 'irb', '-I', File.expand_path('../', __FILE__), '-r', 'config/init'
end
desc 'Starts processes for local development'
task :serve do
exec 'env PORT=4567 RACK_ENV=development foreman start'
end
desc 'Run the specs'
task :spec do
title 'Running the specs'
sh "bacon #{FileList['spec/**/*_spec.rb'].shuffle.join(' ')}"
title 'Checking code style'
Rake::Task[:rubocop].invoke
end
desc 'Use Kicker to automatically run specs'
task :kick do
exec 'bundle exec kicker -c'
end
desc 'Update metrics for a pod'
task :update, [:name] do |t, args|
exec "bundle exec ruby updater.rb #{ args[:name] }"
end
task :default => :spec
#-- Rubocop -------------------------------------------------------------------
begin
require 'rubocop/rake_task'
Rubocop::RakeTask.new(:rubocop) do |task|
task.patterns = FileList['{app,config,lib,spec}/**/*.rb']
task.fail_on_error = true
end
rescue LoadError
puts '[!] The Rubocop tasks have been disabled'
end
rescue SystemExit, LoadError => e
puts "[!] The normal tasks have been disabled: #{e.message}"
end
#-- UI ------------------------------------------------------------------------
def title(title)
cyan_title = "\033[0;36m#{title}\033[0m"
puts
puts '-' * 80
puts cyan_title
puts '-' * 80
puts
end