geordi 12.5.0 → 12.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -8
- data/exe/dumple +18 -6
- data/lib/geordi/commands/dump.rb +8 -5
- data/lib/geordi/remote.rb +3 -4
- data/lib/geordi/util.rb +16 -0
- data/lib/geordi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f8359f51e8fa9d619b9d84ede59104e711d59e33c2f034e6a3bc1a8933fd457
|
4
|
+
data.tar.gz: 2d234986282ecc98a4853a8d6b4f8103556ca10694596b399b534aab3b8ce3d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8415640931dfa6738300ab40b3a4ace0d232993cf7b29aacc924f3b9de3a13b82b45b9064984dcc263883ec50bcc8717e97671140c8c45413842a94566e6ff13
|
7
|
+
data.tar.gz: c4f0ed717cd6dadfc770019444b35e47fc8176ff65971a99fef0e71eeb37d2e740201b000738db5e12bdf8d3043e957f77a05d92165fc2562fde9de6ea8239ec
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,14 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
10
10
|
### Breaking changes
|
11
11
|
|
12
12
|
|
13
|
+
## 12.6.0 2025-09-22
|
14
|
+
|
15
|
+
### Compatible changes
|
16
|
+
|
17
|
+
- `geordi dump`: Allow to forward the compression option to the underlying `dumple` command, e.g. `geordi dump --compress=zstd:3` (for PostgreSQL) or `geordi dump --compress` (for MySQL).
|
18
|
+
- `dumple`: Allow to specify a compression algorithm for PostgreSQL, e.g. `dumple --compress=zstd:3`. The already supported compression for MySQL `dumple --compress` is kept untouched.
|
19
|
+
|
20
|
+
|
13
21
|
## 12.5.0 2025-09-09
|
14
22
|
|
15
23
|
### Compatible changes
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -65,8 +65,8 @@ Example: `geordi chromedriver_update`
|
|
65
65
|
This command will find and install the matching chromedriver for the currently
|
66
66
|
installed Chrome.
|
67
67
|
|
68
|
-
Setting `auto_update_chromedriver` to `true` in your global Geordi config file
|
69
|
-
(`~/.config/geordi/global.yml`), will automatically update chromedriver before
|
68
|
+
Setting `auto_update_chromedriver` to `true` in your global Geordi config file
|
69
|
+
(`~/.config/geordi/global.yml`), will automatically update chromedriver before
|
70
70
|
cucumber tests if a newer chromedriver version is available.
|
71
71
|
|
72
72
|
|
@@ -98,8 +98,8 @@ servers. When passed a number, directly connects to the selected server.
|
|
98
98
|
IRB flags can be given as `irb_flags: '...'` in the global or local Geordi config file
|
99
99
|
(`~/.config/geordi/global.yml` / `./.geordi.yml`). If you define irb_flags in both files, the local config file will be
|
100
100
|
used. For IRB >=1.2 in combination with Ruby <3 geordi automatically sets the `--nomultiline` flag, to prevent slow
|
101
|
-
pasting. You can override this behavior by setting `--multiline` in the global config file or by defining `irb_flags`
|
102
|
-
in the local config file. The latter will always turn off the automatic behavior, even if you don't set any values for
|
101
|
+
pasting. You can override this behavior by setting `--multiline` in the global config file or by defining `irb_flags`
|
102
|
+
in the local config file. The latter will always turn off the automatic behavior, even if you don't set any values for
|
103
103
|
the irb_flags key.
|
104
104
|
|
105
105
|
**Options**
|
@@ -191,8 +191,8 @@ and offer to delete them. Excluded are databases that are whitelisted. This come
|
|
191
191
|
in handy when you're keeping your currently active projects in the whitelist files
|
192
192
|
and perform regular housekeeping with Geordi.
|
193
193
|
|
194
|
-
Per default, Geordi will try to connect to the databases as a local user without
|
195
|
-
password authorization.
|
194
|
+
Per default, Geordi will try to connect to the databases as a local user without
|
195
|
+
password authorization.
|
196
196
|
|
197
197
|
Geordi will ask for confirmation before actually dropping databases and will
|
198
198
|
offer to edit the whitelist instead.
|
@@ -234,6 +234,7 @@ not match, please issue separate commands for dumping (`dump -d`) and sourcing
|
|
234
234
|
**Options**
|
235
235
|
- `-l, --load=[DUMP_FILE]`: Load a dump
|
236
236
|
- `-d, --database=NAME`: Target database, if there are multiple databases
|
237
|
+
- `-c, --compress=[ALGORITHM]`: Compress the dump file (default for PSQL)
|
237
238
|
|
238
239
|
|
239
240
|
### `geordi help [COMMAND]`
|
@@ -341,7 +342,7 @@ Run all employed tests.
|
|
341
342
|
When running `geordi tests` without any arguments, all unit tests, rspec specs
|
342
343
|
and cucumber features will be run.
|
343
344
|
|
344
|
-
When passing file paths or directories as arguments, Geordi will forward them to `rspec` and `cucumber`.
|
345
|
+
When passing file paths or directories as arguments, Geordi will forward them to `rspec` and `cucumber`.
|
345
346
|
All rspec specs and cucumber features matching the given paths will be run.
|
346
347
|
|
347
348
|
|
@@ -389,7 +390,9 @@ Stores a timestamped database dump for the given Rails environment in `~/dumps`:
|
|
389
390
|
|
390
391
|
**Options**
|
391
392
|
- `-i`: Print disk usage of `~/dumps`
|
392
|
-
- `--
|
393
|
+
- `--fail-gently`: On error, do not crash but print a warning and exit(0)
|
394
|
+
- `--for-download`: Dump to `~/dumps/dump_for_download.dump`
|
395
|
+
- `--compress`: Compress the dump (default for PostgreSQL) and optionally set the compression algorithm (only available for PostgreSQL)
|
393
396
|
|
394
397
|
|
395
398
|
Contributing
|
data/exe/dumple
CHANGED
@@ -50,7 +50,7 @@ def cd_to_project_root(fail_gently)
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def dump_command(dump_file, config)
|
53
|
+
def dump_command(dump_file, config, compress)
|
54
54
|
host = config['host']
|
55
55
|
port = config['port']
|
56
56
|
|
@@ -79,6 +79,7 @@ def dump_command(dump_file, config)
|
|
79
79
|
command << " pg_dump #{config['database']}"
|
80
80
|
command << " --clean"
|
81
81
|
command << " --format=custom"
|
82
|
+
command << " --compress=#{compress}" if compress.is_a?(String)
|
82
83
|
command << " --file=#{dump_file}"
|
83
84
|
command << " --username=\"#{config['username']}\""
|
84
85
|
command << " --host=#{host}" if host
|
@@ -124,7 +125,7 @@ def prepare_dump_path(config)
|
|
124
125
|
run "chmod 700 #{DUMPS_DIR}"
|
125
126
|
end
|
126
127
|
|
127
|
-
if ARGV.include?
|
128
|
+
if ARGV.include?('--for_download') || ARGV.include?('--for-download')
|
128
129
|
"#{DUMPS_DIR}/dump_for_download.dump"
|
129
130
|
else
|
130
131
|
"#{DUMPS_DIR}/#{config['database']}_#{Time.now.strftime("%Y%m%d_%H%M%S")}.dump"
|
@@ -133,8 +134,14 @@ end
|
|
133
134
|
|
134
135
|
begin
|
135
136
|
fail_gently = ARGV.include?("--fail-gently")
|
136
|
-
compress = ARGV.
|
137
|
-
|
137
|
+
compress = ARGV.find do |argument|
|
138
|
+
if argument == '--compress'
|
139
|
+
break true
|
140
|
+
elsif argument.start_with?('--compress=')
|
141
|
+
break argument.split('=').last
|
142
|
+
end
|
143
|
+
end
|
144
|
+
environment, database = ARGV.reject { |argument| argument.start_with?('-') }
|
138
145
|
|
139
146
|
cd_to_project_root(fail_gently)
|
140
147
|
config = find_database_config(DB_CONFIG_PATH, environment, database)
|
@@ -142,12 +149,17 @@ begin
|
|
142
149
|
|
143
150
|
# Dump!
|
144
151
|
given_database = database ? %(#{database} ) : ""
|
145
|
-
command = dump_command(dump_path, config)
|
152
|
+
command = dump_command(dump_path, config, compress)
|
146
153
|
puts "> Dumping #{given_database}database for \"#{environment}\" environment ..."
|
147
154
|
run command or raise "x Creating the dump failed."
|
148
155
|
run "chmod 600 #{dump_path}"
|
149
156
|
|
150
|
-
if compress
|
157
|
+
if config['adapter'] == 'mysql' && compress.is_a?(String)
|
158
|
+
puts "> Cannot compress a MySQL dump with #{compress}, falling back to gzip."
|
159
|
+
end
|
160
|
+
|
161
|
+
# For PostgreSQL, #dump_command will do the compression. MySQL needs manual compression.
|
162
|
+
if config['adapter'] == 'mysql' && compress
|
151
163
|
puts "> Compressing the dump ..."
|
152
164
|
# gzip compresses in place
|
153
165
|
compress_success = run "gzip #{dump_path}"
|
data/lib/geordi/commands/dump.rb
CHANGED
@@ -26,11 +26,11 @@ DESC
|
|
26
26
|
|
27
27
|
option :load, aliases: '-l', type: :string, desc: 'Load a dump', banner: '[DUMP_FILE]'
|
28
28
|
option :database, aliases: '-d', type: :string, desc: 'Target database, if there are multiple databases', banner: 'NAME'
|
29
|
+
option :compress, aliases: '-c', type: :string, desc: 'Compress the dump file (default for PSQL)', banner: '[ALGORITHM]'
|
29
30
|
|
30
31
|
def dump(target = nil, *_args)
|
31
32
|
require 'geordi/dump_loader'
|
32
33
|
require 'geordi/remote'
|
33
|
-
database = options[:database] ? "#{options[:database]} " : ''
|
34
34
|
|
35
35
|
if target.nil? # Local …
|
36
36
|
if options.load # … dump loading
|
@@ -46,14 +46,17 @@ def dump(target = nil, *_args)
|
|
46
46
|
|
47
47
|
else # … dump creation
|
48
48
|
Interaction.announce 'Dumping the development database'
|
49
|
-
Util.run!(
|
49
|
+
Util.run!(Util.dumple_command('development', options))
|
50
|
+
|
51
|
+
database = "#{options[:database]} " if options[:database]
|
50
52
|
Interaction.success "Successfully dumped the #{database}development database."
|
51
53
|
end
|
52
54
|
|
53
55
|
else # Remote dumping …
|
54
|
-
database_label =
|
56
|
+
database_label = target.dup
|
57
|
+
database_label << " (#{options[:database]} database)" if options[:database]
|
55
58
|
|
56
|
-
Interaction.announce "Dumping the database of #{
|
59
|
+
Interaction.announce "Dumping the database of #{database_label}"
|
57
60
|
dump_path = Geordi::Remote.new(target).dump(options)
|
58
61
|
|
59
62
|
if options.load # … and dump loading
|
@@ -65,7 +68,7 @@ def dump(target = nil, *_args)
|
|
65
68
|
Util.run! "rm #{dump_path}"
|
66
69
|
Interaction.note "Dump file removed"
|
67
70
|
|
68
|
-
Interaction.success "Your #{loader.config['database']} database has now the data of #{
|
71
|
+
Interaction.success "Your #{loader.config['database']} database has now the data of #{database_label}."
|
69
72
|
end
|
70
73
|
end
|
71
74
|
|
data/lib/geordi/remote.rb
CHANGED
@@ -33,11 +33,9 @@ module Geordi
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def dump(options = {})
|
36
|
-
database = options[:database] ? " #{options[:database]}" : ''
|
37
36
|
# Generate dump on the server
|
38
|
-
|
39
|
-
|
40
|
-
})
|
37
|
+
dumple = Util.dumple_command(@config.env, options.merge(for_download: true))
|
38
|
+
shell(options.merge(remote_command: dumple))
|
41
39
|
|
42
40
|
destination_directory = File.join(@config.root, 'tmp')
|
43
41
|
FileUtils.mkdir_p destination_directory
|
@@ -48,6 +46,7 @@ module Geordi
|
|
48
46
|
server = @config.primary_server
|
49
47
|
Util.run!("scp -C #{@config.user(server)}@#{server}:#{REMOTE_DUMP_PATH} #{destination_path}")
|
50
48
|
|
49
|
+
database = " #{options[:database]}" if options[:database]
|
51
50
|
Interaction.success "Dumped the#{database} #{@stage} database to #{relative_destination}."
|
52
51
|
|
53
52
|
destination_path
|
data/lib/geordi/util.rb
CHANGED
@@ -119,6 +119,21 @@ module Geordi
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
+
def dumple_command(environment, options)
|
123
|
+
compress = if options[:compress] == 'compress'
|
124
|
+
'--compress'
|
125
|
+
elsif options[:compress]
|
126
|
+
"--compress=#{options[:compress]}"
|
127
|
+
end
|
128
|
+
|
129
|
+
cmd = ['dumple']
|
130
|
+
cmd << environment
|
131
|
+
cmd << options[:database]
|
132
|
+
cmd << compress
|
133
|
+
cmd << '--for-download' if options[:for_download]
|
134
|
+
|
135
|
+
cmd.compact.join(' ')
|
136
|
+
end
|
122
137
|
|
123
138
|
def deploy_targets
|
124
139
|
Dir['config/deploy/*'].map do |f|
|
@@ -205,6 +220,7 @@ module Geordi
|
|
205
220
|
def rspec_path?(path)
|
206
221
|
%r{(^|\/)spec|_spec\.rb($|:)}.match?(path)
|
207
222
|
end
|
223
|
+
|
208
224
|
end
|
209
225
|
end
|
210
226
|
end
|
data/lib/geordi/version.rb
CHANGED