phenix 0.7.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/phenix/version.rb +1 -1
  3. data/lib/phenix.rb +16 -9
  4. metadata +9 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6579c2a43b814939fee5b7be5aaa1e4ab6e316b3c4e9dc735500c033bf4d43cb
4
- data.tar.gz: d76b5c29e32c18bec0ba0e17a6e0c3a907db937c8bbaac7dcce469c754107893
3
+ metadata.gz: 8e08178e36e4d3383fa93d7410ef0b870dd5549e50d69a79c8cf74b7e74d5110
4
+ data.tar.gz: 2387284ebdf301559fb301579254c31f40d279060b14ddb4daf279602656243e
5
5
  SHA512:
6
- metadata.gz: 244b06ae752cfefdb33c15b2dd013950aed5d05c31ba651d8aba36aab319390e8f4e1853b0ee56f13a3095c2f908c00f3433f459d0945fd9ca4e4fddfe829fae
7
- data.tar.gz: 1032af97f7da4fd21c98b1fb8dbd50f8a9b85597dbe23f5c973394b0f41f5c01dc30ed3af2e8e68d6fd83bdac79de34027abf436832460dbd6b0674773be096f
6
+ metadata.gz: 3c56dda05491a697ba6fd0444eacf0b19bbc69e18af43a05d731a5a4d30e41bb21759ab38be6ac23e7cd47e31a04be8cb3cd64d121a36affb1610b691ce2fb3d
7
+ data.tar.gz: 64d70cf6691b14b5b8ccdbcea277f9752daaa08f1652081f72dcc23db0d871d26c5395cd019d62f091b7304b5ce69854a6787eedf01c09892cf771e1fd53931c
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Phenix
3
- VERSION = '0.7.0'
3
+ VERSION = '1.0.1'
4
4
  end
data/lib/phenix.rb CHANGED
@@ -42,9 +42,15 @@ module Phenix
42
42
  private
43
43
 
44
44
  def create_databases(with_schema)
45
+ # Ensure we've created _every_ database before attempting to populte them
46
+ # This avoids ActiveRecord caching issues if the cache maintains references
47
+ # to stale databases
45
48
  for_each_database do |name, conf|
46
49
  run_mysql_command(conf, "CREATE DATABASE IF NOT EXISTS #{conf['database']}")
47
- ActiveRecord::Base.establish_connection(name.to_sym)
50
+ end
51
+
52
+ for_each_database do |name, conf|
53
+ ActiveRecord::Base.establish_connection(conf)
48
54
  populate_database if with_schema
49
55
  end
50
56
  end
@@ -64,7 +70,15 @@ module Phenix
64
70
  end
65
71
 
66
72
  def for_each_database
67
- configuration_hashes = if ActiveRecord::VERSION::STRING < '6.1'
73
+ parse_configuration_hashes.each do |name, conf|
74
+ next if conf['database'].nil?
75
+ next if Phenix.skip_database.call(name, conf)
76
+ yield(name, conf)
77
+ end
78
+ end
79
+
80
+ def parse_configuration_hashes
81
+ if ActiveRecord::VERSION::STRING < '6.1'
68
82
  ActiveRecord::Base.configurations.to_h
69
83
  else
70
84
  # We need to get all the configurations and put them back into a hash
@@ -72,13 +86,6 @@ module Phenix
72
86
  ActiveRecord::Base.configurations
73
87
  .configurations
74
88
  .map { |c| [c.env_name, c.configuration_hash.with_indifferent_access] }
75
- .to_h
76
- end
77
-
78
- configuration_hashes.each do |name, conf|
79
- next if conf['database'].nil?
80
- next if Phenix.skip_database.call(name, conf)
81
- yield(name, conf)
82
89
  end
83
90
  end
84
91
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phenix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre Schambacher
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-10 00:00:00.000000000 Z
11
+ date: 2022-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '4.2'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '6.1'
36
+ version: '7.1'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '4.2'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '6.1'
46
+ version: '7.1'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -72,20 +72,6 @@ dependencies:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '3.4'
75
- - !ruby/object:Gem::Dependency
76
- name: wwtd
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: '0'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
75
  - !ruby/object:Gem::Dependency
90
76
  name: bump
91
77
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +114,7 @@ dependencies:
128
114
  - - ">="
129
115
  - !ruby/object:Gem::Version
130
116
  version: '0'
131
- description:
117
+ description:
132
118
  email:
133
119
  - pschambacher@zendesk.com
134
120
  executables: []
@@ -140,7 +126,7 @@ files:
140
126
  homepage: https://github.com/zendesk/phenix
141
127
  licenses: []
142
128
  metadata: {}
143
- post_install_message:
129
+ post_install_message:
144
130
  rdoc_options: []
145
131
  require_paths:
146
132
  - lib
@@ -155,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
141
  - !ruby/object:Gem::Version
156
142
  version: '0'
157
143
  requirements: []
158
- rubygems_version: 3.1.2
159
- signing_key:
144
+ rubygems_version: 3.1.6
145
+ signing_key:
160
146
  specification_version: 4
161
147
  summary: Read a dynamic database.yml file and allow you to drop/create the database
162
148
  on demand.