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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d24e479d857e250201458ae8d8e87857ca973677
4
- data.tar.gz: 95231f647554f326516432a6228963eccfd201b5
3
+ metadata.gz: f7a9d87376c3a34905e0ae62a2cf778917964e9a
4
+ data.tar.gz: beb8cd90e47c105a9465cca0d212c09ee12e98ae
5
5
  SHA512:
6
- metadata.gz: 3308f4baea02ab03e62da41a922c96a0fa41cc2909da23b07a7c4709b78c6d417832277b2b531aa31cc1cb9631a456a000605d66cf37a1f4fa1de231265289eb
7
- data.tar.gz: bee140a75df7feb198809c9cd5ab29733e90a6a52076d265f2181d697df05126c74076215590df394765f0fe64808f8798d07a779b819806c4d5a1c1d80c9f88
6
+ metadata.gz: 9a4b903572ba4db5c49f94a7492881cbea0e31e2dfc90114f145f52150474790974d33d074c50bbdf2a09c4cad938ce097d2b5aec74cf938d530fb70cd2b5018
7
+ data.tar.gz: bb006bd646aebde08d0fe1a313d975bdc4ae106fcec1965a11d5407b3141c2bccba335dc34e5ce5b067aaddc8c89742e24e85dd73f59aabb9bdbc3eaa3203b07
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gris (0.1.5)
4
+ gris (0.1.6)
5
5
  activesupport (~> 4.2, >= 4.2.0)
6
6
  dotenv (~> 1.0.2, >= 1.0.2)
7
7
  git (~> 1.2, >= 1.2.8)
@@ -15,5 +15,9 @@ module Gris
15
15
  def env=(environment)
16
16
  @_env = ActiveSupport::StringInquirer.new(environment)
17
17
  end
18
+
19
+ def db_connection_details
20
+ YAML.load(ERB.new(File.read('./config/database.yml')).result)[Gris.env]
21
+ end
18
22
  end
19
23
  end
@@ -1,5 +1,5 @@
1
1
  module Gris
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
 
4
4
  class Version
5
5
  class << self
@@ -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 = YAML.load(ERB.new(File.read('./config/database.yml')).result)[Gris.env]
26
-
27
- options = {}.tap do |o|
28
- o[:adapter] = db['adapter']
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 = YAML.load(ERB.new(File.read('./config/database.yml')).result)[Gris.env]
39
-
40
- options = {}.tap do |o|
41
- o[:adapter] = db['adapter']
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 = YAML.load(ERB.new(File.read('./config/database.yml')).result)[Gris.env]
69
- ActiveRecord::Base.establish_connection(db)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gris
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Fareed