takeltau 0.42.5 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71f4b8c42519b8825c3db2922c7b10d9bf7890078a061f85a4a5147e70a559b9
4
- data.tar.gz: bd6e95457e9a5e4cf87ae95bdd65dd10ad74b4de43acaa0ea763332c0d2898f3
3
+ metadata.gz: 21ce8c9adb2444d89382171349bad2541743195640c773e0e50e9bda09b1a813
4
+ data.tar.gz: dc8467fd57e0e273b8c8df0390d3b206a88f4f86691e62f77ae59a5d59404b44
5
5
  SHA512:
6
- metadata.gz: fabb96294a6f7601fc7308a10dbf293a6488a4a8d21a098836b6e7479e0296d488301405e4257cd07fa9c26bf46affb3ebc0044a8d82105d3df89d827f62d11b
7
- data.tar.gz: 8b0a73a0b2e58d6291a2cc72083390db8074c68c7a32120ba1551695e2dbda593d497295610b256dc977a8fd332ed10604eb7abdba8adf7646f9ded61b63b86a
6
+ metadata.gz: 727b786c912e1f966f0e05c0ff6caa5b619e0c54da280ede84eab297913587ea9d18dff97793dee3ad232504d56da9fca12ff51eaa9c1a759e88f5190fffd703
7
+ data.tar.gz: 1a7eb0cd00dcef8b061f9fd2f12d03ce9e815d12e031e6309a8d582468b4c33bb3cf8d5b580ac412cce788fdf27e3cf87f7c1b7967952dc0aaf212bfffa928ee
data/README.md CHANGED
@@ -12,29 +12,36 @@ command line script using the
12
12
 
13
13
  ## Framework Versions
14
14
 
15
- | Project | Artifacts |
16
- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
17
- | [![takelage-doc](https://img.shields.io/badge/github-takelage--doc-purple)](https://github.com/takelwerk/takelage-doc) | [![License](https://img.shields.io/badge/license-GNU_GPLv3-blue)](https://github.com/takelwerk/takelage-doc/blob/main/LICENSE) |
18
- | [![takelage-img-takelslim](https://img.shields.io/badge/github-takelage--img--takelslim-purple)](https://github.com/takelwerk/takelage-img-takelslim) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelslim/latest-amd64?label=hub.docker.com&arch=amd64&color=teal)](https://hub.docker.com/r/takelwerk/takelslim) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelslim/latest-arm64?label=hub.docker.com&arch=arm64&color=slateblue)](https://hub.docker.com/r/takelwerk/takelslim) |
19
- | [![takelage-img-takelbase](https://img.shields.io/badge/github-takelage--img--takelbase-purple)](https://github.com/takelwerk/takelage-img-takelbase) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelbase/latest-amd64?label=hub.docker.com&arch=amd64&color=teal)](https://hub.docker.com/r/takelwerk/takelbase) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelbase/latest-arm64?label=hub.docker.com&arch=arm64&color=slateblue)](https://hub.docker.com/r/takelwerk/takelbase) |
20
- | [![takelage-var](https://img.shields.io/badge/github-takelage--var-purple)](https://github.com/takelwerk/takelage-var) | [![pypi,org](https://img.shields.io/pypi/v/pytest-takeltest?label=pypi.org&color=blue)](https://pypi.org/project/pytest-takeltest/) |
21
- | [![takelage-cli](https://img.shields.io/badge/github-takelage--cli-purple)](https://github.com/takelwerk/takelage-cli) | [![rubygems.org](https://img.shields.io/gem/v/takeltau?label=rubygems.org&color=blue)](https://rubygems.org/gems/takeltau) |
22
- | [![takelage-dev](https://img.shields.io/badge/github-takelage--dev-purple)](https://github.com/takelwerk/takelage-dev) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelage/latest-amd64?label=hub.docker.com&arch=amd64&sort=semver&color=teal)](https://hub.docker.com/r/takelwerk/takelage) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelage/latest-arm64?label=hub.docker.com&arch=arm64&sort=semver&color=slateblue)](https://hub.docker.com/r/takelwerk/takelage) |
23
- | [![takelage-pad](https://img.shields.io/badge/github-takelage--pad-purple)](https://github.com/takelwerk/takelage-pad) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpad/latest-amd64?label=hub.docker.com&arch=amd64&sort=semver&color=teal)](https://hub.docker.com/r/takelwerk/takelpad) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpad/latest-arm64?label=hub.docker.com&arch=arm64&sort=semver&color=slateblue)](https://hub.docker.com/r/takelwerk/takelpad) |
15
+ | Project | Artifacts |
16
+ |-|-|
17
+ | [![takelage-doc](https://img.shields.io/badge/github-takelage--doc-purple)](https://github.com/takelwerk/takelage-doc) | [![License](https://img.shields.io/badge/license-GNU_GPLv3-blue)](https://github.com/takelwerk/takelage-doc/blob/main/LICENSE) |
18
+ | [![takelage-var](https://img.shields.io/badge/github-takelage--var-purple)](https://github.com/takelwerk/takelage-var) | [![pypi,org](https://img.shields.io/pypi/v/pytest-takeltest?label=pypi.org&color=blue)](https://pypi.org/project/pytest-takeltest/) |
19
+ | [![takelage-cli](https://img.shields.io/badge/github-takelage--cli-purple)](https://github.com/takelwerk/takelage-cli) | [![rubygems.org](https://img.shields.io/gem/v/takeltau?label=rubygems.org&color=blue)](https://rubygems.org/gems/takeltau) |
20
+ | [![takelage-img-takelslim](https://img.shields.io/badge/github-takelage--img--takelslim-purple)](https://github.com/takelwerk/takelage-img-takelslim) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelslim/latest-amd64?label=hub.docker.com&arch=amd64&color=teal)](https://hub.docker.com/r/takelwerk/takelslim) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelslim/latest-arm64?label=hub.docker.com&arch=arm64&color=slateblue)](https://hub.docker.com/r/takelwerk/takelslim) |
21
+ | [![takelage-img-takelbase](https://img.shields.io/badge/github-takelage--img--takelbase-purple)](https://github.com/takelwerk/takelage-img-takelbase) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelbase/latest-amd64?label=hub.docker.com&arch=amd64&color=teal)](https://hub.docker.com/r/takelwerk/takelbase) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelbase/latest-arm64?label=hub.docker.com&arch=arm64&color=slateblue)](https://hub.docker.com/r/takelwerk/takelbase) |
22
+ | [![takelage-img-takelpodslim](https://img.shields.io/badge/github-takelage--img--takelpodslim-purple)](https://github.com/takelwerk/takelage-img-takelpodslim) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpodslim/latest-amd64?label=hub.docker.com&arch=amd64&color=teal)](https://hub.docker.com/r/takelwerk/takelpodslim) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpodslim/latest-arm64?label=hub.docker.com&arch=arm64&color=slateblue)](https://hub.docker.com/r/takelwerk/takelpodslim) |
23
+ | [![takelage-img-takelpodbase](https://img.shields.io/badge/github-takelage--img--takelpodbase-purple)](https://github.com/takelwerk/takelage-img-takelpodbase) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpodbase/latest-amd64?label=hub.docker.com&arch=amd64&color=teal)](https://hub.docker.com/r/takelwerk/takelpodbase) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpodbase/latest-arm64?label=hub.docker.com&arch=arm64&color=slateblue)](https://hub.docker.com/r/takelwerk/takelpodbase) |
24
+ | [![takelage-dev](https://img.shields.io/badge/github-takelage--dev-purple)](https://github.com/takelwerk/takelage-dev) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelage/latest-amd64?label=hub.docker.com&arch=amd64&sort=semver&color=teal)](https://hub.docker.com/r/takelwerk/takelage) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelage/latest-arm64?label=hub.docker.com&arch=arm64&sort=semver&color=slateblue)](https://hub.docker.com/r/takelwerk/takelage) |
25
+ | [![takelage-pad](https://img.shields.io/badge/github-takelage--pad-purple)](https://github.com/takelwerk/takelage-pad) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpad/latest-amd64?label=hub.docker.com&arch=amd64&sort=semver&color=teal)](https://hub.docker.com/r/takelwerk/takelpad) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelpad/latest-arm64?label=hub.docker.com&arch=arm64&sort=semver&color=slateblue)](https://hub.docker.com/r/takelwerk/takelpad) |
26
+ | [![takelship](https://img.shields.io/badge/github-takelship-purple)](https://github.com/takelwerk/takelship) | [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelship/latest-amd64?label=hub.docker.com&arch=amd64&sort=semver&color=teal)](https://hub.docker.com/r/takelwerk/takelship) [![hub.docker.com](https://img.shields.io/docker/v/takelwerk/takelship/latest-arm64?label=hub.docker.com&arch=arm64&sort=semver&color=slateblue)](https://hub.docker.com/r/takelwerk/takelship) | |
27
+
24
28
 
25
29
  ## Framework Status
26
30
 
27
- | Project | Pipelines |
28
- |---------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
29
- | [![takelage-img-takelslim](https://img.shields.io/badge/github-takelage--img--takelslim-purple)](https://github.com/takelwerk/takelage-img-takelslim) | [![takelslim amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-img-takelslim/takelslim_amd64.yml?label=takelslim%20amd64)](https://github.com/takelwerk/takelage-img-takelslim/actions/workflows/takelslim_amd64.yml) |
30
- | [![takelage-img-takelbase](https://img.shields.io/badge/github-takelage--img--takelbase-purple)](https://github.com/takelwerk/takelage-img-takelbase) | [![takelbase amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-img-takelbase/takelbase_amd64.yml?label=takelbase%20amd64)](https://github.com/takelwerk/takelage-img-takelbase/actions/workflows/takelbase_amd64.yml) |
31
- | [![takelage-var](https://img.shields.io/badge/github-takelage--var-purple)](https://github.com/takelwerk/takelage-var) | [![takeltest](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-var/takeltest.yml?label=takeltest)](https://github.com/takelwerk/takelage-var/actions/workflows/takeltest.yml) [![test_takeltest](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-var/test_takeltest.yml?label=test%20takeltest)](https://github.com/takelwerk/takelage-var/actions/workflows/test_takeltest.yml) |
32
- | [![takelage-cli](https://img.shields.io/badge/github-takelage--cli-purple)](https://github.com/takelwerk/takelage-cli) | [![takeltau](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-cli/takeltau.yml?label=takeltau)](https://github.com/takelwerk/takelage-cli/actions/workflows/takeltau.yml) [![test_takeltau](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-cli/test_takeltau.yml?label=test%20takeltau)](https://github.com/takelwerk/takelage-cli/actions/workflows/test_takeltau.yml) |
33
- | [![takelage-dev](https://img.shields.io/badge/github-takelage--dev-purple)](https://github.com/takelwerk/takelage-dev) | [![takelage amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/takelage_amd64.yml?label=takelage%20amd64)](https://github.com/takelwerk/takelage-dev/actions/workflows/takelage_amd64.yml) [![test_takelage](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/test_takelage.yml?label=test%20takelage)](https://github.com/takelwerk/takelage-dev/actions/workflows/test_takelage.yml)
34
- | | [![takelbuild amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/takelbuild_amd64.yml?label=takelbuild%20amd64)](https://github.com/takelwerk/takelage-dev/actions/workflows/takelbuild_amd64.yml) [![test_takelbuild](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/test_takelbuild.yml?label=test%20takelbuild)](https://github.com/takelwerk/takelage-dev/actions/workflows/test_takelbuild.yml) |
35
- | | [![takelbeta amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/takelbeta_amd64.yml?label=takelbeta%20amd64)](https://github.com/takelwerk/takelage-dev/actions/workflows/takelbeta_amd64.yml) [![test_roles](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/test_roles.yml?label=test%20roles)](https://github.com/takelwerk/takelage-dev/actions/workflows/test_roles.yml) |
31
+ | Project | Pipelines |
32
+ |-|-|
33
+ | [![takelage-var](https://img.shields.io/badge/github-takelage--var-purple)](https://github.com/takelwerk/takelage-var) | [![takeltest](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-var/takeltest.yml?label=takeltest)](https://github.com/takelwerk/takelage-var/actions/workflows/takeltest.yml) [![test_takeltest](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-var/test_takeltest.yml?label=test%20takeltest)](https://github.com/takelwerk/takelage-var/actions/workflows/test_takeltest.yml) |
34
+ | [![takelage-cli](https://img.shields.io/badge/github-takelage--cli-purple)](https://github.com/takelwerk/takelage-cli) | [![takeltau](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-cli/takeltau.yml?label=takeltau)](https://github.com/takelwerk/takelage-cli/actions/workflows/takeltau.yml) [![test_takeltau](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-cli/test_takeltau.yml?label=test%20takeltau)](https://github.com/takelwerk/takelage-cli/actions/workflows/test_takeltau.yml) |
35
+ | [![takelage-img-takelslim](https://img.shields.io/badge/github-takelage--img--takelslim-purple)](https://github.com/takelwerk/takelage-img-takelslim) | [![takelslim amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-img-takelslim/takelslim_amd64.yml?label=takelslim%20amd64)](https://github.com/takelwerk/takelage-img-takelslim/actions/workflows/takelslim_amd64.yml) |
36
+ | [![takelage-img-takelbase](https://img.shields.io/badge/github-takelage--img--takelbase-purple)](https://github.com/takelwerk/takelage-img-takelbase) | [![takelbase amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-img-takelbase/takelbase_amd64.yml?label=takelbase%20amd64)](https://github.com/takelwerk/takelage-img-takelbase/actions/workflows/takelbase_amd64.yml) |
37
+ | [![takelage-img-takelpodslim](https://img.shields.io/badge/github-takelage--img--takelpodslim-purple)](https://github.com/takelwerk/takelage-img-takelpodslim) | [![takelpodslim amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-img-takelpodslim/takelpodslim_amd64.yml?label=takelpodslim%20amd64)](https://github.com/takelwerk/takelage-img-takelpodslim/actions/workflows/takelpodslim_amd64.yml) |
38
+ | [![takelage-img-takelpodbase](https://img.shields.io/badge/github-takelage--img--takelpodbase-purple)](https://github.com/takelwerk/takelage-img-takelpodbase) | [![takelpodbase amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-img-takelpodbase/takelpodbase_amd64.yml?label=takelpodbase%20amd64)](https://github.com/takelwerk/takelage-img-takelpodbase/actions/workflows/takelpodbase_amd64.yml) |
39
+ | [![takelage-dev](https://img.shields.io/badge/github-takelage--dev-purple)](https://github.com/takelwerk/takelage-dev) | [![takelage amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/takelage_amd64.yml?label=takelage%20amd64)](https://github.com/takelwerk/takelage-dev/actions/workflows/takelage_amd64.yml) [![test_takelage](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/test_takelage.yml?label=test%20takelage)](https://github.com/takelwerk/takelage-dev/actions/workflows/test_takelage.yml)
40
+ | | [![takelbuild amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/takelbuild_amd64.yml?label=takelbuild%20amd64)](https://github.com/takelwerk/takelage-dev/actions/workflows/takelbuild_amd64.yml) [![test_takelbuild](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/test_takelbuild.yml?label=test%20takelbuild)](https://github.com/takelwerk/takelage-dev/actions/workflows/test_takelbuild.yml) |
41
+ | | [![takelbeta amd64](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/takelbeta_amd64.yml?label=takelbeta%20amd64)](https://github.com/takelwerk/takelage-dev/actions/workflows/takelbeta_amd64.yml) [![test_roles](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-dev/test_roles.yml?label=test%20roles)](https://github.com/takelwerk/takelage-dev/actions/workflows/test_roles.yml) |
36
42
  | [![takelage-pad](https://img.shields.io/badge/github-takelage--pad-purple)](https://github.com/takelwerk/takelage-pad) | [![takelpad docker](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-pad/takelpad_docker.yml?label=takelpad%20docker)](https://github.com/takelwerk/takelage-pad/actions/workflows/takelpad_docker.yml) |
37
- | | [![test takelpad](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-pad/test_takelpad.yml?label=test%20takelpad)](https://github.com/takelwerk/takelage-pad/actions/workflows/test_takelpad.yml) [![test roles](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-pad/test_roles.yml?label=test%20roles)](https://github.com/takelwerk/takelage-pad/actions/workflows/test_roles.yml) |
43
+ | | [![test takelpad](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-pad/test_takelpad.yml?label=test%20takelpad)](https://github.com/takelwerk/takelage-pad/actions/workflows/test_takelpad.yml) [![test roles](https://img.shields.io/github/actions/workflow/status/takelwerk/takelage-pad/test_roles.yml?label=test%20roles)](https://github.com/takelwerk/takelage-pad/actions/workflows/test_roles.yml) |
44
+ | [![takelship](https://img.shields.io/badge/github-takelship-purple)](https://github.com/takelwerk/takelship) | [![takelship docker](https://img.shields.io/github/actions/workflow/status/takelwerk/takelship/takelship-amd64.yml?label=takelship%20docker)](https://github.com/takelwerk/takelship/actions/workflows/takelship-amd64.yml) |
38
45
 
39
46
  ## Installation
40
47
 
data/bin/ship ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ system "TAKELAGE_TAU_SHIP=#{$PROGRAM_NAME} tau ship #{ARGV.join(' ')}"
@@ -74,3 +74,25 @@ mutagen_socket_path_mutagen_host: '~/.mutagen/daemon/daemon.sock'
74
74
  mutagen_socket_path_ssh_container: '~/.gnupg/S.gpg-agent.ssh'
75
75
  mutagen_socket_path_ssh_host: '~/.gnupg/S.gpg-agent.ssh'
76
76
  mutagen_socket_takelage_label: 'type=takelage'
77
+ ship_name: 'takelship'
78
+ ship_hostname: '%{ship_name}_%{unique}'
79
+ ship_default_project: 'default'
80
+ ship_env: '--env TAKELSHIP_UPDATE=true'
81
+ ship_ports: ''
82
+ #ship_user: 'takelwerk'
83
+ #ship_repo: 'takelship'
84
+ ship_user: 'packer_local'
85
+ ship_repo: 'takelship-project'
86
+ ship_tag: 'latest'
87
+ ship_data_dir: 'takelship'
88
+ ship_takelship_yml: '%{pwd}/%{ship_data_dir}/compose/projects/takelship.yml'
89
+ ship_podman_localhost: '127.0.0.1'
90
+ ship_docker_host: '32375'
91
+ ship_default_docker_host: '32375'
92
+ cmd_ship_project_start_docker_run_nonprivileged: 'docker run --rm --interactive %{image} %{command}'
93
+ cmd_ship_project_start_docker_run_privileged: 'docker run --privileged --rm --detach --name %{ship_hostname} --hostname %{ship_hostname} %{ship_env} %{ports} --volume ./%{ship_data_dir}:/home/podman/takelship %{image} %{command}'
94
+ cmd_ship_project_start_docker_stop: 'docker stop %{ship_hostname}'
95
+ cmd_ship_container_check_existing_docker_ps: 'docker ps --filter name=^%{ship_name}$ --quiet'
96
+ cmd_ship_container_docker: 'docker exec --interactive %{tty} %{ship_hostname} %{command}'
97
+ cmd_ship_container_podman: 'DOCKER_HOST=tcp://%{localhost}:%{docker_host} docker %{command}'
98
+ cmd_ship_container_login: 'bash'
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # takeltau docker container check existing
3
4
  # tau docker container check existing
4
5
  module DockerContainerCheckExisting
5
6
  # Backend method for docker container check existing.
@@ -1,2 +1,2 @@
1
1
  ---
2
- project: "{{ lookup('pipe', 'tau project') | from_yaml }}"
2
+ project: "{{ lookup('pipe', 'cd /project && tau project') | from_yaml }}"
@@ -8,6 +8,7 @@ __pycache__/
8
8
  *.pyc
9
9
  .pytest_cache
10
10
  pytestdebug.log
11
+ .rake_tasks~
11
12
  *.retry
12
13
  takelage.log
13
14
  takelage.yml
@@ -8,13 +8,14 @@ module ConfigModule
8
8
  include LoggingModule
9
9
  include SystemModule
10
10
 
11
- attr_accessor :active, :default, :home, :project
11
+ attr_accessor :active, :default, :home, :project, :envvars
12
12
 
13
13
  def initialize
14
14
  @active = {}
15
15
  @default = {}
16
16
  @home = {}
17
17
  @project = {}
18
+ @envvars = {}
18
19
  end
19
20
  end
20
21
 
@@ -30,6 +31,7 @@ module ConfigModule
30
31
  TakeltauConfig.instance.default = _config_read_default project_root_dir
31
32
  TakeltauConfig.instance.home = _config_read_home
32
33
  TakeltauConfig.instance.project = _config_read_project project_root_dir
34
+ TakeltauConfig.instance.envvars = _config_read_envvars
33
35
  TakeltauConfig.instance.active = _config_merge_active
34
36
  end
35
37
  # rubocop:enable Metrics/AbcSize
@@ -105,26 +107,63 @@ module ConfigModule
105
107
  (read_yaml_file(project_file) || {}).sort.to_h
106
108
  end
107
109
 
110
+ # Read default config file in lib.
111
+ def _config_read_envvars
112
+ envvars_yaml = {}
113
+ TakeltauConfig.instance.default.each_key do |key|
114
+ envvar = "TAKELAGE_TAU_CONFIG_#{key}".upcase
115
+ envvars_yaml[key] = ENV[envvar] if ENV.key? envvar
116
+ end
117
+ envvars_yaml.sort.to_h
118
+ end
119
+
108
120
  # Merge active config.
121
+ # rubocop:disable Metrics/AbcSize
109
122
  def _config_merge_active
110
123
  # make a clone or else we'll change the original hash
111
124
  default = TakeltauConfig.instance.default.clone
112
125
  home = TakeltauConfig.instance.home.clone
113
126
  project = TakeltauConfig.instance.project.clone
127
+ envvars = TakeltauConfig.instance.envvars.clone
114
128
 
115
- # merge default and home and project to active
116
- # project wins against home wins against default
117
- project_over_home = home.merge!(project)
129
+ # merge default and home and project and envvars to active
130
+ # merge envvars over project over home over default
131
+ envvars_over_project = project.merge!(envvars)
132
+ project_over_home = home.merge!(envvars_over_project)
118
133
  default.merge!(project_over_home).sort.to_h
119
134
  end
135
+ # rubocop:enable Metrics/AbcSize
120
136
 
121
137
  # Get project root directory.
122
138
  # @return [String] project root directory
123
139
  def _get_project_root_dir
124
- _rakefile, path = Rake.application.find_rakefile_location
125
- return path unless path.nil?
140
+ return ENV['TAKELAGE_TAU_DIR'] if ENV.key? 'TAKELAGE_TAU_DIR'
141
+
142
+ log.debug 'Environment variable TAKELTAU_TAU_DIR not set.'
143
+
144
+ tau_takelage_root_dir = _get_takelage_root_dir
145
+ return tau_takelage_root_dir unless tau_takelage_root_dir.nil?
126
146
 
127
- log.debug 'No "Rakefile" found. Cannot determine project root directory.'
147
+ log.debug 'No "Rakefile" found. Cannot determine takelage project root directory.'
148
+
149
+ takelship_root_dir = _get_takelship_root_dir
150
+ return takelship_root_dir unless takelship_root_dir.nil?
151
+
152
+ log.debug 'Not in takelship mode. Unable to determine root directory.'
128
153
  ''
129
154
  end
155
+
156
+ # Return a takelage root dir
157
+ def _get_takelage_root_dir
158
+ _rakefile, path_rakefile = Rake.application.find_rakefile_location
159
+ path_rakefile
160
+ end
161
+
162
+ # Return a takelship root dir
163
+ def _get_takelship_root_dir
164
+ return nil if ENV['TAKELAGE_TAU_SHIP'].nil?
165
+
166
+ log.debug 'Invoked in takelship mode. Using current working directory as root directory.'
167
+ Dir.pwd
168
+ end
130
169
  end
@@ -5,7 +5,12 @@ class SubCommandBase < Thor
5
5
  # Set the subcommand banner.
6
6
  # rubocop:disable Style/OptionalBooleanParameter
7
7
  def self.banner(command, _namespace = nil, _subcommand = false)
8
- "#{basename} #{subcommand_prefix} #{command.usage}"
8
+ subcommand = subcommand_prefix
9
+ name = $PROGRAM_NAME
10
+ name = ENV['TAKELAGE_TAU_TAU'] unless ENV['TAKELAGE_TAU_TAU'].nil?
11
+ subcommand.gsub!(/ship\s*/) {} unless ENV['TAKELAGE_TAU_SHIP'].nil?
12
+ name = File.basename(name)
13
+ [name, subcommand, command.usage].reject(&:empty?).join(' ')
9
14
  end
10
15
  # rubocop:enable Style/OptionalBooleanParameter
11
16
 
@@ -43,7 +43,7 @@ module SystemModule
43
43
  log.debug "Reading YAML file \"#{file}\""
44
44
  return nil unless _file_exists? file
45
45
  return nil unless _file_read file
46
- return nil unless _parse_yaml file, @content_file
46
+ return nil unless _parse_yaml_file file, @content_file
47
47
 
48
48
  @content
49
49
  end
@@ -54,8 +54,8 @@ module SystemModule
54
54
  log.debug "Reading YAML ERB file \"#{file}\""
55
55
  return nil unless _file_exists? file
56
56
  return nil unless _file_read file
57
- return nil unless _parse_erb file, @content_file
58
- return nil unless _parse_yaml file, @content_yaml
57
+ return nil unless _parse_erb_file file, @content_file
58
+ return nil unless _parse_yaml_file file, @content_yaml
59
59
 
60
60
  @content
61
61
  end
@@ -160,7 +160,7 @@ module SystemModule
160
160
  end
161
161
 
162
162
  # Parse erb file.
163
- def _parse_erb(file, content_erb)
163
+ def _parse_erb_file(file, content_erb)
164
164
  begin
165
165
  @content_yaml = ERB.new(content_erb).result
166
166
  rescue StandardError => e
@@ -173,7 +173,7 @@ module SystemModule
173
173
  end
174
174
 
175
175
  # Parse yaml file.
176
- def _parse_yaml(file, content_yaml)
176
+ def _parse_yaml_file(file, content_yaml)
177
177
  begin
178
178
  @content = YAML.safe_load content_yaml
179
179
  rescue Psych::SyntaxError
@@ -184,6 +184,18 @@ module SystemModule
184
184
  true
185
185
  end
186
186
 
187
+ # Get yaml.
188
+ def _parse_yaml(content_yaml)
189
+ begin
190
+ content = YAML.safe_load content_yaml
191
+ rescue Psych::SyntaxError
192
+ log.debug "Invalid YAML file \"#{file}\""
193
+ log.debug "Try: yamllint #{file}"
194
+ return false
195
+ end
196
+ content
197
+ end
198
+
187
199
  # Pluralize a verb in relation to a number
188
200
  def pluralize(number, singular, plural)
189
201
  return singular if number == 1
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Takeltau
4
- # tau git
4
+ # tau mutagen
5
5
  class Mutagen < SubCommandBase
6
6
  desc 'check [COMMAND]', 'Check mutagen'
7
7
  subcommand 'check', MutagenCheck
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Takeltau
4
+ # tau ship
5
+ class Ship < SubCommandBase
6
+ desc 'completion [COMMAND] ', 'Print shell completion code'
7
+ subcommand 'completion', ShipCompletion
8
+
9
+ desc 'container [COMMAND]', 'Manage takelship containers'
10
+ subcommand 'container', ShipContainer
11
+
12
+ desc 'info [COMMAND]', 'Get info about takelship containers'
13
+ subcommand 'info', ShipInfo
14
+
15
+ desc 'project [COMMAND]', 'Manage takelship projects'
16
+ subcommand 'project', ShipProject
17
+
18
+ #
19
+ # Top-level ship commands
20
+ #
21
+
22
+ desc 'config', 'Alias for tau self config active'
23
+ # tau config: {Takeltau::SelfConfig#active}
24
+ def config
25
+ Takeltau::SelfConfig.new.active
26
+ end
27
+
28
+ desc 'login', 'Alias for tau ship container login'
29
+ # ship login: {Takeltau::ShipContainer#login}
30
+ def login
31
+ Takeltau::ShipContainer.new.login
32
+ end
33
+
34
+ desc 'podman [ARGS]', 'Alias for tau ship container podman'
35
+ # ship podman: {Takeltau::ShipContainer#podman}
36
+ def podman(*args)
37
+ Takeltau::ShipContainer.new.podman args
38
+ end
39
+
40
+ desc 'start [PROJECT]', 'Alias for tau ship project start'
41
+ # ship start: {Takeltau::ShipProject#start}
42
+ def start(project = 'default')
43
+ Takeltau::ShipProject.new.start project
44
+ end
45
+
46
+ desc 'stop', 'Alias for tau ship project stop'
47
+ # ship stop: {Takeltau::ShipProject#stop}
48
+ def stop
49
+ Takeltau::ShipProject.new.stop
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship completion bash
4
+ module ShipCompletionBash
5
+ # Print bash completion code
6
+ def ship_completion_bash
7
+ tau_completion = Takeltau::CLI.new.bash_fylla
8
+ completion = _ship_completion_bash_remove_lines tau_completion
9
+ completion = _ship_completion_bash_remove_functions completion
10
+ completion << 'complete -F _ship ship'
11
+ completion
12
+ end
13
+
14
+ private
15
+
16
+ # Remove bash completion lines
17
+ # rubocop:disable Style/BlockDelimiters
18
+ def _ship_completion_bash_remove_lines(tau_completion)
19
+ completion =
20
+ tau_completion
21
+ .strip.split("\n")
22
+ .reject { |line|
23
+ line.include? 'options+=("--help")' or
24
+ line.include? 'options+=("-h")'
25
+ }
26
+ completion.pop
27
+ completion.join("\n")
28
+ end
29
+ # rubocop:enable Style/BlockDelimiters
30
+
31
+ # Remove bash completion functions
32
+ def _ship_completion_bash_remove_functions(completion)
33
+ functions =
34
+ completion
35
+ .split(/_tau[^_]*/)
36
+ .select { |f| f =~ /_ship/ }
37
+ .reject { |f| f =~ /_ship\n/ }
38
+ .reject { |f| f.include? 'help ()' }
39
+ functions.join('')
40
+ end
41
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Takeltau
4
+ # tau completion
5
+ class ShipCompletion < SubCommandBase
6
+ include LoggingModule
7
+ include ShipCompletionBash
8
+
9
+ desc 'bash', 'Print bash completion code'
10
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
11
+ Print bash completion code
12
+ This command will print bash code which can be parsed to enable auto-completion for the takelage cli.
13
+ Add this to your bash startup files:
14
+
15
+ source <(tau completion bash)
16
+ LONGDESC
17
+ # Print bash completion code.
18
+ def bash
19
+ completion_bash = ship_completion_bash
20
+ exit false if completion_bash == false
21
+ say completion_bash
22
+ true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Takeltau
4
+ # tau ship container check
5
+ class ShipContainerCheck < SubCommandBase
6
+ include LoggingModule
7
+ include SystemModule
8
+ include ConfigModule
9
+ include DockerCheckDaemon
10
+ include ShipContainerLib
11
+ include ShipContainerCheckExisting
12
+
13
+ #
14
+ # ship container check existing
15
+ #
16
+ desc 'existing', 'Check if takelship is existing'
17
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
18
+ Check if a takelship container is existing
19
+ This check looks for a container with a given name.
20
+ If such a container is existing the result is true else false.
21
+ LONGDESC
22
+ # Check if takelship container is existing.
23
+ def existing
24
+ exit ship_container_check_existing
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship container check existing
4
+ module ShipContainerCheckExisting
5
+ # Backend method for ship container check existing.
6
+ # @return [Boolean] is container existing?
7
+ def ship_container_check_existing
8
+ ship_hostname = _ship_container_lib_ship_hostname
9
+ log.debug "Checking if takelship \"#{ship_hostname}\" is existing"
10
+
11
+ return false unless docker_check_daemon
12
+
13
+ stdout_str = run _ship_container_cmd_check_existing ship_hostname
14
+
15
+ if stdout_str.to_s.chomp.empty?
16
+ log.debug "The takelship \"#{ship_hostname}\" is not existing"
17
+ return false
18
+ end
19
+
20
+ log.debug "The takelship \"#{ship_hostname}\" is existing"
21
+ true
22
+ end
23
+
24
+ private
25
+
26
+ # Format command to check if ship container exists.
27
+ def _ship_container_cmd_check_existing(ship_hostname)
28
+ format(
29
+ config.active['cmd_ship_container_check_existing_docker_ps'],
30
+ ship_name: ship_hostname
31
+ )
32
+ end
33
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Takeltau
4
+ # tau docker container
5
+ class ShipContainer < SubCommandBase
6
+ include LoggingModule
7
+ include SystemModule
8
+ include ConfigModule
9
+ include DockerCheckDaemon
10
+ include ShipInfoLib
11
+ include ShipContainerCheckExisting
12
+ include ShipContainerLib
13
+ include ShipContainerLogin
14
+ include ShipContainerPodman
15
+
16
+ desc 'check [COMMAND]', 'Check takelship container'
17
+ subcommand 'check', ShipContainerCheck
18
+
19
+ #
20
+ # ship container login
21
+ #
22
+ desc 'login', 'Run login command'
23
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
24
+ Run login command
25
+ LONGDESC
26
+ # Run login command.
27
+ def login
28
+ ship_container_login
29
+ end
30
+
31
+ #
32
+ # ship container podman
33
+ #
34
+ desc 'podman', 'Run podman command'
35
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
36
+ Run podman command
37
+ LONGDESC
38
+ # Run podman command.
39
+ def podman(*args)
40
+ result = ship_container_podman args
41
+ unless result
42
+ say 'No connection to takelship'
43
+ exit 1
44
+ end
45
+ say result
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship container lib
4
+ module ShipContainerLib
5
+ private
6
+
7
+ # Run nonprivileged docker command
8
+ def _ship_container_lib_docker_nonprivileged(command)
9
+ return false unless docker_check_daemon
10
+
11
+ cmd_docker_run_command = format(
12
+ config.active['cmd_ship_project_start_docker_run_nonprivileged'],
13
+ image: _ship_container_lib_image,
14
+ command: command
15
+ )
16
+ run cmd_docker_run_command
17
+ end
18
+
19
+ # Run privileged docker command
20
+ # rubocop:disable Metrics/AbcSize
21
+ # rubocop:disable Metrics/MethodLength
22
+ def _ship_container_lib_docker_privileged(ports, command)
23
+ return false unless docker_check_daemon
24
+
25
+ ship_data_dir = config.active['ship_data_dir']
26
+ ship_env = config.active['ship_env']
27
+ ports = _ship_container_lib_publish(ports)
28
+ ports = config.active['ports'] unless config.active['ship_ports'].empty?
29
+ cmd_docker_run_command = format(
30
+ config.active['cmd_ship_project_start_docker_run_privileged'],
31
+ ship_hostname: _ship_container_lib_ship_hostname,
32
+ ship_env: ship_env,
33
+ ports: ports,
34
+ ship_data_dir: ship_data_dir,
35
+ image: _ship_container_lib_image,
36
+ command: command
37
+ )
38
+ run cmd_docker_run_command
39
+ end
40
+ # rubocop:enable Metrics/MethodLength
41
+ # rubocop:enable Metrics/AbcSize
42
+
43
+ # Run a podman command in a takelship container
44
+ # rubocop:disable Metrics/MethodLength
45
+ # rubocop:disable Metrics/AbcSize
46
+ def _ship_container_lib_podman(command)
47
+ return false unless docker_check_daemon
48
+
49
+ docker_host = _ship_info_lib_get_takelshipinfo['docker_host']
50
+ config_docker_host = config.active['ship_docker_host']
51
+ docker_host = config_docker_host if
52
+ config_docker_host != config.active['ship_default_docker_host']
53
+ localhost = config.active['ship_podman_localhost']
54
+ cmd_docker_run_command = format(
55
+ config.active['cmd_ship_container_podman'],
56
+ docker_host: docker_host,
57
+ localhost: localhost,
58
+ command: command
59
+ )
60
+ run cmd_docker_run_command
61
+ end
62
+ # rubocop:enable Metrics/AbcSize
63
+ # rubocop:enable Metrics/MethodLength
64
+
65
+ # Run a docker command in a takelship container
66
+ def _ship_container_lib_docker(command, tty = '')
67
+ return false unless docker_check_daemon
68
+
69
+ cmd_docker_run_command = format(
70
+ config.active['cmd_ship_container_docker'],
71
+ ship_hostname: _ship_container_lib_ship_hostname,
72
+ tty: tty,
73
+ command: command
74
+ )
75
+ run_and_exit cmd_docker_run_command
76
+ end
77
+
78
+ # Run takelship docker stop command
79
+ def _ship_container_lib_docker_stop
80
+ return false unless docker_check_daemon
81
+
82
+ return false unless ship_container_check_existing
83
+
84
+ cmd_docker_stop_command = format(
85
+ config.active['cmd_ship_project_start_docker_stop'],
86
+ ship_hostname: _ship_container_lib_ship_hostname
87
+ )
88
+ run cmd_docker_stop_command
89
+ end
90
+
91
+ # Return takelship image
92
+ def _ship_container_lib_image
93
+ ship_user = config.active['ship_user']
94
+ ship_repo = config.active['ship_repo']
95
+ ship_tag = config.active['ship_tag']
96
+ "#{ship_user}/#{ship_repo}:#{ship_tag}"
97
+ end
98
+
99
+ # Create unique docker hostname
100
+ def _ship_container_lib_ship_hostname
101
+ ship_name = config.active['ship_name']
102
+ workdir = Dir.getwd
103
+ unique_name = "#{ship_name}_#{workdir}"
104
+ digest = Digest::SHA256.bubblebabble unique_name
105
+ unique = digest[0..10]
106
+ format(
107
+ config.active['ship_hostname'],
108
+ ship_name: ship_name,
109
+ unique: unique
110
+ )
111
+ end
112
+
113
+ # Create publish ports string
114
+ def _ship_container_lib_publish(ports)
115
+ publish = []
116
+ ports.each do |port|
117
+ publish << "--publish \"127.0.0.1:#{port}:#{port}\""
118
+ end
119
+ publish.join(' ')
120
+ end
121
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship container login
4
+ module ShipContainerLogin
5
+ # Run a login command in a takelship
6
+ def ship_container_login
7
+ return false unless ship_container_check_existing
8
+
9
+ command_after_login = config.active['cmd_ship_container_login']
10
+ _ship_container_lib_docker command_after_login, '--tty'
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship container podman
4
+ module ShipContainerPodman
5
+ # Run a podman command in a takelship
6
+ def ship_container_podman(args)
7
+ return false unless ship_container_check_existing
8
+
9
+ _ship_container_lib_podman args.join(' ')
10
+ end
11
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Takeltau
4
+ # tau ship info
5
+ class ShipInfo < SubCommandBase
6
+ include LoggingModule
7
+ include SystemModule
8
+ include ConfigModule
9
+ include DockerCheckDaemon
10
+ include ShipContainerLib
11
+ include ShipInfoLib
12
+
13
+ #
14
+ # ship info json
15
+ #
16
+ desc 'json', 'Print json takelship info'
17
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
18
+ Print json takelship info
19
+ LONGDESC
20
+ # Print json takelship info.
21
+ def json
22
+ say _ship_info_lib_get_takelshipinfo.to_json
23
+ end
24
+
25
+ #
26
+ # ship info yaml
27
+ #
28
+ desc 'yaml', 'Print yaml takelship info'
29
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
30
+ Print yaml takelship info
31
+ LONGDESC
32
+ # Print yaml takelship info.
33
+ def yaml
34
+ say _ship_info_lib_get_takelshipinfo.to_yaml
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship info lib
4
+ module ShipInfoLib
5
+ private
6
+
7
+ # Gather takelship information
8
+ def _ship_info_lib_get_takelshipinfo
9
+ log.debug 'Gathering takelship info'
10
+ takelshipinfo = _ship_info_lib_get_info_from_file
11
+ takelshipinfo = _ship_info_lib_get_info_from_docker if takelshipinfo.empty?
12
+ return false if takelshipinfo.nil?
13
+
14
+ takelshipinfo
15
+ end
16
+
17
+ # Read takelship info from file
18
+ def _ship_info_lib_get_info_from_file
19
+ log.debug 'Reading takelship info from file'
20
+ ship_data_dir = config.active['ship_data_dir']
21
+ yaml_file = format(
22
+ config.active['ship_takelship_yml'],
23
+ pwd: Dir.getwd,
24
+ ship_data_dir: ship_data_dir
25
+ )
26
+ read_yaml_file(yaml_file) || {}
27
+ end
28
+
29
+ # Read takelship info from docker run
30
+ def _ship_info_lib_get_info_from_docker
31
+ log.debug 'Reading takelship info from takelship container'
32
+ command = 'info'
33
+ _parse_yaml _ship_container_lib_docker_nonprivileged(command) || {}
34
+ end
35
+
36
+ def _ship_info_lib_valid_project?(takelship, project)
37
+ valid_project = false
38
+ takelship_projects = takelship['projects']
39
+ takelship_projects.each do |takelship_project|
40
+ valid_project = true if project == takelship_project['name']
41
+ end
42
+ valid_project
43
+ end
44
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Takeltau
4
+ # tau docker container
5
+ class ShipProject < SubCommandBase
6
+ include LoggingModule
7
+ include SystemModule
8
+ include ConfigModule
9
+ include DockerCheckDaemon
10
+ include ShipContainerCheckExisting
11
+ include ShipContainerLib
12
+ include ShipInfoLib
13
+ include ShipProjectList
14
+ include ShipProjectStart
15
+
16
+ #
17
+ # ship container list
18
+ #
19
+ desc 'list', 'List projects'
20
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
21
+ List projects
22
+ LONGDESC
23
+ # List projects.
24
+ def list
25
+ ship_project_list
26
+ end
27
+
28
+ #
29
+ # ship container start
30
+ #
31
+ desc 'start [PROJECT]', 'Start project [PROJECT] in a takelship container'
32
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
33
+ Start project [PROJECT] in a takelship container
34
+ LONGDESC
35
+ # Run command in docker container.
36
+ def start(project = 'default')
37
+ ship_project_start project
38
+ end
39
+
40
+ #
41
+ # ship project stop
42
+ #
43
+ desc 'stop', 'Stop a takelship container'
44
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
45
+ Stop a takelship container
46
+ LONGDESC
47
+ # Stop a takelship container.
48
+ def stop
49
+ say _ship_container_lib_docker_stop
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship project list
4
+ module ShipProjectList
5
+ # List takelship projects
6
+ def ship_project_list
7
+ log.debug 'List takelship projects'
8
+ _ship_info_lib_get_takelshipinfo['projects'].each do |project|
9
+ say project['name']
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau ship project start
4
+ module ShipProjectStart
5
+ # Start a takelship
6
+ def ship_project_start(project)
7
+ return false if ship_container_check_existing
8
+
9
+ takelship = _ship_info_lib_get_takelshipinfo
10
+ project = config.active['ship_default_project'] if project == 'default'
11
+ project = takelship['default_project'] if project == 'default'
12
+
13
+ return false unless _ship_info_lib_valid_project? takelship, project
14
+
15
+ log.debug "Starting takelship project \"#{project}\""
16
+ ports = _ship_project_start_ports takelship, project
17
+ say _ship_container_lib_docker_privileged ports, project
18
+ end
19
+
20
+ private
21
+
22
+ # Get takelship ports
23
+ # rubocop:disable Metrics/MethodLength
24
+ def _ship_project_start_ports(takelship, project)
25
+ ports = []
26
+ takelship['projects'].each do |takelship_project|
27
+ next unless project == takelship_project['name']
28
+
29
+ takelship_project['services'].each do |service|
30
+ next unless service.key?('ports')
31
+
32
+ service['ports'].each do |port|
33
+ ports << port['port']
34
+ end
35
+ end
36
+ end
37
+ # add DOCKER_HOST port
38
+ ports << config.active['ship_docker_host']
39
+ ports
40
+ end
41
+ end
42
+ # rubocop:enable Metrics/MethodLength
data/lib/takeltau/version CHANGED
@@ -1 +1 @@
1
- 0.42.5
1
+ 0.43.1
data/lib/takeltau.rb CHANGED
@@ -82,11 +82,30 @@ require_relative 'takeltau/info/cli'
82
82
  require_relative 'takeltau/self/config/cli'
83
83
  require_relative 'takeltau/self/commands'
84
84
  require_relative 'takeltau/self/cli'
85
+ require_relative 'takeltau/ship/completion/bash'
86
+ require_relative 'takeltau/ship/completion/cli'
87
+ require_relative 'takeltau/ship/container/lib'
88
+ require_relative 'takeltau/ship/container/check/existing'
89
+ require_relative 'takeltau/ship/container/check/cli'
90
+ require_relative 'takeltau/ship/info/lib'
91
+ require_relative 'takeltau/ship/container/login'
92
+ require_relative 'takeltau/ship/container/podman'
93
+ require_relative 'takeltau/ship/container/cli'
94
+ require_relative 'takeltau/ship/info/cli'
95
+ require_relative 'takeltau/ship/project/list'
96
+ require_relative 'takeltau/ship/project/start'
97
+ require_relative 'takeltau/ship/project/cli'
98
+ require_relative 'takeltau/ship/cli'
85
99
 
86
100
  # Facilitate the takelage devops workflow.
87
101
  module Takeltau
88
102
  # takeltau
89
103
  class CLI < Thor
104
+ def self.extended(base)
105
+ super
106
+ base.check_unknown_options!
107
+ end
108
+
90
109
  include LoggingModule
91
110
  include SystemModule
92
111
  include ConfigModule
@@ -153,6 +172,9 @@ module Takeltau
153
172
  desc 'self [COMMAND] ', 'Manage takelage tools'
154
173
  subcommand 'self', Self
155
174
 
175
+ desc 'ship [COMMAND] ', 'Manage takelships'
176
+ subcommand 'ship', Ship
177
+
156
178
  #
157
179
  # Top-level commands
158
180
  #
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.42.5
4
+ version: 0.43.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk
@@ -197,11 +197,13 @@ email:
197
197
  - takeltau@takelwerk.net
198
198
  executables:
199
199
  - tau
200
+ - ship
200
201
  extensions: []
201
202
  extra_rdoc_files: []
202
203
  files:
203
204
  - LICENSE
204
205
  - README.md
206
+ - bin/ship
205
207
  - bin/tau
206
208
  - lib/Thorfile
207
209
  - lib/takeltau.rb
@@ -281,6 +283,20 @@ files:
281
283
  - lib/takeltau/self/cli.rb
282
284
  - lib/takeltau/self/commands.rb
283
285
  - lib/takeltau/self/config/cli.rb
286
+ - lib/takeltau/ship/cli.rb
287
+ - lib/takeltau/ship/completion/bash.rb
288
+ - lib/takeltau/ship/completion/cli.rb
289
+ - lib/takeltau/ship/container/check/cli.rb
290
+ - lib/takeltau/ship/container/check/existing.rb
291
+ - lib/takeltau/ship/container/cli.rb
292
+ - lib/takeltau/ship/container/lib.rb
293
+ - lib/takeltau/ship/container/login.rb
294
+ - lib/takeltau/ship/container/podman.rb
295
+ - lib/takeltau/ship/info/cli.rb
296
+ - lib/takeltau/ship/info/lib.rb
297
+ - lib/takeltau/ship/project/cli.rb
298
+ - lib/takeltau/ship/project/list.rb
299
+ - lib/takeltau/ship/project/start.rb
284
300
  - lib/takeltau/version
285
301
  homepage: https://github.com/takelwerk/takelage-cli
286
302
  licenses: