gris 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gris/setup.rb +4 -0
- data/lib/gris/version.rb +1 -1
- data/lib/tasks/db.rake +12 -26
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7a9d87376c3a34905e0ae62a2cf778917964e9a
|
4
|
+
data.tar.gz: beb8cd90e47c105a9465cca0d212c09ee12e98ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a4b903572ba4db5c49f94a7492881cbea0e31e2dfc90114f145f52150474790974d33d074c50bbdf2a09c4cad938ce097d2b5aec74cf938d530fb70cd2b5018
|
7
|
+
data.tar.gz: bb006bd646aebde08d0fe1a313d975bdc4ae106fcec1965a11d5407b3141c2bccba335dc34e5ce5b067aaddc8c89742e24e85dd73f59aabb9bdbc3eaa3203b07
|
data/Gemfile.lock
CHANGED
data/lib/gris/setup.rb
CHANGED
data/lib/gris/version.rb
CHANGED
data/lib/tasks/db.rake
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
unless defined?(Rails)
|
2
2
|
task :environment do
|
3
|
-
require 'erb'
|
4
3
|
require './config/application.rb'
|
5
|
-
|
6
4
|
fail 'ActiveRecord Not Found' unless Module.const_defined?(:ActiveRecord)
|
7
5
|
end
|
8
6
|
|
@@ -22,27 +20,19 @@ unless defined?(Rails)
|
|
22
20
|
|
23
21
|
desc 'Create the database'
|
24
22
|
task create: :environment do
|
25
|
-
db =
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
o[:database] = 'postgres' if db['adapter'] == 'postgresql'
|
30
|
-
end
|
31
|
-
|
32
|
-
ActiveRecord::Base.establish_connection(options)
|
23
|
+
db = Gris.db_connection_details
|
24
|
+
admin_connection = db.merge(database: 'postgres',
|
25
|
+
schema_search_path: 'public')
|
26
|
+
ActiveRecord::Base.establish_connection(admin_connection)
|
33
27
|
ActiveRecord::Base.connection.create_database(db['database'])
|
34
28
|
end
|
35
29
|
|
36
30
|
desc 'Delete the database'
|
37
31
|
task drop: :environment do
|
38
|
-
db =
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
o[:database] = 'postgres' if db['adapter'] == 'postgresql'
|
43
|
-
end
|
44
|
-
|
45
|
-
ActiveRecord::Base.establish_connection(options)
|
32
|
+
db = Gris.db_connection_details
|
33
|
+
admin_connection = db.merge(database: 'postgres',
|
34
|
+
schema_search_path: 'public')
|
35
|
+
ActiveRecord::Base.establish_connection(admin_connection)
|
46
36
|
ActiveRecord::Base.connection.drop_database(db['database'])
|
47
37
|
end
|
48
38
|
|
@@ -65,17 +55,13 @@ unless defined?(Rails)
|
|
65
55
|
desc 'Load a schema.rb file into the database'
|
66
56
|
task load: :environment do
|
67
57
|
file = ENV['SCHEMA'] || 'db/schema.rb'
|
68
|
-
db =
|
69
|
-
|
58
|
+
db = Gris.db_connection_details
|
59
|
+
admin_connection = db.merge(database: 'postgres',
|
60
|
+
schema_search_path: 'public')
|
61
|
+
ActiveRecord::Base.establish_connection(admin_connection)
|
70
62
|
ActiveRecord::Schema.verbose = true
|
71
63
|
load(file)
|
72
64
|
end
|
73
65
|
end
|
74
|
-
|
75
|
-
desc 'Load the seed data from db/seeds.rb'
|
76
|
-
task seed: :environment do
|
77
|
-
ActiveRecord::Tasks::DatabaseTasks.seed_loader = Gris::ActiveRecordSeeder.new './db/seeds.rb'
|
78
|
-
ActiveRecord::Tasks::DatabaseTasks.load_seed
|
79
|
-
end
|
80
66
|
end
|
81
67
|
end
|