2013-04-30 00:56:40 +02:00
|
|
|
$: << 'lib'
|
|
|
|
|
2012-11-20 17:36:12 +01:00
|
|
|
require 'fixer'
|
2012-11-21 01:04:15 +01:00
|
|
|
require 'rake/testtask'
|
2013-04-30 00:56:40 +02:00
|
|
|
require 'db'
|
2012-11-20 17:36:12 +01:00
|
|
|
|
2013-04-30 00:56:40 +02:00
|
|
|
task :load do
|
2012-11-20 17:36:12 +01:00
|
|
|
Currency.delete
|
2013-04-30 00:56:40 +02:00
|
|
|
data = Fixer::Feed.new(:historical)
|
|
|
|
Currency.multi_insert(data.to_a)
|
2012-11-20 17:36:12 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
task :update do
|
|
|
|
Fixer::Feed.new.each do |hsh|
|
2013-04-30 00:56:40 +02:00
|
|
|
Currency.find_or_create(hsh)
|
2012-11-20 17:36:12 +01:00
|
|
|
end
|
|
|
|
end
|
2012-11-21 01:04:15 +01:00
|
|
|
|
|
|
|
Rake::TestTask.new do |t|
|
2013-04-30 00:56:40 +02:00
|
|
|
t.libs.push('lib')
|
2012-11-21 01:04:15 +01:00
|
|
|
t.test_files = FileList['spec/*_spec.rb']
|
|
|
|
t.verbose = true
|
|
|
|
end
|
|
|
|
|
|
|
|
task :default => [:test]
|