mlb/Rakefile

49 lines
1.1 KiB
Ruby
Raw Permalink Normal View History

2010-09-12 01:20:51 -06:00
require 'bundler'
Bundler::GemHelper.install_tasks
2009-10-16 17:32:56 -06:00
2010-11-06 21:36:45 -06:00
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
2011-02-03 10:45:55 -07:00
task :test => :spec
2010-11-06 21:41:39 -06:00
namespace :cache do
require 'mlb'
2013-12-30 22:05:58 -07:00
desc 'Update the teams file cache'
task :update do
2014-01-02 23:17:49 -07:00
json = MLB::Team.results_from_freebase
file = File.new('cache/teams.json', 'w+')
tempfile = Tempfile.new('teams.json')
tempfile.write(JSON.dump(json))
if system("python -mjson.tool #{tempfile.path} #{file.path}")
puts "File sucessfully written to #{file.path}"
tempfile.delete
else
abort "Error parsing #{tempfile.path}"
end
end
end
2013-01-25 10:55:21 -07:00
2013-12-30 22:00:12 -07:00
begin
require 'rubocop/rake_task'
2014-06-20 15:35:08 -06:00
RuboCop::RakeTask.new
2013-12-30 22:00:12 -07:00
rescue LoadError
task :rubocop do
2014-06-20 15:35:08 -06:00
$stderr.puts 'RuboCop is disabled'
2013-12-30 22:00:12 -07:00
end
end
2013-01-25 10:55:21 -07:00
require 'yard'
YARD::Rake::YardocTask.new
2013-12-30 22:00:12 -07:00
2013-12-30 22:08:57 -07:00
require 'yardstick/rake/measurement'
Yardstick::Rake::Measurement.new do |measurement|
measurement.output = 'measurement/report.txt'
end
require 'yardstick/rake/verify'
Yardstick::Rake::Verify.new do |verify|
2014-06-20 15:35:08 -06:00
verify.threshold = 56.5
2013-12-30 22:08:57 -07:00
end
task :default => [:spec, :rubocop, :verify_measurements]