Skip to content

Commit

Permalink
[Rake] Don't assume bundler is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed May 9, 2014
1 parent 80467c9 commit 05c5c31
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
require 'bundler/gem_tasks'
# encoding: utf-8

task :default => :spec

#-- Bootstrap ----------------------------------------------------------------#
#-- Bootstrap --------------------------------------------------------------#

desc 'Initializes your working copy to run the specs'
task :bootstrap do
puts 'Installing gems'
`bundle install`
title 'Installing gems'
sh 'gem install bundler'
sh 'bundle install'
end

#-- Specs --------------------------------------------------------------------#
begin
require 'bundler/gem_tasks'
task :default => :spec

desc 'Run specs'
task :spec do
title 'Running Unit Tests'
files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
sh "bundle exec bacon #{files}"
#-- Specs ------------------------------------------------------------------#

Rake::Task['rubocop'].invoke
end
desc 'Run specs'
task :spec do
title 'Running Unit Tests'
files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
sh "bundle exec bacon #{files}"

#-- Rubocop ------------------------------------------------------------------#
Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
end

#-- Rubocop ----------------------------------------------------------------#

desc 'Checks code style'
task :rubocop do
title 'Checking code style'
if RUBY_VERSION >= '1.9.3'
require 'rubocop'
cli = Rubocop::CLI.new
result = cli.run
abort('RuboCop failed!') unless result == 0
else
puts '[!] Ruby > 1.9 is required to run style checks'
require 'rubocop/rake_task'
Rubocop::RakeTask.new
end

rescue LoadError
$stderr.puts '[!] Some Rake tasks haven been disabled because the ' \
'environment couldn’t be loaded. Be sure to run `rake bootstrap` first.'
end

#-- Helpers ------------------------------------------------------------------#
Expand Down

0 comments on commit 05c5c31

Please sign in to comment.