-
Notifications
You must be signed in to change notification settings - Fork 0
/
rakefile
78 lines (63 loc) · 1.69 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
67
68
69
70
71
72
73
74
75
76
77
78
# Because of some difference between ruby 1.8.7 et 1.9.2
if !defined? require_relative
require 'app/pastatron'
else
require_relative 'app/pastatron'
end
desc "default task"
task :default do
sh "rake -T"
end
desc "Reset and migrate the DB"
task :migrate do
DataMapper.auto_migrate!
end
desc "Let's start thin !"
task :start do
sh "thin -s 1 -C config/config.yml -R config/config.ru start"
end
desc "Let's stop thin !"
task :stop do
sh "thin -s 1 -C config/config.yml -R config/config.ru stop"
end
desc "Let's restart thin !"
task :restart do
sh "thin -s 1 -C config/config.yml -R config/config.ru restart"
end
desc "Let's set the app to dev mode"
task :set_to_dev do
require "yaml"
puts 'Set to dev config'
myconfig = YAML.load_file( 'config/config.yml' )
if myconfig['environment'] == "development"
puts "Config already in dev mode"
else
puts "Config was #{myconfig['environment']} set to dev mode"
myconfig['environment'] = "development"
File.open("config/config.yml", "w") do |f|
f.write(myconfig.to_yaml)
end
end
end
desc "Let's set the app to prod mode"
task :set_to_prod do
require "yaml"
puts 'Set to prod config'
myconfig = YAML.load_file( 'config/config.yml' )
if myconfig['environment'] == "production"
puts "Config already in prod mode"
else
puts "Config was #{myconfig['environment']} has been set to prod mode"
myconfig['environment'] = "production"
File.open("config/config.yml", "w") do |f|
f.write(myconfig.to_yaml)
end
end
end
desc "Let's show the config"
task :show_config do
require "yaml"
myconfig = YAML.load_file( 'config/config.yml' )
puts myconfig.to_yaml
end
# vim: set sts=2 ts=2 sw=2 expandtab: