-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
32 lines (27 loc) · 876 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 'rake/tasklib'
require 'rake/testtask'
Rake::TestTask.new :test do |t|
# RACK_ENV = :test
t.libs << "test"
t.test_files = FileList['test/*_test.rb']
t.verbose = true
end
task :environment do
require 'environment'
end
namespace :db do
desc "Migrate the database"
task(:migrate => :environment) do
RACK_ENV = ENV['RACK_ENV'] || :development unless defined?(RACK_ENV)
Weed::ActiveRecord::Base.connection_args = { :adapter => 'sqlite3',
:database => File.dirname(__FILE__) + "/db/weed3.#{RACK_ENV}.sqlite3.db"
}
Weed::ActiveRecord::Base.establish_connection Weed::ActiveRecord::Base.connection_args
module Weed
Weed::ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Migration.verbose = true
Weed::ActiveRecord::Migrator.migrate("db/migrate/weed")
end
end
end
task :default => :test