geordi 2.11.0 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +62 -10
- data/README.md +22 -0
- data/bin/geordi +2 -0
- data/features/docker.feature +59 -0
- data/features/step_definitions/docker_command_steps.rb +10 -0
- data/features/{support/step_definitions → step_definitions}/miscellaneous_steps.rb +0 -0
- data/features/support/aruba.rb +60 -0
- data/features/support/env.rb +2 -1
- data/lib/geordi/commands/docker.rb +36 -0
- data/lib/geordi/cucumber.rb +2 -1
- data/lib/geordi/docker.rb +71 -0
- data/lib/geordi/util.rb +1 -1
- data/lib/geordi/version.rb +1 -1
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ae46d6ac8d8dd9bf53654f65445df1d0c576833db47db589b76e94cbb5784c0
|
4
|
+
data.tar.gz: 0034075de2f4f848686463486854cfaaee3980918048ce3480c3d6dc50634f0b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c52e541c8204de7e79e2935211251001b9992898770632eca578678eae5b58d4d8edb5c64b2ec82fa4f797109adc76091f9293a4bd2e3a0567c1a65a050791ab
|
7
|
+
data.tar.gz: 63bdba922fb2eaccd2edd3fffe233abc67fce88587606fea218685b4ee682181ea5f8c6daf728227dfa736d838327eef6f1ae930f67dec056dcd6c23fb0d6a85
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,38 +1,69 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
geordi (2.
|
4
|
+
geordi (2.12.0)
|
5
5
|
thor (~> 0.18.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
10
|
addressable (2.3.8)
|
11
|
-
aruba (0.
|
12
|
-
childprocess (
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
aruba (0.8.1)
|
12
|
+
childprocess (~> 0.5.6)
|
13
|
+
contracts (~> 0.9)
|
14
|
+
cucumber (>= 1.3.19)
|
15
|
+
rspec-expectations (>= 2.99)
|
16
|
+
axiom-types (0.1.1)
|
17
|
+
descendants_tracker (~> 0.0.4)
|
18
|
+
ice_nine (~> 0.11.0)
|
19
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
20
|
+
builder (3.2.4)
|
21
|
+
childprocess (0.5.9)
|
22
|
+
ffi (~> 1.0, >= 1.0.11)
|
23
|
+
coderay (1.1.3)
|
24
|
+
coercible (1.0.0)
|
25
|
+
descendants_tracker (~> 0.0.1)
|
26
|
+
contracts (0.9)
|
18
27
|
cucumber (1.3.20)
|
19
28
|
builder (>= 2.1.2)
|
20
29
|
diff-lcs (>= 1.1.3)
|
21
30
|
gherkin (~> 2.12)
|
22
31
|
multi_json (>= 1.7.5, < 2.0)
|
23
32
|
multi_test (>= 0.1.2)
|
33
|
+
declarative (0.0.20)
|
34
|
+
declarative-option (0.1.0)
|
35
|
+
descendants_tracker (0.0.4)
|
36
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
24
37
|
diff-lcs (1.2.5)
|
38
|
+
equalizer (0.0.11)
|
39
|
+
excon (0.78.0)
|
40
|
+
faraday (1.1.0)
|
41
|
+
multipart-post (>= 1.2, < 3)
|
42
|
+
ruby2_keywords
|
43
|
+
faraday_middleware (1.0.0)
|
44
|
+
faraday (~> 1.0)
|
45
|
+
ffi (1.9.18)
|
25
46
|
gherkin (2.12.2)
|
26
47
|
multi_json (~> 1.3)
|
27
48
|
highline (1.6.21)
|
49
|
+
ice_nine (0.11.2)
|
28
50
|
launchy (2.4.3)
|
29
51
|
addressable (~> 2.3)
|
30
|
-
|
52
|
+
method_source (1.0.0)
|
53
|
+
mimemagic (0.3.5)
|
54
|
+
multi_json (1.15.0)
|
31
55
|
multi_test (0.1.2)
|
56
|
+
multipart-post (2.1.1)
|
32
57
|
parallel (0.5.16)
|
33
58
|
parallel_tests (0.6.18)
|
34
59
|
parallel
|
35
|
-
|
60
|
+
pry (0.13.1)
|
61
|
+
coderay (~> 1.1)
|
62
|
+
method_source (~> 1.0)
|
63
|
+
representable (3.0.4)
|
64
|
+
declarative (< 0.1.0)
|
65
|
+
declarative-option (< 0.2.0)
|
66
|
+
uber (< 0.2.0)
|
36
67
|
rspec-expectations (3.4.0)
|
37
68
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
69
|
rspec-support (~> 3.4.0)
|
@@ -40,18 +71,39 @@ GEM
|
|
40
71
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
72
|
rspec-support (~> 3.4.0)
|
42
73
|
rspec-support (3.4.1)
|
74
|
+
ruby2_keywords (0.0.2)
|
43
75
|
thor (0.18.1)
|
76
|
+
thread_safe (0.3.6)
|
77
|
+
tracker_api (1.11.0)
|
78
|
+
addressable
|
79
|
+
equalizer
|
80
|
+
excon
|
81
|
+
faraday
|
82
|
+
faraday_middleware
|
83
|
+
mimemagic
|
84
|
+
multi_json
|
85
|
+
representable
|
86
|
+
virtus
|
87
|
+
uber (0.1.0)
|
88
|
+
virtus (1.0.5)
|
89
|
+
axiom-types (~> 0.1)
|
90
|
+
coercible (~> 1.0)
|
91
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
92
|
+
equalizer (~> 0.0, >= 0.0.9)
|
44
93
|
|
45
94
|
PLATFORMS
|
46
95
|
ruby
|
47
96
|
|
48
97
|
DEPENDENCIES
|
49
98
|
aruba
|
99
|
+
contracts (= 0.9)
|
50
100
|
geordi!
|
51
101
|
highline
|
52
102
|
launchy
|
53
103
|
parallel_tests
|
104
|
+
pry
|
54
105
|
rspec-mocks
|
106
|
+
tracker_api
|
55
107
|
|
56
108
|
BUNDLED WITH
|
57
109
|
1.17.3
|
data/README.md
CHANGED
@@ -54,6 +54,11 @@ 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
63
|
stored in `~/.gitpt`.
|
59
64
|
|
@@ -135,6 +140,23 @@ instead of `cap deploy:migrations`. You can force using `deploy` by passing the
|
|
135
140
|
-M option: `geordi deploy -M staging`.
|
136
141
|
|
137
142
|
|
143
|
+
### `geordi docker`
|
144
|
+
|
145
|
+
Manage docker containers for the current project.
|
146
|
+
|
147
|
+
Manage docker containers to run your project dockerized.
|
148
|
+
|
149
|
+
It expects a docker-compose file that specifies all services, and a service
|
150
|
+
named "main" that opens a shell for the project.
|
151
|
+
|
152
|
+
There are two subcommands:
|
153
|
+
|
154
|
+
- geordi docker setup
|
155
|
+
Builds all docker containers.
|
156
|
+
- geordi docker shell
|
157
|
+
Runs the docker service named 'main'.
|
158
|
+
|
159
|
+
|
138
160
|
### `geordi drop-databases`
|
139
161
|
|
140
162
|
Interactively delete local databases.
|
data/bin/geordi
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
@same-process
|
2
|
+
Feature: The docker command
|
3
|
+
|
4
|
+
Scenario: Setup checks for existence of docker
|
5
|
+
Given the docker command cannot find the "docker" binary
|
6
|
+
When I run `geordi docker setup`
|
7
|
+
Then the output should contain "which docker"
|
8
|
+
And the output should contain "x You need to install docker first"
|
9
|
+
|
10
|
+
|
11
|
+
Scenario: Setup checks for existence of docker-compose
|
12
|
+
Given the docker command cannot find the "docker-compose" binary
|
13
|
+
When I run `geordi docker setup`
|
14
|
+
Then the output should contain "which docker-compose"
|
15
|
+
And the output should contain "x You need to install docker-compose first"
|
16
|
+
|
17
|
+
|
18
|
+
Scenario: Setup checks for existence of docker-compose.yml
|
19
|
+
When I run `geordi docker setup`
|
20
|
+
Then the output should contain "x Your project does not seem to be properly set up."
|
21
|
+
|
22
|
+
|
23
|
+
Scenario: Setup checks for service named "main"
|
24
|
+
Given a file named "docker-compose.yml" with:
|
25
|
+
"""
|
26
|
+
foo: bar
|
27
|
+
"""
|
28
|
+
|
29
|
+
When I run `geordi docker setup`
|
30
|
+
Then the output should contain "x Your project does not seem to be properly set up."
|
31
|
+
|
32
|
+
|
33
|
+
Scenario: Setup runs docker-compose build
|
34
|
+
Given a file named "docker-compose.yml" with:
|
35
|
+
"""
|
36
|
+
services:
|
37
|
+
main: foo
|
38
|
+
"""
|
39
|
+
|
40
|
+
When I run `geordi docker setup`
|
41
|
+
Then the output should contain "docker-compose build"
|
42
|
+
|
43
|
+
|
44
|
+
Scenario: Shell checks for existence of docker
|
45
|
+
Given the docker command cannot find the "docker" binary
|
46
|
+
When I run `geordi docker shell`
|
47
|
+
Then the output should contain "which docker"
|
48
|
+
And the output should contain "x You need to install docker first"
|
49
|
+
|
50
|
+
|
51
|
+
Scenario: Shell runs docker-compose run maiun
|
52
|
+
Given a file named "docker-compose.yml" with:
|
53
|
+
"""
|
54
|
+
services:
|
55
|
+
main: foo
|
56
|
+
"""
|
57
|
+
|
58
|
+
When I run `geordi docker shell`
|
59
|
+
Then the output should contain "docker-compose run --service-ports main"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Given(/the docker command cannot find the "(.*?)" binary/) do |command|
|
2
|
+
require 'geordi/docker'
|
3
|
+
expect_any_instance_of(Geordi::Docker).to receive(:mock_run).at_least(:once).and_wrap_original do |original, *args|
|
4
|
+
if args[0] =~ /which #{Regexp.escape(command)}/
|
5
|
+
false
|
6
|
+
else
|
7
|
+
original.call(*args)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
File without changes
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'aruba/cucumber'
|
2
|
+
require 'aruba/in_process'
|
3
|
+
require 'geordi/cli'
|
4
|
+
|
5
|
+
# https://github.com/erikhuda/thor/wiki/Integrating-with-Aruba-In-Process-Runs
|
6
|
+
class InProcessCliRunner
|
7
|
+
|
8
|
+
# Allow everything fun to be injected from the outside while defaulting to normal implementations.
|
9
|
+
def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
|
10
|
+
@argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel
|
11
|
+
end
|
12
|
+
|
13
|
+
def execute!
|
14
|
+
exit_code = begin
|
15
|
+
# Thor accesses these streams directly rather than letting them be injected, so we replace them...
|
16
|
+
$stderr = @stderr
|
17
|
+
$stdin = @stdin
|
18
|
+
$stdout = @stdout
|
19
|
+
|
20
|
+
# Run our normal Thor app the way we know and love.
|
21
|
+
previous_program_name = $PROGRAM_NAME
|
22
|
+
$PROGRAM_NAME = 'geordi'
|
23
|
+
Geordi::CLI.start(@argv)
|
24
|
+
|
25
|
+
# Thor::Base#start does not have a return value, assume success if no exception is raised.
|
26
|
+
0
|
27
|
+
rescue StandardError => e
|
28
|
+
# The ruby interpreter would pipe this to STDERR and exit 1 in the case of an unhandled exception
|
29
|
+
b = e.backtrace
|
30
|
+
@stderr.puts("#{b.shift}: #{e.message} (#{e.class})")
|
31
|
+
@stderr.puts(b.map{|s| "\tfrom #{s}"}.join("\n"))
|
32
|
+
1
|
33
|
+
rescue SystemExit => e
|
34
|
+
e.status
|
35
|
+
ensure
|
36
|
+
# add additional cleanup code here
|
37
|
+
|
38
|
+
$stderr = STDERR
|
39
|
+
$stdin = STDIN
|
40
|
+
$stdout = STDOUT
|
41
|
+
$PROGRAM_NAME = previous_program_name
|
42
|
+
end
|
43
|
+
|
44
|
+
# Proxy our exit code back to the injected kernel.
|
45
|
+
@kernel.exit(exit_code)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Aruba.configure do |config|
|
50
|
+
config.main_class = InProcessCliRunner
|
51
|
+
config.command_launcher = :spawn
|
52
|
+
end
|
53
|
+
|
54
|
+
Before('@same-process') do
|
55
|
+
aruba.config.command_launcher = :in_process
|
56
|
+
end
|
57
|
+
|
58
|
+
Before do
|
59
|
+
@aruba_timeout_seconds = 5
|
60
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
class DockerCLI < Thor
|
2
|
+
desc 'setup', 'Setup docker and build 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
|
+
map 'shell' => '_shell'
|
9
|
+
def _shell
|
10
|
+
docker.shell
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def docker
|
16
|
+
require 'geordi/docker'
|
17
|
+
Geordi::Docker.new
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc 'docker', 'Manage docker containers for the current project.'
|
22
|
+
long_desc <<-LONGDESC
|
23
|
+
Manage docker containers to run your project dockerized.
|
24
|
+
|
25
|
+
It expects a docker-compose file that specifies all services, and a service
|
26
|
+
named "main" that opens a shell for the project.
|
27
|
+
|
28
|
+
There are two subcommands:
|
29
|
+
|
30
|
+
- geordi docker setup
|
31
|
+
Builds all docker containers.
|
32
|
+
- geordi docker shell
|
33
|
+
Runs the docker service named 'main'.
|
34
|
+
|
35
|
+
LONGDESC
|
36
|
+
subcommand 'docker', DockerCLI
|
data/lib/geordi/cucumber.rb
CHANGED
@@ -11,7 +11,8 @@ module Geordi
|
|
11
11
|
include Geordi::Interaction
|
12
12
|
|
13
13
|
VNC_DISPLAY = ':17'
|
14
|
-
|
14
|
+
VNC_SERVER_DEFAULT_OPTIONS = '-localhost -nolisten tcp -SecurityTypes None -geometry 1280x1024'
|
15
|
+
VNC_SERVER_COMMAND = "vncserver #{VNC_DISPLAY} #{ENV.fetch('GEORDI_VNC_OPTIONS', VNC_SERVER_DEFAULT_OPTIONS)}"
|
15
16
|
VNC_VIEWER_COMMAND = "vncviewer #{VNC_DISPLAY}"
|
16
17
|
VNC_ENV_VARIABLES = %w[DISPLAY BROWSER LAUNCHY_BROWSER]
|
17
18
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'geordi/interaction'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Geordi
|
5
|
+
class Docker
|
6
|
+
DOCKER_COMPOSE_FILE = 'docker-compose.yml'.freeze
|
7
|
+
|
8
|
+
include Interaction
|
9
|
+
|
10
|
+
def setup
|
11
|
+
check_installation_and_config
|
12
|
+
announce('Building containers...')
|
13
|
+
if execute(:system, 'docker-compose', 'build')
|
14
|
+
success('Build successful.')
|
15
|
+
else
|
16
|
+
fail('Build failed.')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def shell
|
21
|
+
check_installation_and_config
|
22
|
+
execute(:exec, 'docker-compose', 'run', '--service-ports', 'main')
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def execute(kind, *args)
|
28
|
+
if ENV['GEORDI_TESTING']
|
29
|
+
puts "Stubbed run #{args.join(' ')}"
|
30
|
+
mock_run(*args)
|
31
|
+
else
|
32
|
+
send(kind, *args)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def mock_run(*args)
|
37
|
+
# exists just to be stubbed in tests
|
38
|
+
true
|
39
|
+
end
|
40
|
+
|
41
|
+
def check_installation_and_config
|
42
|
+
unless command_exists?('docker')
|
43
|
+
fail('You need to install docker first with `sudo apt install docker`. After installation please log out and back in to your system once.')
|
44
|
+
end
|
45
|
+
|
46
|
+
unless command_exists?('docker-compose')
|
47
|
+
fail('You need to install docker-compose first with `sudo apt install docker-compose`.')
|
48
|
+
end
|
49
|
+
|
50
|
+
unless docker_compose_config && (services = docker_compose_config['services']) && services.key?('main')
|
51
|
+
fail('Your project does not seem to be properly set up. Expected to find a docker-compose.yml which defines a service named "main".')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def command_exists?(command)
|
56
|
+
execute(:system, "which #{command} > /dev/null")
|
57
|
+
end
|
58
|
+
|
59
|
+
def docker_compose_config
|
60
|
+
if File.exists?(DOCKER_COMPOSE_FILE)
|
61
|
+
if YAML.respond_to?(:safe_load)
|
62
|
+
YAML.safe_load(File.read(DOCKER_COMPOSE_FILE))
|
63
|
+
else
|
64
|
+
YAML.load(File.read(DOCKER_COMPOSE_FILE))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
rescue
|
68
|
+
false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/geordi/util.rb
CHANGED
@@ -51,7 +51,7 @@ module Geordi
|
|
51
51
|
# Remove Geordi's Bundler environment when running commands.
|
52
52
|
success = if !defined?(Bundler)
|
53
53
|
system(*commands)
|
54
|
-
elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('
|
54
|
+
elsif Gem::Version.new(Bundler::VERSION) >= Gem::Version.new('1.17.3')
|
55
55
|
Bundler.with_original_env do
|
56
56
|
system(*commands)
|
57
57
|
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: 2.
|
4
|
+
version: 2.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -81,14 +81,17 @@ files:
|
|
81
81
|
- features/console.feature
|
82
82
|
- features/cucumber.feature
|
83
83
|
- features/deploy.feature
|
84
|
+
- features/docker.feature
|
84
85
|
- features/dump.feature
|
85
86
|
- features/firefox.feature
|
86
87
|
- features/server.feature
|
87
88
|
- features/setup.feature
|
88
89
|
- features/shell.feature
|
90
|
+
- features/step_definitions/docker_command_steps.rb
|
91
|
+
- features/step_definitions/miscellaneous_steps.rb
|
92
|
+
- features/support/aruba.rb
|
89
93
|
- features/support/env.rb
|
90
94
|
- features/support/step_definitions/aruba_backport_steps.rb
|
91
|
-
- features/support/step_definitions/miscellaneous_steps.rb
|
92
95
|
- geordi.gemspec
|
93
96
|
- lib/geordi.rb
|
94
97
|
- lib/geordi/COMMAND_TEMPLATE
|
@@ -108,6 +111,7 @@ files:
|
|
108
111
|
- lib/geordi/commands/cucumber.rb
|
109
112
|
- lib/geordi/commands/delete_dumps.rb
|
110
113
|
- lib/geordi/commands/deploy.rb
|
114
|
+
- lib/geordi/commands/docker.rb
|
111
115
|
- lib/geordi/commands/drop_databases.rb
|
112
116
|
- lib/geordi/commands/dump.rb
|
113
117
|
- lib/geordi/commands/eurest.rb
|
@@ -130,6 +134,7 @@ files:
|
|
130
134
|
- lib/geordi/commands/yarn_install.rb
|
131
135
|
- lib/geordi/cucumber.rb
|
132
136
|
- lib/geordi/db_cleaner.rb
|
137
|
+
- lib/geordi/docker.rb
|
133
138
|
- lib/geordi/dump_loader.rb
|
134
139
|
- lib/geordi/firefox_for_selenium.rb
|
135
140
|
- lib/geordi/gitpt.rb
|
@@ -156,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
161
|
- !ruby/object:Gem::Version
|
157
162
|
version: '0'
|
158
163
|
requirements: []
|
159
|
-
rubygems_version: 3.
|
164
|
+
rubygems_version: 3.0.3
|
160
165
|
signing_key:
|
161
166
|
specification_version: 4
|
162
167
|
summary: Collection of command line tools we use in our daily work with Ruby, Rails
|