-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
56 lines (47 loc) · 1.2 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
namespace :server do
config_dir = "./conf"
conf_file_name = "server-conf.yml"
desc 'start server daemon'
task :start do
sh "thin start -C #{config_dir}/#{conf_file_name}"
end
desc 'stop server daemon'
task :stop do
sh "thin stop -C #{config_dir}/#{conf_file_name}"
end
desc 'restart server daemon'
task :restart do
sh "thin restart -C #{config_dir}/#{conf_file_name}"
end
end
namespace :db do
task :migrate do
ActiveRecord::Migrator.migrate(
'db/migrate',
ENV["VERSION"] ? ENV["VERSION"].to_i : nil
)
end
task :create do
case SETTING["adapter"]
when "mysql2"
`mysql -u #{SETTING["username"]} -p -e "CREATE DATABASE #{SETTING["database"]} CHARACTER SET UTF8;"`
end
end
task :reset do
case SETTING["adapter"]
when "sqlite3"
`rm #{SETTING["database"]}`
when "mysql2"
`mysql -u #{SETTING["username"]} -p -e "DROP DATABASE #{SETTING["database"]}"`
end
`rake db:create`
`rake db:migrate`
end
end
desc 'convert .haml files into .html files'
task :haml do
dir_name = "./views"
Dir.glob("#{dir_name}/*.haml") do |path|
sh "haml #{path} > #{dir_name}/#{File.basename(path, ".haml")}.html"
end
end