geordi 4.2.1 → 5.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +48 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +37 -0
- data/Gemfile.lock +20 -20
- data/README.md +30 -11
- data/exe/geordi +2 -0
- data/geordi.gemspec +3 -5
- data/lib/geordi/commands/_setup_vnc.rb +8 -10
- data/lib/geordi/commands/commit.rb +0 -4
- data/lib/geordi/commands/docker.rb +44 -0
- data/lib/geordi/commands/update.rb +15 -4
- data/lib/geordi/cucumber.rb +6 -4
- data/lib/geordi/docker.rb +116 -0
- data/lib/geordi/dump_loader.rb +1 -1
- data/lib/geordi/util.rb +1 -1
- data/lib/geordi/version.rb +1 -1
- metadata +8 -8
- data/.travis.yml +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cdbb8d2117f5dabfe50dd59aefd6350f0bc4ed432c34b84ed69c1eb7ec4deb8
|
4
|
+
data.tar.gz: 8c698261c37144cb4d5d237bb7617103cb662b442702f629c8a84bc2b90e46fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5073101d9cf2117115e5ae56ef1c702f7a809390b11a80aef7d18b8006ce6a57c2519e6ba46c2498bb08fdb7f41c1dc87393dc241faaaddff9f7f02d6fea09e6
|
7
|
+
data.tar.gz: ebbd01ff8e87137f89dccb27f8f57d2aca28c5993631957ec5d1c23cb23b24182b368748bcfb0dadd8f0c4d841218755ac34c4f3ba449333f3aa7b2c6f0c3e25
|
@@ -0,0 +1,48 @@
|
|
1
|
+
name: Tests
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
pull_request:
|
7
|
+
branches:
|
8
|
+
- master
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-18.04
|
12
|
+
strategy:
|
13
|
+
fail-fast: false
|
14
|
+
matrix:
|
15
|
+
include:
|
16
|
+
- ruby: 2.2.10
|
17
|
+
gemfile: Gemfile
|
18
|
+
- ruby: 2.3.8
|
19
|
+
gemfile: Gemfile
|
20
|
+
- ruby: 2.4.10
|
21
|
+
gemfile: Gemfile
|
22
|
+
- ruby: 2.5.8
|
23
|
+
gemfile: Gemfile
|
24
|
+
- ruby: 2.6.6
|
25
|
+
gemfile: Gemfile
|
26
|
+
- ruby: 2.7.2
|
27
|
+
gemfile: Gemfile
|
28
|
+
env:
|
29
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v2
|
32
|
+
- name: Install ruby
|
33
|
+
uses: ruby/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: "${{ matrix.ruby }}"
|
36
|
+
- name: Install vncserver
|
37
|
+
run: |
|
38
|
+
sudo apt-get update
|
39
|
+
sudo apt-get install -y tightvncserver
|
40
|
+
# Fake required password for vncserver
|
41
|
+
mkdir ~/.vnc && touch ~/.vnc/passwd && chmod 700 ~/.vnc/passwd
|
42
|
+
- name: Bundle
|
43
|
+
run: |
|
44
|
+
gem install bundler:1.17.3
|
45
|
+
bundle install --no-deployment
|
46
|
+
- name: Run tests
|
47
|
+
run: bundle exec rake
|
48
|
+
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5
|
1
|
+
2.5.8
|
data/CHANGELOG.md
CHANGED
@@ -7,7 +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
|
+
### Breaking changes
|
12
|
+
|
13
|
+
|
14
|
+
## 5.2.2 2020-12-17
|
15
|
+
|
16
|
+
### Compatible changes
|
17
|
+
|
18
|
+
* Ignore ACL settings when loading a PostgreSQL dump
|
19
|
+
|
20
|
+
|
21
|
+
## 5.2.1 2020-12-15
|
22
|
+
|
23
|
+
### Compatible changes
|
24
|
+
|
25
|
+
* Fix a bug regarding `geordi vnc` which was introduced in 5.1.0
|
26
|
+
|
27
|
+
## 5.2.0 2020-12-14
|
28
|
+
|
29
|
+
### Compatible changes
|
30
|
+
|
31
|
+
* Geordi update will exit with a warning when Ruby version changes during pull.
|
32
|
+
* Add `geordi docker` command with support for opening a shell for dockerized dev environments.
|
33
|
+
|
34
|
+
|
35
|
+
## 5.1.0 2020-12-04
|
36
|
+
|
37
|
+
### Compatible changes
|
38
|
+
* Switch to tightvncserver to be compatible with Ubuntu 20.04. vnc4server is still supported.
|
39
|
+
|
40
|
+
|
41
|
+
## 5.0.0 2020-11-25
|
42
|
+
|
10
43
|
### Breaking changes
|
44
|
+
* Remove support for Ruby 2.0 and 2.1
|
11
45
|
|
12
46
|
|
13
47
|
## 4.2.0 2020-10-02
|
@@ -120,6 +154,9 @@ Don't know how to build task 'db:migrate parallel:prepare'
|
|
120
154
|
### Breaking changes
|
121
155
|
- 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.
|
122
156
|
|
157
|
+
## 2.12.3
|
158
|
+
|
159
|
+
* Add `geordi docker` command with support for opening a shell for dockerized dev environments.
|
123
160
|
|
124
161
|
## 2.11.0 2020-05-04
|
125
162
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
geordi (
|
4
|
+
geordi (5.2.2)
|
5
5
|
thor (~> 1)
|
6
6
|
|
7
7
|
GEM
|
@@ -28,21 +28,21 @@ GEM
|
|
28
28
|
coercible (1.0.0)
|
29
29
|
descendants_tracker (~> 0.0.1)
|
30
30
|
contracts (0.16.0)
|
31
|
-
cucumber (3.
|
31
|
+
cucumber (3.2.0)
|
32
32
|
builder (>= 2.1.2)
|
33
|
-
cucumber-core (~> 3.
|
34
|
-
cucumber-expressions (~>
|
33
|
+
cucumber-core (~> 3.2.0)
|
34
|
+
cucumber-expressions (~> 6.0.1)
|
35
35
|
cucumber-wire (~> 0.0.1)
|
36
36
|
diff-lcs (~> 1.3)
|
37
|
-
gherkin (~>
|
37
|
+
gherkin (~> 5.1.0)
|
38
38
|
multi_json (>= 1.7.5, < 2.0)
|
39
39
|
multi_test (>= 0.1.2)
|
40
|
-
cucumber-core (3.
|
40
|
+
cucumber-core (3.2.1)
|
41
41
|
backports (>= 3.8.0)
|
42
|
-
cucumber-tag_expressions (
|
43
|
-
gherkin (
|
44
|
-
cucumber-expressions (
|
45
|
-
cucumber-tag_expressions (
|
42
|
+
cucumber-tag_expressions (~> 1.1.0)
|
43
|
+
gherkin (~> 5.0)
|
44
|
+
cucumber-expressions (6.0.1)
|
45
|
+
cucumber-tag_expressions (1.1.1)
|
46
46
|
cucumber-wire (0.0.1)
|
47
47
|
declarative (0.0.10)
|
48
48
|
declarative-option (0.1.0)
|
@@ -50,13 +50,13 @@ GEM
|
|
50
50
|
thread_safe (~> 0.3, >= 0.3.1)
|
51
51
|
diff-lcs (1.4.4)
|
52
52
|
equalizer (0.0.11)
|
53
|
-
excon (0.
|
53
|
+
excon (0.78.0)
|
54
54
|
faraday (0.17.3)
|
55
55
|
multipart-post (>= 1.2, < 3)
|
56
56
|
faraday_middleware (0.14.0)
|
57
57
|
faraday (>= 0.7.4, < 1.0)
|
58
58
|
ffi (1.12.2)
|
59
|
-
gherkin (
|
59
|
+
gherkin (5.1.0)
|
60
60
|
highline (2.0.3)
|
61
61
|
ice_nine (0.11.2)
|
62
62
|
launchy (2.4.3)
|
@@ -66,25 +66,25 @@ GEM
|
|
66
66
|
multi_json (1.15.0)
|
67
67
|
multi_test (0.1.2)
|
68
68
|
multipart-post (2.1.1)
|
69
|
-
parallel (1.
|
70
|
-
parallel_tests (2.
|
69
|
+
parallel (1.19.2)
|
70
|
+
parallel_tests (2.32.0)
|
71
71
|
parallel
|
72
72
|
pry (0.13.1)
|
73
73
|
coderay (~> 1.1)
|
74
74
|
method_source (~> 1.0)
|
75
|
-
public_suffix (
|
75
|
+
public_suffix (3.1.1)
|
76
76
|
rake (12.3.3)
|
77
77
|
representable (3.0.4)
|
78
78
|
declarative (< 0.1.0)
|
79
79
|
declarative-option (< 0.2.0)
|
80
80
|
uber (< 0.2.0)
|
81
|
-
rspec-expectations (3.
|
81
|
+
rspec-expectations (3.10.0)
|
82
82
|
diff-lcs (>= 1.2.0, < 2.0)
|
83
|
-
rspec-support (~> 3.
|
84
|
-
rspec-mocks (3.
|
83
|
+
rspec-support (~> 3.10.0)
|
84
|
+
rspec-mocks (3.10.0)
|
85
85
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
|
-
rspec-support (~> 3.
|
87
|
-
rspec-support (3.
|
86
|
+
rspec-support (~> 3.10.0)
|
87
|
+
rspec-support (3.10.0)
|
88
88
|
thor (1.0.1)
|
89
89
|
thread_safe (0.3.6)
|
90
90
|
tracker_api (1.11.0)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Geordi [![
|
1
|
+
Geordi [![Tests](https://github.com/makandra/geordi/workflows/Tests/badge.svg)](https://github.com/makandra/geordi/actions)
|
2
2
|
======
|
3
3
|
|
4
4
|
Geordi is a collection of command line tools we use in our daily work with
|
@@ -157,6 +157,24 @@ instead of `cap deploy:migrations`. You can force using `deploy` by passing the
|
|
157
157
|
- `-c, [--current-branch], [--no-current-branch]`: Set DEPLOY_BRANCH to the current branch during deploy
|
158
158
|
|
159
159
|
|
160
|
+
### `geordi docker`
|
161
|
+
Manage docker containers for the current project.
|
162
|
+
|
163
|
+
Manage docker containers to run your project dockerized.
|
164
|
+
|
165
|
+
It expects a `docker-compose.yml` file that specifies all services, and a service
|
166
|
+
named "main" that opens a shell for the project.
|
167
|
+
|
168
|
+
There are three subcommands:
|
169
|
+
|
170
|
+
- `geordi docker setup`
|
171
|
+
Fetches all docker containers.
|
172
|
+
- `geordi docker shell`
|
173
|
+
Runs the docker service named 'main'.
|
174
|
+
- `geordi docker vnc`
|
175
|
+
Opens a VNC viewer to connect to the VNC server in the container.
|
176
|
+
|
177
|
+
|
160
178
|
### `geordi drop-databases`
|
161
179
|
Interactively delete local databases.
|
162
180
|
|
@@ -176,18 +194,10 @@ offer to edit the whitelist instead.
|
|
176
194
|
- `[--postgres=PORT_OR_SOCKET]`: Use Postgres port or socket
|
177
195
|
- `[--mysql=PORT_OR_SOCKET]`: Use MySQL/MariaDB port or socket
|
178
196
|
|
197
|
+
|
179
198
|
### `geordi dump [TARGET]`
|
180
199
|
Handle (remote) database dumps.
|
181
200
|
|
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
|
-
|
191
201
|
`geordi dump` (without arguments) dumps the development database with `dumple`.
|
192
202
|
|
193
203
|
`geordi dump -l tmp/staging.dump` (with the `--load` option) sources the
|
@@ -199,8 +209,15 @@ specified target's database and downloads it to `tmp/`.
|
|
199
209
|
`geordi dump staging -l` (with a Capistrano deploy target and the `--load`
|
200
210
|
option) sources the dump into the development database after downloading it.
|
201
211
|
|
212
|
+
If you are using multiple databases per environment, pass the database name like this:
|
213
|
+
|
214
|
+
geordi dump -d primary
|
215
|
+
|
216
|
+
Loading a dump into one of multiple local databases is not supported yet.
|
217
|
+
|
202
218
|
**Options**
|
203
219
|
- `-l, [--load=[DUMP_FILE]]`: Load a dump
|
220
|
+
- `-d, [--database=NAME]`: Database name, if there are multiple databases
|
204
221
|
|
205
222
|
|
206
223
|
### `geordi firefox COMMAND`
|
@@ -384,7 +401,9 @@ Stores a timestamped database dump for the given Rails environment in `~/dumps`:
|
|
384
401
|
|
385
402
|
dumple development
|
386
403
|
|
387
|
-
|
404
|
+
**Options**
|
405
|
+
- `-i`: Print disk usage of `~/dumps`
|
406
|
+
- `--compress`: After dumping, run gzip to compress the dump in place
|
388
407
|
|
389
408
|
|
390
409
|
launchy_browser
|
data/exe/geordi
CHANGED
data/geordi.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'geordi/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'geordi'
|
7
7
|
spec.version = Geordi::VERSION
|
8
|
-
spec.required_ruby_version = '>= 2.
|
8
|
+
spec.required_ruby_version = '>= 2.2.0'
|
9
9
|
spec.authors = ['Henning Koch']
|
10
10
|
spec.email = ['henning.koch@makandra.de']
|
11
11
|
|
@@ -25,8 +25,6 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_runtime_dependency 'thor', '~> 1'
|
27
27
|
|
28
|
-
spec.post_install_message = <<-ATTENTION
|
29
|
-
|
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
|
-
ATTENTION
|
28
|
+
#spec.post_install_message = <<-ATTENTION
|
29
|
+
#ATTENTION
|
32
30
|
end
|
@@ -23,26 +23,24 @@ def _setup_vnc
|
|
23
23
|
Interaction.success 'It appears you already have a VNC server installed. Good job!'
|
24
24
|
else
|
25
25
|
puts 'Please run:'
|
26
|
-
Interaction.note_cmd 'sudo apt-get install
|
26
|
+
Interaction.note_cmd 'sudo apt-get install tightvncserver'
|
27
|
+
puts 'In case this package is not available, you may try vnc4server instead.'
|
27
28
|
Interaction.prompt 'Continue ...'
|
28
29
|
|
29
30
|
puts
|
31
|
+
|
30
32
|
Interaction.note 'We will now set a password for your VNC server.'
|
31
33
|
puts Util.strip_heredoc <<-TEXT
|
32
|
-
When running our cucumber script,
|
33
|
-
|
34
|
-
without our cucumber script, a user with
|
35
|
-
your machine.
|
34
|
+
When running our cucumber script, this password will be used while also
|
35
|
+
restricting access to the local machine. However, if you start a vncserver
|
36
|
+
without our cucumber script, keep in mind that a user with this password
|
37
|
+
can connect to your machine.
|
36
38
|
|
37
39
|
TEXT
|
38
40
|
puts 'Please run:'
|
39
|
-
Interaction.note_cmd '
|
41
|
+
Interaction.note_cmd 'vncpasswd'
|
40
42
|
Interaction.warn 'Enter a secure password!'
|
41
43
|
Interaction.prompt 'Continue ...'
|
42
|
-
|
43
|
-
puts 'Now stop the server again. Please run:'
|
44
|
-
Interaction.note_cmd 'vncserver -kill :20'
|
45
|
-
Interaction.prompt 'Continue ...'
|
46
44
|
end
|
47
45
|
|
48
46
|
Interaction.announce 'Setup VNC viewer'
|
@@ -9,10 +9,6 @@ stored in `~/.config/geordi/global.yml`.
|
|
9
9
|
LONGDESC
|
10
10
|
|
11
11
|
def commit(*git_args)
|
12
|
-
raise <<-TEXT if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1')
|
13
|
-
Unsupported Ruby Version #{RUBY_VERSION}. `geordi commit` requires Ruby 2.1+.
|
14
|
-
TEXT
|
15
|
-
|
16
12
|
require 'geordi/gitpt'
|
17
13
|
Gitpt.new.run(git_args)
|
18
14
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class DockerCLI < Thor
|
2
|
+
desc 'setup', 'Setup docker and fetch required docker-container for the current project.'
|
3
|
+
def setup
|
4
|
+
docker.setup
|
5
|
+
end
|
6
|
+
|
7
|
+
desc 'shell', 'Open a shell in the main docker container for the current project.'
|
8
|
+
option :secondary, default: false, type: :boolean
|
9
|
+
map 'shell' => '_shell'
|
10
|
+
def _shell
|
11
|
+
docker.shell(:secondary => options[:secondary])
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'vnc', 'Open a vnc viewer connecting to the docker container.'
|
15
|
+
def vnc
|
16
|
+
docker.vnc
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def docker
|
22
|
+
require 'geordi/docker'
|
23
|
+
Geordi::Docker.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'docker', 'Manage docker containers for the current project.'
|
28
|
+
long_desc <<-LONGDESC
|
29
|
+
Manage docker containers to run your project dockerized.
|
30
|
+
|
31
|
+
It expects a `docker-compose.yml` file that specifies all services, and a service
|
32
|
+
named "main" that opens a shell for the project.
|
33
|
+
|
34
|
+
There are three subcommands:
|
35
|
+
|
36
|
+
- `geordi docker setup`
|
37
|
+
Fetches all docker containers.
|
38
|
+
- `geordi docker shell`
|
39
|
+
Runs the docker service named 'main'.
|
40
|
+
- `geordi docker vnc`
|
41
|
+
Opens a VNC viewer to connect to the VNC server in the container.
|
42
|
+
|
43
|
+
LONGDESC
|
44
|
+
subcommand 'docker', DockerCLI
|
@@ -10,13 +10,24 @@ option :dump, type: :string, aliases: '-d', banner: 'TARGET',
|
|
10
10
|
option :test, type: :boolean, aliases: '-t', desc: 'After updating, run tests'
|
11
11
|
|
12
12
|
def update
|
13
|
+
old_ruby_version = File.read('.ruby-version').chomp
|
14
|
+
|
13
15
|
Interaction.announce 'Updating repository'
|
14
16
|
Util.run!('git pull', show_cmd: true)
|
15
17
|
|
16
|
-
|
18
|
+
ruby_version = File.read('.ruby-version').chomp
|
19
|
+
ruby_version_changed = !ruby_version.empty? && (ruby_version != old_ruby_version)
|
20
|
+
|
21
|
+
if ruby_version_changed
|
22
|
+
puts
|
23
|
+
Interaction.warn 'Ruby version changed during git pull. Please run again to use the new version.'
|
24
|
+
exit(1)
|
25
|
+
else
|
26
|
+
invoke_geordi 'migrate'
|
17
27
|
|
18
|
-
|
28
|
+
Interaction.success 'Successfully updated the project.'
|
19
29
|
|
20
|
-
|
21
|
-
|
30
|
+
invoke_geordi 'dump', options.dump, load: true if options.dump
|
31
|
+
invoke_geordi 'tests' if options.test
|
32
|
+
end
|
22
33
|
end
|
data/lib/geordi/cucumber.rb
CHANGED
@@ -11,8 +11,10 @@ module Geordi
|
|
11
11
|
class Cucumber
|
12
12
|
|
13
13
|
VNC_DISPLAY = ':17'.freeze
|
14
|
-
|
15
|
-
|
14
|
+
VNC_PASSWORD_FILE = File.expand_path('~/.vnc/passwd').freeze # default for "vncpasswd"
|
15
|
+
VNC_SERVER_DEFAULT_OPTIONS = "-localhost -nolisten tcp -geometry 1280x1024 -rfbauth #{VNC_PASSWORD_FILE}".freeze
|
16
|
+
VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} #{ENV.fetch('GEORDI_VNC_OPTIONS', VNC_SERVER_DEFAULT_OPTIONS)}".freeze
|
17
|
+
VNC_VIEWER_COMMAND = "vncviewer -passwd #{VNC_PASSWORD_FILE}".freeze
|
16
18
|
VNC_ENV_VARIABLES = %w[DISPLAY BROWSER LAUNCHY_BROWSER].freeze
|
17
19
|
|
18
20
|
def run(files, cucumber_options, options = {})
|
@@ -30,10 +32,10 @@ module Geordi
|
|
30
32
|
system command # Util.run! would reset the Firefox PATH
|
31
33
|
end
|
32
34
|
|
33
|
-
def launch_vnc_viewer
|
35
|
+
def launch_vnc_viewer(source = VNC_DISPLAY)
|
34
36
|
fork do
|
35
37
|
error = capture_stderr do
|
36
|
-
system(VNC_VIEWER_COMMAND)
|
38
|
+
system("#{VNC_VIEWER_COMMAND} #{source}")
|
37
39
|
end
|
38
40
|
unless $?.success?
|
39
41
|
if $?.exitstatus == 127
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'geordi/interaction'
|
2
|
+
require 'geordi/cucumber'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Geordi
|
6
|
+
class Docker
|
7
|
+
DOCKER_COMPOSE_FILE = 'docker-compose.yml'.freeze
|
8
|
+
|
9
|
+
include Interaction
|
10
|
+
|
11
|
+
def setup
|
12
|
+
check_installation_and_config
|
13
|
+
announce('Fetching containers...')
|
14
|
+
if execute(:system, 'docker-compose', 'pull')
|
15
|
+
success('Fetch successful.')
|
16
|
+
else
|
17
|
+
fail('Fetch failed.')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def shell(options = {})
|
22
|
+
check_installation_and_config
|
23
|
+
if options[:secondary]
|
24
|
+
attach_to_running_shell
|
25
|
+
else
|
26
|
+
run_shell
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def vnc
|
31
|
+
Cucumber.new.launch_vnc_viewer('::5967')
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def attach_to_running_shell
|
37
|
+
running_containers = execute(:`, 'docker-compose ps').split("\n")
|
38
|
+
if (main_container_line = running_containers.grep(/_main_run/).first)
|
39
|
+
container_name = main_container_line.split(' ').first
|
40
|
+
execute(:exec, 'docker', 'exec', '-it', container_name, 'bash')
|
41
|
+
else
|
42
|
+
fail('Could not find a running shell. Start without --secondary first.')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def run_shell
|
47
|
+
command = [:system, 'docker-compose', 'run', '--service-ports']
|
48
|
+
command += ssh_agent_forward
|
49
|
+
command += ['main']
|
50
|
+
execute(*command)
|
51
|
+
execute(:system, 'docker-compose', 'stop')
|
52
|
+
end
|
53
|
+
|
54
|
+
def execute(kind, *args)
|
55
|
+
if ENV['GEORDI_TESTING']
|
56
|
+
puts "Stubbed run #{args.join(' ')}"
|
57
|
+
if kind == :`
|
58
|
+
mock_parse(*args)
|
59
|
+
else
|
60
|
+
mock_run(*args)
|
61
|
+
end
|
62
|
+
else
|
63
|
+
send(kind, *args)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def mock_run(*args)
|
68
|
+
# exists just to be stubbed in tests
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
def mock_parse(*args)
|
73
|
+
# exists just to be stubbed in tests
|
74
|
+
'command output'
|
75
|
+
end
|
76
|
+
|
77
|
+
def check_installation_and_config
|
78
|
+
unless command_exists?('docker')
|
79
|
+
fail('You need to install docker first with `sudo apt install docker`. After installation please log out and back in to your system once.')
|
80
|
+
end
|
81
|
+
|
82
|
+
unless command_exists?('docker-compose')
|
83
|
+
fail('You need to install docker-compose first with `sudo apt install docker-compose`.')
|
84
|
+
end
|
85
|
+
|
86
|
+
unless docker_compose_config && (services = docker_compose_config['services']) && services.key?('main')
|
87
|
+
fail('Your project does not seem to be properly set up. Expected to find a docker-compose.yml which defines a service named "main".')
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def command_exists?(command)
|
92
|
+
execute(:system, "which #{command} > /dev/null")
|
93
|
+
end
|
94
|
+
|
95
|
+
def docker_compose_config
|
96
|
+
@docker_compose_config ||= if File.exists?(DOCKER_COMPOSE_FILE)
|
97
|
+
if YAML.respond_to?(:safe_load)
|
98
|
+
YAML.safe_load(File.read(DOCKER_COMPOSE_FILE))
|
99
|
+
else
|
100
|
+
YAML.load(File.read(DOCKER_COMPOSE_FILE))
|
101
|
+
end
|
102
|
+
end
|
103
|
+
rescue
|
104
|
+
false
|
105
|
+
end
|
106
|
+
|
107
|
+
def ssh_agent_forward
|
108
|
+
if (auth_sock = ENV['SSH_AUTH_SOCK'])
|
109
|
+
dirname = File.dirname(auth_sock)
|
110
|
+
['-v', "#{dirname}:#{dirname}", '-e', "SSH_AUTH_SOCK=#{auth_sock}"]
|
111
|
+
else
|
112
|
+
[]
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/lib/geordi/dump_loader.rb
CHANGED
@@ -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']
|
data/lib/geordi/util.rb
CHANGED
@@ -64,7 +64,7 @@ module Geordi
|
|
64
64
|
# Remove Geordi's Bundler environment when running commands.
|
65
65
|
success = if !defined?(Bundler)
|
66
66
|
system(*command)
|
67
|
-
elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('
|
67
|
+
elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('1.17.3')
|
68
68
|
Bundler.with_original_env do
|
69
69
|
system(*command)
|
70
70
|
end
|
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
|
+
version: 5.2.2
|
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-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -36,9 +36,9 @@ executables:
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
+
- ".github/workflows/test.yml"
|
39
40
|
- ".gitignore"
|
40
41
|
- ".ruby-version"
|
41
|
-
- ".travis.yml"
|
42
42
|
- CHANGELOG.md
|
43
43
|
- Gemfile
|
44
44
|
- Gemfile.lock
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/geordi/commands/cucumber.rb
|
69
69
|
- lib/geordi/commands/delete_dumps.rb
|
70
70
|
- lib/geordi/commands/deploy.rb
|
71
|
+
- lib/geordi/commands/docker.rb
|
71
72
|
- lib/geordi/commands/drop_databases.rb
|
72
73
|
- lib/geordi/commands/dump.rb
|
73
74
|
- lib/geordi/commands/firefox.rb
|
@@ -89,6 +90,7 @@ files:
|
|
89
90
|
- lib/geordi/commands/yarn_install.rb
|
90
91
|
- lib/geordi/cucumber.rb
|
91
92
|
- lib/geordi/db_cleaner.rb
|
93
|
+
- lib/geordi/docker.rb
|
92
94
|
- lib/geordi/dump_loader.rb
|
93
95
|
- lib/geordi/firefox_for_selenium.rb
|
94
96
|
- lib/geordi/gitpt.rb
|
@@ -101,9 +103,7 @@ homepage: https://makandra.com
|
|
101
103
|
licenses:
|
102
104
|
- MIT
|
103
105
|
metadata: {}
|
104
|
-
post_install_message:
|
105
|
-
* Binary `geordi` installed
|
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
|
106
|
+
post_install_message:
|
107
107
|
rdoc_options: []
|
108
108
|
require_paths:
|
109
109
|
- lib
|
@@ -111,14 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
111
|
requirements:
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: 2.
|
114
|
+
version: 2.2.0
|
115
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - ">="
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
|
-
rubygems_version: 3.
|
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
|
data/.travis.yml
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- '2.0.0'
|
5
|
-
- '2.1.10'
|
6
|
-
- '2.2.10'
|
7
|
-
- '2.3.8'
|
8
|
-
- '2.4.10'
|
9
|
-
- '2.5.8'
|
10
|
-
- '2.6.6'
|
11
|
-
- '2.7.1'
|
12
|
-
|
13
|
-
gemfile:
|
14
|
-
- 'Gemfile'
|
15
|
-
|
16
|
-
dist: trusty
|
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
|
22
|
-
install:
|
23
|
-
- gem install bundler:1.17.3
|
24
|
-
# Replace default Travis CI bundler script with a version that doesn't
|
25
|
-
# explode when lockfile doesn't match recently bumped version
|
26
|
-
- bundle install --no-deployment --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
|
27
|
-
|
28
|
-
script: bundle exec rake
|