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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e8dcb193d83d352bffb4f62670c93732de779a9471e51f942a0c20ddf19b89b
4
- data.tar.gz: 152f889f12fe2cfdeea9b1457bc1b6c9d083169d3400a1189588470fc061f4b2
3
+ metadata.gz: 2f8359f51e8fa9d619b9d84ede59104e711d59e33c2f034e6a3bc1a8933fd457
4
+ data.tar.gz: 2d234986282ecc98a4853a8d6b4f8103556ca10694596b399b534aab3b8ce3d5
5
5
  SHA512:
6
- metadata.gz: 04732b8f09ba0f7eba641fe8fa5cbff9ea625f311ce42db3b588345a7565b4631d4e67e81420b3b4f357afc98fff3021a458cdb08a03daf15ea93110512e444d
7
- data.tar.gz: '02938cfa637e316e97b70666a7615696ccc1d881711c8823954529fc109af32ef16f98f132938ce1e04e49c0f007b1e60563e725669aff040eb504e207b7dc5f'
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (12.5.0)
4
+ geordi (12.6.0)
5
5
  highline
6
6
  thor (~> 1)
7
7
 
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
- - `--compress`: After dumping, run gzip to compress the dump in place
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? '--for_download'
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.include?("--compress")
137
- environment, database = ARGV.reject { |arg| arg[0].chr == '-' }
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}"
@@ -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!("dumple development #{database}")
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 = options[:database] ? " (#{database}database)" : ""
56
+ database_label = target.dup
57
+ database_label << " (#{options[:database]} database)" if options[:database]
55
58
 
56
- Interaction.announce "Dumping the database of #{target}#{database_label}"
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 #{target}#{database_label}."
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
- shell options.merge({
39
- remote_command: "dumple #{@config.env}#{database} --for_download",
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
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '12.5.0'.freeze
2
+ VERSION = '12.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.5.0
4
+ version: 12.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch