-
Notifications
You must be signed in to change notification settings - Fork 18
/
Rakefile
56 lines (45 loc) · 1.37 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
# Bootstrap
#-----------------------------------------------------------------------------#
task :bootstrap, :use_bundle_dir? do |t, args|
if system('which bundle')
if args[:use_bundle_dir?]
sh 'bundle install --path ./travis_bundle_dir'
else
sh 'bundle install'
end
else
$stderr.puts "\033[0;31m" \
"[!] Please install the bundler gem manually:\n" \
' $ [sudo] gem install bundler' \
"\e[0m"
exit 1
end
end
begin
require 'bundler/gem_tasks'
task :default => 'spec'
# Spec
#-----------------------------------------------------------------------------#
desc 'Runs all the specs'
task :spec do
puts "\033[0;32mUsing #{`ruby --version`}\033[0m"
start_time = Time.now
sh "bundle exec bacon #{specs('**')}"
duration = Time.now - start_time
puts "Tests completed in #{duration}s"
Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
end
def specs(dir)
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
end
#-- Rubocop ----------------------------------------------------------------#
if RUBY_VERSION >= '1.9.3'
require 'rubocop/rake_task'
RuboCop::RakeTask.new
end
rescue LoadError
$stderr.puts "\033[0;31m" \
'[!] Some Rake tasks haven been disabled because the environment' \
' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
"\e[0m"
end