takelage 0.26.2 → 0.27.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 +4 -4
- data/README.md +34 -21
- data/lib/takelage.rb +4 -4
- data/lib/takelage/bit/check/workspace.rb +1 -1
- data/lib/takelage/bit/scope/cli.rb +1 -1
- data/lib/takelage/default.yml +2 -2
- data/lib/takelage/docker/container/check/existing.rb +1 -1
- data/lib/takelage/docker/container/check/network.rb +1 -1
- data/lib/takelage/docker/image/tag/check.rb +2 -2
- data/lib/takelage/docker/socket/stop.rb +1 -1
- data/lib/takelage/git/check/main.rb +1 -1
- data/lib/takelage/git/check/workspace.rb +9 -7
- data/lib/takelage/info/status/bar.rb +106 -0
- data/lib/takelage/info/status/cli.rb +14 -13
- data/lib/takelage/info/status/git.rb +8 -3
- data/lib/takelage/info/status/gopass.rb +3 -3
- data/lib/takelage/info/status/lib.rb +1 -1
- data/lib/takelage/info/status/ssh.rb +5 -4
- data/lib/takelage/version +1 -1
- metadata +2 -2
- data/lib/takelage/info/status/header.rb +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 689104aead67286437fded2a138c0a043f9eb9604a7a44375df45a5f9d66de68
|
4
|
+
data.tar.gz: 91fe52a44bfc3025b284ae155879a1c5d948a34baba5fc2a903c376c8996062e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 948586185c0cf2b448d3ad14d49c80742e73e5517d545cbd951908d062ceb2a1aec0e2404c86deec18e8b916c597dc246e2129b21e165986ed5cb55b367f1c89
|
7
|
+
data.tar.gz: 82c8e74a3e9673707f0ca2ce1cb865e73bff2282208ac0d76b8ba21eed04e6cefc07b84080faeaafa10bd34e324beafb2e5537ebd7a6a6e809e40dd0342bad43
|
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
](https://github.com/geospin-takelage/takelage-cli/blob/main/LICENSE)
|
2
|
+
[](https://rubygems.org/gems/takelage)
|
3
|
+
[](https://github.com/geospin-takelage/takelage-cli/actions/workflows/build_test_deploy_project_on_push.yml)
|
4
|
+
[](https://github.com/geospin-takelage/takelage-cli/actions/workflows/test_project_nightly.yml)
|
2
5
|
|
3
6
|
# takelage-cli
|
4
7
|
|
@@ -12,17 +15,30 @@ The *takelage-cli* executable *tau* is a
|
|
12
15
|
command line script using the
|
13
16
|
[thor](http://whatisthor.com/) toolkit.
|
14
17
|
|
15
|
-
## Framework
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
|
20
|
-
|
|
21
|
-
| *[takelage-
|
22
|
-
| *[takelage-
|
23
|
-
| *[takelage-
|
24
|
-
| *[takelage-
|
25
|
-
| *[takelage-
|
18
|
+
## Framework Versions
|
19
|
+
|
20
|
+
| App | Artifact |
|
21
|
+
| --- | -------- |
|
22
|
+
| *[takelage-doc](https://github.com/geospin-takelage/takelage-doc)* | [](https://github.com/geospin-takelage/takelage-doc/blob/main/LICENSE) |
|
23
|
+
| *[takelage-dev](https://github.com/geospin-takelage/takelage-dev)* | [](https://hub.docker.com/r/takelage/takelage) |
|
24
|
+
| *[takelage-cli](https://github.com/geospin-takelage/takelage-cli)* | [](https://rubygems.org/gems/takelage) |
|
25
|
+
| *[takelage-var](https://github.com/geospin-takelage/takelage-var)* | [](https://pypi.org/project/takeltest/) |
|
26
|
+
| *[takelage-bit](https://github.com/geospin-takelage/takelage-bit)* | [](https://hub.docker.com/r/takelage/bitboard) |
|
27
|
+
| *[takelage-img-takelslim](https://github.com/geospin-takelage/takelage-img-takelslim)* | [](https://hub.docker.com/r/takelage/takelslim) |
|
28
|
+
| *[takelage-img-takelbase](https://github.com/geospin-takelage/takelage-img-takelbase)* | [](https://hub.docker.com/r/takelage/takelbase) |
|
29
|
+
| *[takelage-img-multipostgres](https://github.com/geospin-takelage/takelage-img-multipostgres)* | [](https://hub.docker.com/r/takelage/multipostgres) |
|
30
|
+
|
31
|
+
## Framework Status
|
32
|
+
|
33
|
+
| App | Deploy project | Test project | Test roles |
|
34
|
+
| --- | -------------- | ------------ | ---------- |
|
35
|
+
| *[takelage-dev](https://github.com/geospin-takelage/takelage-dev)* | [](https://github.com/geospin-takelage/takelage-dev/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/geospin-takelage/takelage-dev/actions/workflows/build_test_project_nightly.yml) | [](https://github.com/geospin-takelage/takelage-dev/actions/workflows/build_test_roles_nightly.yml) |
|
36
|
+
| *[takelage-cli](https://github.com/geospin-takelage/takelage-cli)* | [](https://github.com/geospin-takelage/takelage-cli/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/geospin-takelage/takelage-cli/actions/workflows/test_project_nightly.yml) |
|
37
|
+
| *[takelage-var](https://github.com/geospin-takelage/takelage-var)* | [](https://github.com/geospin-takelage/takelage-var/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/geospin-takelage/takelage-var/actions/workflows/build_test_project_nightly.yml) |
|
38
|
+
| *[takelage-bit](https://github.com/geospin-takelage/takelage-bit)* | [](https://github.com/geospin-takelage/takelage-bit/actions/workflows/build_test_deploy_project_on_push.yml) | [](https://github.com/geospin-takelage/takelage-bit/actions/workflows/build_test_project_nightly.yml) | [](https://github.com/geospin-takelage/takelage-bit/actions/workflows/build_test_roles_nightly.yml) |
|
39
|
+
| *[takelage-img-takelslim](https://github.com/geospin-takelage/takelage-img-takelslim)* | [](https://github.com/geospin-takelage/takelage-img-takelslim/actions/workflows/build_deploy_takelslim_nightly.yml) |
|
40
|
+
| *[takelage-img-takelbase](https://github.com/geospin-takelage/takelage-img-takelbase)* | [](https://github.com/geospin-takelage/takelage-img-takelbase/actions/workflows/build_deploy_takelbase_nightly.yml) |
|
41
|
+
| *[takelage-img-multipostgres](https://github.com/geospin-takelage/takelage-img-multipostgres)* | [](https://github.com/geospin-takelage/takelage-img-multipostgres/actions/workflows/build_deploy_multipostgres_nightly.yml) |
|
26
42
|
|
27
43
|
## Installation
|
28
44
|
|
@@ -86,6 +102,11 @@ tau [info project active](features/cucumber/features/info/info.project.active.fe
|
|
86
102
|
tau [info project dir](features/cucumber/features/info/info.project.dir.feature) | Print project root directory
|
87
103
|
tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
|
88
104
|
tau [info project private](features/cucumber/features/info/info.project.private.feature) | Print private project info
|
105
|
+
tau [info status git](features/cucumber/features/info/info.status.git.feature) | Check git status info
|
106
|
+
tau [info status gopass](features/cucumber/features/info/info.status.gopass.feature) | Check gopass status info
|
107
|
+
tau [info status gpg](features/cucumber/features/info/info.status.gpg.feature) | Check gpg status info
|
108
|
+
tau [info status bar](features/cucumber/features/info/info.status.bar.feature) | Print status info bar
|
109
|
+
tau [info status ssh](features/cucumber/features/info/info.status.ssh.feature) | Check ssh status info
|
89
110
|
tau [self config active](features/cucumber/features/self/self.config.active.feature) | Print active takelage configuration
|
90
111
|
tau [self config default](features/cucumber/features/self/self.config.default.feature) | Print takelage default configuration
|
91
112
|
tau [self config home](features/cucumber/features/self/self.config.home.feature) | Print takelage home config file configuration
|
@@ -102,6 +123,7 @@ tau project | Alias for tau [info project active](features/cucumber/features/inf
|
|
102
123
|
tau prune | Alias for tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature)
|
103
124
|
tau pull | Alias for tau [bit clipboard pull](features/cucumber/features/bit/bit.clipboard.pull.feature)
|
104
125
|
tau push | Alias for tau [bit clipboard push](features/cucumber/features/bit/bit.clipboard.push.feature)
|
126
|
+
tau status | Alias for tau [docker info status bar](features/cucumber/features/info/info.status.bar.feature)
|
105
127
|
tau update | Alias for tau [docker image update](features/cucumber/features/docker/docker.image.update.feature)
|
106
128
|
tau version | Alias for tau [self version](features/cucumber/features/self/self.version.feature)
|
107
129
|
|
@@ -138,15 +160,6 @@ bit_remote: 'ssh://bit@bit.example.com:222:/bit'
|
|
138
160
|
bit_ssh: 'ssh -p 222 bit@bit.example.com'
|
139
161
|
```
|
140
162
|
|
141
|
-
- By default, takelage uses bright prompt colors which are best viewed on a
|
142
|
-
dark background. If you prefer a light background (or want less bright colors)
|
143
|
-
you can add an option to your *~/.takelage.yml*:
|
144
|
-
|
145
|
-
```yaml
|
146
|
-
---
|
147
|
-
docker_daynight: 'day'
|
148
|
-
```
|
149
|
-
|
150
163
|
- If you want to pin a specific docker tag for one of your projects
|
151
164
|
then create an *takelage.yml* file with:
|
152
165
|
|
data/lib/takelage.rb
CHANGED
@@ -76,7 +76,7 @@ require_relative 'takelage/info/status/git'
|
|
76
76
|
require_relative 'takelage/info/status/gopass'
|
77
77
|
require_relative 'takelage/info/status/gpg'
|
78
78
|
require_relative 'takelage/info/status/ssh'
|
79
|
-
require_relative 'takelage/info/status/
|
79
|
+
require_relative 'takelage/info/status/bar'
|
80
80
|
require_relative 'takelage/info/status/cli'
|
81
81
|
require_relative 'takelage/info/project/cli'
|
82
82
|
require_relative 'takelage/info/cli'
|
@@ -210,10 +210,10 @@ module Takelage
|
|
210
210
|
Takelage::BitClipboard.new.push
|
211
211
|
end
|
212
212
|
|
213
|
-
desc 'status', 'Alias for tau info status
|
214
|
-
# takelage status: {takelage::InfoStatus#
|
213
|
+
desc 'status', 'Alias for tau info status bar'
|
214
|
+
# takelage status: {takelage::InfoStatus#bar}
|
215
215
|
def status
|
216
|
-
Takelage::InfoStatus.new.
|
216
|
+
Takelage::InfoStatus.new.bar
|
217
217
|
end
|
218
218
|
|
219
219
|
desc 'update', 'Alias for tau docker image update'
|
data/lib/takelage/default.yml
CHANGED
@@ -34,7 +34,7 @@ cmd_docker_check_socat_which_socat: 'which socat'
|
|
34
34
|
cmd_docker_container_check_existing_docker_ps: 'docker ps --filter name=^%{container}$ --quiet'
|
35
35
|
cmd_docker_container_check_network_docker_network: 'docker network ls --quiet --filter name=^%{network}$'
|
36
36
|
cmd_docker_container_check_orphaned_docker_exec: 'docker exec --interactive %{container} ps a'
|
37
|
-
cmd_docker_container_create: 'docker run --detach --env TAKELAGE_PROJECT_BASE_DIR=%{workdir} --env TZ=%{timezone} --hostname %{container} --name %{container} --network %{container} --
|
37
|
+
cmd_docker_container_create: 'docker run --detach --env TAKELAGE_PROJECT_BASE_DIR=%{workdir} --env TZ=%{timezone} --hostname %{container} --name %{container} --network %{container} --rm --shm-size %{shmsize} --tty --volume %{dockersock}:/var/run/docker.sock --volume %{homedir}:/hostdir --volume %{workdir}:/project %{volume_dev} --workdir /project %{addhost} %{docker_run_options} %{image} %{entrypoint} --gid %{gid} --home %{homedir} --uid %{uid} --username %{username} --gpg_agent_port %{gpg_agent_port} --gpg_ssh_agent_port %{gpg_ssh_agent_port} --extra=%{extra} %{entrypoint_options}'
|
38
38
|
cmd_docker_container_create_network: 'docker network create %{network}'
|
39
39
|
cmd_docker_container_enter_container: 'docker exec --interactive --tty %{container} %{loginpoint} --username %{username}'
|
40
40
|
cmd_docker_container_get_container_name: 'docker ps --filter id=%{container} --format "{{.Names}}"'
|
@@ -56,7 +56,7 @@ cmd_git_check_clean_git_unstaged: 'git diff --exit-code'
|
|
56
56
|
cmd_git_check_clean_git_uncommitted: 'git diff --cached --exit-code'
|
57
57
|
cmd_git_check_clean_git_status: 'git status --porcelain'
|
58
58
|
cmd_git_check_main_git_branch: 'git symbolic-ref HEAD'
|
59
|
-
cmd_git_check_workspace_git_repo: 'git -C
|
59
|
+
cmd_git_check_workspace_git_repo: 'git -C %{dir} rev-parse'
|
60
60
|
cmd_git_check_workspace_pwd: 'pwd'
|
61
61
|
cmd_info_status_lib_git_name: 'git -C %{root} config user.name'
|
62
62
|
cmd_info_status_lib_git_email: 'git -C %{root} config user.email'
|
@@ -9,7 +9,7 @@ module DockerImageTagCheck
|
|
9
9
|
|
10
10
|
return false unless docker_check_daemon
|
11
11
|
|
12
|
-
if tag.to_s.
|
12
|
+
if tag.to_s.chomp.empty?
|
13
13
|
log.warn 'No docker image tag specified'
|
14
14
|
return false
|
15
15
|
end
|
@@ -32,7 +32,7 @@ module DockerImageTagCheck
|
|
32
32
|
image: image
|
33
33
|
)
|
34
34
|
|
35
|
-
if (run cmd_docker_images).to_s.
|
35
|
+
if (run cmd_docker_images).to_s.chomp.empty?
|
36
36
|
log.debug "No docker image \"#{image}\" found"
|
37
37
|
return false
|
38
38
|
end
|
@@ -31,7 +31,7 @@ module DockerSocketStop
|
|
31
31
|
# Stop process.
|
32
32
|
def _docker_socket_stop_kill_process(process, cmds_start_socket)
|
33
33
|
# split processes in process id and process command
|
34
|
-
pid_command = process.
|
34
|
+
pid_command = process.chomp.split(/ /, 2)
|
35
35
|
pid = pid_command[0]
|
36
36
|
command = pid_command[1]
|
37
37
|
|
@@ -4,10 +4,9 @@
|
|
4
4
|
module GitCheckWorkspace
|
5
5
|
# Backend method for git check workspace.
|
6
6
|
# @return [Boolean] is this a git workspace?
|
7
|
-
def git_check_workspace
|
8
|
-
log.debug
|
9
|
-
status_repo = _git_check_workspace_get_status_repo
|
10
|
-
dir = _git_check_workspace_get_dir
|
7
|
+
def git_check_workspace(dir = _git_check_workspace_get_dir)
|
8
|
+
log.debug "Check if \"#{dir}\" is a git workspace"
|
9
|
+
status_repo = _git_check_workspace_get_status_repo(dir)
|
11
10
|
unless status_repo.exitstatus.zero?
|
12
11
|
log.debug "No git workspace found in \"#{dir}\""
|
13
12
|
return false
|
@@ -18,8 +17,11 @@ module GitCheckWorkspace
|
|
18
17
|
private
|
19
18
|
|
20
19
|
# Get git repository status.
|
21
|
-
def _git_check_workspace_get_status_repo
|
22
|
-
cmd_git_repo =
|
20
|
+
def _git_check_workspace_get_status_repo(dir)
|
21
|
+
cmd_git_repo = format(
|
22
|
+
config.active['cmd_git_check_workspace_git_repo'],
|
23
|
+
dir: dir
|
24
|
+
)
|
23
25
|
try cmd_git_repo
|
24
26
|
end
|
25
27
|
|
@@ -27,6 +29,6 @@ module GitCheckWorkspace
|
|
27
29
|
def _git_check_workspace_get_dir
|
28
30
|
cmd_pwd =
|
29
31
|
config.active['cmd_git_check_workspace_pwd']
|
30
|
-
(run cmd_pwd).
|
32
|
+
(run cmd_pwd).chomp
|
31
33
|
end
|
32
34
|
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage info status bar
|
4
|
+
module InfoStatusBar
|
5
|
+
# Backend method for info status bar.
|
6
|
+
# @return [String] status info bar
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
8
|
+
def info_status_bar
|
9
|
+
log.debug 'Get status info bar'
|
10
|
+
|
11
|
+
@bar_list = []
|
12
|
+
|
13
|
+
_info_status_bar_takelage
|
14
|
+
_info_status_bar_tau
|
15
|
+
_info_status_bar_git
|
16
|
+
_info_status_bar_gopass
|
17
|
+
_info_status_bar_gpg
|
18
|
+
_info_status_bar_ssh
|
19
|
+
|
20
|
+
bar = @bar_list.join(' | ')
|
21
|
+
log.debug "status info bar: #{bar}"
|
22
|
+
bar
|
23
|
+
end
|
24
|
+
# rubocop:enable Metrics/MethodLength
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# Add takelage version info to bar
|
29
|
+
def _info_status_bar_takelage
|
30
|
+
takelage_version_file = '/etc/takelage_version'
|
31
|
+
return unless _file_exists? takelage_version_file
|
32
|
+
|
33
|
+
_file_read takelage_version_file
|
34
|
+
@bar_list << "takelage: #{@content_file.chomp.green}"
|
35
|
+
end
|
36
|
+
|
37
|
+
# Add tau version info to bar
|
38
|
+
def _info_status_bar_tau
|
39
|
+
@bar_list << "tau: #{Takelage::VERSION.green}"
|
40
|
+
end
|
41
|
+
|
42
|
+
# Add git status info to bar
|
43
|
+
def _info_status_bar_git
|
44
|
+
@status_git = info_status_git
|
45
|
+
@bar_list << ("git: #{@status_git ? 'ok'.green : 'no'.red}")
|
46
|
+
end
|
47
|
+
|
48
|
+
# Add gopass status info to bar
|
49
|
+
def _info_status_bar_gopass
|
50
|
+
@status_gopass = info_status_gopass
|
51
|
+
@bar_list << ("gopass: #{@status_gopass ? 'ok'.green : 'no'.red}")
|
52
|
+
end
|
53
|
+
|
54
|
+
# Add gpg status info to bar
|
55
|
+
def _info_status_bar_gpg
|
56
|
+
if @status_git || @status_gopass
|
57
|
+
@bar_list << "gpg: #{'ok'.green}"
|
58
|
+
return
|
59
|
+
end
|
60
|
+
|
61
|
+
@bar_list << ("gpg: #{info_status_gpg ? 'ok'.green : 'no'.red}")
|
62
|
+
end
|
63
|
+
|
64
|
+
# Add ssh status info to bar
|
65
|
+
def _info_status_bar_ssh
|
66
|
+
@bar_list << ("ssh: #{info_status_ssh ? 'ok'.green : 'no'.red}")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Amend String class with colorization
|
71
|
+
class String
|
72
|
+
# Colorize strings
|
73
|
+
def colorize(color_code)
|
74
|
+
"\e[#{color_code}m#{self}\e[0m"
|
75
|
+
end
|
76
|
+
|
77
|
+
# String color red
|
78
|
+
def red
|
79
|
+
colorize(31)
|
80
|
+
end
|
81
|
+
|
82
|
+
# String color green
|
83
|
+
def green
|
84
|
+
colorize(32)
|
85
|
+
end
|
86
|
+
|
87
|
+
# String color yellow
|
88
|
+
def yellow
|
89
|
+
colorize(33)
|
90
|
+
end
|
91
|
+
|
92
|
+
# String color blue
|
93
|
+
def blue
|
94
|
+
colorize(34)
|
95
|
+
end
|
96
|
+
|
97
|
+
# String color pink
|
98
|
+
def pink
|
99
|
+
colorize(35)
|
100
|
+
end
|
101
|
+
|
102
|
+
# String color light_blue
|
103
|
+
def light_blue
|
104
|
+
colorize(36)
|
105
|
+
end
|
106
|
+
end
|
@@ -7,12 +7,25 @@ module Takelage
|
|
7
7
|
include SystemModule
|
8
8
|
include ConfigModule
|
9
9
|
include DockerSocketScheme
|
10
|
+
include GitCheckWorkspace
|
10
11
|
include InfoStatusLib
|
11
12
|
include InfoStatusGit
|
12
13
|
include InfoStatusGopass
|
13
14
|
include InfoStatusGPG
|
14
15
|
include InfoStatusSSH
|
15
|
-
include
|
16
|
+
include InfoStatusBar
|
17
|
+
|
18
|
+
#
|
19
|
+
# info status bar
|
20
|
+
#
|
21
|
+
desc 'bar', 'Print status info bar'
|
22
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
23
|
+
Print status info bar
|
24
|
+
LONGDESC
|
25
|
+
# Print status info bar.
|
26
|
+
def bar
|
27
|
+
say info_status_bar
|
28
|
+
end
|
16
29
|
|
17
30
|
#
|
18
31
|
# info status git
|
@@ -50,18 +63,6 @@ module Takelage
|
|
50
63
|
exit info_status_gpg
|
51
64
|
end
|
52
65
|
|
53
|
-
#
|
54
|
-
# info status header
|
55
|
-
#
|
56
|
-
desc 'header', 'Print status info header'
|
57
|
-
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
58
|
-
Print status info header
|
59
|
-
LONGDESC
|
60
|
-
# Print status info header.
|
61
|
-
def header
|
62
|
-
say info_status_header
|
63
|
-
end
|
64
|
-
|
65
66
|
#
|
66
67
|
# info status ssh
|
67
68
|
#
|
@@ -11,18 +11,23 @@ module InfoStatusGit
|
|
11
11
|
|
12
12
|
root = config.active['project_root_dir']
|
13
13
|
|
14
|
-
if root.
|
14
|
+
if root.chomp.empty?
|
15
15
|
log.error 'Cannot determine project root directory'
|
16
16
|
log.info 'Is there a Rakefile in the project root directory?'
|
17
17
|
return false
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
unless git_check_workspace(root)
|
21
|
+
log.error 'Project root directory is not a git workspace'
|
22
|
+
return false
|
23
|
+
end
|
24
|
+
|
25
|
+
if _info_status_lib_git_name(root).chomp.empty?
|
21
26
|
log.error 'git config user.name is not available'
|
22
27
|
return false
|
23
28
|
end
|
24
29
|
|
25
|
-
if _info_status_lib_git_email(root).
|
30
|
+
if _info_status_lib_git_email(root).chomp.empty?
|
26
31
|
log.error 'git config user.email is not available'
|
27
32
|
return false
|
28
33
|
end
|
@@ -8,9 +8,9 @@ module InfoStatusGopass
|
|
8
8
|
def info_status_gopass
|
9
9
|
log.debug 'Check gopass status'
|
10
10
|
|
11
|
-
root = _info_status_gopass_root_store
|
11
|
+
root = _info_status_gopass_root_store
|
12
12
|
|
13
|
-
if root.
|
13
|
+
if root.chomp.empty?
|
14
14
|
log.error 'gopass root store not found'
|
15
15
|
return false
|
16
16
|
end
|
@@ -32,6 +32,6 @@ module InfoStatusGopass
|
|
32
32
|
# Get gopass root store
|
33
33
|
def _info_status_gopass_root_store
|
34
34
|
cmd_gopass_root_store = config.active['cmd_info_status_gopass_root_store']
|
35
|
-
run cmd_gopass_root_store
|
35
|
+
(run cmd_gopass_root_store).chomp
|
36
36
|
end
|
37
37
|
end
|
@@ -8,14 +8,15 @@ module InfoStatusSSH
|
|
8
8
|
def info_status_ssh
|
9
9
|
log.debug 'Check ssh status'
|
10
10
|
|
11
|
-
|
11
|
+
ssh_auth_sock = ENV['SSH_AUTH_SOCK']
|
12
|
+
gpg_ssh_socket = _socket_get_agent_ssh_socket_path
|
12
13
|
|
13
|
-
unless
|
14
|
-
log.error 'gpg ssh socket
|
14
|
+
unless ssh_auth_sock == gpg_ssh_socket
|
15
|
+
log.error 'ssh does not use gpg ssh socket'
|
15
16
|
return false
|
16
17
|
end
|
17
18
|
|
18
|
-
unless _file_exists?
|
19
|
+
unless _file_exists? gpg_ssh_socket
|
19
20
|
log.error 'gpg ssh socket is not available'
|
20
21
|
return false
|
21
22
|
end
|
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.27.1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: takelage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.27.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geospin
|
@@ -259,11 +259,11 @@ files:
|
|
259
259
|
- lib/takelage/git/cli.rb
|
260
260
|
- lib/takelage/info/cli.rb
|
261
261
|
- lib/takelage/info/project/cli.rb
|
262
|
+
- lib/takelage/info/status/bar.rb
|
262
263
|
- lib/takelage/info/status/cli.rb
|
263
264
|
- lib/takelage/info/status/git.rb
|
264
265
|
- lib/takelage/info/status/gopass.rb
|
265
266
|
- lib/takelage/info/status/gpg.rb
|
266
|
-
- lib/takelage/info/status/header.rb
|
267
267
|
- lib/takelage/info/status/lib.rb
|
268
268
|
- lib/takelage/info/status/ssh.rb
|
269
269
|
- lib/takelage/lib/config.rb
|
@@ -1,106 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# takelage info status header
|
4
|
-
module InfoStatusHeader
|
5
|
-
# Backend method for info status header.
|
6
|
-
# @return [String] status info header
|
7
|
-
# rubocop:disable Metrics/MethodLength
|
8
|
-
def info_status_header
|
9
|
-
log.debug 'Get status info header'
|
10
|
-
|
11
|
-
@header_list = []
|
12
|
-
|
13
|
-
_info_status_header_takelage
|
14
|
-
_info_status_header_tau
|
15
|
-
_info_status_header_git
|
16
|
-
_info_status_header_gopass
|
17
|
-
_info_status_header_gpg
|
18
|
-
_info_status_header_ssh
|
19
|
-
|
20
|
-
header = @header_list.join(' | ')
|
21
|
-
log.debug "status info header: #{header}"
|
22
|
-
header
|
23
|
-
end
|
24
|
-
# rubocop:enable Metrics/MethodLength
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
# Add takelage version info to header
|
29
|
-
def _info_status_header_takelage
|
30
|
-
takelage_version_file = '/etc/takelage_version'
|
31
|
-
return unless _file_exists? takelage_version_file
|
32
|
-
|
33
|
-
_file_read takelage_version_file
|
34
|
-
@header_list << "takelage: #{@content_file.chomp.green}"
|
35
|
-
end
|
36
|
-
|
37
|
-
# Add tau version info to header
|
38
|
-
def _info_status_header_tau
|
39
|
-
@header_list << "tau: #{Takelage::VERSION.green}"
|
40
|
-
end
|
41
|
-
|
42
|
-
# Add git status info to header
|
43
|
-
def _info_status_header_git
|
44
|
-
@status_git = info_status_git
|
45
|
-
@header_list << ("git: #{@status_git ? 'ok'.green : 'no'.red}")
|
46
|
-
end
|
47
|
-
|
48
|
-
# Add gopass status info to header
|
49
|
-
def _info_status_header_gopass
|
50
|
-
@status_gopass = info_status_gopass
|
51
|
-
@header_list << ("gopass: #{@status_gopass ? 'ok'.green : 'no'.red}")
|
52
|
-
end
|
53
|
-
|
54
|
-
# Add gpg status info to header
|
55
|
-
def _info_status_header_gpg
|
56
|
-
if @status_git || @status_gopass
|
57
|
-
@header_list << "gpg: #{'ok'.green}"
|
58
|
-
return
|
59
|
-
end
|
60
|
-
|
61
|
-
@header_list << ("gpg: #{info_status_gpg ? 'ok'.green : 'no'.red}")
|
62
|
-
end
|
63
|
-
|
64
|
-
# Add ssh status info to header
|
65
|
-
def _info_status_header_ssh
|
66
|
-
@header_list << ("ssh: #{info_status_ssh ? 'ok'.green : 'no'.red}")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# Amend String class with colorization
|
71
|
-
class String
|
72
|
-
# Colorize strings
|
73
|
-
def colorize(color_code)
|
74
|
-
"\e[#{color_code}m#{self}\e[0m"
|
75
|
-
end
|
76
|
-
|
77
|
-
# String color red
|
78
|
-
def red
|
79
|
-
colorize(31)
|
80
|
-
end
|
81
|
-
|
82
|
-
# String color green
|
83
|
-
def green
|
84
|
-
colorize(32)
|
85
|
-
end
|
86
|
-
|
87
|
-
# String color yellow
|
88
|
-
def yellow
|
89
|
-
colorize(33)
|
90
|
-
end
|
91
|
-
|
92
|
-
# String color blue
|
93
|
-
def blue
|
94
|
-
colorize(34)
|
95
|
-
end
|
96
|
-
|
97
|
-
# String color pink
|
98
|
-
def pink
|
99
|
-
colorize(35)
|
100
|
-
end
|
101
|
-
|
102
|
-
# String color light_blue
|
103
|
-
def light_blue
|
104
|
-
colorize(36)
|
105
|
-
end
|
106
|
-
end
|