geordi 4.0.0 → 4.2.1
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/.travis.yml +5 -0
- data/CHANGELOG.md +59 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +46 -28
- data/README.md +29 -6
- data/Rakefile +1 -1
- data/exe/dumple +19 -4
- data/geordi.gemspec +3 -3
- data/lib/geordi/COMMAND_TEMPLATE +1 -1
- data/lib/geordi/chromedriver_updater.rb +2 -2
- data/lib/geordi/cli.rb +1 -1
- data/lib/geordi/commands/bundle_install.rb +1 -1
- data/lib/geordi/commands/capistrano.rb +1 -1
- data/lib/geordi/commands/chromedriver_update.rb +8 -1
- data/lib/geordi/commands/console.rb +4 -3
- data/lib/geordi/commands/create_database_yml.rb +1 -1
- data/lib/geordi/commands/create_databases.rb +7 -6
- data/lib/geordi/commands/cucumber.rb +9 -4
- data/lib/geordi/commands/deploy.rb +7 -7
- data/lib/geordi/commands/dump.rb +14 -4
- data/lib/geordi/commands/firefox.rb +1 -1
- data/lib/geordi/commands/migrate.rb +4 -4
- data/lib/geordi/commands/rake.rb +6 -4
- data/lib/geordi/commands/rspec.rb +5 -5
- data/lib/geordi/commands/security_update.rb +10 -10
- data/lib/geordi/commands/server.rb +3 -3
- data/lib/geordi/commands/setup.rb +5 -5
- data/lib/geordi/commands/shell.rb +1 -1
- data/lib/geordi/commands/tests.rb +4 -4
- data/lib/geordi/commands/unit.rb +3 -3
- data/lib/geordi/commands/update.rb +4 -4
- data/lib/geordi/commands/vnc.rb +1 -1
- data/lib/geordi/commands/with_rake.rb +3 -3
- data/lib/geordi/commands/yarn_install.rb +1 -1
- data/lib/geordi/cucumber.rb +2 -2
- data/lib/geordi/dump_loader.rb +1 -1
- data/lib/geordi/gitpt.rb +1 -1
- data/lib/geordi/interaction.rb +1 -1
- data/lib/geordi/remote.rb +5 -4
- data/lib/geordi/settings.rb +11 -2
- data/lib/geordi/util.rb +33 -21
- data/lib/geordi/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 143cfb8cfd0cc7fb52b39eb7a41d22fb1af259f78f817fa55742cec61271b117
|
|
4
|
+
data.tar.gz: 2bde738375417d40af0545c582c290c85a67cff890679fe58521054eb9f80d67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 418c1c83487f4b807346a576fa3a9ee08e890c01075df6937e47bc2669cbe4031829c4a9d797223e747ed93ba209e5f689eab0fc8c722c1bb8067fd5c25af538
|
|
7
|
+
data.tar.gz: 5a979db241a56d199d496becb9a2966dbb92adfe90125a6d026b0b323f3b24111810876aaf2bc70b2d111450412230b9f00be4939dd7548bae7c311d36fe96b2
|
data/.travis.yml
CHANGED
|
@@ -8,12 +8,17 @@ rvm:
|
|
|
8
8
|
- '2.4.10'
|
|
9
9
|
- '2.5.8'
|
|
10
10
|
- '2.6.6'
|
|
11
|
+
- '2.7.1'
|
|
11
12
|
|
|
12
13
|
gemfile:
|
|
13
14
|
- 'Gemfile'
|
|
14
15
|
|
|
15
16
|
dist: trusty
|
|
16
17
|
|
|
18
|
+
before_install:
|
|
19
|
+
- sudo apt-get install -y vnc4server
|
|
20
|
+
# Fake required password for vncserver
|
|
21
|
+
- mkdir ~/.vnc && touch ~/.vnc/passwd && chmod 700 ~/.vnc/passwd
|
|
17
22
|
install:
|
|
18
23
|
- gem install bundler:1.17.3
|
|
19
24
|
# Replace default Travis CI bundler script with a version that doesn't
|
data/CHANGELOG.md
CHANGED
|
@@ -5,10 +5,68 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
|
+
|
|
8
9
|
### Compatible changes
|
|
9
10
|
### Breaking changes
|
|
10
11
|
|
|
11
12
|
|
|
13
|
+
## 4.2.0 2020-10-02
|
|
14
|
+
|
|
15
|
+
### Compatible changes
|
|
16
|
+
* Add `auto_update_chromedriver` as global setting option to automatically update chromedriver before cucumber
|
|
17
|
+
tests, if Chrome and chromedriver versions don't match.
|
|
18
|
+
* Dump command: Add support for multiple databases (#103 by @kajatiger)
|
|
19
|
+
* Add Ruby 2.7 to list of supported Ruby versions
|
|
20
|
+
* Fix #115: `geordi cucumber --modified` command, that corrupted filenames like:
|
|
21
|
+
```
|
|
22
|
+
No such file or directory tures/pages.feature
|
|
23
|
+
```
|
|
24
|
+
* Avoid writing an instance of HighLine::String to Geordi config files (closes #114)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## 4.1.1 2020-08-28
|
|
28
|
+
### Compatible changes
|
|
29
|
+
|
|
30
|
+
* Fixed: System calls are not executed properly if no bin stub is present. This resulted in errors like:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
% geordi rspec
|
|
34
|
+
|
|
35
|
+
# Running specs
|
|
36
|
+
> All specs at once (using parallel_tests)
|
|
37
|
+
|
|
38
|
+
x Specs failed.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
or
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
% geordi migrate
|
|
45
|
+
|
|
46
|
+
# Migrating
|
|
47
|
+
> Development and parallel test databases
|
|
48
|
+
|
|
49
|
+
x Something went wrong.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## 4.1.0 2020-08-18
|
|
54
|
+
|
|
55
|
+
### Compatible changes
|
|
56
|
+
|
|
57
|
+
- Added dumple option `--compress` to compress after dumping
|
|
58
|
+
|
|
59
|
+
## 4.0.1 2020-08-11
|
|
60
|
+
|
|
61
|
+
### Compatible changes
|
|
62
|
+
|
|
63
|
+
- Fix `geordi migrate` command, that fails with:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Don't know how to build task 'db:migrate parallel:prepare'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
|
|
12
70
|
## 4.0.0 2020-07-30
|
|
13
71
|
|
|
14
72
|
### Compatible changes
|
|
@@ -18,6 +76,7 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
|
18
76
|
### Breaking changes
|
|
19
77
|
- Removed deprecated executables
|
|
20
78
|
- Removed `eurest` command
|
|
79
|
+
- Respect binstubs if available, otherwise fallback to geordi's previous behaviour. Note that this might cause failures, when your binstubs are not working. Please have a look at #109 for how a failure might look like and how you can fix it.
|
|
21
80
|
|
|
22
81
|
|
|
23
82
|
## 3.2.0 2020-07-15
|
data/Gemfile
CHANGED
|
@@ -3,7 +3,8 @@ source 'http://rubygems.org'
|
|
|
3
3
|
# Specify your gem's dependencies in geordi.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
-
gem 'aruba'
|
|
6
|
+
gem 'aruba', '< 1' # Drops support for Ruby 2.2-
|
|
7
|
+
gem 'rake', '< 13' # Drops support for Ruby 2.1
|
|
7
8
|
gem 'rspec-mocks'
|
|
8
9
|
gem 'highline'
|
|
9
10
|
gem 'parallel_tests'
|
data/Gemfile.lock
CHANGED
|
@@ -1,76 +1,93 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
geordi (4.
|
|
4
|
+
geordi (4.2.1)
|
|
5
5
|
thor (~> 1)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: http://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
addressable (2.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
addressable (2.7.0)
|
|
11
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
12
|
+
aruba (0.14.14)
|
|
13
|
+
childprocess (>= 0.6.3, < 4.0.0)
|
|
14
|
+
contracts (~> 0.9)
|
|
15
|
+
cucumber (>= 1.3.19)
|
|
16
|
+
ffi (~> 1.9)
|
|
17
|
+
rspec-expectations (>= 2.99)
|
|
18
|
+
thor (>= 0.19, < 2.0)
|
|
15
19
|
axiom-types (0.1.1)
|
|
16
20
|
descendants_tracker (~> 0.0.4)
|
|
17
21
|
ice_nine (~> 0.11.0)
|
|
18
22
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
19
|
-
|
|
23
|
+
backports (3.18.2)
|
|
24
|
+
builder (3.2.4)
|
|
20
25
|
childprocess (1.0.1)
|
|
21
26
|
rake (< 13.0)
|
|
22
|
-
coderay (1.1.
|
|
27
|
+
coderay (1.1.3)
|
|
23
28
|
coercible (1.0.0)
|
|
24
29
|
descendants_tracker (~> 0.0.1)
|
|
25
|
-
|
|
30
|
+
contracts (0.16.0)
|
|
31
|
+
cucumber (3.0.0)
|
|
26
32
|
builder (>= 2.1.2)
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
cucumber-core (~> 3.0.0)
|
|
34
|
+
cucumber-expressions (~> 4.0.3)
|
|
35
|
+
cucumber-wire (~> 0.0.1)
|
|
36
|
+
diff-lcs (~> 1.3)
|
|
37
|
+
gherkin (~> 4.0)
|
|
29
38
|
multi_json (>= 1.7.5, < 2.0)
|
|
30
39
|
multi_test (>= 0.1.2)
|
|
40
|
+
cucumber-core (3.0.0)
|
|
41
|
+
backports (>= 3.8.0)
|
|
42
|
+
cucumber-tag_expressions (>= 1.0.1)
|
|
43
|
+
gherkin (>= 4.1.3)
|
|
44
|
+
cucumber-expressions (4.0.4)
|
|
45
|
+
cucumber-tag_expressions (2.0.2)
|
|
46
|
+
cucumber-wire (0.0.1)
|
|
31
47
|
declarative (0.0.10)
|
|
32
48
|
declarative-option (0.1.0)
|
|
33
49
|
descendants_tracker (0.0.4)
|
|
34
50
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
35
|
-
diff-lcs (1.
|
|
51
|
+
diff-lcs (1.4.4)
|
|
36
52
|
equalizer (0.0.11)
|
|
37
|
-
excon (0.
|
|
53
|
+
excon (0.76.0)
|
|
38
54
|
faraday (0.17.3)
|
|
39
55
|
multipart-post (>= 1.2, < 3)
|
|
40
56
|
faraday_middleware (0.14.0)
|
|
41
57
|
faraday (>= 0.7.4, < 1.0)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
highline (
|
|
58
|
+
ffi (1.12.2)
|
|
59
|
+
gherkin (4.1.3)
|
|
60
|
+
highline (2.0.3)
|
|
45
61
|
ice_nine (0.11.2)
|
|
46
62
|
launchy (2.4.3)
|
|
47
63
|
addressable (~> 2.3)
|
|
48
64
|
method_source (1.0.0)
|
|
49
|
-
mimemagic (0.3.
|
|
50
|
-
multi_json (1.
|
|
65
|
+
mimemagic (0.3.5)
|
|
66
|
+
multi_json (1.15.0)
|
|
51
67
|
multi_test (0.1.2)
|
|
52
68
|
multipart-post (2.1.1)
|
|
53
|
-
parallel (
|
|
54
|
-
parallel_tests (
|
|
69
|
+
parallel (1.13.0)
|
|
70
|
+
parallel_tests (2.23.0)
|
|
55
71
|
parallel
|
|
56
72
|
pry (0.13.1)
|
|
57
73
|
coderay (~> 1.1)
|
|
58
74
|
method_source (~> 1.0)
|
|
59
|
-
|
|
75
|
+
public_suffix (2.0.5)
|
|
76
|
+
rake (12.3.3)
|
|
60
77
|
representable (3.0.4)
|
|
61
78
|
declarative (< 0.1.0)
|
|
62
79
|
declarative-option (< 0.2.0)
|
|
63
80
|
uber (< 0.2.0)
|
|
64
|
-
rspec-expectations (3.
|
|
81
|
+
rspec-expectations (3.9.2)
|
|
65
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
66
|
-
rspec-support (~> 3.
|
|
67
|
-
rspec-mocks (3.
|
|
83
|
+
rspec-support (~> 3.9.0)
|
|
84
|
+
rspec-mocks (3.9.1)
|
|
68
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
69
|
-
rspec-support (~> 3.
|
|
70
|
-
rspec-support (3.
|
|
86
|
+
rspec-support (~> 3.9.0)
|
|
87
|
+
rspec-support (3.9.3)
|
|
71
88
|
thor (1.0.1)
|
|
72
89
|
thread_safe (0.3.6)
|
|
73
|
-
tracker_api (1.
|
|
90
|
+
tracker_api (1.11.0)
|
|
74
91
|
addressable
|
|
75
92
|
equalizer
|
|
76
93
|
excon
|
|
@@ -91,12 +108,13 @@ PLATFORMS
|
|
|
91
108
|
ruby
|
|
92
109
|
|
|
93
110
|
DEPENDENCIES
|
|
94
|
-
aruba
|
|
111
|
+
aruba (< 1)
|
|
95
112
|
geordi!
|
|
96
113
|
highline
|
|
97
114
|
launchy
|
|
98
115
|
parallel_tests
|
|
99
116
|
pry
|
|
117
|
+
rake (< 13)
|
|
100
118
|
rspec-mocks
|
|
101
119
|
tracker_api
|
|
102
120
|
|
data/README.md
CHANGED
|
@@ -39,6 +39,13 @@ Example: `geordi chromedriver_update`
|
|
|
39
39
|
This command will find and install the matching chromedriver for the currently
|
|
40
40
|
installed Chrome.
|
|
41
41
|
|
|
42
|
+
Setting `auto_update_chromedriver` to `true` in your global Geordi config file
|
|
43
|
+
(`~/.config/geordi/global.yml`), will automatically update chromedriver before
|
|
44
|
+
cucumber tests, in case Chrome and chromedriver versions don't match
|
|
45
|
+
|
|
46
|
+
**Options**
|
|
47
|
+
- `[--quiet-if-matching], [--no-quiet-if-matching]`: Suppress notification if chromedriver and chrome versions match
|
|
48
|
+
|
|
42
49
|
|
|
43
50
|
### `geordi clean`
|
|
44
51
|
Remove unneeded files from the current directory.
|
|
@@ -169,10 +176,18 @@ offer to edit the whitelist instead.
|
|
|
169
176
|
- `[--postgres=PORT_OR_SOCKET]`: Use Postgres port or socket
|
|
170
177
|
- `[--mysql=PORT_OR_SOCKET]`: Use MySQL/MariaDB port or socket
|
|
171
178
|
|
|
172
|
-
|
|
173
179
|
### `geordi dump [TARGET]`
|
|
174
180
|
Handle (remote) database dumps.
|
|
175
181
|
|
|
182
|
+
If you are using multiple databases per environment, pass the database name like this:
|
|
183
|
+
|
|
184
|
+
geordi dump -d primary
|
|
185
|
+
|
|
186
|
+
Loading a dump into one of multiple local databases is not supported yet.
|
|
187
|
+
|
|
188
|
+
When called with the `--load` option, sources the specified dump into the
|
|
189
|
+
development database.
|
|
190
|
+
|
|
176
191
|
`geordi dump` (without arguments) dumps the development database with `dumple`.
|
|
177
192
|
|
|
178
193
|
`geordi dump -l tmp/staging.dump` (with the `--load` option) sources the
|
|
@@ -382,10 +397,18 @@ browser, as opposed to opening it within the VNC window.
|
|
|
382
397
|
Contributing
|
|
383
398
|
============
|
|
384
399
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
400
|
+
When making changes to Geordi, please make sure your code is tested. Not all,
|
|
401
|
+
but most features of Geordi can be tested. See other tests for inspiration.
|
|
402
|
+
|
|
403
|
+
Once you have completed your modifications, please update CHANGELOG and README
|
|
404
|
+
as needed. Use `rake readme` to regenerate the Geordi section of the README from
|
|
405
|
+
the command documentations.
|
|
406
|
+
|
|
407
|
+
Make sure tests are green in the default Ruby *plus* in the oldest Ruby > 1.8
|
|
408
|
+
that you have installed on your system (1.8.7 support has been dropped).
|
|
409
|
+
|
|
410
|
+
Before releasing your changes, wait for the Travis results to see that tests
|
|
411
|
+
passed in all Ruby versions.
|
|
389
412
|
|
|
390
413
|
|
|
391
414
|
Adding a new command
|
|
@@ -399,7 +422,7 @@ To try Geordi locally, call it like this:
|
|
|
399
422
|
|
|
400
423
|
# -I means "add the following directory to load path"
|
|
401
424
|
ruby -Ilib exe/geordi
|
|
402
|
-
|
|
425
|
+
|
|
403
426
|
# From another directory
|
|
404
427
|
ruby -I ../geordi/lib ../geordi/exe/geordi
|
|
405
428
|
|
data/Rakefile
CHANGED
data/exe/dumple
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'erb'
|
|
4
4
|
|
|
5
5
|
fail_gently = ARGV.include?("--fail-gently")
|
|
6
|
+
compress = ARGV.include?("--compress")
|
|
6
7
|
|
|
7
8
|
if ARGV.include?("-i")
|
|
8
9
|
puts "*******************************************************"
|
|
@@ -44,9 +45,13 @@ begin
|
|
|
44
45
|
end
|
|
45
46
|
|
|
46
47
|
config = YAML::load(ERB.new(File.read(config_path)).result)
|
|
48
|
+
environment, database = ARGV.reject{ |arg| arg[0].chr == '-' }
|
|
49
|
+
environment ||= 'production'
|
|
50
|
+
config = config[environment] or raise "No #{environment} database found.\nUsage: dumple ENVIRONMENT [DATABASE]"
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
if database
|
|
53
|
+
config = config[database] or raise %(Unknown #{environment} database "#{database}")
|
|
54
|
+
end
|
|
50
55
|
|
|
51
56
|
dump_dir = "#{ENV['HOME']}/dumps"
|
|
52
57
|
unless File.directory?(dump_dir)
|
|
@@ -60,7 +65,8 @@ begin
|
|
|
60
65
|
dump_path = "#{dump_dir}/#{config['database']}_#{Time.now.strftime("%Y%m%d_%H%M%S")}.dump"
|
|
61
66
|
end
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
given_database = database ? %(#{database} ) : ""
|
|
69
|
+
puts "> Dumping #{given_database}database for \"#{environment}\" environment ..."
|
|
64
70
|
|
|
65
71
|
host = config['host']
|
|
66
72
|
port = config['port']
|
|
@@ -89,13 +95,22 @@ begin
|
|
|
89
95
|
command << " --port=#{port}" if port
|
|
90
96
|
command
|
|
91
97
|
else
|
|
92
|
-
raise "Adapter \"#{config['adapter']} is not supported"
|
|
98
|
+
raise "Adapter \"#{config['adapter']}\" is not supported"
|
|
93
99
|
end
|
|
94
100
|
success = system(dump_command)
|
|
95
101
|
success or raise "Creating the dump failed"
|
|
96
102
|
|
|
97
103
|
system "chmod 600 #{dump_path}"
|
|
98
104
|
|
|
105
|
+
if compress
|
|
106
|
+
puts "> Compressing the dump ..."
|
|
107
|
+
|
|
108
|
+
# gzip compresses in place
|
|
109
|
+
compress_success = system("gzip #{dump_path}")
|
|
110
|
+
compress_success or raise "Compressing the dump failed"
|
|
111
|
+
dump_path << ".gz"
|
|
112
|
+
end
|
|
113
|
+
|
|
99
114
|
dump_size_kb = (File.size(dump_path) / 1024).round
|
|
100
115
|
|
|
101
116
|
puts "> Dumped to #{dump_path} (#{dump_size_kb} KB)"
|
data/geordi.gemspec
CHANGED
|
@@ -11,13 +11,13 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
|
|
12
12
|
spec.summary = 'Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.'
|
|
13
13
|
spec.description = 'Collection of command line tools we use in our daily work with Ruby, Rails and Linux at makandra.'
|
|
14
|
-
spec.homepage = '
|
|
14
|
+
spec.homepage = 'https://makandra.com'
|
|
15
15
|
spec.license = 'MIT'
|
|
16
16
|
|
|
17
17
|
# Specify which files should be added to the gem when it is released.
|
|
18
18
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
19
19
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
20
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(
|
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec|features)/}) }
|
|
21
21
|
end
|
|
22
22
|
spec.bindir = 'exe'
|
|
23
23
|
spec.executables = spec.files.grep(%r(^exe/)) { |f| File.basename(f) }
|
|
@@ -27,6 +27,6 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
|
|
28
28
|
spec.post_install_message = <<-ATTENTION
|
|
29
29
|
* Binary `geordi` installed
|
|
30
|
-
* Geordi 4
|
|
30
|
+
* Geordi 4 has removed its deprecated executables. If you want to invoke these commands like before, you may create aliases on your machine. For the alias mapping, please refer to https://github.com/makandra/geordi/commit/68fa92acb146ebde3acb92d7b9556bd4eaa2b4ff
|
|
31
31
|
ATTENTION
|
|
32
32
|
end
|
data/lib/geordi/COMMAND_TEMPLATE
CHANGED
|
@@ -21,7 +21,7 @@ option :opt, type: :boolean, aliases: '-o', banner: 'VALUE_NAME', desc: 'If set,
|
|
|
21
21
|
|
|
22
22
|
def example
|
|
23
23
|
# Invoke other commands like this:
|
|
24
|
-
|
|
24
|
+
invoke_geordi 'other_command', 'argument', an: 'option'
|
|
25
25
|
|
|
26
26
|
Interaction.fail 'Option missing' unless options.opt?
|
|
27
27
|
|
|
@@ -5,12 +5,12 @@ require 'tempfile'
|
|
|
5
5
|
module Geordi
|
|
6
6
|
class ChromedriverUpdater
|
|
7
7
|
|
|
8
|
-
def run
|
|
8
|
+
def run(options)
|
|
9
9
|
chrome_version = determine_chrome_version
|
|
10
10
|
chromedriver_version = determine_chromedriver_version
|
|
11
11
|
|
|
12
12
|
if skip_update?(chrome_version, chromedriver_version)
|
|
13
|
-
Interaction.
|
|
13
|
+
Interaction.note("No update required, you are using for both executables the same version #{chrome_version}!") unless options[:quiet_if_matching]
|
|
14
14
|
else
|
|
15
15
|
chromedriver_zip = download_chromedriver(chrome_version)
|
|
16
16
|
unzip(chromedriver_zip, File.expand_path('~/bin'))
|
data/lib/geordi/cli.rb
CHANGED
|
@@ -17,6 +17,6 @@ def capistrano(*args)
|
|
|
17
17
|
command = "bundle exec cap #{stage} " + args.join(' ')
|
|
18
18
|
Interaction.note_cmd command
|
|
19
19
|
|
|
20
|
-
Util.
|
|
20
|
+
Util.run!(command, fail_message: 'Capistrano failed. Have a look!')
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -4,10 +4,17 @@ Example: `geordi chromedriver_update`
|
|
|
4
4
|
|
|
5
5
|
This command will find and install the matching chromedriver for the currently
|
|
6
6
|
installed Chrome.
|
|
7
|
+
|
|
8
|
+
Setting `auto_update_chromedriver` to `true` in your global Geordi config file
|
|
9
|
+
(`~/.config/geordi/global.yml`), will automatically update chromedriver before
|
|
10
|
+
cucumber tests, in case Chrome and chromedriver versions don't match
|
|
7
11
|
LONGDESC
|
|
8
12
|
|
|
13
|
+
option :quiet_if_matching, type: :boolean, default: false,
|
|
14
|
+
desc: 'Suppress notification if chromedriver and chrome versions match'
|
|
15
|
+
|
|
9
16
|
def chromedriver_update
|
|
10
17
|
require 'geordi/chromedriver_updater'
|
|
11
18
|
|
|
12
|
-
ChromedriverUpdater.new.run
|
|
19
|
+
ChromedriverUpdater.new.run(options)
|
|
13
20
|
end
|
|
@@ -14,14 +14,15 @@ 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
|
-
|
|
17
|
+
invoke_geordi 'bundle_install'
|
|
18
18
|
|
|
19
19
|
if target == 'development'
|
|
20
|
-
|
|
20
|
+
invoke_geordi 'yarn_install'
|
|
21
21
|
|
|
22
22
|
Interaction.announce 'Opening a local Rails console'
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
command = Util.console_command(target)
|
|
25
|
+
Util.run!(command)
|
|
25
26
|
else
|
|
26
27
|
Interaction.announce 'Opening a Rails console on ' + target
|
|
27
28
|
|
|
@@ -7,7 +7,7 @@ def create_database_yml
|
|
|
7
7
|
Interaction.announce 'Creating ' + real_yml
|
|
8
8
|
|
|
9
9
|
sample = File.read(sample_yml)
|
|
10
|
-
adapter = sample.match(/adapter: (\w+)
|
|
10
|
+
adapter = sample.match(/adapter: (\w+)/).captures.first
|
|
11
11
|
|
|
12
12
|
print "Please enter your #{adapter} password: "
|
|
13
13
|
db_password = STDIN.gets.strip
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
desc 'create-databases', 'Create all databases', hide: true
|
|
2
2
|
def create_databases
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
invoke_geordi 'create_database_yml'
|
|
4
|
+
invoke_geordi 'bundle_install'
|
|
5
5
|
|
|
6
6
|
Interaction.announce 'Creating databases'
|
|
7
7
|
|
|
8
8
|
if File.exist?('config/database.yml')
|
|
9
|
-
command =
|
|
10
|
-
command << '
|
|
11
|
-
command << '
|
|
9
|
+
command = []
|
|
10
|
+
command << Util.binstub_or_fallback('rake')
|
|
11
|
+
command << 'db:create:all'
|
|
12
|
+
command << 'parallel:create' if Util.file_containing?('Gemfile', /parallel_tests/)
|
|
12
13
|
|
|
13
|
-
Util.
|
|
14
|
+
Util.run!(command)
|
|
14
15
|
else
|
|
15
16
|
puts 'config/database.yml does not exist. Nothing to do.'
|
|
16
17
|
end
|
|
@@ -37,7 +37,7 @@ def cucumber(*args)
|
|
|
37
37
|
if args.empty?
|
|
38
38
|
# This is not testable as there is no way to stub `git` :(
|
|
39
39
|
if options.modified?
|
|
40
|
-
modified_features = `git status --short`.split(
|
|
40
|
+
modified_features = `git status --short`.split("\n").map do |line|
|
|
41
41
|
indicators = line.slice!(0..2) # Remove leading indicators
|
|
42
42
|
line if line.include?('.feature') && !indicators.include?('D')
|
|
43
43
|
end.compact
|
|
@@ -45,7 +45,7 @@ def cucumber(*args)
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
if options.containing
|
|
48
|
-
matching_features = `grep -lri '#{options.containing}' --include=*.feature features/`.split(
|
|
48
|
+
matching_features = `grep -lri '#{options.containing}' --include=*.feature features/`.split("\n")
|
|
49
49
|
args = matching_features.uniq
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -53,8 +53,13 @@ def cucumber(*args)
|
|
|
53
53
|
if File.directory?('features')
|
|
54
54
|
require 'geordi/cucumber'
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
settings = Geordi::Settings.new
|
|
57
|
+
|
|
58
|
+
invoke_geordi 'bundle_install'
|
|
59
|
+
invoke_geordi 'yarn_install'
|
|
60
|
+
if settings.auto_update_chromedriver
|
|
61
|
+
invoke_geordi 'chromedriver_update', quiet_if_matching: true
|
|
62
|
+
end
|
|
58
63
|
|
|
59
64
|
cmd_opts, files = args.partition { |f| f.start_with? '-' }
|
|
60
65
|
cmd_opts << '--format' << 'pretty' << '--backtrace' if options.debug
|
|
@@ -66,7 +66,7 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
|
66
66
|
push_needed = false if Util.testing? # Hard to test
|
|
67
67
|
|
|
68
68
|
Interaction.announce "Checking whether your #{source_branch} branch is ready" ############
|
|
69
|
-
Util.
|
|
69
|
+
Util.run!("git checkout #{source_branch}")
|
|
70
70
|
if (`git status -s | wc -l`.strip != '0') && !Util.testing?
|
|
71
71
|
Interaction.warn "Your #{source_branch} branch holds uncommitted changes."
|
|
72
72
|
Interaction.prompt('Continue anyway?', 'n', /y|yes/) || raise('Cancelled.')
|
|
@@ -76,14 +76,14 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
|
76
76
|
|
|
77
77
|
if merge_needed
|
|
78
78
|
Interaction.announce "Checking what's in your #{target_branch} branch right now" #######
|
|
79
|
-
Util.
|
|
79
|
+
Util.run!("git checkout #{target_branch} && git pull")
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
Interaction.announce 'You are about to:' #################################################
|
|
83
83
|
Interaction.note "Merge branch #{source_branch} into #{target_branch}" if merge_needed
|
|
84
84
|
if push_needed
|
|
85
85
|
Interaction.note 'Push these commits:' if push_needed
|
|
86
|
-
Util.
|
|
86
|
+
Util.run!("git --no-pager log origin/#{target_branch}..#{source_branch} --oneline")
|
|
87
87
|
end
|
|
88
88
|
Interaction.note "Deploy to #{target_stage}"
|
|
89
89
|
Interaction.note "From current branch #{source_branch}" if options.current_branch
|
|
@@ -94,7 +94,7 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
|
94
94
|
git_call << "git merge #{source_branch}" if merge_needed
|
|
95
95
|
git_call << 'git push' if push_needed
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
invoke_geordi 'bundle_install'
|
|
98
98
|
|
|
99
99
|
capistrano_call = "cap #{target_stage} deploy"
|
|
100
100
|
capistrano_call << ':migrations' unless Util.gem_major_version('capistrano') == 3 || options.no_migrations
|
|
@@ -102,14 +102,14 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
|
|
|
102
102
|
capistrano_call = "DEPLOY_BRANCH=#{source_branch} #{capistrano_call}" if options.current_branch
|
|
103
103
|
|
|
104
104
|
if git_call.any?
|
|
105
|
-
Util.
|
|
105
|
+
Util.run!(git_call.join(' && '), show_cmd: true)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
-
Util.
|
|
108
|
+
Util.run!(capistrano_call, show_cmd: true)
|
|
109
109
|
|
|
110
110
|
Interaction.success 'Deployment complete.'
|
|
111
111
|
else
|
|
112
|
-
Util.
|
|
112
|
+
Util.run!("git checkout #{source_branch}")
|
|
113
113
|
Interaction.fail 'Deployment cancelled.'
|
|
114
114
|
end
|
|
115
115
|
end
|
data/lib/geordi/commands/dump.rb
CHANGED
|
@@ -10,13 +10,21 @@ specified target's database and downloads it to `tmp/`.
|
|
|
10
10
|
|
|
11
11
|
`geordi dump staging -l` (with a Capistrano deploy target and the `--load`
|
|
12
12
|
option) sources the dump into the development database after downloading it.
|
|
13
|
+
|
|
14
|
+
If you are using multiple databases per environment, pass the database name like this:
|
|
15
|
+
|
|
16
|
+
geordi dump -d primary
|
|
17
|
+
|
|
18
|
+
Loading a dump into one of multiple local databases is not supported yet.
|
|
13
19
|
DESC
|
|
14
20
|
|
|
15
21
|
option :load, aliases: '-l', type: :string, desc: 'Load a dump', banner: '[DUMP_FILE]'
|
|
22
|
+
option :database, aliases: '-d', type: :string, desc: 'Database name, if there are multiple databases', banner: 'NAME'
|
|
16
23
|
|
|
17
24
|
def dump(target = nil, *_args)
|
|
18
25
|
require 'geordi/dump_loader'
|
|
19
26
|
require 'geordi/remote'
|
|
27
|
+
database = options[:database] ? "#{options[:database]} " : ''
|
|
20
28
|
|
|
21
29
|
if target.nil?
|
|
22
30
|
if options.load
|
|
@@ -33,12 +41,14 @@ def dump(target = nil, *_args)
|
|
|
33
41
|
|
|
34
42
|
else
|
|
35
43
|
Interaction.announce 'Dumping the development database'
|
|
36
|
-
Util.
|
|
37
|
-
Interaction.success
|
|
44
|
+
Util.run!("dumple development #{database}")
|
|
45
|
+
Interaction.success "Successfully dumped the #{database}development database."
|
|
38
46
|
end
|
|
39
47
|
|
|
40
48
|
else
|
|
41
|
-
|
|
49
|
+
database_label = options[:database] ? " (#{database}database)" : ""
|
|
50
|
+
|
|
51
|
+
Interaction.announce "Dumping the database of #{target}#{database_label}"
|
|
42
52
|
dump_path = Geordi::Remote.new(target).dump(options)
|
|
43
53
|
|
|
44
54
|
if options.load
|
|
@@ -47,7 +57,7 @@ def dump(target = nil, *_args)
|
|
|
47
57
|
Interaction.announce "Sourcing dump into the #{loader.config['database']} db"
|
|
48
58
|
loader.load
|
|
49
59
|
|
|
50
|
-
Interaction.success "Your #{loader.config['database']} database has now the data of #{target}."
|
|
60
|
+
Interaction.success "Your #{loader.config['database']} database has now the data of #{target}#{database_label}."
|
|
51
61
|
end
|
|
52
62
|
end
|
|
53
63
|
end
|
|
@@ -8,8 +8,8 @@ with `db:migrate`.
|
|
|
8
8
|
LONGDESC
|
|
9
9
|
|
|
10
10
|
def migrate
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
invoke_geordi 'bundle_install'
|
|
12
|
+
invoke_geordi 'yarn_install'
|
|
13
13
|
Interaction.announce 'Migrating'
|
|
14
14
|
|
|
15
15
|
if File.directory?('db/migrate')
|
|
@@ -17,9 +17,9 @@ def migrate
|
|
|
17
17
|
Interaction.note 'Development and parallel test databases'
|
|
18
18
|
puts
|
|
19
19
|
|
|
20
|
-
Util.
|
|
20
|
+
Util.run!([Util.binstub_or_fallback('rake'), 'db:migrate', 'parallel:prepare'])
|
|
21
21
|
else
|
|
22
|
-
|
|
22
|
+
invoke_geordi 'rake', 'db:migrate'
|
|
23
23
|
end
|
|
24
24
|
else
|
|
25
25
|
Interaction.note 'No migrations directory found.'
|
data/lib/geordi/commands/rake.rb
CHANGED
|
@@ -10,14 +10,16 @@ Example: `geordi rake db:migrate`
|
|
|
10
10
|
LONGDESC
|
|
11
11
|
|
|
12
12
|
def rake(*args)
|
|
13
|
-
|
|
13
|
+
invoke_geordi 'bundle_install'
|
|
14
14
|
|
|
15
15
|
%w[development test cucumber].each do |env| # update long_desc when changing this
|
|
16
16
|
if File.exist? "config/environments/#{env}.rb"
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
command = []
|
|
18
|
+
command << Util.binstub_or_fallback('rake')
|
|
19
|
+
command += args
|
|
20
|
+
command << "RAILS_ENV=#{env}"
|
|
19
21
|
|
|
20
|
-
Util.
|
|
22
|
+
Util.run!(command, show_cmd: true)
|
|
21
23
|
end
|
|
22
24
|
end
|
|
23
25
|
end
|
|
@@ -7,14 +7,14 @@ LONGDESC
|
|
|
7
7
|
|
|
8
8
|
def rspec(*files)
|
|
9
9
|
if File.exist?('spec/spec_helper.rb')
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
invoke_geordi 'bundle_install'
|
|
11
|
+
invoke_geordi 'yarn_install'
|
|
12
12
|
|
|
13
13
|
Interaction.announce 'Running specs'
|
|
14
14
|
|
|
15
15
|
if Util.file_containing?('Gemfile', /parallel_tests/) && files.empty?
|
|
16
16
|
Interaction.note 'All specs at once (using parallel_tests)'
|
|
17
|
-
Util.
|
|
17
|
+
Util.run!([Util.binstub_or_fallback('rake'), 'parallel:spec'], fail_message: 'Specs failed.')
|
|
18
18
|
|
|
19
19
|
else
|
|
20
20
|
# tell which specs will be run
|
|
@@ -28,13 +28,13 @@ def rspec(*files)
|
|
|
28
28
|
command = if File.exist?('script/spec')
|
|
29
29
|
['bundle exec spec -c'] # RSpec 1
|
|
30
30
|
else
|
|
31
|
-
[Util.
|
|
31
|
+
[Util.binstub_or_fallback('rspec')]
|
|
32
32
|
end
|
|
33
33
|
command << '-r rspec_spinner -f RspecSpinner::Bar' if Util.file_containing?('Gemfile', /rspec_spinner/)
|
|
34
34
|
command << files.join(' ')
|
|
35
35
|
|
|
36
36
|
puts
|
|
37
|
-
Util.
|
|
37
|
+
Util.run!(command.join(' '), fail_message: 'Specs failed.')
|
|
38
38
|
end
|
|
39
39
|
else
|
|
40
40
|
Interaction.note 'RSpec not employed.'
|
|
@@ -35,8 +35,8 @@ def security_update(step = 'prepare')
|
|
|
35
35
|
Interaction.note 'About to checkout production and pull.'
|
|
36
36
|
Interaction.prompt('Continue?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
|
37
37
|
|
|
38
|
-
Util.
|
|
39
|
-
Util.
|
|
38
|
+
Util.run!('git checkout production', show_cmd: true)
|
|
39
|
+
Util.run!('git pull', show_cmd: true)
|
|
40
40
|
|
|
41
41
|
Interaction.success 'Successfully prepared for security update'
|
|
42
42
|
puts
|
|
@@ -47,7 +47,7 @@ def security_update(step = 'prepare')
|
|
|
47
47
|
when 'f', 'finish'
|
|
48
48
|
# ensure everything is committed
|
|
49
49
|
if Util.testing?
|
|
50
|
-
puts 'Util.
|
|
50
|
+
puts 'Util.run! git status --porcelain'
|
|
51
51
|
else
|
|
52
52
|
`git status --porcelain`.empty? || Interaction.fail('Please commit your changes before finishing the update.')
|
|
53
53
|
end
|
|
@@ -59,11 +59,11 @@ def security_update(step = 'prepare')
|
|
|
59
59
|
Interaction.note 'About to: push production, checkout & pull master, merge production, push master.'
|
|
60
60
|
Interaction.prompt('Continue?', 'n', /y|yes/) || Interaction.fail('Cancelled.')
|
|
61
61
|
|
|
62
|
-
Util.
|
|
63
|
-
Util.
|
|
64
|
-
Util.
|
|
65
|
-
Util.
|
|
66
|
-
Util.
|
|
62
|
+
Util.run!('git push', show_cmd: true)
|
|
63
|
+
Util.run!('git checkout master', show_cmd: true)
|
|
64
|
+
Util.run!('git pull', show_cmd: true)
|
|
65
|
+
Util.run!('git merge production', show_cmd: true)
|
|
66
|
+
Util.run!('git push', show_cmd: true)
|
|
67
67
|
|
|
68
68
|
Interaction.announce 'Deployment'
|
|
69
69
|
deploy = (Util.gem_major_version('capistrano') == 3) ? 'deploy' : 'deploy:migrations'
|
|
@@ -76,7 +76,7 @@ def security_update(step = 'prepare')
|
|
|
76
76
|
Interaction.prompt('Deploy staging now?', 'y', /y|yes/) || Interaction.fail('Cancelled.')
|
|
77
77
|
|
|
78
78
|
Interaction.announce 'Deploy staging'
|
|
79
|
-
Util.
|
|
79
|
+
Util.run! "bundle exec cap staging #{deploy}", show_cmd: true
|
|
80
80
|
|
|
81
81
|
Interaction.prompt('Is the deployment log okay and the application is still running on staging?', 'y', /y|yes/) || Interaction.fail('Please fix the deployment issues on staging before you continue.')
|
|
82
82
|
else
|
|
@@ -96,7 +96,7 @@ def security_update(step = 'prepare')
|
|
|
96
96
|
|
|
97
97
|
deploy_targets_without_staging.each do |target|
|
|
98
98
|
Interaction.announce "Deploy #{target}"
|
|
99
|
-
Util.
|
|
99
|
+
Util.run!("bundle exec cap #{target} #{deploy}", show_cmd: true)
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
Interaction.prompt('Is the application still running on all other stages and the logs are okay?', 'y', /y|yes/) || Interaction.fail('Please fix the application immediately!')
|
|
@@ -6,8 +6,8 @@ option :public, aliases: '-P', type: :boolean,
|
|
|
6
6
|
desc: 'Make the server accessible from the local network'
|
|
7
7
|
|
|
8
8
|
def server(port = nil)
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
invoke_geordi 'bundle_install'
|
|
10
|
+
invoke_geordi 'yarn_install'
|
|
11
11
|
require 'geordi/util'
|
|
12
12
|
|
|
13
13
|
Interaction.announce 'Booting a development server'
|
|
@@ -18,7 +18,7 @@ def server(port = nil)
|
|
|
18
18
|
command = Util.server_command
|
|
19
19
|
command << ' -b 0.0.0.0' if options.public
|
|
20
20
|
command << ' -p ' << port
|
|
21
|
-
Util.
|
|
21
|
+
Util.run!(command)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
map 'devserver' => 'server'
|
|
@@ -19,14 +19,14 @@ def setup
|
|
|
19
19
|
Interaction.announce 'Running bin/setup'
|
|
20
20
|
Interaction.note "Geordi's own setup routine is skipped"
|
|
21
21
|
|
|
22
|
-
Util.
|
|
22
|
+
Util.run!('bin/setup')
|
|
23
23
|
else
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
invoke_geordi 'create_databases'
|
|
25
|
+
invoke_geordi 'migrate'
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
Interaction.success 'Successfully set up the project.'
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
invoke_geordi 'dump', options.dump, load: true if options.dump
|
|
31
|
+
invoke_geordi 'tests' if options.test
|
|
32
32
|
end
|
|
@@ -15,7 +15,7 @@ option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
|
|
|
15
15
|
def shelll(target, *_args)
|
|
16
16
|
require 'geordi/remote'
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
invoke_geordi 'bundle_install'
|
|
19
19
|
|
|
20
20
|
Interaction.announce 'Opening a shell on ' + target
|
|
21
21
|
Geordi::Remote.new(target).shell(options)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
desc 'tests', 'Run all employed tests'
|
|
2
2
|
def tests
|
|
3
|
-
rake_result =
|
|
3
|
+
rake_result = invoke_geordi 'with_rake'
|
|
4
4
|
|
|
5
5
|
# Since `rake` usually is configured to run all tests, only run them if `rake`
|
|
6
6
|
# did not perform
|
|
7
7
|
if rake_result == :did_not_perform
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
invoke_geordi 'unit'
|
|
9
|
+
invoke_geordi 'rspec'
|
|
10
|
+
invoke_geordi 'cucumber'
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
Interaction.success 'Successfully ran tests.'
|
data/lib/geordi/commands/unit.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
desc 'unit', 'Run Test::Unit'
|
|
2
2
|
def unit
|
|
3
3
|
if File.exist?('test/test_helper.rb')
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
invoke_geordi 'bundle_install'
|
|
5
|
+
invoke_geordi 'yarn_install'
|
|
6
6
|
|
|
7
7
|
Interaction.announce 'Running Test::Unit'
|
|
8
|
-
Util.
|
|
8
|
+
Util.run!([Util.binstub_or_fallback('rake'), 'test'])
|
|
9
9
|
else
|
|
10
10
|
Interaction.note 'Test::Unit not employed.'
|
|
11
11
|
end
|
|
@@ -11,12 +11,12 @@ option :test, type: :boolean, aliases: '-t', desc: 'After updating, run tests'
|
|
|
11
11
|
|
|
12
12
|
def update
|
|
13
13
|
Interaction.announce 'Updating repository'
|
|
14
|
-
Util.
|
|
14
|
+
Util.run!('git pull', show_cmd: true)
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
invoke_geordi 'migrate'
|
|
17
17
|
|
|
18
18
|
Interaction.success 'Successfully updated the project.'
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
invoke_geordi 'dump', options.dump, load: true if options.dump
|
|
21
|
+
invoke_geordi 'tests' if options.test
|
|
22
22
|
end
|
data/lib/geordi/commands/vnc.rb
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
desc 'with-rake', 'Run tests with `rake`', hide: true
|
|
2
2
|
def with_rake
|
|
3
3
|
if Util.file_containing?('Rakefile', /^task.+default.+(spec|test|feature)/)
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
invoke_geordi 'bundle_install'
|
|
5
|
+
invoke_geordi 'yarn_install'
|
|
6
6
|
|
|
7
7
|
Interaction.announce 'Running tests with `rake`'
|
|
8
|
-
Util.
|
|
8
|
+
Util.run!(Util.binstub_or_fallback('rake'))
|
|
9
9
|
else
|
|
10
10
|
Interaction.note '`rake` does not run tests.'
|
|
11
11
|
:did_not_perform
|
|
@@ -3,6 +3,6 @@ desc 'yarn-install', 'Runs yarn install if required', hide: true
|
|
|
3
3
|
def yarn_install
|
|
4
4
|
if File.exist?('package.json') && !system('yarn check --integrity > /dev/null 2>&1')
|
|
5
5
|
Interaction.announce 'Yarn install'
|
|
6
|
-
Util.
|
|
6
|
+
Util.run!('yarn install')
|
|
7
7
|
end
|
|
8
8
|
end
|
data/lib/geordi/cucumber.rb
CHANGED
|
@@ -27,7 +27,7 @@ module Geordi
|
|
|
27
27
|
Interaction.note_cmd(command) if options[:verbose]
|
|
28
28
|
|
|
29
29
|
puts # Make newline
|
|
30
|
-
system command # Util.
|
|
30
|
+
system command # Util.run! would reset the Firefox PATH
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def launch_vnc_viewer
|
|
@@ -74,7 +74,7 @@ module Geordi
|
|
|
74
74
|
unless argv.include?('--format') || argv.include?('-f')
|
|
75
75
|
format_args = spinner_available? ? ['--format', 'CucumberSpinner::CuriousProgressBarFormatter'] : ['--format', 'progress']
|
|
76
76
|
end
|
|
77
|
-
[use_firefox_for_selenium, Util.
|
|
77
|
+
[use_firefox_for_selenium, Util.binstub_or_fallback('cucumber'), format_args, escape_shell_args(argv)].flatten.compact.join(' ')
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
def parallel_execution_command
|
data/lib/geordi/dump_loader.rb
CHANGED
|
@@ -57,7 +57,7 @@ module Geordi
|
|
|
57
57
|
Interaction.note 'Source file: ' + dump_file
|
|
58
58
|
|
|
59
59
|
source_command = send("#{config['adapter']}_command")
|
|
60
|
-
Util.
|
|
60
|
+
Util.run! source_command, fail_message: "An error occured loading #{File.basename(dump_file)}"
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
end
|
data/lib/geordi/gitpt.rb
CHANGED
|
@@ -89,7 +89,7 @@ No staged changes. Will create an empty commit.
|
|
|
89
89
|
extra = highline.ask("\nAdd an optional message").strip
|
|
90
90
|
message << ' - ' << extra if extra != ''
|
|
91
91
|
|
|
92
|
-
Geordi::Util.
|
|
92
|
+
Geordi::Util.run!(['git', 'commit', '--allow-empty', '-m', message, *git_args])
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def bold(string)
|
data/lib/geordi/interaction.rb
CHANGED
data/lib/geordi/remote.rb
CHANGED
|
@@ -31,9 +31,10 @@ module Geordi
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def dump(options = {})
|
|
34
|
+
database = options[:database] ? " #{options[:database]}" : ''
|
|
34
35
|
# Generate dump on the server
|
|
35
36
|
shell options.merge({
|
|
36
|
-
remote_command: "dumple #{@config.env} --for_download",
|
|
37
|
+
remote_command: "dumple #{@config.env}#{database} --for_download",
|
|
37
38
|
})
|
|
38
39
|
|
|
39
40
|
destination_directory = File.join(@config.root, 'tmp')
|
|
@@ -43,9 +44,9 @@ module Geordi
|
|
|
43
44
|
|
|
44
45
|
Interaction.note "Downloading remote dump to #{relative_destination} ..."
|
|
45
46
|
server = @config.primary_server
|
|
46
|
-
Util.
|
|
47
|
+
Util.run!("scp -C #{@config.user(server)}@#{server}:#{REMOTE_DUMP_PATH} #{destination_path}")
|
|
47
48
|
|
|
48
|
-
Interaction.success "Dumped the #{@stage} database to #{relative_destination}."
|
|
49
|
+
Interaction.success "Dumped the#{database} #{@stage} database to #{relative_destination}."
|
|
49
50
|
|
|
50
51
|
destination_path
|
|
51
52
|
end
|
|
@@ -74,7 +75,7 @@ module Geordi
|
|
|
74
75
|
remote_command << " -c '#{options[:remote_command]}'" if options[:remote_command]
|
|
75
76
|
|
|
76
77
|
Interaction.note 'Connecting to ' + server.to_s
|
|
77
|
-
Util.
|
|
78
|
+
Util.run!(['ssh', "#{@config.user(server)}@#{server}", '-t', remote_command])
|
|
78
79
|
end
|
|
79
80
|
|
|
80
81
|
end
|
data/lib/geordi/settings.rb
CHANGED
|
@@ -8,7 +8,7 @@ module Geordi
|
|
|
8
8
|
GLOBAL_SETTINGS_FILE_NAME = Util.testing? ? './tmp/global_settings.yml'.freeze : File.join(ENV['HOME'], '.config/geordi/global.yml').freeze
|
|
9
9
|
LOCAL_SETTINGS_FILE_NAME = Util.testing? ? './tmp/local_settings.yml'.freeze : './.geordi.yml'.freeze
|
|
10
10
|
|
|
11
|
-
ALLOWED_GLOBAL_SETTINGS = %w[ pivotal_tracker_api_key ].freeze
|
|
11
|
+
ALLOWED_GLOBAL_SETTINGS = %w[ pivotal_tracker_api_key auto_update_chromedriver ].freeze
|
|
12
12
|
ALLOWED_LOCAL_SETTINGS = %w[ use_vnc pivotal_tracker_project_ids ].freeze
|
|
13
13
|
|
|
14
14
|
def initialize
|
|
@@ -25,6 +25,15 @@ module Geordi
|
|
|
25
25
|
save_global_settings
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
def auto_update_chromedriver
|
|
29
|
+
@global_settings["auto_update_chromedriver"] || false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def auto_update_chromedriver=(value)
|
|
33
|
+
@global_settings['auto_update_chromedriver'] = value
|
|
34
|
+
save_global_settings
|
|
35
|
+
end
|
|
36
|
+
|
|
28
37
|
# Local settings
|
|
29
38
|
# They should not be changed by geordi to avoid unexpected diffs, therefore
|
|
30
39
|
# there are no setters for these settings
|
|
@@ -129,7 +138,7 @@ module Geordi
|
|
|
129
138
|
def inquire_pt_api_key
|
|
130
139
|
Geordi::Interaction.warn 'Your settings are missing or invalid.'
|
|
131
140
|
Geordi::Interaction.warn "Please configure your Pivotal Tracker access."
|
|
132
|
-
token = Geordi::Interaction.prompt
|
|
141
|
+
token = Geordi::Interaction.prompt('Your API key:').to_s # Just be sure
|
|
133
142
|
self.pivotal_tracker_api_key = token
|
|
134
143
|
puts
|
|
135
144
|
|
data/lib/geordi/util.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Geordi
|
|
|
21
21
|
# install missing gem
|
|
22
22
|
Interaction.warn 'Probably missing gem: ' + gem_name
|
|
23
23
|
Interaction.prompt('Install it now?', 'y', /y|yes/) || Interaction.fail('Missing Gems.')
|
|
24
|
-
|
|
24
|
+
Util.run!(install_command, show_cmd: true)
|
|
25
25
|
|
|
26
26
|
# retry
|
|
27
27
|
Gem.clear_paths
|
|
@@ -33,50 +33,62 @@ module Geordi
|
|
|
33
33
|
# Run a command with a clean environment.
|
|
34
34
|
# Print an error message and exit if the command fails.
|
|
35
35
|
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if
|
|
36
|
+
# show_cmd: Whether to print the command
|
|
37
|
+
# confirm: Whether to ask for confirmation before running it
|
|
38
|
+
# fail_message: The text to print on command failure
|
|
39
|
+
def run!(command, show_cmd: false, confirm: false, fail_message: 'Something went wrong.')
|
|
40
|
+
# Disable shell features for arrays https://stackoverflow.com/questions/13338147/ruby-system-method-arguments
|
|
41
|
+
# Conversion: ['ls *', 'some arg'] => ['ls', '*', 'some arg']
|
|
42
|
+
# If you need shell features, you need to pass in a String instead of an array.
|
|
43
|
+
if command.is_a?(Array)
|
|
44
|
+
real_command, *arguments = *command
|
|
45
|
+
command = [real_command.split(' '), arguments].flatten
|
|
46
|
+
show_command = command
|
|
47
|
+
else
|
|
48
|
+
show_command = [command]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
if show_cmd
|
|
52
|
+
# Join with spaces for better readability and copy-pasting
|
|
53
|
+
Interaction.note_cmd show_command.join(' ')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
if confirm
|
|
44
57
|
Interaction.prompt('Run this now?', 'n', /y|yes/) or Interaction.fail('Cancelled.')
|
|
45
58
|
end
|
|
46
59
|
|
|
47
60
|
if testing?
|
|
48
|
-
|
|
61
|
+
# Join with commas for precise argument distinction
|
|
62
|
+
puts "Util.run! #{show_command.join(', ')}"
|
|
49
63
|
else
|
|
50
64
|
# Remove Geordi's Bundler environment when running commands.
|
|
51
65
|
success = if !defined?(Bundler)
|
|
52
|
-
system(*
|
|
66
|
+
system(*command)
|
|
53
67
|
elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('2.1.2')
|
|
54
68
|
Bundler.with_original_env do
|
|
55
|
-
system(*
|
|
69
|
+
system(*command)
|
|
56
70
|
end
|
|
57
71
|
else
|
|
58
|
-
Bundler.clean_system(*
|
|
72
|
+
Bundler.clean_system(*command)
|
|
59
73
|
end
|
|
60
74
|
|
|
61
|
-
success || Interaction.fail(
|
|
75
|
+
success || Interaction.fail(fail_message)
|
|
62
76
|
end
|
|
63
77
|
end
|
|
64
78
|
|
|
65
|
-
def
|
|
79
|
+
def binstub_or_fallback(executable)
|
|
66
80
|
binstub_file = "bin/#{executable}"
|
|
67
81
|
|
|
68
|
-
|
|
69
|
-
command.push(*arguments)
|
|
70
|
-
command.join(' ')
|
|
82
|
+
File.exists?(binstub_file) ? binstub_file : "bundle exec #{executable}"
|
|
71
83
|
end
|
|
72
84
|
|
|
73
85
|
def console_command(environment)
|
|
74
86
|
if gem_major_version('rails') == 2
|
|
75
87
|
'script/console ' + environment
|
|
76
88
|
elsif gem_major_version('rails') == 3
|
|
77
|
-
|
|
89
|
+
"#{binstub_or_fallback('rails')} console #{environment}"
|
|
78
90
|
else
|
|
79
|
-
|
|
91
|
+
"#{binstub_or_fallback('rails')} console -e #{environment}"
|
|
80
92
|
end
|
|
81
93
|
end
|
|
82
94
|
|
|
@@ -84,7 +96,7 @@ module Geordi
|
|
|
84
96
|
if gem_major_version('rails') == 2
|
|
85
97
|
'script/server ""'
|
|
86
98
|
else
|
|
87
|
-
|
|
99
|
+
"#{binstub_or_fallback('rails')} server"
|
|
88
100
|
end
|
|
89
101
|
end
|
|
90
102
|
|
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: 4.
|
|
4
|
+
version: 4.2.1
|
|
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-
|
|
11
|
+
date: 2020-11-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|
|
@@ -97,13 +97,13 @@ files:
|
|
|
97
97
|
- lib/geordi/settings.rb
|
|
98
98
|
- lib/geordi/util.rb
|
|
99
99
|
- lib/geordi/version.rb
|
|
100
|
-
homepage:
|
|
100
|
+
homepage: https://makandra.com
|
|
101
101
|
licenses:
|
|
102
102
|
- MIT
|
|
103
103
|
metadata: {}
|
|
104
104
|
post_install_message: |
|
|
105
105
|
* Binary `geordi` installed
|
|
106
|
-
* Geordi 4
|
|
106
|
+
* Geordi 4 has removed its deprecated executables. If you want to invoke these commands like before, you may create aliases on your machine. For the alias mapping, please refer to https://github.com/makandra/geordi/commit/68fa92acb146ebde3acb92d7b9556bd4eaa2b4ff
|
|
107
107
|
rdoc_options: []
|
|
108
108
|
require_paths:
|
|
109
109
|
- lib
|