geordi 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CHANGELOG.md +36 -2
- data/Gemfile.lock +1 -1
- data/README.md +46 -3
- data/lib/geordi/COMMAND_TEMPLATE +2 -3
- data/lib/geordi/chromedriver_updater.rb +7 -8
- data/lib/geordi/cli.rb +0 -1
- data/lib/geordi/commands/_setup_vnc.rb +22 -22
- data/lib/geordi/commands/bundle_install.rb +1 -1
- data/lib/geordi/commands/capistrano.rb +4 -4
- data/lib/geordi/commands/clean.rb +6 -5
- data/lib/geordi/commands/commit.rb +1 -1
- data/lib/geordi/commands/console.rb +11 -3
- data/lib/geordi/commands/create_database_yml.rb +2 -2
- data/lib/geordi/commands/create_databases.rb +1 -1
- data/lib/geordi/commands/cucumber.rb +16 -9
- data/lib/geordi/commands/delete_dumps.rb +5 -5
- data/lib/geordi/commands/deploy.rb +19 -19
- data/lib/geordi/commands/drop_databases.rb +3 -3
- data/lib/geordi/commands/dump.rb +8 -9
- data/lib/geordi/commands/firefox.rb +2 -2
- data/lib/geordi/commands/migrate.rb +3 -3
- data/lib/geordi/commands/png_optimize.rb +5 -5
- data/lib/geordi/commands/rake.rb +1 -1
- data/lib/geordi/commands/remove_executable_flags.rb +2 -2
- data/lib/geordi/commands/rspec.rb +5 -5
- data/lib/geordi/commands/security_update.rb +76 -19
- data/lib/geordi/commands/server.rb +2 -2
- data/lib/geordi/commands/setup.rb +3 -3
- data/lib/geordi/commands/shell.rb +7 -3
- data/lib/geordi/commands/tests.rb +1 -1
- data/lib/geordi/commands/unit.rb +2 -2
- data/lib/geordi/commands/update.rb +2 -2
- data/lib/geordi/commands/with_rake.rb +2 -2
- data/lib/geordi/commands/yarn_install.rb +1 -1
- data/lib/geordi/cucumber.rb +18 -17
- data/lib/geordi/db_cleaner.rb +21 -22
- data/lib/geordi/dump_loader.rb +5 -4
- data/lib/geordi/firefox_for_selenium.rb +17 -19
- data/lib/geordi/gitpt.rb +10 -53
- data/lib/geordi/interaction.rb +2 -6
- data/lib/geordi/remote.rb +17 -6
- data/lib/geordi/settings.rb +155 -0
- data/lib/geordi/util.rb +14 -9
- data/lib/geordi/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e775f88b224275cf01077937ba959b27666c1ae7ac18b58548a62bfa31161a12
|
4
|
+
data.tar.gz: 4e0efdb89bbf65b69a9753e8e05978b094915b613b1ded6ef1c1ea4716be0ea7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56146e32a18966efbe63a58074d158b888410cf19520150d175f3220be709820b7b05ed6f95df5f80993ed163ba9b59232f1d1f67c3bd43d2055e9b2d66cd812
|
7
|
+
data.tar.gz: e8e41bb61713a5f32dd4039cadee5b11a9f08bac20cad738e61975ea741bfd76cdf5e2d64a166579e701eda472f95f4f8ce15da27181fa0a8b11b748f5d222d3
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Changelog
|
2
|
+
|
2
3
|
All notable changes to this project will be documented in this file.
|
3
4
|
|
4
5
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
@@ -7,13 +8,46 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
7
8
|
## Unreleased
|
8
9
|
|
9
10
|
### Compatible changes
|
10
|
-
|
11
11
|
### Breaking changes
|
12
12
|
|
13
13
|
|
14
|
-
## 3.
|
14
|
+
## 3.2.0 2020-07-15
|
15
|
+
|
16
|
+
### Compatible changes
|
17
|
+
- Improvement #43: `--select-server` option on `geordi shell` and `geordi console` can take the number of the server to connect to it directly and to skip the menu.
|
18
|
+
- Add a `.geordi.yml` file to change multiple settings in the project and `~/.config/geordi/global.yml` for global settings.
|
19
|
+
- Deprecated the `.pt_project_id` file in favor of `.geordi.yml`.
|
20
|
+
- Deprecated the `~/.gitpt` file in favor of `~/.config/geordi/global.yml`.
|
21
|
+
- Add #91: Now there is an option to start cucumber without a VNC session. This is configured by the .geordi.yml file.
|
22
|
+
- Fixed `git#staged_changes?` detection on Ruby < 2.5.
|
23
|
+
|
24
|
+
|
25
|
+
## 3.1.0 2020-06-03
|
26
|
+
|
27
|
+
### Compatible changes
|
28
|
+
- Update security-update for improved workflow (#89): Deploy staging first and ask user, if application is still running. Then deploy other stages.
|
29
|
+
|
30
|
+
|
31
|
+
## 3.0.3 2020-05-27
|
15
32
|
|
16
33
|
### Compatible changes
|
34
|
+
- Fix #98: Changing the `config/database.yml` reader from `YAML.load` to `YAML.safe_load` dropped the support for aliases. We now allow aliases and the classes `Time` and `Symbol`. If we encounter further issues with this approach a revert to `YAML.load` would be an option, too.
|
35
|
+
|
36
|
+
|
37
|
+
## 3.0.2 2020-05-18
|
38
|
+
|
39
|
+
### Compatible changes
|
40
|
+
- Fix #95: Method change from `! *.include?` to `*.exclude?` was not valid as we do not have active support in Geordi. Affected commands were `geordi cucumber` and `geordi deploy`.
|
41
|
+
|
42
|
+
|
43
|
+
## 3.0.1 2020-05-13
|
44
|
+
|
45
|
+
### Compatible changes
|
46
|
+
- Fix #93: Using `$CHILDSTATUS` instead of `$?` did not work properly. This affected commands like `geordi drop-databases` to fail.
|
47
|
+
- Fix #92: Geordi fail messages were converted to exceptions by accident. Now they are printed as red error message without the backtrace again.
|
48
|
+
|
49
|
+
|
50
|
+
## 3.0.0 2020-05-04
|
17
51
|
|
18
52
|
### Breaking changes
|
19
53
|
- Remove support for Ruby 1.8.7 and Ruby 1.9.3. Bug fixes might still be backported to 2.x, but we will not add any features to 2.x anymore. Please consider to upgrade the Ruby version of your project.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -54,8 +54,13 @@ Commit using a story title from Pivotal Tracker.
|
|
54
54
|
|
55
55
|
Example: `geordi commit`
|
56
56
|
|
57
|
+
Any extra arguments are forwarded to `git commit -m <message>`.
|
58
|
+
|
59
|
+
If there are no staged changes, prints a warning but will continue to create
|
60
|
+
an empty commit.
|
61
|
+
|
57
62
|
On the first execution we ask for your Pivotal Tracker API token. It will be
|
58
|
-
stored in `~/.
|
63
|
+
stored in `~/.config/geordi/global.yml`.
|
59
64
|
|
60
65
|
|
61
66
|
### `geordi console [TARGET]`
|
@@ -66,6 +71,14 @@ Open a local Rails console: `geordi console`
|
|
66
71
|
|
67
72
|
Open a Rails console on `staging`: `geordi console staging`
|
68
73
|
|
74
|
+
Lets you select the server to connect to from a menu when called with `--select-server` or the alias `-s`:
|
75
|
+
|
76
|
+
geordi console staging -s
|
77
|
+
|
78
|
+
If you already know the number of the server you want to connect to, just pass it along:
|
79
|
+
|
80
|
+
geordi console staging -s2
|
81
|
+
|
69
82
|
|
70
83
|
### `geordi cucumber [FILES and OPTIONS]`
|
71
84
|
|
@@ -87,6 +100,12 @@ or `-d`.
|
|
87
100
|
- *Options:* Any unknown option will be passed through to Cucumber,
|
88
101
|
e.g. `--format pretty`.
|
89
102
|
|
103
|
+
- *VNC:* By default, test browsers will run in a VNC session. When using a
|
104
|
+
headless test browser anyway, you can disable VNC by putting the following
|
105
|
+
config into `.geordi.yml` in the project root:
|
106
|
+
|
107
|
+
use_vnc: false
|
108
|
+
|
90
109
|
|
91
110
|
### `geordi delete-dumps [DIRECTORY]`
|
92
111
|
|
@@ -255,10 +274,30 @@ Support for performing security updates.
|
|
255
274
|
|
256
275
|
Preparation for security update: `geordi security-update`
|
257
276
|
|
277
|
+
Checks out production and pulls.
|
278
|
+
|
258
279
|
After performing the update: `geordi security-update finish`
|
259
280
|
|
260
281
|
Switches branches, pulls, pushes and deploys as required by our workflow. Tells
|
261
|
-
what it will do before it does it.
|
282
|
+
what it will do before it does it. In detail:
|
283
|
+
|
284
|
+
1. Asks user, if tests are green
|
285
|
+
|
286
|
+
2. Pushes production
|
287
|
+
|
288
|
+
3. Checks out master and pulls
|
289
|
+
|
290
|
+
4. Merges production and pushes in master
|
291
|
+
|
292
|
+
5. Deploys staging first, if there is a staging environment
|
293
|
+
|
294
|
+
6. Asks user, if deployment log is okay and application is still running on staging
|
295
|
+
|
296
|
+
7. Deploys other stages
|
297
|
+
|
298
|
+
8. Asks user, if deployment log is okay and application is still running on all other stages
|
299
|
+
|
300
|
+
9. Informs user about the next steps
|
262
301
|
|
263
302
|
|
264
303
|
### `geordi server [PORT]`
|
@@ -295,10 +334,14 @@ Open a shell on a Capistrano deploy target.
|
|
295
334
|
|
296
335
|
Example: `geordi shell production`
|
297
336
|
|
298
|
-
Lets you select the server to connect to when called with `--select-server`:
|
337
|
+
Lets you select the server to connect to from a menu when called with `--select-server` or the alias `-s`:
|
299
338
|
|
300
339
|
geordi shell production -s
|
301
340
|
|
341
|
+
If you already know the number of the server you want to connect to, just pass it along:
|
342
|
+
|
343
|
+
geordi shell production -s2
|
344
|
+
|
302
345
|
|
303
346
|
### `geordi tests`
|
304
347
|
|
data/lib/geordi/COMMAND_TEMPLATE
CHANGED
@@ -21,10 +21,9 @@ def example
|
|
21
21
|
# Invoke other commands like this:
|
22
22
|
invoke_cmd 'other_command', 'argument', an: 'option'
|
23
23
|
|
24
|
-
fail 'Option missing' unless options.opt?
|
24
|
+
Interaction.fail 'Option missing' unless options.opt?
|
25
25
|
|
26
|
-
|
27
|
-
success 'Done.'
|
26
|
+
Interaction.success 'Done.'
|
28
27
|
end
|
29
28
|
|
30
29
|
# Command mappings, usually not needed
|
@@ -4,14 +4,13 @@ require 'tempfile'
|
|
4
4
|
|
5
5
|
module Geordi
|
6
6
|
class ChromedriverUpdater
|
7
|
-
include Geordi::Interaction
|
8
7
|
|
9
8
|
def run
|
10
9
|
chrome_version = determine_chrome_version
|
11
10
|
chromedriver_version = determine_chromedriver_version
|
12
11
|
|
13
12
|
if skip_update?(chrome_version, chromedriver_version)
|
14
|
-
warn("No update required, you are using for both executables the same version #{chrome_version}!")
|
13
|
+
Interaction.warn("No update required, you are using for both executables the same version #{chrome_version}!")
|
15
14
|
else
|
16
15
|
chromedriver_zip = download_chromedriver(chrome_version)
|
17
16
|
unzip(chromedriver_zip, File.expand_path('~/bin'))
|
@@ -19,7 +18,7 @@ module Geordi
|
|
19
18
|
chromedriver_zip.unlink
|
20
19
|
|
21
20
|
# We need to determine the version again, as it could be nil in case no chromedriver was installed before
|
22
|
-
note "Chromedriver updated to version #{determine_chromedriver_version}"
|
21
|
+
Interaction.note "Chromedriver updated to version #{determine_chromedriver_version}"
|
23
22
|
end
|
24
23
|
end
|
25
24
|
|
@@ -32,7 +31,7 @@ module Geordi
|
|
32
31
|
end
|
33
32
|
|
34
33
|
if !status.success? || chrome_version.nil?
|
35
|
-
|
34
|
+
Interaction.fail('Could not determine the current Google Chrome version')
|
36
35
|
else
|
37
36
|
chrome_version.to_i
|
38
37
|
end
|
@@ -47,7 +46,7 @@ module Geordi
|
|
47
46
|
end
|
48
47
|
|
49
48
|
if !status.success? || chromedriver_version.nil?
|
50
|
-
|
49
|
+
Interaction.fail('Could not determine the current chromedriver version')
|
51
50
|
else
|
52
51
|
chromedriver_version.to_i
|
53
52
|
end
|
@@ -69,7 +68,7 @@ module Geordi
|
|
69
68
|
|
70
69
|
file
|
71
70
|
else
|
72
|
-
|
71
|
+
Interaction.fail("Could not download chromedriver version #{latest_version}")
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
@@ -80,7 +79,7 @@ module Geordi
|
|
80
79
|
if response.is_a?(Net::HTTPSuccess)
|
81
80
|
response.body.to_s
|
82
81
|
else
|
83
|
-
|
82
|
+
Interaction.fail("Could not find the latest version for Google Chrome version #{chrome_version}")
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
@@ -88,7 +87,7 @@ module Geordi
|
|
88
87
|
_stdout_str, _error_str, status = Open3.capture3('unzip', '-d', output_dir, '-o', zip.path)
|
89
88
|
|
90
89
|
unless status.success?
|
91
|
-
|
90
|
+
Interaction.fail("Could not unzip #{zip.path}")
|
92
91
|
end
|
93
92
|
end
|
94
93
|
end
|
data/lib/geordi/cli.rb
CHANGED
@@ -2,33 +2,33 @@ desc '-setup-vnc', 'Setup VNC for running Selenium tests there', hide: true
|
|
2
2
|
def _setup_vnc
|
3
3
|
`clear`
|
4
4
|
|
5
|
-
note 'This script will help you install a VNC server and a VNC viewer.'
|
5
|
+
Interaction.note 'This script will help you install a VNC server and a VNC viewer.'
|
6
6
|
puts
|
7
|
-
puts strip_heredoc <<-TEXT
|
7
|
+
puts Util.strip_heredoc <<-TEXT
|
8
8
|
With those you will be able to use our cucumber script without being
|
9
9
|
disturbed by focus-stealing Selenium windows. Instead, they will open
|
10
10
|
inside a VNC session.
|
11
11
|
|
12
12
|
You can still inspect everything with:
|
13
13
|
TEXT
|
14
|
-
note_cmd 'geordi vnc'
|
14
|
+
Interaction.note_cmd 'geordi vnc'
|
15
15
|
puts
|
16
|
-
note 'Please open a second shell to execute instructions.'
|
17
|
-
prompt 'Continue ...'
|
16
|
+
Interaction.note 'Please open a second shell to execute instructions.'
|
17
|
+
Interaction.prompt 'Continue ...'
|
18
18
|
|
19
|
-
announce 'Setup VNC server'
|
19
|
+
Interaction.announce 'Setup VNC server'
|
20
20
|
|
21
21
|
vnc_server_installed = system('which vncserver > /dev/null 2>&1')
|
22
22
|
if vnc_server_installed
|
23
|
-
success 'It appears you already have a VNC server installed. Good job!'
|
23
|
+
Interaction.success 'It appears you already have a VNC server installed. Good job!'
|
24
24
|
else
|
25
25
|
puts 'Please run:'
|
26
|
-
note_cmd 'sudo apt-get install vnc4server'
|
27
|
-
prompt 'Continue ...'
|
26
|
+
Interaction.note_cmd 'sudo apt-get install vnc4server'
|
27
|
+
Interaction.prompt 'Continue ...'
|
28
28
|
|
29
29
|
puts
|
30
|
-
note 'We will now set a password for your VNC server.'
|
31
|
-
puts strip_heredoc <<-TEXT
|
30
|
+
Interaction.note 'We will now set a password for your VNC server.'
|
31
|
+
puts Util.strip_heredoc <<-TEXT
|
32
32
|
When running our cucumber script, you will not actually need this
|
33
33
|
password, and there is no security risk. However, if you start a vncserver
|
34
34
|
without our cucumber script, a user with your password can connect to
|
@@ -36,31 +36,31 @@ def _setup_vnc
|
|
36
36
|
|
37
37
|
TEXT
|
38
38
|
puts 'Please run:'
|
39
|
-
note_cmd 'vncserver :20'
|
40
|
-
warn 'Enter a secure password!'
|
41
|
-
prompt 'Continue ...'
|
39
|
+
Interaction.note_cmd 'vncserver :20'
|
40
|
+
Interaction.warn 'Enter a secure password!'
|
41
|
+
Interaction.prompt 'Continue ...'
|
42
42
|
|
43
43
|
puts 'Now stop the server again. Please run:'
|
44
|
-
note_cmd 'vncserver -kill :20'
|
45
|
-
prompt 'Continue ...'
|
44
|
+
Interaction.note_cmd 'vncserver -kill :20'
|
45
|
+
Interaction.prompt 'Continue ...'
|
46
46
|
end
|
47
47
|
|
48
|
-
announce 'Setup VNC viewer'
|
48
|
+
Interaction.announce 'Setup VNC viewer'
|
49
49
|
|
50
50
|
vnc_viewer_installed = system('which vncviewer > /dev/null 2>&1')
|
51
51
|
if vnc_viewer_installed
|
52
|
-
success 'It appears you already have a VNC viewer installed. Good job!'
|
52
|
+
Interaction.success 'It appears you already have a VNC viewer installed. Good job!'
|
53
53
|
else
|
54
54
|
puts 'Please run:'
|
55
|
-
note_cmd 'sudo apt-get install xtightvncviewer'
|
56
|
-
prompt 'Continue ...'
|
55
|
+
Interaction.note_cmd 'sudo apt-get install xtightvncviewer'
|
56
|
+
Interaction.prompt 'Continue ...'
|
57
57
|
end
|
58
58
|
|
59
59
|
puts
|
60
|
-
puts strip_heredoc <<-TEXT
|
60
|
+
puts Util.strip_heredoc <<-TEXT
|
61
61
|
All done. Our cucumber script will now automatically run Selenium features
|
62
62
|
in VNC.
|
63
63
|
TEXT
|
64
64
|
|
65
|
-
success 'Happy cuking!'
|
65
|
+
Interaction.success 'Happy cuking!'
|
66
66
|
end
|
@@ -6,16 +6,16 @@ LONGDESC
|
|
6
6
|
def capistrano(*args)
|
7
7
|
targets = Dir['config/deploy/*.rb'].map { |file| File.basename(file, '.rb') }.sort
|
8
8
|
|
9
|
-
note 'Found the following deploy targets:'
|
9
|
+
Interaction.note 'Found the following deploy targets:'
|
10
10
|
puts targets
|
11
|
-
prompt('Continue?', 'n', /y|yes/) ||
|
11
|
+
Interaction.prompt('Continue?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
|
12
12
|
|
13
13
|
targets << nil if targets.empty? # default target
|
14
14
|
targets.each do |stage|
|
15
|
-
announce 'Target: ' + (stage || '(default)')
|
15
|
+
Interaction.announce 'Target: ' + (stage || '(default)')
|
16
16
|
|
17
17
|
command = "bundle exec cap #{stage} " + args.join(' ')
|
18
|
-
note_cmd command
|
18
|
+
Interaction.note_cmd command
|
19
19
|
|
20
20
|
Util.system!(command, fail_message: 'Capistrano failed. Have a look!')
|
21
21
|
end
|
@@ -1,14 +1,15 @@
|
|
1
1
|
desc 'clean', 'Remove unneeded files from the current directory'
|
2
2
|
def clean
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
|
4
|
+
Interaction.announce 'Removing tempfiles'
|
5
|
+
for pattern in %w[ webrat-* capybara-* tmp/webrat-* tmp/capybara-* tmp/rtex/* log/*.log ]
|
6
|
+
Interaction.note pattern
|
6
7
|
puts `rm -vfR #{pattern}`
|
7
8
|
end
|
8
9
|
|
9
|
-
announce 'Finding recursively and removing backup files'
|
10
|
+
Interaction.announce 'Finding recursively and removing backup files'
|
10
11
|
%w[*~].each do |pattern|
|
11
|
-
note pattern
|
12
|
+
Interaction.note pattern
|
12
13
|
`find . -name #{pattern} -exec rm {} ';'`
|
13
14
|
end
|
14
15
|
end
|
@@ -9,7 +9,7 @@ If there are no staged changes, prints a warning but will continue to create
|
|
9
9
|
an empty commit.
|
10
10
|
|
11
11
|
On the first execution we ask for your Pivotal Tracker API token. It will be
|
12
|
-
stored in `~/.
|
12
|
+
stored in `~/.config/geordi/global.yml`.
|
13
13
|
LONGDESC
|
14
14
|
|
15
15
|
def commit(*git_args)
|
@@ -3,10 +3,18 @@ long_desc <<-LONGDESC
|
|
3
3
|
Open a local Rails console: `geordi console`
|
4
4
|
|
5
5
|
Open a Rails console on `staging`: `geordi console staging`
|
6
|
+
|
7
|
+
Lets you select the server to connect to from a menu when called with `--select-server` or the alias `-s`:
|
8
|
+
|
9
|
+
geordi console staging -s
|
10
|
+
|
11
|
+
If you already know the number of the server you want to connect to, just pass it along:
|
12
|
+
|
13
|
+
geordi console staging -s2
|
6
14
|
LONGDESC
|
7
15
|
|
8
16
|
|
9
|
-
option :select_server,
|
17
|
+
option :select_server, type: :string, aliases: '-s'
|
10
18
|
|
11
19
|
def console(target = 'development', *_args)
|
12
20
|
require 'geordi/remote'
|
@@ -14,11 +22,11 @@ def console(target = 'development', *_args)
|
|
14
22
|
if target == 'development'
|
15
23
|
invoke_cmd 'yarn_install'
|
16
24
|
|
17
|
-
announce 'Opening a local Rails console'
|
25
|
+
Interaction.announce 'Opening a local Rails console'
|
18
26
|
|
19
27
|
Util.system! Util.console_command(target)
|
20
28
|
else
|
21
|
-
announce 'Opening a Rails console on ' + target
|
29
|
+
Interaction.announce 'Opening a Rails console on ' + target
|
22
30
|
|
23
31
|
Geordi::Remote.new(target).console(options)
|
24
32
|
end
|