forked from nacyot/dev-study.github.io.source
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
32 lines (28 loc) · 835 Bytes
/
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
require './config/boot.rb'
require 'sinatra'
require 'sinatra/activerecord'
require 'sinatra/activerecord/rake'
namespace :middleman do
desc "Server"
task :server do
`bundle exec middleman server --reload-paths=./config.rb`
end
desc "Guard"
task :watch do
sh 'MIDDLEMAN_ENV=test bundle exec guard', verbose: true
end
end
namespace :db do
namespace :test do
task :environment do
require 'active_record'
ActiveRecord::Base.establish_connection :adapter => 'sqlite3', :database => 'db/test.sqlite3'
end
desc "Migrate the database"
task(:migrate => :environment) do
# ActiveRecord::Base.logger = Logger.new(STDOUT)
# ActiveRecord::Migration.verbose = false
ActiveRecord::Migrator.migrate("db/migrate", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
end
end
end