Rakefile in cocoapods-try-0.3.0 vs Rakefile in cocoapods-try-0.4.0
- old
+ new
@@ -31,29 +31,22 @@
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
+
+ Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
end
def specs(dir)
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
end
- # Rubocop
- #-----------------------------------------------------------------------------#
+ #-- Rubocop ----------------------------------------------------------------#
- desc 'Checks code style'
- task :rubocop do
- if RUBY_VERSION >= '1.9.3'
- require 'rubocop'
- cli = Rubocop::CLI.new
- result = cli.run(FileList['{spec,lib}/**/*.rb'])
- abort('RuboCop failed!') unless result == 0
- else
- puts '[!] Ruby > 1.9 is required to run style checks'
- end
+ 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' \