Class: OpenHood::Rake::CITask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Gem
Defined in:
lib/openhood/rake/ci.rb

Instance Method Summary collapse

Constructor Details

#initializeCITask

Returns a new instance of CITask.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/openhood/rake/ci.rb', line 9

def initialize
  namespace :ci do 
    desc 'Run all features and specs' 
    task :all do 
      ENV['RACK_ENV'] = 'test'
      error = 0 

      rake_bin = "#{File.join(Config::CONFIG['bindir'], 'rake')} "

      ["#{rake_bin} spec", "#{rake_bin} features"].each do |command|
        if system command 
          error += $?.to_i 
        else 
          error += 1 
        end 
      end 
      at_exit {exit error} if(error != 0) 
     end 
  end
end