/
Rakefile
44 lines (38 loc) · 1 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
task :default => 'spec'
task :environment do
ENV['CORRUPT_ENV'] ||= 'development'
begin
# Try to load from ./vendor first.
require File.dirname(__FILE__) + '/vendor/corrupt'
rescue LoadError
# Now try the gem.
require 'corrupt'
end
Corrupt.boot!
end
FileList['tasks/**/*.rake'].each { |task| load task }
desc 'Open a console with the library loaded'
task :console do
lib_dir = File.join(File.dirname(__FILE__), 'lib')
sh "irb -I #{lib_dir} -r 'corrupt'"
end
desc 'List the configured routes'
task :routes => [ :environment ] do
width = 30
puts "| Routes for '#{Corrupt.env}' environment |"
Corrupt::Router.routes.each do |route|
print "#{route[0]}".ljust(width)
print "#{route[1].inspect}".rjust(width)
puts
end
end
namespace :db do
desc 'Migrate the database (destructive)'
task :migrate => [:environment] do
DataMapper.auto_migrate!
end
desc 'Migrate the database (non-destructive)'
task :uprade => [:environment] do
DataMapper.auto_upgrade!
end
end