-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
56 lines (44 loc) · 1.15 KB
/
Copy pathRakefile
File metadata and controls
56 lines (44 loc) · 1.15 KB
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
require 'yaml'
task :patch_sqlite do
`gcc -fPIC -shared ./db/extension-functions.c -o ./db/libsqlitefunctions.so -lm`
end
namespace :run do
task :dev do
sh 'rackup'
end
task :prod do
sh 'pumactl -F puma.rb start'
end
task :stop do
sh 'pumactl -F puma.rb -S .pids/pte.state -P .pids/pte.pid stop'
end
task :restart do
sh 'pumactl -F puma.rb -S .pids/pte.state -P .pids/pte.pid restart'
end
end
namespace :db do
require 'bundler'
Bundler.require
Sequel.extension :migration
require './initializers/sequel'
task :version do
version = if DB.tables.include?(:schema_info)
DB[:schema_info].first[:version]
end || 0
puts "Schema Version: #{version}"
end
task :migrate do
Sequel::Migrator.run(DB, 'migrations')
Rake::Task['db:version'].execute
end
task :rollback do |_t, args|
args.with_defaults(:target => 0)
Sequel::Migrator.run(DB, 'migrations', :target => args[:target].to_i)
Rake::Task['db:version'].execute
end
task :reset do
Sequel::Migrator.run(DB, 'migrations', :target => 0)
Sequel::Migrator.run(DB, 'migrations')
Rake::Task['db:version'].execute
end
end