forked from basecamp/marginalia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·66 lines (51 loc) · 1.45 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
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env rake
require "bundler/gem_tasks"
task :default => ['test:all']
namespace :test do
desc "test all drivers"
task :all => [:mysql, :mysql2, :postgresql, :sqlite]
desc "test mysql driver"
task :mysql do
sh "DRIVER=mysql ruby -Ilib -Itest test/*_test.rb"
end
desc "test mysql2 driver"
task :mysql2 do
sh "DRIVER=mysql2 ruby -Ilib -Itest test/*_test.rb"
end
desc "test PostgreSQL driver"
task :postgresql do
sh "DRIVER=postgresql DB_USERNAME=postgres ruby -Ilib -Itest test/*_test.rb"
end
desc "test sqlite3 driver"
task :sqlite do
sh "DRIVER=sqlite3 ruby -Ilib -Itest test/*_test.rb"
end
end
namespace :db do
desc "reset all databases"
task :reset => [:"mysql:reset", :"postgresql:reset"]
namespace :mysql do
desc "reset MySQL database"
task :reset => [:drop, :create]
desc "create MySQL database"
task :create do
sh 'mysql -u root -e "create database marginalia_test;"'
end
desc "drop MySQL database"
task :drop do
sh 'mysql -u root -e "drop database if exists marginalia_test;"'
end
end
namespace :postgresql do
desc "reset PostgreSQL database"
task :reset => [:drop, :create]
desc "create PostgreSQL database"
task :create do
sh 'createdb -U postgres marginalia_test'
end
desc "drop PostgreSQL database"
task :drop do
sh 'psql -d postgres -U postgres -c "DROP DATABASE IF EXISTS marginalia_test"'
end
end
end