takeltau 0.43.23 → 0.44.8
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/README.md +42 -9
- data/bin/ship +1 -1
- data/lib/takeltau/default.yml +1 -2
- data/lib/takeltau/docker/container/lib.rb +5 -1
- data/lib/takeltau/init/packer/docker.rb +1 -1
- data/lib/takeltau/init/takelage/rake.rb +1 -1
- data/lib/takeltau/lib/config.rb +24 -6
- data/lib/takeltau/lib/system.rb +7 -0
- data/lib/takeltau/ship/cli.rb +58 -15
- data/lib/takeltau/ship/completion/bash.rb +0 -6
- data/lib/takeltau/ship/completion/cli.rb +2 -3
- data/lib/takeltau/ship/container/check/cli.rb +1 -2
- data/lib/takeltau/ship/container/cli.rb +15 -23
- data/lib/takeltau/ship/container/lib.rb +12 -4
- data/lib/takeltau/ship/container/stop.rb +1 -0
- data/lib/takeltau/ship/info/cli.rb +16 -13
- data/lib/takeltau/ship/info/lib.rb +3 -0
- data/lib/takeltau/ship/ports/cli.rb +24 -0
- data/lib/takeltau/ship/ports/lib.rb +124 -0
- data/lib/takeltau/ship/ports/list.rb +16 -0
- data/lib/takeltau/ship/project/cli.rb +11 -13
- data/lib/takeltau/ship/project/start.rb +59 -28
- data/lib/takeltau/version +1 -1
- data/lib/takeltau.rb +8 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0265577b0c7fe802841470d93b7df218162928a825b3c360e0c7fa5c16d10810
|
4
|
+
data.tar.gz: 39143047fc8490a50a8bef1c967ddf7ee61396e5f8a1f198f7aac0ab803c9ffe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d28bb37c89010cbba5c0a0061b6d349bfe3e1c1235c5fc1e3ecab38db85518583c86059f0d457362ef1f0c4fb25fdb6d24593b98579e15df914876f4e04a9b89
|
7
|
+
data.tar.gz: 06c7e2e98e681c7a28cc03ddbfef9cff9c21481db11446c8067ef5e9962c56ee1c55506d436a728dd1949323c51aeb1127ec7cdf32c7c4d561826739d6daa0df
|
data/README.md
CHANGED
@@ -115,6 +115,32 @@ tau [self config default](features/cucumber/features/self/self.config.default.fe
|
|
115
115
|
tau [self config home](features/cucumber/features/self/self.config.home.feature) | Print takelage home config file configuration
|
116
116
|
tau [self config project](features/cucumber/features/self/self.config.project.feature) | Print takelage project config file configuration
|
117
117
|
tau [self version](features/cucumber/features/self/self.version.feature) | Print tau semantic version number
|
118
|
+
tau [ship completion bash](features/cucumber/features/ship/completion/completion.bash.feature) | Print bash completion code for ship subcommand
|
119
|
+
tau [ship container check existing](features/cucumber/features/ship/container/ship.container.check.existing.feature) | Check if a takelship is existing
|
120
|
+
tau [ship container clean](features/cucumber/features/ship/container/ship.container.clean.feature) | Stop all takelships
|
121
|
+
tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature) [COMMAND] | Run a [COMMAND] in a takelship container
|
122
|
+
tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature) | List takelships
|
123
|
+
tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature) | Log in to a takelship
|
124
|
+
tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature) [COMMAND] | Run a podman [COMMAND] in a takelship
|
125
|
+
tau [ship container stop](features/cucumber/features/ship/container/ship.container.stop.feature) | Stop a takelship
|
126
|
+
tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature) [COMMAND] | Run a sudo [COMMAND] in a takelship
|
127
|
+
tau [ship container update](features/cucumber/features/ship/container/ship.container.update.feature) | Update takelship image
|
128
|
+
tau [ship info takelconfig](features/cucumber/features/ship/info/ship.info.takelconfig.feature) | Print takelage config
|
129
|
+
tau [ship info takelship](features/cucumber/features/ship/info/ship.info.takelship.feature) | Print takelship info
|
130
|
+
tau [ship project list](features/cucumber/features/ship/project/ship.project.list.feature) | List takelship projects
|
131
|
+
tau [ship project logs](features/cucumber/features/ship/project/ship.project.logs.feature) [PROJECT] | Follow logs of a takelship [PROJECT]
|
132
|
+
tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature) [PROJECT] | Start a takelship [PROJECT]
|
133
|
+
tau [ship project stop](features/cucumber/features/ship/project/ship.project.stop.feature) | Stop a takelship project
|
134
|
+
tau ship command [COMMAND] | Alias for tau [ship container command](features/cucumber/features/ship/container/ship.container.command.feature)
|
135
|
+
tau ship list | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature)
|
136
|
+
tau ship login | Alias for tau [ship container login](features/cucumber/features/ship/container/ship.container.login.feature)
|
137
|
+
tau ship logs [PROJECT] | Alias for tau [ship project logs](features/cucumber/features/ship/project/ship.project.logs.feature)
|
138
|
+
tau ship ls | Alias for tau [ship container list](features/cucumber/features/ship/container/ship.container.list.feature)
|
139
|
+
tau ship podman [COMMAND] | Alias for tau [ship container podman](features/cucumber/features/ship/container/ship.container.podman.feature)
|
140
|
+
tau ship start [PROJECT] | Alias for tau [ship project start](features/cucumber/features/ship/project/ship.project.start.feature)
|
141
|
+
tau ship stop | Alias for tau [ship project stop](features/cucumber/features/ship/project/ship.project.stop.feature)
|
142
|
+
tau ship sudo [COMMAND] | Alias for tau [ship container sudo](features/cucumber/features/ship/container/ship.container.sudo.feature)
|
143
|
+
tau ship update | Alias for tau [ship container update](features/cucumber/features/ship/container/ship.container.update.feature)
|
118
144
|
tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature)
|
119
145
|
tau commands | Alias for tau [self commands](features/cucumber/features/self/self.commands.feature)
|
120
146
|
tau config | Alias for tau [self config active](features/cucumber/features/self/self.config.active.feature)
|
@@ -133,21 +159,28 @@ tau version | Alias for tau [self version](features/cucumber/features/self/self.
|
|
133
159
|
|
134
160
|
### Configuration Files
|
135
161
|
|
136
|
-
*takelage-cli* uses three different YAML configuration files
|
137
|
-
which have different precedences.
|
162
|
+
*takelage-cli* uses three different YAML configuration files and environment variables which have different precedences.
|
138
163
|
They are merged to an active configuration during runtime
|
139
164
|
which can be inspected with
|
140
165
|
*tau [self config active](features/cucumber/features/self/self.config.active.feature)*
|
141
166
|
or *tau config*.
|
142
167
|
|
143
168
|
| Filename | Precedence | Description |
|
144
|
-
|
145
|
-
| *default.yml* | lowest | Shipped with *takelage-cli*. Sets defaults where applicable.
|
146
|
-
| *~/.takelage.yml* | normal | User-wide configuration file in your home directory. This is your normal custom configuration file.
|
147
|
-
| *takelage.yml* | highest | Project-specific configuration file next to your main Rakefile. Some projects need special configuration.
|
148
|
-
|
149
|
-
|
150
|
-
|
169
|
+
|-|-|-|
|
170
|
+
| *default.yml* | lowest | Shipped with *takelage-cli*. Sets defaults where applicable. |
|
171
|
+
| *~/.takelage.yml* | normal | User-wide configuration file in your home directory. This is your normal custom configuration file. |
|
172
|
+
| *takelage.yml* | highest | Project-specific configuration file next to your main Rakefile. Some projects need special configuration. |
|
173
|
+
| TAKELAGE_TAU_CONFIG_* | ultimate | Fileless configuration through TAKELAGE_TAU_CONFIG environment variables. |
|
174
|
+
|
175
|
+
The tau command line tool is directory-aware so it is important that you can set the working directory of the tau command.
|
176
|
+
The project directory is identified by the first match:
|
177
|
+
|
178
|
+
| Method | Precedence | Description |
|
179
|
+
|-|-|-|
|
180
|
+
| `--workdir`/`-w` command line option | ultimate |
|
181
|
+
| `TAKELAGE_WORKDIR` environment variable | highest |
|
182
|
+
| Main [`Rakefile`](Rakefile) | normal |
|
183
|
+
| Current working directory | lowest |
|
151
184
|
|
152
185
|
### Configuration Examples
|
153
186
|
|
data/bin/ship
CHANGED
data/lib/takeltau/default.yml
CHANGED
@@ -61,10 +61,10 @@ cmd_ship_container_docker: '%{ship_docker} exec --interactive %{tty} %{ship_host
|
|
61
61
|
cmd_ship_container_login: 'bash'
|
62
62
|
cmd_ship_docker: 'docker'
|
63
63
|
cmd_ship_docker_check: 'docker --version'
|
64
|
+
cmd_ship_project_follow_logs: 'pod --workdir /home/podman/takelship/compose/projects/%{project} podman-compose logs --follow'
|
64
65
|
cmd_ship_project_start_docker_run_nonprivileged: '%{ship_docker} run --rm --interactive %{image} %{command}'
|
65
66
|
cmd_ship_project_start_docker_run_privileged: '%{ship_docker} run --privileged --rm --detach --name %{ship_hostname} --hostname %{ship_hostname} %{ship_env} %{ports} --volume ./%{ship_data_dir}:/home/podman/takelship %{image} %{command}'
|
66
67
|
cmd_ship_project_start_docker_stop: '%{ship_docker} stop %{ship_hostname}'
|
67
|
-
cmd_ship_project_follow_logs: 'pod --workdir /home/podman/takelship/compose/projects/%{project} podman-compose logs --follow'
|
68
68
|
docker_container_check_matrjoschka: 'true'
|
69
69
|
docker_debug: 'ansible/roles/takel_takelage/files/takelscripts'
|
70
70
|
docker_entrypoint_extra: ''
|
@@ -96,7 +96,6 @@ ship_env: '--env TAKELSHIP_UPDATE=true'
|
|
96
96
|
ship_hostname: '%{ship_name}_%{unique}'
|
97
97
|
ship_name: 'takelship'
|
98
98
|
ship_podman_localhost: '127.0.0.1'
|
99
|
-
ship_ports: ''
|
100
99
|
ship_port_expose_podman_socket: 'false'
|
101
100
|
ship_repo: 'takelship'
|
102
101
|
ship_tag: 'latest'
|
@@ -181,6 +181,10 @@ module DockerContainerLib
|
|
181
181
|
run cmd_docker_stop
|
182
182
|
end
|
183
183
|
|
184
|
+
def _docker_container_lib_homify_dir(dir)
|
185
|
+
dir.strip.sub Dir.home, '~'
|
186
|
+
end
|
187
|
+
|
184
188
|
# Get the mounted takelage directory
|
185
189
|
def _docker_container_lib_get_mounted_dir(name, destination, docker)
|
186
190
|
log.debug 'Getting mounted directory from ' \
|
@@ -193,7 +197,7 @@ module DockerContainerLib
|
|
193
197
|
dest_dir: "\"#{destination}\""
|
194
198
|
)
|
195
199
|
|
196
|
-
|
200
|
+
_docker_container_lib_homify_dir run cmd_get_mounted_dir
|
197
201
|
end
|
198
202
|
end
|
199
203
|
# rubocop:enable Style/IfUnlessModifier
|
data/lib/takeltau/lib/config.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# tau config module
|
4
|
+
# rubocop:disable Metrics/ModuleLength
|
4
5
|
module ConfigModule
|
5
6
|
# tau config class.
|
6
7
|
class TakeltauConfig
|
@@ -21,8 +22,8 @@ module ConfigModule
|
|
21
22
|
|
22
23
|
# Initialize config
|
23
24
|
# rubocop:disable Metrics/AbcSize
|
24
|
-
def initialize_config
|
25
|
-
project_root_dir = _get_project_root_dir
|
25
|
+
def initialize_config(workdir)
|
26
|
+
project_root_dir = _get_project_root_dir workdir
|
26
27
|
|
27
28
|
log.debug "takelage version: #{Takeltau::VERSION}"
|
28
29
|
log.debug "Current working directory: #{Dir.pwd}"
|
@@ -137,10 +138,18 @@ module ConfigModule
|
|
137
138
|
# Get project root directory.
|
138
139
|
# @return [String] project root directory
|
139
140
|
# rubocop:disable Metrics/MethodLength
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
141
|
+
# rubocop:disable Metrics/AbcSize
|
142
|
+
def _get_project_root_dir(workdir)
|
143
|
+
tau_workdir_root_dir = _get_workdir_root_dir workdir
|
144
|
+
unless tau_workdir_root_dir.empty?
|
145
|
+
log.debug "CLI option workdir is set to #{tau_workdir_root_dir}"
|
146
|
+
return tau_workdir_root_dir
|
147
|
+
end
|
148
|
+
|
149
|
+
if ENV.key? 'TAKELAGE_WORKDIR'
|
150
|
+
tau_envvar_root_dir = ENV['TAKELAGE_WORKDIR']
|
151
|
+
log.debug "TAKELAGE_WORKDIR is set to \"#{tau_envvar_root_dir}\""
|
152
|
+
return File.expand_path tau_envvar_root_dir
|
144
153
|
end
|
145
154
|
|
146
155
|
tau_takelage_root_dir = _get_takelage_root_dir
|
@@ -152,11 +161,20 @@ module ConfigModule
|
|
152
161
|
log.debug "Setting root dir to current working dir \"#{Dir.pwd}\""
|
153
162
|
Dir.pwd
|
154
163
|
end
|
164
|
+
# rubocop:enable Metrics/AbcSize
|
155
165
|
# rubocop:enable Metrics/MethodLength
|
156
166
|
|
167
|
+
# Return a command line workdir
|
168
|
+
def _get_workdir_root_dir(workdir)
|
169
|
+
return '' unless Dir.exist? File.expand_path workdir
|
170
|
+
|
171
|
+
workdir
|
172
|
+
end
|
173
|
+
|
157
174
|
# Return a takelage root dir
|
158
175
|
def _get_takelage_root_dir
|
159
176
|
_rakefile, path_rakefile = Rake.application.find_rakefile_location
|
160
177
|
path_rakefile
|
161
178
|
end
|
162
179
|
end
|
180
|
+
# rubocop:enable Metrics/ModuleLength
|
data/lib/takeltau/lib/system.rb
CHANGED
@@ -49,6 +49,13 @@ module SystemModule
|
|
49
49
|
@content
|
50
50
|
end
|
51
51
|
|
52
|
+
# Write content to file
|
53
|
+
def write_file(file, content)
|
54
|
+
log.debug "Writing content to file \"#{file}\":"
|
55
|
+
log.debug "\"#{content}\""
|
56
|
+
File.write(file, content)
|
57
|
+
end
|
58
|
+
|
52
59
|
# Remove directory tree.
|
53
60
|
def rm_fr(directory)
|
54
61
|
unless File.directory? directory
|
data/lib/takeltau/ship/cli.rb
CHANGED
@@ -25,6 +25,9 @@ module Takeltau
|
|
25
25
|
desc 'info [COMMAND]', 'Get info about takelship containers'
|
26
26
|
subcommand 'info', ShipInfo
|
27
27
|
|
28
|
+
desc 'ports [COMMAND]', 'Manage takelship portss'
|
29
|
+
subcommand 'ports', ShipPorts
|
30
|
+
|
28
31
|
desc 'project [COMMAND]', 'Manage takelship projects'
|
29
32
|
subcommand 'project', ShipProject
|
30
33
|
|
@@ -32,61 +35,101 @@ module Takeltau
|
|
32
35
|
# Top-level ship commands
|
33
36
|
#
|
34
37
|
|
35
|
-
desc '
|
38
|
+
desc 'command [COMMAND]', 'Run a [COMMAND] in a takelship'
|
39
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
40
|
+
Run a command in a takelship container as user podman.
|
41
|
+
Alias for ship container command.
|
42
|
+
LONGDESC
|
43
|
+
# ship command: {Takeltau::ShipContainer#command}
|
44
|
+
def command(*args)
|
45
|
+
Takeltau::ShipContainer.new.command args
|
46
|
+
end
|
47
|
+
|
48
|
+
desc 'list', 'List takelships'
|
49
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
50
|
+
List takelship containers.
|
51
|
+
Alias for ship container list.
|
52
|
+
LONGDESC
|
36
53
|
# ship list: {Takeltau::ShipContainer#list}
|
37
54
|
def list
|
38
55
|
Takeltau::ShipContainer.new.list
|
39
56
|
end
|
40
57
|
|
41
|
-
desc 'logs [PROJECT]', '
|
58
|
+
desc 'logs [PROJECT]', 'Follow logs of takelship [PROJECT]'
|
59
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
60
|
+
Follow logs of project [PROJECT] in a takelship project.
|
61
|
+
Alias for ship project logs.
|
62
|
+
LONGDESC
|
42
63
|
# ship logs: {Takeltau::ShipProject#logs}
|
43
64
|
def logs(project = 'default')
|
44
65
|
Takeltau::ShipProject.new.logs(project)
|
45
66
|
end
|
46
67
|
|
47
|
-
desc 'ls', '
|
68
|
+
desc 'ls', 'List takelships'
|
69
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
70
|
+
List takelship containers.
|
71
|
+
Alias for ship container list.
|
72
|
+
LONGDESC
|
48
73
|
# ship list: {Takeltau::ShipContainer#list}
|
49
74
|
def ls
|
50
75
|
Takeltau::ShipContainer.new.list
|
51
76
|
end
|
52
77
|
|
53
|
-
desc 'login', '
|
78
|
+
desc 'login', 'Log in to a takelship'
|
79
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
80
|
+
Log in to a takelship as root.
|
81
|
+
Alias for ship container login.
|
82
|
+
LONGDESC
|
54
83
|
# ship login: {Takeltau::ShipContainer#login}
|
55
84
|
def login
|
56
85
|
Takeltau::ShipContainer.new.login
|
57
86
|
end
|
58
87
|
|
59
|
-
desc 'podman [
|
88
|
+
desc 'podman [COMMAND]', 'Run a podman [COMMAND] in a takelship'
|
89
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
90
|
+
Run a podman command as user podman in a takelship container.
|
91
|
+
Alias for ship container podman.
|
92
|
+
LONGDESC
|
60
93
|
# ship podman: {Takeltau::ShipContainer#podman}
|
61
94
|
def podman(*args)
|
62
95
|
Takeltau::ShipContainer.new.podman args
|
63
96
|
end
|
64
97
|
|
65
|
-
desc '
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
desc 'sudo [ARGS]', 'Alias for tau ship container sudo'
|
98
|
+
desc 'sudo [COMMAND]', 'Run a sudo [COMMAND] in a takelship'
|
99
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
100
|
+
Run a command as root in a takelship container.
|
101
|
+
Alias for ship container sudo.
|
102
|
+
LONGDESC
|
72
103
|
# ship sudo: {Takeltau::ShipContainer#sudo}
|
73
104
|
def sudo(*args)
|
74
105
|
Takeltau::ShipContainer.new.sudo args
|
75
106
|
end
|
76
107
|
|
77
|
-
desc 'start [PROJECT]', '
|
108
|
+
desc 'start [PROJECT]', 'Start takelship [PROJECT]'
|
109
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
110
|
+
Start a takelship and run project [PROJECT] in it.
|
111
|
+
Alias for ship project start.
|
112
|
+
LONGDESC
|
78
113
|
# ship start: {Takeltau::ShipProject#start}
|
79
114
|
def start(project = 'default')
|
80
115
|
Takeltau::ShipProject.new.start project
|
81
116
|
end
|
82
117
|
|
83
|
-
desc 'stop', '
|
118
|
+
desc 'stop', 'Stop a takelship'
|
119
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
120
|
+
Stop a takelship container.
|
121
|
+
Alias for ship container stop.
|
122
|
+
LONGDESC
|
84
123
|
# ship stop: {Takeltau::ShipProject#stop}
|
85
124
|
def stop
|
86
125
|
Takeltau::ShipProject.new.stop
|
87
126
|
end
|
88
127
|
|
89
|
-
desc 'update', '
|
128
|
+
desc 'update', 'Update takelship image'
|
129
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
130
|
+
Update the takelship docker image.
|
131
|
+
Alias for ship container update.
|
132
|
+
LONGDESC
|
90
133
|
# tau update: {Takeltau::ShipContainer#update}
|
91
134
|
def update
|
92
135
|
Takeltau::ShipContainer.new.update
|
@@ -14,19 +14,13 @@ module ShipCompletionBash
|
|
14
14
|
private
|
15
15
|
|
16
16
|
# Remove bash completion lines
|
17
|
-
# rubocop:disable Style/BlockDelimiters
|
18
17
|
def _ship_completion_bash_remove_lines(tau_completion)
|
19
18
|
completion =
|
20
19
|
tau_completion
|
21
20
|
.strip.split("\n")
|
22
|
-
.reject { |line|
|
23
|
-
line.include? 'options+=("--help")' or
|
24
|
-
line.include? 'options+=("-h")'
|
25
|
-
}
|
26
21
|
completion.pop
|
27
22
|
completion.join("\n")
|
28
23
|
end
|
29
|
-
# rubocop:enable Style/BlockDelimiters
|
30
24
|
|
31
25
|
# Remove bash completion functions
|
32
26
|
def _ship_completion_bash_remove_functions(completion)
|
@@ -9,12 +9,11 @@ module Takeltau
|
|
9
9
|
desc 'bash', 'Print bash completion code'
|
10
10
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
11
11
|
Print bash completion code
|
12
|
-
This command will print bash code which can be parsed to enable auto-completion for the
|
12
|
+
This command will print bash code which can be parsed to enable auto-completion for the takelship cli.
|
13
13
|
Add this to your bash startup files:
|
14
14
|
|
15
|
-
source <(
|
15
|
+
source <(ship completion bash)
|
16
16
|
LONGDESC
|
17
|
-
# Print bash completion code.
|
18
17
|
def bash
|
19
18
|
completion_bash = ship_completion_bash
|
20
19
|
exit false if completion_bash == false
|
@@ -13,13 +13,12 @@ module Takeltau
|
|
13
13
|
#
|
14
14
|
# ship container check existing
|
15
15
|
#
|
16
|
-
desc 'existing', 'Check if takelship is existing'
|
16
|
+
desc 'existing', 'Check if a takelship is existing'
|
17
17
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
18
18
|
Check if a takelship container is existing
|
19
19
|
This check looks for a container with a given name.
|
20
20
|
If such a container is existing the result is true else false.
|
21
21
|
LONGDESC
|
22
|
-
# Check if takelship container is existing.
|
23
22
|
def existing
|
24
23
|
exit ship_container_check_existing
|
25
24
|
end
|
@@ -19,17 +19,16 @@ module Takeltau
|
|
19
19
|
include ShipContainerStop
|
20
20
|
include ShipContainerUpdate
|
21
21
|
|
22
|
-
desc 'check [COMMAND]', 'Check takelship
|
22
|
+
desc 'check [COMMAND]', 'Check takelship containers'
|
23
23
|
subcommand 'check', ShipContainerCheck
|
24
24
|
|
25
25
|
#
|
26
26
|
# ship container clean
|
27
27
|
#
|
28
|
-
desc 'clean', 'Stop all
|
28
|
+
desc 'clean', 'Stop all takelships'
|
29
29
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
30
|
-
Stop all takelship containers
|
30
|
+
Stop all takelship containers.
|
31
31
|
LONGDESC
|
32
|
-
# Stop all takelship containers.
|
33
32
|
def clean
|
34
33
|
ship_container_clean
|
35
34
|
end
|
@@ -37,11 +36,10 @@ module Takeltau
|
|
37
36
|
#
|
38
37
|
# ship container command
|
39
38
|
#
|
40
|
-
desc 'command', 'Run a
|
39
|
+
desc 'command [COMMAND]', 'Run a [COMMAND] in a takelship container'
|
41
40
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
42
|
-
Run a command in a takelship container
|
41
|
+
Run a command in a takelship container as user podman.
|
43
42
|
LONGDESC
|
44
|
-
# Run a command in a takelship container.
|
45
43
|
def command(*args)
|
46
44
|
say ship_container_command args
|
47
45
|
end
|
@@ -49,11 +47,10 @@ module Takeltau
|
|
49
47
|
#
|
50
48
|
# ship container list
|
51
49
|
#
|
52
|
-
desc 'list', 'List
|
50
|
+
desc 'list', 'List takelships'
|
53
51
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
54
|
-
List
|
52
|
+
List takelship containers.
|
55
53
|
LONGDESC
|
56
|
-
# List takelage containers.
|
57
54
|
def list
|
58
55
|
say ship_container_list
|
59
56
|
end
|
@@ -63,9 +60,8 @@ module Takeltau
|
|
63
60
|
#
|
64
61
|
desc 'login', 'Log in to a takelship'
|
65
62
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
66
|
-
Log in to a takelship
|
63
|
+
Log in to a takelship as root.
|
67
64
|
LONGDESC
|
68
|
-
# Log in to a takelship.
|
69
65
|
def login
|
70
66
|
ship_container_login
|
71
67
|
end
|
@@ -73,11 +69,10 @@ module Takeltau
|
|
73
69
|
#
|
74
70
|
# ship container podman
|
75
71
|
#
|
76
|
-
desc 'podman', 'Run podman
|
72
|
+
desc 'podman [COMMAND]', 'Run a podman [COMMAND] in a takelship'
|
77
73
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
78
|
-
Run podman command
|
74
|
+
Run a podman command as user podman in a takelship container.
|
79
75
|
LONGDESC
|
80
|
-
# Run podman command.
|
81
76
|
def podman(*args)
|
82
77
|
say ship_container_podman args
|
83
78
|
end
|
@@ -85,11 +80,10 @@ module Takeltau
|
|
85
80
|
#
|
86
81
|
# ship container sudo
|
87
82
|
#
|
88
|
-
desc 'sudo', 'Run a sudo
|
83
|
+
desc 'sudo [COMMAND]', 'Run a sudo [COMMAND] in a takelship'
|
89
84
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
90
|
-
Run a
|
85
|
+
Run a command as root in a takelship container.
|
91
86
|
LONGDESC
|
92
|
-
# Run a sudo command in a takelship container.
|
93
87
|
def sudo(*args)
|
94
88
|
say ship_container_sudo args
|
95
89
|
end
|
@@ -97,11 +91,10 @@ module Takeltau
|
|
97
91
|
#
|
98
92
|
# ship container stop
|
99
93
|
#
|
100
|
-
desc 'stop', 'Stop takelship
|
94
|
+
desc 'stop', 'Stop a takelship'
|
101
95
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
102
|
-
Stop takelship container
|
96
|
+
Stop a takelship container.
|
103
97
|
LONGDESC
|
104
|
-
# Stop takelship container.
|
105
98
|
def stop
|
106
99
|
ship_container_stop
|
107
100
|
end
|
@@ -111,9 +104,8 @@ module Takeltau
|
|
111
104
|
#
|
112
105
|
desc 'update', 'Update takelship image'
|
113
106
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
114
|
-
Update takelship image
|
107
|
+
Update the takelship docker image.
|
115
108
|
LONGDESC
|
116
|
-
# Update takelship image.
|
117
109
|
def update
|
118
110
|
ship_container_update
|
119
111
|
end
|
@@ -20,14 +20,18 @@ module ShipContainerLib
|
|
20
20
|
# rubocop:disable Metrics/MethodLength
|
21
21
|
def _ship_container_lib_docker_privileged(ports, command)
|
22
22
|
ship_data_dir = config.active['ship_data_dir']
|
23
|
-
ship_env = config.active['ship_env']
|
23
|
+
ship_env = [config.active['ship_env']]
|
24
|
+
ports.each do |key, port|
|
25
|
+
envvar = "TAKELSHIP_CONFIG_#{key}".upcase
|
26
|
+
envstr = "--env #{envvar}=#{port['localhost']}"
|
27
|
+
ship_env << envstr
|
28
|
+
end
|
24
29
|
ports = _ship_container_lib_publish(ports)
|
25
|
-
ports = config.active['ports'] unless config.active['ship_ports'].empty?
|
26
30
|
cmd_docker_run_command = format(
|
27
31
|
config.active['cmd_ship_project_start_docker_run_privileged'],
|
28
32
|
ship_docker: config.active['cmd_ship_docker'],
|
29
33
|
ship_hostname: _ship_container_lib_ship_hostname,
|
30
|
-
ship_env: ship_env,
|
34
|
+
ship_env: ship_env.join(' '),
|
31
35
|
ports: ports,
|
32
36
|
ship_data_dir: ship_data_dir,
|
33
37
|
image: _ship_container_lib_image,
|
@@ -77,7 +81,11 @@ module ShipContainerLib
|
|
77
81
|
def _ship_container_lib_publish(ports)
|
78
82
|
publish = []
|
79
83
|
ports.each do |port|
|
80
|
-
|
84
|
+
shipport = port[1]['takelship'].to_s
|
85
|
+
localport = port[1]['localhost'].to_s
|
86
|
+
next unless localport.to_i.between? 1, 65_535
|
87
|
+
|
88
|
+
publish << "--publish \"127.0.0.1:#{localport}:#{shipport}\""
|
81
89
|
end
|
82
90
|
publish.join(' ')
|
83
91
|
end
|
@@ -10,27 +10,30 @@ module Takeltau
|
|
10
10
|
include ShipContainerLib
|
11
11
|
include ShipInfoLib
|
12
12
|
|
13
|
-
|
14
|
-
# ship info json
|
15
|
-
#
|
16
|
-
desc 'json', 'Print json takelship info'
|
13
|
+
desc 'takelconfig', 'Print takelage config'
|
17
14
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
18
|
-
|
15
|
+
Print takelage config.
|
16
|
+
The configuration values can be overwritten by a
|
17
|
+
1. ~/.takelage.yml in your home directory
|
18
|
+
2. takelage.yml next to a takelship directory
|
19
|
+
3. environment variables like TAKELAGE_TAU_CONFIG_SHIP_NAME
|
20
|
+
Alias for tau self config.
|
19
21
|
LONGDESC
|
20
|
-
#
|
21
|
-
def
|
22
|
-
|
22
|
+
# ship takelconfig: {Takeltau::SelfConfig#active}
|
23
|
+
def takelconfig
|
24
|
+
Takeltau::SelfConfig.new.active
|
23
25
|
end
|
24
26
|
|
25
27
|
#
|
26
|
-
# ship info
|
28
|
+
# ship info takelship
|
27
29
|
#
|
28
|
-
desc '
|
30
|
+
desc 'takelship', 'Print takelship info'
|
29
31
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
30
|
-
|
32
|
+
Print takelship info.
|
33
|
+
This info is read from a takelship.yml file in a takelship directory.
|
34
|
+
If no such file exists the info is gathered from a takelship.
|
31
35
|
LONGDESC
|
32
|
-
|
33
|
-
def yaml
|
36
|
+
def takelship
|
34
37
|
say _ship_info_lib_get_takelshipinfo.to_yaml
|
35
38
|
end
|
36
39
|
end
|
@@ -9,6 +9,7 @@ module ShipInfoLib
|
|
9
9
|
log.debug 'Gathering takelship info'
|
10
10
|
takelshipinfo = _ship_info_lib_get_info_from_file
|
11
11
|
takelshipinfo = _ship_info_lib_get_info_from_docker if takelshipinfo.empty?
|
12
|
+
|
12
13
|
return false if takelshipinfo.nil?
|
13
14
|
|
14
15
|
takelshipinfo
|
@@ -44,6 +45,8 @@ module ShipInfoLib
|
|
44
45
|
def _ship_info_lib_valid_project?(takelship, project)
|
45
46
|
valid_project = false
|
46
47
|
takelship_projects = takelship['projects']
|
48
|
+
return false if takelship_projects.nil? || takelship_projects.empty?
|
49
|
+
|
47
50
|
takelship_projects.each do |takelship_project|
|
48
51
|
valid_project = true if project == takelship_project['name']
|
49
52
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Takeltau
|
4
|
+
# tau ship info
|
5
|
+
class ShipPorts < SubCommandBase
|
6
|
+
include LoggingModule
|
7
|
+
include SystemModule
|
8
|
+
include ConfigModule
|
9
|
+
include DockerCheckDaemon
|
10
|
+
include ShipContainerLib
|
11
|
+
include ShipInfoLib
|
12
|
+
include ShipPortsLib
|
13
|
+
include ShipPortsList
|
14
|
+
|
15
|
+
desc 'list [PROJECT]', 'Print takelship ports of a [PROJECT]'
|
16
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
17
|
+
Print the ports that a takelship project exposes.
|
18
|
+
LONGDESC
|
19
|
+
# ship list: {Takeltau::ShipPorts#list}
|
20
|
+
def list(project = 'default')
|
21
|
+
say (ship_ports_list project).to_yaml
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# tau ship ports lib
|
4
|
+
module ShipPortsLib
|
5
|
+
private
|
6
|
+
|
7
|
+
# get the ports of a takelship
|
8
|
+
# rubocop:disable Metrics/MethodLength
|
9
|
+
def _ship_ports_lib_get_ports(takelship, takelproject)
|
10
|
+
ports = _ship_ports_lib_get_ports_docker(takelship)
|
11
|
+
takelship['projects'].each do |project|
|
12
|
+
next unless project['name'] == takelproject
|
13
|
+
|
14
|
+
project['services'].each do |service|
|
15
|
+
next unless service.key? 'ports'
|
16
|
+
|
17
|
+
service['ports'].each do |port|
|
18
|
+
key = _ship_ports_lib_generate_key port, service
|
19
|
+
ports[key] = _ship_ports_lib_get_port key, port, service
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
ports
|
24
|
+
end
|
25
|
+
# rubocop:enable Metrics/MethodLength
|
26
|
+
|
27
|
+
# write ports to project takelage.yml
|
28
|
+
def _ship_ports_lib_write_ports(ports, project)
|
29
|
+
config_project = _ship_ports_lib_get_project_config ports, project
|
30
|
+
project_dir = config.active['project_root_dir']
|
31
|
+
config_file = "#{project_dir}/takelage.yml"
|
32
|
+
write_file config_file, config_project.to_yaml
|
33
|
+
end
|
34
|
+
|
35
|
+
# get current project config
|
36
|
+
# the values are added/updated unconditionally
|
37
|
+
# the merge with the existing values has been done here:
|
38
|
+
# ConfigModule::TakeltauConfig::_config_merge_active
|
39
|
+
# and here: _ship_ports_lib_get_localhost_port
|
40
|
+
def _ship_ports_lib_get_project_config(ports, project)
|
41
|
+
config_project = config.project
|
42
|
+
ports.each do |key, port|
|
43
|
+
config_project[key] = port['localhost']
|
44
|
+
end
|
45
|
+
config_project['ship_default_project'] = project
|
46
|
+
config_project.sort.to_h
|
47
|
+
end
|
48
|
+
|
49
|
+
# map the podman socket port (aka "DOCKER_HOST")
|
50
|
+
# returns a hash unlike the get_port method
|
51
|
+
# rubocop:disable Metrics/MethodLength
|
52
|
+
def _ship_ports_lib_get_ports_docker(takelship)
|
53
|
+
takel_docker = takelship['docker_host']
|
54
|
+
docker_key = "ship_ports_dind_docker_#{takel_docker}"
|
55
|
+
local_docker = _ship_ports_lib_get_localhost_port docker_key, takel_docker
|
56
|
+
{
|
57
|
+
docker_key => {
|
58
|
+
'service' => 'dind',
|
59
|
+
'protocol' => 'docker',
|
60
|
+
'takelship' => takel_docker.to_i,
|
61
|
+
'localhost' => local_docker
|
62
|
+
}
|
63
|
+
}
|
64
|
+
end
|
65
|
+
# rubocop:enable Metrics/MethodLength
|
66
|
+
|
67
|
+
# map a takelship port
|
68
|
+
def _ship_ports_lib_get_port(key, port, service)
|
69
|
+
localhost = _ship_ports_lib_get_localhost_port key, port['port']
|
70
|
+
{
|
71
|
+
'service' => service['name'],
|
72
|
+
'protocol' => port['protocol'],
|
73
|
+
'takelship' => port['port'],
|
74
|
+
'localhost' => localhost
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
# get new port on localhost for takelport
|
79
|
+
def _ship_ports_lib_get_localhost_port(key, port)
|
80
|
+
env_var = "TAKELAGE_TAU_CONFIG_#{key}".upcase
|
81
|
+
return ENV[env_var].to_i if ENV.key? env_var
|
82
|
+
|
83
|
+
return config.active[key] if config.active.key? key
|
84
|
+
|
85
|
+
_ship_ports_lib_get_free_port port
|
86
|
+
end
|
87
|
+
|
88
|
+
# derive a random free port from a port
|
89
|
+
def _ship_ports_lib_get_free_port(port)
|
90
|
+
localport = 0
|
91
|
+
loop do
|
92
|
+
offset = _ship_ports_lib_get_offset
|
93
|
+
localport = port.to_i + offset
|
94
|
+
break unless _ship_ports_lib_port_open? localport
|
95
|
+
end
|
96
|
+
localport
|
97
|
+
end
|
98
|
+
|
99
|
+
# generate dynamic takelconfig key
|
100
|
+
def _ship_ports_lib_generate_key(port, service)
|
101
|
+
key = "ship_ports_#{service['name']}_#{port['protocol']}_#{port['port']}"
|
102
|
+
key.gsub('-', '_')
|
103
|
+
end
|
104
|
+
|
105
|
+
# generate random offset
|
106
|
+
def _ship_ports_lib_get_offset
|
107
|
+
# this results in ports
|
108
|
+
# from 30000 + 15000 = 45000
|
109
|
+
# to 40000 + 25000 = 65000
|
110
|
+
# max port number: 65535
|
111
|
+
rand(15_000..25_000)
|
112
|
+
end
|
113
|
+
|
114
|
+
# check if a port on the host is open
|
115
|
+
def _ship_ports_lib_port_open?(port)
|
116
|
+
log.debug "Checking if port #{port} is open"
|
117
|
+
begin
|
118
|
+
Socket.tcp('127.0.0.1', port, connect_timeout: 5)
|
119
|
+
true
|
120
|
+
rescue Errno::ECONNREFUSED
|
121
|
+
false
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# tau ship ports list
|
4
|
+
module ShipPortsList
|
5
|
+
# List takelship portss.
|
6
|
+
def ship_ports_list(project)
|
7
|
+
log.debug 'List takelship ports'
|
8
|
+
|
9
|
+
takelship = _ship_info_lib_get_takelshipinfo
|
10
|
+
project = _ship_info_lib_get_project(project, takelship)
|
11
|
+
|
12
|
+
return false unless _ship_info_lib_valid_project? takelship, project
|
13
|
+
|
14
|
+
_ship_ports_lib_get_ports takelship, project
|
15
|
+
end
|
16
|
+
end
|
@@ -12,6 +12,7 @@ module Takeltau
|
|
12
12
|
include ShipContainerLib
|
13
13
|
include ShipContainerStop
|
14
14
|
include ShipInfoLib
|
15
|
+
include ShipPortsLib
|
15
16
|
include ShipProjectList
|
16
17
|
include ShipProjectLogs
|
17
18
|
include ShipProjectStart
|
@@ -19,11 +20,10 @@ module Takeltau
|
|
19
20
|
#
|
20
21
|
# ship container list
|
21
22
|
#
|
22
|
-
desc 'list', 'List projects'
|
23
|
+
desc 'list', 'List takelship projects'
|
23
24
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
24
|
-
List projects
|
25
|
+
List all available takelship projects.
|
25
26
|
LONGDESC
|
26
|
-
# List projects.
|
27
27
|
def list
|
28
28
|
ship_project_list
|
29
29
|
end
|
@@ -31,11 +31,10 @@ module Takeltau
|
|
31
31
|
#
|
32
32
|
# ship container logs
|
33
33
|
#
|
34
|
-
desc 'logs [PROJECT]', 'Follow logs of
|
34
|
+
desc 'logs [PROJECT]', 'Follow logs of [PROJECT]'
|
35
35
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
36
|
-
Follow logs of project [PROJECT]
|
36
|
+
Follow logs of project [PROJECT] in a takelship project.
|
37
37
|
LONGDESC
|
38
|
-
# logs projects.
|
39
38
|
def logs(project = 'default')
|
40
39
|
ship_project_logs project
|
41
40
|
end
|
@@ -43,23 +42,22 @@ module Takeltau
|
|
43
42
|
#
|
44
43
|
# ship container start
|
45
44
|
#
|
46
|
-
desc 'start [PROJECT]', 'Start
|
45
|
+
desc 'start [PROJECT]', 'Start takelship [PROJECT]'
|
47
46
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
48
|
-
Start project [PROJECT] in
|
47
|
+
Start a takelship and run project [PROJECT] in it.
|
49
48
|
LONGDESC
|
50
|
-
# Run command in docker container.
|
51
49
|
def start(project = 'default')
|
52
|
-
ship_project_start project
|
50
|
+
project_start = ship_project_start project
|
51
|
+
say project_start if project_start
|
53
52
|
end
|
54
53
|
|
55
54
|
#
|
56
55
|
# ship project stop
|
57
56
|
#
|
58
|
-
desc 'stop', 'Stop a takelship
|
57
|
+
desc 'stop', 'Stop a takelship project'
|
59
58
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
60
|
-
Stop a takelship container
|
59
|
+
Stop a takelship container running a project.
|
61
60
|
LONGDESC
|
62
|
-
# Stop a takelship container.
|
63
61
|
def stop
|
64
62
|
say ship_container_stop
|
65
63
|
end
|
@@ -4,44 +4,75 @@
|
|
4
4
|
module ShipProjectStart
|
5
5
|
# Start a takelship
|
6
6
|
def ship_project_start(project)
|
7
|
-
return false
|
8
|
-
|
9
|
-
return false if ship_container_check_existing
|
7
|
+
return false unless _ship_project_start_prerequisites_fulfilled?
|
10
8
|
|
11
9
|
takelship = _ship_info_lib_get_takelshipinfo
|
12
|
-
project = _ship_info_lib_get_project
|
10
|
+
project = _ship_info_lib_get_project project, takelship
|
11
|
+
|
12
|
+
return false unless _ship_project_start_valid_project? takelship, project
|
13
|
+
|
14
|
+
ports = _ship_ports_lib_get_ports(takelship, project)
|
13
15
|
|
14
|
-
|
16
|
+
log.debug 'Writing port configuration to takelage.yml'
|
17
|
+
_ship_ports_lib_write_ports(ports, project)
|
15
18
|
|
16
19
|
log.debug "Starting takelship project \"#{project}\""
|
17
|
-
ports
|
18
|
-
|
20
|
+
_ship_container_lib_docker_privileged ports, project
|
21
|
+
|
22
|
+
_ship_project_start_print_ports project, ports
|
19
23
|
end
|
20
24
|
|
21
25
|
private
|
22
26
|
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
# check prerequisistes
|
28
|
+
def _ship_project_start_prerequisites_fulfilled?
|
29
|
+
if _docker_container_lib_check_matrjoschka
|
30
|
+
say 'Cannot start a takelship from within a takelage container!'
|
31
|
+
return false
|
32
|
+
end
|
33
|
+
|
34
|
+
if ship_container_check_existing
|
35
|
+
say "Container \"#{_ship_container_lib_ship_hostname}\" is already started!"
|
36
|
+
return false
|
37
|
+
end
|
38
|
+
|
39
|
+
true
|
40
|
+
end
|
41
|
+
|
42
|
+
# check if the project is a valid takelship project
|
43
|
+
def _ship_project_start_valid_project?(takelship, project)
|
44
|
+
return true if _ship_info_lib_valid_project? takelship, project
|
45
|
+
|
46
|
+
say 'No valid project found!'
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
50
|
+
# print ports after starting a takelship
|
51
|
+
def _ship_project_start_print_ports(project, ports)
|
52
|
+
output = []
|
53
|
+
output << "Started takelship project \"#{project}\"\n"
|
54
|
+
max_length = _ship_project_start_get_maxlength ports
|
55
|
+
|
56
|
+
ports.each_value do |port|
|
57
|
+
next unless port['localhost'].to_i.between? 1, 65_535
|
58
|
+
|
59
|
+
left = "localhost:#{port['localhost']}"
|
60
|
+
right = "(#{port['service']} #{port['protocol']})"
|
61
|
+
output << "#{left.ljust(max_length)} #{right}"
|
38
62
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
63
|
+
output.join("\n")
|
64
|
+
end
|
65
|
+
|
66
|
+
# get max length of left column
|
67
|
+
def _ship_project_start_get_maxlength(ports)
|
68
|
+
max_length = 0
|
69
|
+
ports.each_value do |port|
|
70
|
+
localport = port['localhost']
|
71
|
+
next unless localport.to_i.between? 1, 65_535
|
72
|
+
|
73
|
+
left_string = "localhost:#{localport}"
|
74
|
+
max_length = left_string.length if max_length < left_string.length
|
42
75
|
end
|
43
|
-
|
76
|
+
max_length
|
44
77
|
end
|
45
78
|
end
|
46
|
-
# rubocop:enable Metrics/AbcSize
|
47
|
-
# rubocop:enable Metrics/MethodLength
|
data/lib/takeltau/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.44.8
|
data/lib/takeltau.rb
CHANGED
@@ -98,6 +98,9 @@ require_relative 'takeltau/ship/container/stop'
|
|
98
98
|
require_relative 'takeltau/ship/container/update'
|
99
99
|
require_relative 'takeltau/ship/container/cli'
|
100
100
|
require_relative 'takeltau/ship/info/cli'
|
101
|
+
require_relative 'takeltau/ship/ports/lib'
|
102
|
+
require_relative 'takeltau/ship/ports/list'
|
103
|
+
require_relative 'takeltau/ship/ports/cli'
|
101
104
|
require_relative 'takeltau/ship/project/list'
|
102
105
|
require_relative 'takeltau/ship/project/logs'
|
103
106
|
require_relative 'takeltau/ship/project/start'
|
@@ -127,6 +130,10 @@ module Takeltau
|
|
127
130
|
aliases: 'l',
|
128
131
|
default: 'INFO',
|
129
132
|
desc: 'One of: FATAL, ERROR, WARN, INFO, DEBUG'
|
133
|
+
option :workdir,
|
134
|
+
aliases: 'w',
|
135
|
+
default: '',
|
136
|
+
desc: 'Working directory'
|
130
137
|
# Initialize takelage cli.
|
131
138
|
def initialize(args = [], local_options = {}, configuration = {})
|
132
139
|
# Initialize thor parent class
|
@@ -136,7 +143,7 @@ module Takeltau
|
|
136
143
|
initialize_logging options[:loglevel].to_s.upcase
|
137
144
|
|
138
145
|
# Initialize global singleton config
|
139
|
-
initialize_config
|
146
|
+
initialize_config options[:workdir]
|
140
147
|
|
141
148
|
# Initialize global singleton project
|
142
149
|
initialize_project
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: takeltau
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.44.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takelwerk
|
@@ -300,6 +300,9 @@ files:
|
|
300
300
|
- lib/takeltau/ship/container/update.rb
|
301
301
|
- lib/takeltau/ship/info/cli.rb
|
302
302
|
- lib/takeltau/ship/info/lib.rb
|
303
|
+
- lib/takeltau/ship/ports/cli.rb
|
304
|
+
- lib/takeltau/ship/ports/lib.rb
|
305
|
+
- lib/takeltau/ship/ports/list.rb
|
303
306
|
- lib/takeltau/ship/project/cli.rb
|
304
307
|
- lib/takeltau/ship/project/list.rb
|
305
308
|
- lib/takeltau/ship/project/logs.rb
|