geordi 5.2.0 → 5.3.0

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
  SHA256:
3
- metadata.gz: 4359df61d9901b0d3091ef950530212fb9ba92847425d136a42c4668d6745462
4
- data.tar.gz: c6cf00413126337330997068a59f097f226cdc41f9feb97d8523996d77ceeba5
3
+ metadata.gz: 693551524b9b50f70e2daf649cd8184cc197b1576153beaf675ebaae01a88e84
4
+ data.tar.gz: 915a4c3e1449f0883e31bd828a850354db26bcdcf57523ffdf28ade6e51bee1e
5
5
  SHA512:
6
- metadata.gz: 6a2b44bbe812e2a20bd2002ee64f3925108203f188d88e7da0f590cf2b7d2f4e01c744525c778cce47f6e1990ec44b2df65a95adaaa15cb4a6e2d3a8167ceddb
7
- data.tar.gz: 0f6441323fc798aba02f8d6947a803504e9bb11d3714001e1840959a90cf3763e590f45e112d94b6494996f78101bd73e5a7fb62440359c9c9b402dd1b9bc2a9
6
+ metadata.gz: bcbd43ffb224b54a7ba553c6bbcab6931d06b15df4a5e2e3eb9a93fe019187df47174bb2b61030a54d2408fb80235a1937eae7ff0a0f3c17e58756d3cbfc94b0
7
+ data.tar.gz: 03ef92df5d677f51ee70bec10bf035034824980b5c16c15c38e587de5b2a2cf683ddbce64067695e566fc9ee207d26af6f1986d909210b9fda61d9570bb91add
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.8
1
+ 2.2
data/CHANGELOG.md CHANGED
@@ -7,14 +7,41 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
7
7
  ## Unreleased
8
8
 
9
9
  ### Compatible changes
10
-
11
10
  ### Breaking changes
12
11
 
12
+ ## 5.3.0 2021-02-01
13
13
 
14
- ## 5.2.0 2020-12-14
14
+ ### Compatible changes
15
+ * Changed: Dumping and loading a database will not keep the database dump in `tmp/` but delete it once the operation finishes successfully. Example: `geordi dump staging -l` will remove the file `tmp/staging.dump` after it loaded the dump.
16
+
17
+
18
+ ## 5.2.4 2021-01-29
15
19
 
16
20
  ### Compatible changes
21
+ * Fix and improve delete-dumps command (now supporting multiple arguments)
22
+
23
+
24
+ ## 5.2.3 2021-01-27
25
+
26
+ ### Compatible changes
27
+ * Remove auto-bundling from `geordi shell` and remote `geordi console`
28
+
29
+
30
+ ## 5.2.2 2020-12-17
17
31
 
32
+ ### Compatible changes
33
+ * Ignore ACL settings when loading a PostgreSQL dump
34
+
35
+
36
+ ## 5.2.1 2020-12-15
37
+
38
+ ### Compatible changes
39
+ * Fix a bug regarding `geordi vnc` which was introduced in 5.1.0
40
+
41
+
42
+ ## 5.2.0 2020-12-14
43
+
44
+ ### Compatible changes
18
45
  * Geordi update will exit with a warning when Ruby version changes during pull.
19
46
  * Add `geordi docker` command with support for opening a shell for dockerized dev environments.
20
47
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (5.2.0)
4
+ geordi (5.3.0)
5
5
  thor (~> 1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -111,13 +111,13 @@ in `.geordi.yml` in the project root.
111
111
  ### `geordi delete-dumps [DIRECTORY]`
112
112
  Delete database dump files (*.dump).
113
113
 
114
- Example: `geordi delete_dumps` or `geordi delete_dumps ~/tmp/dumps`
114
+ Example: `geordi delete-dumps` or `geordi delete-dumps ~/tmp/dumps`
115
115
 
116
- Recursively search for files ending in `*.dump` and offer to delete those. When
116
+ Recursively searches for files ending in `.dump` and offers to delete them. When
117
117
  no argument is given, two default directories are searched for dump files: the
118
118
  current working directory and `~/dumps` (for dumps created with geordi).
119
119
 
120
- Geordi will ask for confirmation before actually deleting files.
120
+ Will ask for confirmation before actually deleting files.
121
121
 
122
122
 
123
123
  ### `geordi deploy [STAGE]`
@@ -169,8 +169,11 @@ There are three subcommands:
169
169
 
170
170
  - `geordi docker setup`
171
171
  Fetches all docker containers.
172
+
172
173
  - `geordi docker shell`
173
174
  Runs the docker service named 'main'.
175
+ Append `--secondary` to open a second shell in an already running container.
176
+
174
177
  - `geordi docker vnc`
175
178
  Opens a VNC viewer to connect to the VNC server in the container.
176
179
 
@@ -423,11 +426,9 @@ Once you have completed your modifications, please update CHANGELOG and README
423
426
  as needed. Use `rake readme` to regenerate the Geordi section of the README from
424
427
  the command documentations.
425
428
 
426
- Make sure tests are green in the default Ruby *plus* in the oldest Ruby > 1.8
427
- that you have installed on your system (1.8.7 support has been dropped).
428
-
429
- Before releasing your changes, wait for the Travis results to see that tests
430
- passed in all Ruby versions.
429
+ Make sure tests are green in the oldest supported Ruby version. Before releasing
430
+ a new gem version, wait for the CI results to see that tests are green in all
431
+ Ruby versions.
431
432
 
432
433
 
433
434
  Adding a new command
@@ -14,9 +14,9 @@ option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
14
14
 
15
15
  def console(target = 'development', *_args)
16
16
  require 'geordi/remote'
17
- invoke_geordi 'bundle_install'
18
17
 
19
18
  if target == 'development'
19
+ invoke_geordi 'bundle_install'
20
20
  invoke_geordi 'yarn_install'
21
21
 
22
22
  Interaction.announce 'Opening a local Rails console'
@@ -1,43 +1,41 @@
1
1
  desc 'delete-dumps [DIRECTORY]', 'Delete database dump files (*.dump)'
2
2
  long_desc <<-LONGDESC
3
- Example: `geordi delete_dumps` or `geordi delete_dumps ~/tmp/dumps`
3
+ Example: `geordi delete-dumps` or `geordi delete-dumps ~/tmp/dumps`
4
4
 
5
- Recursively search for files ending in `*.dump` and offer to delete those. When
5
+ Recursively searches for files ending in `.dump` and offers to delete them. When
6
6
  no argument is given, two default directories are searched for dump files: the
7
7
  current working directory and `~/dumps` (for dumps created with geordi).
8
8
 
9
- Geordi will ask for confirmation before actually deleting files.
9
+ Will ask for confirmation before actually deleting files.
10
10
  LONGDESC
11
11
 
12
- def delete_dumps(dump_directory = nil)
13
- deletable_dumps = []
14
- dump_directories = if dump_directory.nil?
15
- [
16
- File.join(Dir.home, 'dumps'),
17
- Dir.pwd,
18
- ]
19
- else
20
- [dump_directory]
12
+ def delete_dumps(*locations)
13
+ Interaction.announce 'Retrieving dump files'
14
+
15
+ dump_files = []
16
+ if locations.empty?
17
+ locations = [ File.join(Dir.home, 'dumps'), Dir.pwd ]
21
18
  end
22
- Interaction.announce 'Looking for *.dump in ' << dump_directories.join(',')
23
- dump_directories.each do |d|
24
- d_2 = File.expand_path(d)
25
- unless File.directory? File.realdirpath(d_2)
26
- Interaction.warn "Directory #{d_2} does not exist"
19
+ locations.map! &File.method(:expand_path)
20
+
21
+ Interaction.note "Looking in #{locations.join(', ')}"
22
+ locations.each do |dir|
23
+ directory = File.expand_path(dir)
24
+ unless File.directory? File.realdirpath(directory)
25
+ Interaction.warn "Directory #{directory} does not exist. Skipping."
27
26
  next
28
27
  end
29
- deletable_dumps.concat(Dir.glob("#{d_2}/**/*.dump"))
28
+ dump_files.concat Dir.glob("#{directory}/**/*.dump")
30
29
  end
30
+ deletable_dumps = dump_files.flatten.uniq.sort.select &File.method(:file?)
31
+
31
32
  if deletable_dumps.empty?
32
- Interaction.success 'No dumps to delete' if deletable_dumps.empty?
33
- exit 0
34
- end
35
- deletable_dumps.uniq!.sort!
36
- Interaction.note 'The following dumps can be deleted:'
37
- puts
38
- puts deletable_dumps
39
- Interaction.prompt('Delete those dumps', 'n', /y|yes/) || raise('Cancelled.')
40
- deletable_dumps.each do |dump|
41
- File.delete dump unless File.directory? dump
33
+ Interaction.note 'No dump files found'
34
+ else
35
+ puts deletable_dumps
36
+ Interaction.prompt('Delete these files?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
37
+
38
+ deletable_dumps.each &File.method(:delete)
39
+ Interaction.success 'Done.'
42
40
  end
43
41
  end
@@ -1,17 +1,17 @@
1
1
  class DockerCLI < Thor
2
- desc 'setup', 'Setup docker and fetch required docker-container for the current project.'
2
+ desc 'setup', 'Setup docker and fetch required docker-container for the current project'
3
3
  def setup
4
4
  docker.setup
5
5
  end
6
6
 
7
- desc 'shell', 'Open a shell in the main docker container for the current project.'
7
+ desc 'shell', 'Open a shell in the main docker container for the current project'
8
8
  option :secondary, default: false, type: :boolean
9
9
  map 'shell' => '_shell'
10
10
  def _shell
11
11
  docker.shell(:secondary => options[:secondary])
12
12
  end
13
13
 
14
- desc 'vnc', 'Open a vnc viewer connecting to the docker container.'
14
+ desc 'vnc', 'Open a vnc viewer connecting to the docker container'
15
15
  def vnc
16
16
  docker.vnc
17
17
  end
@@ -24,7 +24,7 @@ class DockerCLI < Thor
24
24
  end
25
25
  end
26
26
 
27
- desc 'docker', 'Manage docker containers for the current project.'
27
+ desc 'docker', 'Manage docker containers for the current project'
28
28
  long_desc <<-LONGDESC
29
29
  Manage docker containers to run your project dockerized.
30
30
 
@@ -35,10 +35,12 @@ There are three subcommands:
35
35
 
36
36
  - `geordi docker setup`
37
37
  Fetches all docker containers.
38
+
38
39
  - `geordi docker shell`
39
40
  Runs the docker service named 'main'.
41
+ Append `--secondary` to open a second shell in an already running container.
42
+
40
43
  - `geordi docker vnc`
41
44
  Opens a VNC viewer to connect to the VNC server in the container.
42
-
43
45
  LONGDESC
44
46
  subcommand 'docker', DockerCLI
@@ -15,8 +15,6 @@ option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
15
15
  def shelll(target, *_args)
16
16
  require 'geordi/remote'
17
17
 
18
- invoke_geordi 'bundle_install'
19
-
20
18
  Interaction.announce 'Opening a shell on ' + target
21
19
  Geordi::Remote.new(target).shell(options)
22
20
  end
@@ -11,7 +11,7 @@ module Geordi
11
11
  class Cucumber
12
12
 
13
13
  VNC_DISPLAY = ':17'.freeze
14
- VNC_PASSWORD_FILE = File.absolute_path('~/.vnc/passwd').freeze # default for "vncpasswd"
14
+ VNC_PASSWORD_FILE = File.expand_path('~/.vnc/passwd').freeze # default for "vncpasswd"
15
15
  VNC_SERVER_DEFAULT_OPTIONS = "-localhost -nolisten tcp -geometry 1280x1024 -rfbauth #{VNC_PASSWORD_FILE}".freeze
16
16
  VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} #{ENV.fetch('GEORDI_VNC_OPTIONS', VNC_SERVER_DEFAULT_OPTIONS)}".freeze
17
17
  VNC_VIEWER_COMMAND = "vncviewer -passwd #{VNC_PASSWORD_FILE}".freeze
@@ -60,7 +60,7 @@ module Geordi
60
60
  VNC_ENV_VARIABLES.each do |variable|
61
61
  ENV["OUTER_#{variable}"] = ENV[variable] if ENV[variable]
62
62
  end
63
- ENV['BROWSER'] = ENV['LAUNCHY_BROWSER'] = File.expand_path('../../bin/launchy_browser', __dir__)
63
+ ENV['BROWSER'] = ENV['LAUNCHY_BROWSER'] = File.expand_path('../../exe/launchy_browser', __dir__)
64
64
  ENV['DISPLAY'] = VNC_DISPLAY
65
65
 
66
66
  Interaction.note 'Run `geordi vnc` to view the Selenium test browsers'
@@ -34,7 +34,7 @@ module Geordi
34
34
 
35
35
  def postgresql_command
36
36
  ENV['PGPASSWORD'] = config['password']
37
- command = 'pg_restore --no-owner --clean'
37
+ command = 'pg_restore --no-owner --clean --no-acl'
38
38
  command << ' --username=' << config['username'].to_s if config['username']
39
39
  command << ' --port=' << config['port'].to_s if config['port']
40
40
  command << ' --host=' << config['host'].to_s if config['host']
@@ -58,6 +58,10 @@ module Geordi
58
58
 
59
59
  source_command = send("#{config['adapter']}_command")
60
60
  Util.run! source_command, fail_message: "An error occured loading #{File.basename(dump_file)}"
61
+
62
+ Interaction.announce 'Clean up'
63
+ Interaction.note 'Removing: ' + dump_file
64
+ Util.run!("rm #{dump_file}")
61
65
  end
62
66
 
63
67
  end
data/lib/geordi/remote.rb CHANGED
@@ -59,7 +59,7 @@ module Geordi
59
59
  server_option = options[:select_server]
60
60
  server_number = server_option.to_i
61
61
 
62
- server = if server_option == 'select_server'
62
+ server = if server_option == 'select_server'
63
63
  select_server
64
64
  elsif server_number != 0 && server_number <= @config.servers.count
65
65
  server_index = server_number - 1
data/lib/geordi/util.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'geordi/interaction'
2
2
  require 'socket'
3
+ require 'bundler'
3
4
 
4
5
  module Geordi
5
6
  class Util
@@ -167,15 +168,10 @@ module Geordi
167
168
  # Get the version for the given gem by parsing Gemfile.lock.
168
169
  # Returns nil if the gem is not used.
169
170
  def gem_version(gem)
170
- # Lines look like `* will_paginate (2.3.15)` or `railslts-version (2.3.18.16 7f51cc7)`
171
- bundle_list.split("\n").each do |line|
172
- matches = line.match(/\* #{gem} \(([\d\.]+)/)
173
- next if matches.nil? || matches[1].nil?
171
+ lock_file = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
172
+ spec = lock_file.specs.detect { |spec| spec.name == gem }
174
173
 
175
- return Gem::Version.new(matches[1])
176
- end
177
-
178
- nil
174
+ spec && spec.version
179
175
  end
180
176
 
181
177
  def file_containing?(file, regex)
@@ -192,12 +188,6 @@ module Geordi
192
188
  string
193
189
  end
194
190
 
195
- private
196
-
197
- def bundle_list
198
- @bundle_list ||= `bundle list`
199
- end
200
-
201
191
  end
202
192
  end
203
193
  end
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '5.2.0'.freeze
2
+ VERSION = '5.3.0'.freeze
3
3
  end
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: 5.2.0
4
+ version: 5.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: 2020-12-14 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.1.4
121
+ rubygems_version: 3.0.8
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Collection of command line tools we use in our daily work with Ruby, Rails