-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
65 lines (51 loc) · 1.31 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
require 'yaml'
require 'yard'
namespace :run do
task :serve do
sh 'rackup'
end
task :prod do
sh 'pumactl -F puma.rb start'
end
task :stop do
sh 'pumactl -F puma.rb -S .pids/app.state -P .pids/app.pid stop'
end
task :restart do
sh 'pumactl -F puma.rb -S .pids/app.state -P .pids/app.pid restart'
end
end
namespace :db do
require 'bundler'
Bundler.require
Sequel.extension :migration
require './app/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, './app/migrations')
Rake::Task['db:version'].execute
end
task :rollback do |_t, args|
args.with_defaults(:target => 0)
Sequel::Migrator.run(DB, './app/migrations', :target => args[:target].to_i)
Rake::Task['db:version'].execute
end
task :reset do
Sequel::Migrator.run(DB, './app/migrations', :target => 0)
Sequel::Migrator.run(DB, './app/migrations')
Rake::Task['db:version'].execute
end
end
YARD::Rake::YardocTask.new do |t|
t.files = ['app/**/*.rb']
t.options = ['markup-provider=kramdown']
t.stats_options = ['--list-undoc']
end
task :test do
exec "cutest tests/*.rb"
end
task :default => :test