geordi 9.2.0 → 9.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/Gemfile.lock +1 -1
- data/README.md +9 -5
- data/lib/geordi/commands/dump.rb +12 -8
- data/lib/geordi/dump_loader.rb +28 -4
- data/lib/geordi/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e93051812acfd619f8d5a2db9c2641bb1ff19cf28835096cec1a2f6fd1487620
|
4
|
+
data.tar.gz: 4bc007b0985800b275de9dd0676cf0cbdf51a57800a4a426c0878738b9b00f43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07105d522e4ed9c4412e95f0e8bd5dfbfbd4c8ea7bb7a58f7f347473eafb5807f7ceeaf82dc18f80dd85c77699970342f91396eec35f4a113a5aad8e0b73dc6d
|
7
|
+
data.tar.gz: 7bb8747a1352e983c3c3cecc848ae2097a01341e8c1bd0d1b32537e0470085d43cec4a639dbdc36eaacdd8fad5f4bce981032c8d06efe11c8ab0951afe4bbaec
|
data/CHANGELOG.md
CHANGED
@@ -10,13 +10,17 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
10
10
|
### Breaking changes
|
11
11
|
|
12
12
|
|
13
|
+
## 9.3.0 2022-04-26
|
14
|
+
|
15
|
+
### Compatible changes
|
16
|
+
* Add dump loading in multi-database-setups.
|
17
|
+
|
18
|
+
|
13
19
|
## 9.2.0 2022-02-18
|
14
20
|
|
15
21
|
### Compatible changes
|
16
22
|
* Change the update mechanism of `geordi chromedriver-update`: This command (and `geordi cucumber`/`geordi tests` if the `auto_update_chromedriver` option is active) will now always update to the latest version of chromedriver for the current chrome version.
|
17
23
|
|
18
|
-
### Breaking changes
|
19
|
-
|
20
24
|
|
21
25
|
## 9.1.0 2022-02-14
|
22
26
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -195,16 +195,20 @@ specified target's database and downloads it to `tmp/`.
|
|
195
195
|
option) sources the dump into the development database after downloading it.
|
196
196
|
|
197
197
|
If you are using multiple databases per environment, Geordi defaults to the
|
198
|
-
"primary" database, or the first entry in database.yml. To
|
198
|
+
"primary" database, or the first entry in database.yml. To target a specific
|
199
199
|
database, pass the database name like this:
|
200
|
+
```
|
201
|
+
geordi dump -d primary
|
202
|
+
```
|
200
203
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
+
When used with the blank `load` option ("dump and source"), the `database` option
|
205
|
+
will be respected both for the remote *and* the local database. If these should
|
206
|
+
not match, please issue separate commands for dumping (`dump -d`) and sourcing
|
207
|
+
(`dump -l -d`).
|
204
208
|
|
205
209
|
**Options**
|
206
210
|
- `-l, [--load=[DUMP_FILE]]`: Load a dump
|
207
|
-
- `-d, [--database=NAME]`:
|
211
|
+
- `-d, [--database=NAME]`: Target database, if there are multiple databases
|
208
212
|
|
209
213
|
|
210
214
|
### `geordi help [COMMAND]`
|
data/lib/geordi/commands/dump.rb
CHANGED
@@ -12,16 +12,20 @@ specified target's database and downloads it to `tmp/`.
|
|
12
12
|
option) sources the dump into the development database after downloading it.
|
13
13
|
|
14
14
|
If you are using multiple databases per environment, Geordi defaults to the
|
15
|
-
"primary" database, or the first entry in database.yml. To
|
15
|
+
"primary" database, or the first entry in database.yml. To target a specific
|
16
16
|
database, pass the database name like this:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
```
|
18
|
+
geordi dump -d primary
|
19
|
+
```
|
20
|
+
|
21
|
+
When used with the blank `load` option ("dump and source"), the `database` option
|
22
|
+
will be respected both for the remote *and* the local database. If these should
|
23
|
+
not match, please issue separate commands for dumping (`dump -d`) and sourcing
|
24
|
+
(`dump -l -d`).
|
21
25
|
DESC
|
22
26
|
|
23
27
|
option :load, aliases: '-l', type: :string, desc: 'Load a dump', banner: '[DUMP_FILE]'
|
24
|
-
option :database, aliases: '-d', type: :string, desc: '
|
28
|
+
option :database, aliases: '-d', type: :string, desc: 'Target database, if there are multiple databases', banner: 'NAME'
|
25
29
|
|
26
30
|
def dump(target = nil, *_args)
|
27
31
|
require 'geordi/dump_loader'
|
@@ -33,7 +37,7 @@ def dump(target = nil, *_args)
|
|
33
37
|
Interaction.fail 'Missing a dump file.' if options.load == 'load'
|
34
38
|
File.exist?(options.load) || raise('Could not find the given dump file: ' + options.load)
|
35
39
|
|
36
|
-
loader = DumpLoader.new(options.load)
|
40
|
+
loader = DumpLoader.new(options.load, options.database)
|
37
41
|
|
38
42
|
Interaction.announce "Sourcing dump into the #{loader.config['database']} db"
|
39
43
|
loader.load
|
@@ -53,7 +57,7 @@ def dump(target = nil, *_args)
|
|
53
57
|
dump_path = Geordi::Remote.new(target).dump(options)
|
54
58
|
|
55
59
|
if options.load # … and dump loading
|
56
|
-
loader = DumpLoader.new(dump_path)
|
60
|
+
loader = DumpLoader.new(dump_path, options.database)
|
57
61
|
|
58
62
|
Interaction.announce "Sourcing dump into the #{loader.config['database']} db"
|
59
63
|
loader.load
|
data/lib/geordi/dump_loader.rb
CHANGED
@@ -6,24 +6,45 @@ require 'geordi/util'
|
|
6
6
|
module Geordi
|
7
7
|
class DumpLoader
|
8
8
|
|
9
|
-
def initialize(file)
|
9
|
+
def initialize(file, database)
|
10
10
|
@dump_file = file
|
11
|
+
@database = database
|
11
12
|
end
|
12
13
|
|
13
14
|
def development_database_config
|
15
|
+
return @config if @config
|
16
|
+
|
14
17
|
require 'yaml'
|
15
18
|
|
16
19
|
evaluated_config_file = ERB.new(File.read('config/database.yml')).result
|
17
20
|
|
18
21
|
# Allow aliases and a special set of classes like symbols and time objects
|
19
22
|
permitted_classes = [Symbol, Time]
|
20
|
-
|
23
|
+
database_config = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0')
|
21
24
|
YAML.safe_load(evaluated_config_file, permitted_classes: permitted_classes, aliases: true)
|
22
25
|
else
|
23
26
|
YAML.safe_load(evaluated_config_file, permitted_classes, [], true)
|
24
27
|
end
|
25
28
|
|
26
|
-
|
29
|
+
development_config = database_config['development']
|
30
|
+
|
31
|
+
if development_config.values[0].is_a? Hash # Multi-db setup
|
32
|
+
@config = if @database
|
33
|
+
development_config[@database] || Interaction.fail(%(Unknown development database "#{@database}".))
|
34
|
+
elsif development_config.has_key? 'primary'
|
35
|
+
development_config['primary']
|
36
|
+
else
|
37
|
+
development_config.values[0]
|
38
|
+
end
|
39
|
+
else # Single-db setup
|
40
|
+
if @database
|
41
|
+
Interaction.fail %(Could not select "#{@database}" database in a single-db setup.)
|
42
|
+
else
|
43
|
+
@config = development_config
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
@config
|
27
48
|
end
|
28
49
|
alias_method :config, :development_database_config
|
29
50
|
|
@@ -61,9 +82,12 @@ module Geordi
|
|
61
82
|
end
|
62
83
|
|
63
84
|
def load
|
85
|
+
adapter_command = "#{config['adapter']}_command"
|
86
|
+
Interaction.fail "Unknown database adapter #{config['adapter'].inspect} in config/database.yml." unless respond_to? adapter_command
|
87
|
+
|
64
88
|
Interaction.note 'Source file: ' + dump_file
|
65
89
|
|
66
|
-
source_command = send(
|
90
|
+
source_command = send(adapter_command)
|
67
91
|
Util.run! source_command, fail_message: "An error occurred loading #{File.basename(dump_file)}"
|
68
92
|
end
|
69
93
|
|
data/lib/geordi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geordi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
rubygems_version: 3.2.
|
119
|
+
rubygems_version: 3.2.30
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Collection of command line tools we use in our daily work with Ruby, Rails
|