Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 58 lines (46 sloc) 1.392 kb
05c5c31 @fabiopelosin [Rake] Don't assume bundler is installed
fabiopelosin authored
1 # encoding: utf-8
b41eb1f @fabiopelosin [Rake] Clean up
fabiopelosin authored
2
05c5c31 @fabiopelosin [Rake] Don't assume bundler is installed
fabiopelosin authored
3 #-- Bootstrap --------------------------------------------------------------#
b2b1d2c @fabiopelosin [Rakefile] Add bootstrap task
fabiopelosin authored
4
6a56e39 @fabiopelosin [Rubocop] Fix StringLiterals
fabiopelosin authored
5 desc 'Initializes your working copy to run the specs'
b2b1d2c @fabiopelosin [Rakefile] Add bootstrap task
fabiopelosin authored
6 task :bootstrap do
de13b8a @AliSoftware Fixing Rakefile's bootstrap
AliSoftware authored
7 if system('which bundle')
8 title 'Installing gems'
9 sh 'bundle install'
10 else
8c2796b @AliSoftware Fixing Rakefile exception cases
AliSoftware authored
11 $stderr.puts "\033[0;31m" \
12 "[!] Please install the bundler gem manually:\n" \
0777c1d @AliSoftware Rubocop fix
AliSoftware authored
13 ' $ [sudo] gem install bundler' \
8c2796b @AliSoftware Fixing Rakefile exception cases
AliSoftware authored
14 "\e[0m"
15 exit 1
de13b8a @AliSoftware Fixing Rakefile's bootstrap
AliSoftware authored
16 end
b2b1d2c @fabiopelosin [Rakefile] Add bootstrap task
fabiopelosin authored
17 end
18
05c5c31 @fabiopelosin [Rake] Don't assume bundler is installed
fabiopelosin authored
19 begin
20 require 'bundler/gem_tasks'
21 task :default => :spec
89cf54c @fabiopelosin [Rakefile] Add release task
fabiopelosin authored
22
05c5c31 @fabiopelosin [Rake] Don't assume bundler is installed
fabiopelosin authored
23 #-- Specs ------------------------------------------------------------------#
44dd576 @fabiopelosin [Rubocop] Setup
fabiopelosin authored
24
05c5c31 @fabiopelosin [Rake] Don't assume bundler is installed
fabiopelosin authored
25 desc 'Run specs'
26 task :spec do
27 title 'Running Unit Tests'
28 files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
29 sh "bundle exec bacon #{files}"
44dd576 @fabiopelosin [Rubocop] Setup
fabiopelosin authored
30
05c5c31 @fabiopelosin [Rake] Don't assume bundler is installed
fabiopelosin authored
31 Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
32 end
33
34 #-- Rubocop ----------------------------------------------------------------#
44dd576 @fabiopelosin [Rubocop] Setup
fabiopelosin authored
35
d27a580 @alloy [rake] Don't use tasks from gems, just use the CLI and prepend `bundl…
alloy authored
36 desc 'Check code against RuboCop rules'
37 task :rubocop do
6b6384b @segiddins [Bundle] Update RuboCop
segiddins authored
38 sh 'bundle exec rubocop'
44dd576 @fabiopelosin [Rubocop] Setup
fabiopelosin authored
39 end
05c5c31 @fabiopelosin [Rake] Don't assume bundler is installed
fabiopelosin authored
40
41 rescue LoadError
8c2796b @AliSoftware Fixing Rakefile exception cases
AliSoftware authored
42 $stderr.puts "\033[0;31m" \
43 '[!] Some Rake tasks haven been disabled because the environment' \
44 ' couldn’t be loaded. Be sure to run `rake bootstrap` first.' \
45 "\e[0m"
44dd576 @fabiopelosin [Rubocop] Setup
fabiopelosin authored
46 end
47
48 #-- Helpers ------------------------------------------------------------------#
49
50 def title(title)
51 cyan_title = "\033[0;36m#{title}\033[0m"
52 puts
53 puts '-' * 80
54 puts cyan_title
55 puts '-' * 80
56 puts
89cf54c @fabiopelosin [Rakefile] Add release task
fabiopelosin authored
57 end
Something went wrong with that request. Please try again.