geordi 8.0.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5269b4048b40bb81c2d1d89400cbbdabc080107cce0befca2722dbad3451f4b2
4
- data.tar.gz: 2f48fae5fb0849795b994ef3c3c58fcb255024da72e4879f65f5867529a7145a
3
+ metadata.gz: 1060f10e77e6173a1b8d63fd8c2d89579e5be0597a683f5358b01173e4c266de
4
+ data.tar.gz: 8a44e3cd313e779b84ae9ecfa0f92283f4dd3f45f7525ec0bc298b11a719c389
5
5
  SHA512:
6
- metadata.gz: 18ac47bd9c3fb39c3a916f2ece300b931c0af9c466068cbbae5a98bf4db1655063f74096c967e4337d29a96c87202653f3b88a200b5d8e0b2cd8985acf4c41de
7
- data.tar.gz: 02cfbe20e95b29cf90d65760d39587fe43bebf0c7886364816bd16f71d705110f4b3b7af4f98c1873332b08308040bb7e1d4bc897079b8d0469ffa8c1c24e433
6
+ metadata.gz: c7793fda9e1494d3b1a2cf50dfa7b8c10ff61e8c7462596828fe6e44721f50dedbfe18ba2a2c2fb4e0b354500de9528f6e948e8716c9c1a31ceb42a49c8ea845
7
+ data.tar.gz: fedd7f3106bc5283b25b5f4e20fe1eda099d76c7e4b01483362cebde5cca516d559241d976ad51486a3bc71e11df5a3c21d14288c10805ad9af8307f48d7dab3
@@ -31,10 +31,6 @@ jobs:
31
31
  run: |
32
32
  gem install bundler:2.2.26
33
33
  bundle install --no-deployment
34
- - name: Install VNC viewer
35
- run: |
36
- sudo apt-get update
37
- sudo apt-get install -y xtightvncviewer
38
34
  - name: Run tests
39
35
  run: bundle exec rake
40
36
 
data/CHANGELOG.md CHANGED
@@ -11,6 +11,12 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
11
11
  ### Breaking changes
12
12
 
13
13
 
14
+ ## 9.0.0 2021-12-02
15
+
16
+ ### Breaking changes
17
+ * Remove the `geordi docker` command.
18
+
19
+
14
20
  ## 8.0.0 2021-11-08
15
21
 
16
22
  ### Breaking changes
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- geordi (8.0.0)
4
+ geordi (9.0.0)
5
5
  thor (~> 1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -160,28 +160,6 @@ instead of `cap deploy:migrations`. You can force using `deploy` by passing the
160
160
  - `-c, [--current-branch], [--no-current-branch]`: Set DEPLOY_BRANCH to the current branch during deploy
161
161
 
162
162
 
163
- ### `geordi docker`
164
- Manage docker containers for the current project.
165
-
166
- Manage docker containers to run your project dockerized.
167
-
168
- It expects a `docker-compose.yml` file that specifies all services, and a service
169
- named "main" that opens a shell for the project.
170
-
171
- There are three subcommands:
172
-
173
- - `geordi docker setup`
174
- Fetches all docker containers.
175
-
176
- - `geordi docker shell`
177
- Runs the docker service named 'main'.
178
- Append `--secondary` to open a second shell in an already running container.
179
-
180
- - `geordi docker vnc`
181
- Opens a VNC viewer to connect to the VNC server in the container.
182
- Append `--setup` to be guided through the setup of VNC viewer.
183
-
184
-
185
163
  ### `geordi drop-databases`
186
164
  Interactively delete local databases.
187
165
 
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '8.0.0'.freeze
2
+ VERSION = '9.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henning Koch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-08 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -67,7 +67,6 @@ files:
67
67
  - lib/geordi/commands/cucumber.rb
68
68
  - lib/geordi/commands/delete_dumps.rb
69
69
  - lib/geordi/commands/deploy.rb
70
- - lib/geordi/commands/docker.rb
71
70
  - lib/geordi/commands/drop_databases.rb
72
71
  - lib/geordi/commands/dump.rb
73
72
  - lib/geordi/commands/migrate.rb
@@ -87,7 +86,6 @@ files:
87
86
  - lib/geordi/commands/yarn_install.rb
88
87
  - lib/geordi/cucumber.rb
89
88
  - lib/geordi/db_cleaner.rb
90
- - lib/geordi/docker.rb
91
89
  - lib/geordi/dump_loader.rb
92
90
  - lib/geordi/gitpt.rb
93
91
  - lib/geordi/interaction.rb
@@ -102,7 +100,7 @@ metadata: {}
102
100
  post_install_message: 'Support for sequential running of integration tests tagged
103
101
  with @solo has been dropped.
104
102
 
105
- '
103
+ '
106
104
  rdoc_options: []
107
105
  require_paths:
108
106
  - lib
@@ -117,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
115
  - !ruby/object:Gem::Version
118
116
  version: '0'
119
117
  requirements: []
120
- rubygems_version: 3.2.30
118
+ rubygems_version: 3.2.32
121
119
  signing_key:
122
120
  specification_version: 4
123
121
  summary: Collection of command line tools we use in our daily work with Ruby, Rails
@@ -1,52 +0,0 @@
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
- option :setup, default: false, type: :boolean, desc: 'Guide through the setup of VNC'
16
- def vnc
17
- if options.setup
18
- docker.setup_vnc
19
- else
20
- docker.vnc
21
- end
22
- end
23
-
24
- private
25
-
26
- def docker
27
- require 'geordi/docker'
28
- Geordi::Docker.new
29
- end
30
- end
31
-
32
- desc 'docker', 'Manage docker containers for the current project'
33
- long_desc <<-LONGDESC
34
- Manage docker containers to run your project dockerized.
35
-
36
- It expects a `docker-compose.yml` file that specifies all services, and a service
37
- named "main" that opens a shell for the project.
38
-
39
- There are three subcommands:
40
-
41
- - `geordi docker setup`
42
- Fetches all docker containers.
43
-
44
- - `geordi docker shell`
45
- Runs the docker service named 'main'.
46
- Append `--secondary` to open a second shell in an already running container.
47
-
48
- - `geordi docker vnc`
49
- Opens a VNC viewer to connect to the VNC server in the container.
50
- Append `--setup` to be guided through the setup of VNC viewer.
51
- LONGDESC
52
- subcommand 'docker', DockerCLI
data/lib/geordi/docker.rb DELETED
@@ -1,183 +0,0 @@
1
- require 'geordi/interaction'
2
- require 'geordi/cucumber'
3
- require 'yaml'
4
- require 'open3'
5
-
6
- module Geordi
7
- class Docker
8
- DOCKER_COMPOSE_FILE = 'docker-compose.yml'.freeze
9
-
10
- include Interaction
11
-
12
- def setup
13
- check_installation_and_config
14
- announce('Fetching containers...')
15
- if execute(:system, 'docker-compose', 'pull')
16
- success('Fetch successful.')
17
- else
18
- fail('Fetch failed.')
19
- end
20
- end
21
-
22
- def shell(options = {})
23
- check_installation_and_config
24
- if options[:secondary]
25
- attach_to_running_shell
26
- else
27
- run_shell
28
- end
29
- end
30
-
31
- def vnc
32
- check_installation_and_config
33
- launch_vnc_viewer('::5967')
34
- end
35
-
36
- def setup_vnc
37
- `clear`
38
- Interaction.note 'This script will help you install a VNC viewer.'
39
- Interaction.note 'Please open a second shell to execute instructions.'
40
- Interaction.prompt 'Continue ...'
41
-
42
- Interaction.announce 'Setup VNC viewer'
43
- vnc_viewer_installed = system('which vncviewer > /dev/null 2>&1')
44
- if vnc_viewer_installed
45
- Interaction.success 'It appears you already have a VNC viewer installed. Good job!'
46
- else
47
- puts 'Please run:'
48
- Interaction.note_cmd 'sudo apt-get install xtightvncviewer'
49
- Interaction.prompt 'Continue ...'
50
- end
51
-
52
- puts
53
- puts <<~TEXT
54
- Done. You can view the VNC window with `geordi docker vnc`.
55
- TEXT
56
-
57
- Interaction.success 'Happy cuking!'
58
- end
59
-
60
- private
61
-
62
- def launch_vnc_viewer(source)
63
- fail('VNC viewer not found. Install it with `geordi docker vnc --setup`.') unless command_exists?('vncviewer')
64
-
65
- fork do
66
- error = capture_stderr do
67
- system("vncviewer #{source}")
68
- end
69
- unless $?.success?
70
- if $?.exitstatus == 127
71
- fail('VNC viewer not found. Install it with `geordi docker vnc --setup`.')
72
- else
73
- fail("VNC viewer could not be opened: #{error}")
74
- end
75
- end
76
- end
77
- exit 0
78
- end
79
-
80
- def attach_to_running_shell
81
- # The command line output of docker-compose ps changes depending on the container name length, this is
82
- # caused by the varying terminal length and results in the longer outputs, e.g the container name and id
83
- # to be cut after x characters and the rest being placed in the line below.
84
-
85
- stdout_str, _error_str = execute(:capture, {'COLUMNS' => '400'}, 'docker-compose ps')
86
- running_containers = stdout_str.split("\n")
87
- if (main_container_line = running_containers.grep(/_main_run/).first)
88
- container_name = main_container_line.split(' ').first
89
- execute(:exec, 'docker', 'exec', '-it', container_name, 'bash')
90
- else
91
- fail('Could not find a running shell. Start without --secondary first.')
92
- end
93
- end
94
-
95
- def run_shell
96
- command = [:system, 'docker-compose', 'run', '--service-ports']
97
- command += ssh_agent_forward
98
- command += ['main']
99
- execute(*command)
100
- execute(:system, 'docker-compose', 'stop')
101
- end
102
-
103
- def execute(kind, *args)
104
- if ENV['GEORDI_TESTING']
105
- puts "Stubbed run #{args.join(' ')}"
106
- if kind == :` || kind == :capture
107
- mock_parse(*args)
108
- else
109
- mock_run(*args)
110
- end
111
- else
112
- if kind == :capture
113
- Open3.capture2(*args)
114
- else
115
- send(kind, *args)
116
- end
117
- end
118
- end
119
-
120
- def mock_run(*args)
121
- # exists just to be stubbed in tests
122
- true
123
- end
124
-
125
- def mock_parse(*args)
126
- # exists just to be stubbed in tests
127
- 'command output'
128
- end
129
-
130
- def check_installation_and_config
131
- unless command_exists?('docker')
132
- fail('You need to install docker first with `sudo apt install docker`. After installation please log out and back in to your system once.')
133
- end
134
-
135
- unless command_exists?('docker-compose')
136
- fail('You need to install docker-compose first with `sudo apt install docker-compose`.')
137
- end
138
-
139
- unless docker_compose_config && (services = docker_compose_config['services']) && services.key?('main')
140
- fail('Your project does not seem to be properly set up. Expected to find a docker-compose.yml which defines a service named "main".')
141
- end
142
- end
143
-
144
- def command_exists?(command)
145
- execute(:system, "which #{command} > /dev/null")
146
- end
147
-
148
- def docker_compose_config
149
- @docker_compose_config ||= if File.exists?(DOCKER_COMPOSE_FILE)
150
- if YAML.respond_to?(:safe_load)
151
- YAML.safe_load(File.read(DOCKER_COMPOSE_FILE))
152
- else
153
- YAML.load(File.read(DOCKER_COMPOSE_FILE))
154
- end
155
- end
156
- rescue
157
- false
158
- end
159
-
160
- def ssh_agent_forward
161
- if (auth_sock = ENV['SSH_AUTH_SOCK'])
162
- dirname = File.dirname(auth_sock)
163
- ['-v', "#{dirname}:#{dirname}", '-e', "SSH_AUTH_SOCK=#{auth_sock}"]
164
- else
165
- []
166
- end
167
- end
168
-
169
- def capture_stderr
170
- old_stderr = $stderr.dup
171
- io = Tempfile.new('cuc')
172
- $stderr.reopen(io)
173
- yield
174
- io.rewind
175
- io.read
176
- ensure
177
- io.close
178
- io.unlink
179
- $stderr.reopen(old_stderr)
180
- end
181
-
182
- end
183
- end