-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
51 lines (37 loc) · 1.04 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
# https://gist.github.com/drogus/6087979
require 'bundler/setup'
require 'active_record'
# FIX FOR ACTIVE RECORD TASKS
module Rails
def self.root
File.dirname(__FILE__)
end
def self.env
ENV['APP_ENV']
end
def self.application
Paths.new
end
end
class Paths
def paths
{ "db/migrate" => [File.expand_path("../db/migrate", __FILE__)] }
end
def load_seed
load File.expand_path("../db/seeds.rb", __FILE__)
end
end
# END FIX FOR ACTIVE RECORD TASKS
include ActiveRecord::Tasks
db_dir = File.expand_path('../db', __FILE__)
config_dir = File.expand_path('../config', __FILE__)
DatabaseTasks.env = ENV['ENV'] || :development
DatabaseTasks.db_dir = db_dir
DatabaseTasks.database_configuration = YAML.load_file(File.join(config_dir, 'database.yml'))
DatabaseTasks.migrations_paths = File.join(db_dir, 'migrate')
task :environment do
require_relative 'config/environment'
end
load 'active_record/railties/databases.rake'
# Load custom tasks
Dir.glob(File.expand_path('../lib/tasks/*.rake', __FILE__)).each { |r| import r }