forked from entp/seinfeld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
53 lines (45 loc) · 1.26 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$: << File.join(File.dirname(__FILE__), 'lib')
require 'rubygems'
require 'rake/gempackagetask'
# If this require failes, try "gem install rspec"
require 'spec/rake/spectask'
file_list = FileList['spec/*_spec.rb']
Spec::Rake::SpecTask.new('spec') do |t|
t.spec_files = file_list
end
desc 'Default: run specs.'
task :default => 'spec'
namespace :seinfeld do
task :init do
$: << File.join(File.dirname(__FILE__), 'lib')
require 'seinfeld/models'
require 'seinfeld/calendar_helper'
require File.dirname(__FILE__) + '/config/seinfeld.rb'
end
task :setup => :init do
DataMapper.auto_migrate!
puts "Database reset"
end
task :add_user => :init do
raise "Need USER=" if ENV['USER'].to_s.size.zero?
Seinfeld::User.create(:login => ENV['USER'])
end
task :update => :init do
if ENV['USER'].to_s.size.zero?
Seinfeld::User.paginated_each do |user|
user.update_progress
end
else
user = Seinfeld::User.first(:login => ENV['USER'])
if user
user.update_progress
else
raise "No user found for #{ENV['USER'].inspect}"
end
end
end
task :reset => :init do
raise "Need USER=" if ENV['USER'].to_s.size.zero?
Seinfeld::User.first(:login => ENV['USER']).reset_progress
end
end