takelage 0.23.2 → 0.26.2
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 +13 -11
- data/lib/takelage.rb +14 -0
- data/lib/takelage/default.yml +8 -0
- data/lib/takelage/docker/check/socat.rb +1 -1
- data/lib/takelage/docker/container/cli.rb +1 -1
- data/lib/takelage/docker/container/lib.rb +12 -0
- data/lib/takelage/docker/image/tag/cli.rb +1 -1
- data/lib/takelage/docker/image/tag/latest.rb +5 -1
- data/lib/takelage/git/check/workspace.rb +1 -2
- data/lib/takelage/info/cli.rb +3 -0
- data/lib/takelage/info/status/cli.rb +77 -0
- data/lib/takelage/info/status/git.rb +42 -0
- data/lib/takelage/info/status/gopass.rb +37 -0
- data/lib/takelage/info/status/gpg.rb +39 -0
- data/lib/takelage/info/status/header.rb +106 -0
- data/lib/takelage/info/status/lib.rb +46 -0
- data/lib/takelage/info/status/ssh.rb +40 -0
- data/lib/takelage/version +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98366dc05dd33f98b17be99056fcac490af4d5d94b7f6ff6e4b26b76aeb641b7
|
4
|
+
data.tar.gz: 236580e61eeb4820c76aa1c685ffa4e0b84d1dd438d5decbb80af3957ac195da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d30c5477ca06ff1dad259ff2b6c03bb5f62b63227307981efafac6f74a6ee6f0e298d1191efe87ac9b0e777c3b2758e1fd537734f77dd5c9b825e695d8a94ab9
|
7
|
+
data.tar.gz: febee8477c3168f2e23e588077fecfe43df4a8557d7927067eb572065e65e5591fccba41227582f75a20853de24127137bbfdb97dd1645a04ab62bcf35668946
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+

|
2
|
+
|
1
3
|
# takelage-cli
|
2
4
|
|
3
5
|
*takelage-cli* is a command line interface
|
@@ -59,22 +61,19 @@ tau [bit scope inbit](features/cucumber/features/bit/bit.scope.inbit.feature) |
|
|
59
61
|
tau [bit scope list](features/cucumber/features/bit/bit.scope.list.feature) | List bit remote scopes
|
60
62
|
tau [bit scope new](features/cucumber/features/bit/bit.scope.new.feature) [SCOPE] | Init a new bit [SCOPE]
|
61
63
|
tau [completion bash](features/cucumber/features/completion/completion.bash.feature) | Print bash completion code
|
62
|
-
tau [docker check
|
64
|
+
tau [docker check daemon](features/cucumber/features/docker/docker.check.daemon.feature) | Check if docker daemon is running
|
65
|
+
tau [docker check socat](features/cucumber/features/docker/docker.check.socat.feature) | Check if socat command is available
|
63
66
|
tau [docker container check existing](features/cucumber/features/docker/docker.container.check.existing.feature) [CONTAINER] | Check if docker [CONTAINER] is existing
|
64
67
|
tau [docker container check network](features/cucumber/features/docker/docker.container.check.network.feature) [NETWORK] | Check if docker [NETWORK] is existing
|
65
68
|
tau [docker container check orphaned](features/cucumber/features/docker/docker.container.check.orphaned.feature) [CONTAINER] | Check if docker [CONTAINER] is orphaned
|
69
|
+
tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature) | Remove all docker containers
|
66
70
|
tau [docker container command](features/cucumber/features/docker/docker.container.command.feature) [CMD] | Run [CMD] in a docker container
|
67
71
|
tau [docker container daemon](features/cucumber/features/docker/docker.container.daemon.feature) | Run docker container in daemon mode
|
68
72
|
tau [docker container login](features/cucumber/features/docker/docker.container.login.feature) | Log in to latest local docker container
|
69
|
-
tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature) | Remove all docker containers
|
70
73
|
tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature) | Remove orphaned docker containers
|
71
|
-
tau [docker image check
|
72
|
-
tau [docker image tag
|
73
|
-
tau [docker image tag
|
74
|
-
tau [docker image tag latest local](features/cucumber/features/docker/docker.image.tag.latest.local.feature) | Print latest local docker image tag
|
75
|
-
tau [docker image tag latest remote](features/cucumber/features/docker/docker.image.tag.latest.remote.feature) | Print latest remote docker image tag
|
76
|
-
tau [docker image tag list local](features/cucumber/features/docker/docker.image.tag.list.local.feature) | Print local docker image tags
|
77
|
-
tau [docker image tag list remote](features/cucumber/features/docker/docker.image.tag.list.remote.feature) | Print remote docker image tags
|
74
|
+
tau [docker image tag check](features/cucumber/features/docker/docker.image.tag.check.feature) [TAG] | Check if local docker image [TAG] exists
|
75
|
+
tau [docker image tag latest](features/cucumber/features/docker/docker.image.tag.latest.feature) | Print latest local docker image tag
|
76
|
+
tau [docker image tag list](features/cucumber/features/docker/docker.image.tag.list.feature) | Print local docker image tags
|
78
77
|
tau [docker image update](features/cucumber/features/docker/docker.image.update.feature) | Get latest remote docker container
|
79
78
|
tau [docker socket host](features/cucumber/features/docker/docker.socket.host.feature) | Print docker socket host ip address
|
80
79
|
tau [docker socket scheme](features/cucumber/features/docker/docker.socket.scheme.feature) | Print docker socket scheme
|
@@ -93,15 +92,15 @@ tau [self config home](features/cucumber/features/self/self.config.home.feature)
|
|
93
92
|
tau [self config project](features/cucumber/features/self/self.config.project.feature) | Print takelage project config file configuration
|
94
93
|
tau [self list](features/cucumber/features/self/self.list.feature) | List all commands
|
95
94
|
tau [self version](features/cucumber/features/self/self.version.feature) | Print tau semantic version number
|
95
|
+
tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature)
|
96
96
|
tau config | Alias for tau [self config active](features/cucumber/features/self/self.config.active.feature)
|
97
97
|
tau copy [DIR] [SCOPE] | Alias for tau [bit clipboard copy](features/cucumber/features/bit/bit.clipboard.copy.feature)
|
98
98
|
tau list | Alias for tau [self list](features/cucumber/features/self/self.list.feature)
|
99
99
|
tau login | Alias for tau [docker container login](features/cucumber/features/docker/docker.container.login.feature)
|
100
|
-
tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature)
|
101
100
|
tau paste [COMPONENT] [DIR] | Alias for tau [bit clipboard paste](features/cucumber/features/bit/bit.clipboard.paste.feature)
|
102
101
|
tau project | Alias for tau [info project active](features/cucumber/features/info/info.project.active.feature)
|
103
|
-
tau pull | Alias for tau [bit clipboard pull](features/cucumber/features/bit/bit.clipboard.pull.feature)
|
104
102
|
tau prune | Alias for tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature)
|
103
|
+
tau pull | Alias for tau [bit clipboard pull](features/cucumber/features/bit/bit.clipboard.pull.feature)
|
105
104
|
tau push | Alias for tau [bit clipboard push](features/cucumber/features/bit/bit.clipboard.push.feature)
|
106
105
|
tau update | Alias for tau [docker image update](features/cucumber/features/docker/docker.image.update.feature)
|
107
106
|
tau version | Alias for tau [self version](features/cucumber/features/self/self.version.feature)
|
@@ -125,6 +124,9 @@ or *tau config*.
|
|
125
124
|
| *~/.takelage.yml* | normal | User-wide configuration file in your home directory. This is your normal custom configuration file. |
|
126
125
|
| *takelage.yml* | highest | Project-specific configuration file next to your main Rakefile. Some projects need special configuration. |
|
127
126
|
|
127
|
+
Please remember that a project directory is identified by the main
|
128
|
+
[Rakefile](Rakefile).
|
129
|
+
|
128
130
|
### Configuration Examples
|
129
131
|
|
130
132
|
- You should add the following configuration items in your *~/.takelage.yml*
|
data/lib/takelage.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'etc'
|
4
|
+
require 'digest/bubblebabble'
|
4
5
|
require 'fileutils'
|
5
6
|
require 'fylla'
|
6
7
|
require 'json'
|
@@ -70,6 +71,13 @@ require_relative 'takelage/docker/container/clean'
|
|
70
71
|
require_relative 'takelage/docker/container/prune'
|
71
72
|
require_relative 'takelage/docker/container/cli'
|
72
73
|
require_relative 'takelage/docker/cli'
|
74
|
+
require_relative 'takelage/info/status/lib'
|
75
|
+
require_relative 'takelage/info/status/git'
|
76
|
+
require_relative 'takelage/info/status/gopass'
|
77
|
+
require_relative 'takelage/info/status/gpg'
|
78
|
+
require_relative 'takelage/info/status/ssh'
|
79
|
+
require_relative 'takelage/info/status/header'
|
80
|
+
require_relative 'takelage/info/status/cli'
|
73
81
|
require_relative 'takelage/info/project/cli'
|
74
82
|
require_relative 'takelage/info/cli'
|
75
83
|
require_relative 'takelage/self/config/cli'
|
@@ -202,6 +210,12 @@ module Takelage
|
|
202
210
|
Takelage::BitClipboard.new.push
|
203
211
|
end
|
204
212
|
|
213
|
+
desc 'status', 'Alias for tau info status header'
|
214
|
+
# takelage status: {takelage::InfoStatus#header}
|
215
|
+
def status
|
216
|
+
Takelage::InfoStatus.new.header
|
217
|
+
end
|
218
|
+
|
205
219
|
desc 'update', 'Alias for tau docker image update'
|
206
220
|
# takelage update: {takelage::DockerImage#update}
|
207
221
|
def update
|
data/lib/takelage/default.yml
CHANGED
@@ -58,6 +58,14 @@ cmd_git_check_clean_git_status: 'git status --porcelain'
|
|
58
58
|
cmd_git_check_main_git_branch: 'git symbolic-ref HEAD'
|
59
59
|
cmd_git_check_workspace_git_repo: 'git -C . rev-parse'
|
60
60
|
cmd_git_check_workspace_pwd: 'pwd'
|
61
|
+
cmd_info_status_lib_git_name: 'git -C %{root} config user.name'
|
62
|
+
cmd_info_status_lib_git_email: 'git -C %{root} config user.email'
|
63
|
+
cmd_info_status_lib_git_signingkey: 'git -C %{root} config user.signingKey'
|
64
|
+
cmd_info_status_lib_git_key_available: 'gpg --list-key %{key}'
|
65
|
+
cmd_info_status_gopass_root_store: 'gopass config | grep "path" | cut -d " " -f 2'
|
66
|
+
cmd_info_status_gpg_agent: 'gpg-connect-agent /bye'
|
67
|
+
cmd_info_status_gpg_keys: 'gpg --list-keys'
|
68
|
+
cmd_info_status_ssh_keys: 'ssh-add -l'
|
61
69
|
docker_debug: 'ansible/roles/takel-takelage/files/takelscripts'
|
62
70
|
docker_entrypoint_extra: '.config/gcloud'
|
63
71
|
docker_entrypoint_options: ''
|
@@ -37,7 +37,7 @@ module Takelage
|
|
37
37
|
@docker_registry = config.active['docker_registry']
|
38
38
|
@username = ENV['USER'] || 'noname'
|
39
39
|
@workdir = Dir.getwd
|
40
|
-
@hostname =
|
40
|
+
@hostname = _docker_container_lib_hostname
|
41
41
|
@socket_host = docker_socket_host
|
42
42
|
@sockets = docker_socket_scheme
|
43
43
|
end
|
@@ -6,6 +6,14 @@
|
|
6
6
|
module DockerContainerLib
|
7
7
|
private
|
8
8
|
|
9
|
+
# Create unique docker hostname
|
10
|
+
def _docker_container_lib_hostname
|
11
|
+
relative_name = "#{@docker_repo}_#{File.basename(@workdir)}"
|
12
|
+
absolute_name = "#{@docker_repo}_#{@workdir}"
|
13
|
+
digest = Digest::SHA256.bubblebabble absolute_name
|
14
|
+
"#{relative_name}_#{digest[0..10]}"
|
15
|
+
end
|
16
|
+
|
9
17
|
# Create docker container and network.
|
10
18
|
def _docker_container_lib_create_net_and_ctr(name)
|
11
19
|
return false if _docker_container_lib_check_matrjoschka
|
@@ -110,6 +118,10 @@ module DockerContainerLib
|
|
110
118
|
return false unless ENV.keys.include? 'TAKELAGE_PROJECT_BASE_DIR'
|
111
119
|
|
112
120
|
log.error 'You cannot log in to takelage from within takelage'
|
121
|
+
|
122
|
+
# wait or the github workflow will fail
|
123
|
+
sleep 1
|
124
|
+
|
113
125
|
true
|
114
126
|
end
|
115
127
|
|
@@ -37,7 +37,7 @@ module Takelage
|
|
37
37
|
#
|
38
38
|
# docker image tag latest
|
39
39
|
#
|
40
|
-
desc '
|
40
|
+
desc 'latest', 'Print latest docker image tag'
|
41
41
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
42
42
|
Print latest docker image tag
|
43
43
|
Print the tag of the docker image with the highest tag.
|
@@ -19,8 +19,7 @@ module GitCheckWorkspace
|
|
19
19
|
|
20
20
|
# Get git repository status.
|
21
21
|
def _git_check_workspace_get_status_repo
|
22
|
-
cmd_git_repo =
|
23
|
-
config.active['cmd_git_check_workspace_git_repo']
|
22
|
+
cmd_git_repo = config.active['cmd_git_check_workspace_git_repo']
|
24
23
|
try cmd_git_repo
|
25
24
|
end
|
26
25
|
|
data/lib/takelage/info/cli.rb
CHANGED
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Takelage
|
4
|
+
# takelage info status
|
5
|
+
class InfoStatus < SubCommandBase
|
6
|
+
include LoggingModule
|
7
|
+
include SystemModule
|
8
|
+
include ConfigModule
|
9
|
+
include DockerSocketScheme
|
10
|
+
include InfoStatusLib
|
11
|
+
include InfoStatusGit
|
12
|
+
include InfoStatusGopass
|
13
|
+
include InfoStatusGPG
|
14
|
+
include InfoStatusSSH
|
15
|
+
include InfoStatusHeader
|
16
|
+
|
17
|
+
#
|
18
|
+
# info status git
|
19
|
+
#
|
20
|
+
desc 'git', 'Check git status info'
|
21
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
22
|
+
Check git status info
|
23
|
+
LONGDESC
|
24
|
+
# Check git status info.
|
25
|
+
def git
|
26
|
+
exit info_status_git
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# info status gopass
|
31
|
+
#
|
32
|
+
desc 'gopass', 'Check gopass status info'
|
33
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
34
|
+
Check gopass status info
|
35
|
+
LONGDESC
|
36
|
+
# Check gopass status info.
|
37
|
+
def gopass
|
38
|
+
exit info_status_gopass
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# info status gpg
|
43
|
+
#
|
44
|
+
desc 'gpg', 'Check gpg status info'
|
45
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
46
|
+
Check gpg status info
|
47
|
+
LONGDESC
|
48
|
+
# Check gpg status info.
|
49
|
+
def gpg
|
50
|
+
exit info_status_gpg
|
51
|
+
end
|
52
|
+
|
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
|
+
# info status ssh
|
67
|
+
#
|
68
|
+
desc 'ssh', 'Check ssh status info'
|
69
|
+
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
70
|
+
Check ssh status info
|
71
|
+
LONGDESC
|
72
|
+
# Check ssh status info.
|
73
|
+
def ssh
|
74
|
+
exit info_status_ssh
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage info status git
|
4
|
+
module InfoStatusGit
|
5
|
+
# Backend method for info status git.
|
6
|
+
# @return [Boolean] is the git gpg signing key available?
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
8
|
+
# rubocop:disable Metrics/AbcSize
|
9
|
+
def info_status_git
|
10
|
+
log.debug 'Check git status'
|
11
|
+
|
12
|
+
root = config.active['project_root_dir']
|
13
|
+
|
14
|
+
if root.strip.empty?
|
15
|
+
log.error 'Cannot determine project root directory'
|
16
|
+
log.info 'Is there a Rakefile in the project root directory?'
|
17
|
+
return false
|
18
|
+
end
|
19
|
+
|
20
|
+
if _info_status_lib_git_name(root).strip.empty?
|
21
|
+
log.error 'git config user.name is not available'
|
22
|
+
return false
|
23
|
+
end
|
24
|
+
|
25
|
+
if _info_status_lib_git_email(root).strip.empty?
|
26
|
+
log.error 'git config user.email is not available'
|
27
|
+
return false
|
28
|
+
end
|
29
|
+
|
30
|
+
key = _info_status_lib_git_signingkey(root)
|
31
|
+
|
32
|
+
unless _info_status_lib_git_key_available(key).exitstatus.zero?
|
33
|
+
log.error 'git config user.signingkey is not available'
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
|
37
|
+
log.debug 'git config is available'
|
38
|
+
true
|
39
|
+
end
|
40
|
+
# rubocop:enable Metrics/AbcSize
|
41
|
+
# rubocop:enable Metrics/MethodLength
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage info status gopass
|
4
|
+
module InfoStatusGopass
|
5
|
+
# Backend method for info status gopass.
|
6
|
+
# @return [Boolean] is gopass available?
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
8
|
+
def info_status_gopass
|
9
|
+
log.debug 'Check gopass status'
|
10
|
+
|
11
|
+
root = _info_status_gopass_root_store.chomp
|
12
|
+
|
13
|
+
if root.strip.empty?
|
14
|
+
log.error 'gopass root store not found'
|
15
|
+
return false
|
16
|
+
end
|
17
|
+
|
18
|
+
key = _info_status_lib_git_signingkey(root)
|
19
|
+
|
20
|
+
unless _info_status_lib_git_key_available(key).exitstatus.zero?
|
21
|
+
log.error 'gopass root store gpg key is not available'
|
22
|
+
return false
|
23
|
+
end
|
24
|
+
|
25
|
+
log.debug 'gopass is available'
|
26
|
+
true
|
27
|
+
end
|
28
|
+
# rubocop:enable Metrics/MethodLength
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# Get gopass root store
|
33
|
+
def _info_status_gopass_root_store
|
34
|
+
cmd_gopass_root_store = config.active['cmd_info_status_gopass_root_store']
|
35
|
+
run cmd_gopass_root_store
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage info status gpg
|
4
|
+
module InfoStatusGPG
|
5
|
+
# Backend method for info status gpg.
|
6
|
+
# @return [Boolean] is GPG available?
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
8
|
+
def info_status_gpg
|
9
|
+
log.debug 'Check gpg status'
|
10
|
+
|
11
|
+
unless _info_status_gpg_keys
|
12
|
+
log.error 'gpg keys are not available'
|
13
|
+
return false
|
14
|
+
end
|
15
|
+
|
16
|
+
unless _info_status_gpg_agent
|
17
|
+
log.error 'gpg agent is not available'
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
|
21
|
+
log.debug 'gpg is available'
|
22
|
+
true
|
23
|
+
end
|
24
|
+
# rubocop:enable Metrics/MethodLength
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# Check gpg keys
|
29
|
+
def _info_status_gpg_keys
|
30
|
+
status_keys = try config.active['cmd_info_status_gpg_keys']
|
31
|
+
status_keys.exitstatus.zero?
|
32
|
+
end
|
33
|
+
|
34
|
+
# Check gpg agent
|
35
|
+
def _info_status_gpg_agent
|
36
|
+
status_agent = try config.active['cmd_info_status_gpg_agent']
|
37
|
+
status_agent.exitstatus.zero?
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,106 @@
|
|
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
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage info status lib
|
4
|
+
module InfoStatusLib
|
5
|
+
private
|
6
|
+
|
7
|
+
# Get git config user name
|
8
|
+
def _info_status_lib_git_name(root)
|
9
|
+
cmd_git_name =
|
10
|
+
format(
|
11
|
+
config.active['cmd_info_status_lib_git_name'],
|
12
|
+
root: root
|
13
|
+
)
|
14
|
+
run cmd_git_name
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get git config user email
|
18
|
+
def _info_status_lib_git_email(root)
|
19
|
+
cmd_git_email =
|
20
|
+
format(
|
21
|
+
config.active['cmd_info_status_lib_git_email'],
|
22
|
+
root: root
|
23
|
+
)
|
24
|
+
run cmd_git_email
|
25
|
+
end
|
26
|
+
|
27
|
+
# Get git config user signingkey
|
28
|
+
def _info_status_lib_git_signingkey(root)
|
29
|
+
cmd_git_signingkey =
|
30
|
+
format(
|
31
|
+
config.active['cmd_info_status_lib_git_signingkey'],
|
32
|
+
root: root
|
33
|
+
)
|
34
|
+
run cmd_git_signingkey
|
35
|
+
end
|
36
|
+
|
37
|
+
# Check if git key is available
|
38
|
+
def _info_status_lib_git_key_available(key)
|
39
|
+
cmd_git_key_available =
|
40
|
+
format(
|
41
|
+
config.active['cmd_info_status_lib_git_key_available'],
|
42
|
+
key: key
|
43
|
+
)
|
44
|
+
try cmd_git_key_available
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage info status ssh
|
4
|
+
module InfoStatusSSH
|
5
|
+
# Backend method for info status ssh.
|
6
|
+
# @return [Boolean] is ssh available?
|
7
|
+
# rubocop:disable Metrics/MethodLength
|
8
|
+
def info_status_ssh
|
9
|
+
log.debug 'Check ssh status'
|
10
|
+
|
11
|
+
ssh_socket_path = _socket_get_agent_ssh_socket_path
|
12
|
+
|
13
|
+
unless ENV['SSH_AUTH_SOCK'] == ssh_socket_path
|
14
|
+
log.error 'gpg ssh socket is misconfigured'
|
15
|
+
return false
|
16
|
+
end
|
17
|
+
|
18
|
+
unless _file_exists? ssh_socket_path
|
19
|
+
log.error 'gpg ssh socket is not available'
|
20
|
+
return false
|
21
|
+
end
|
22
|
+
|
23
|
+
unless _info_status_ssh_keys
|
24
|
+
log.error 'ssh keys are not available'
|
25
|
+
return false
|
26
|
+
end
|
27
|
+
|
28
|
+
log.debug 'ssh is available'
|
29
|
+
true
|
30
|
+
end
|
31
|
+
# rubocop:enable Metrics/MethodLength
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# Check ssh keys
|
36
|
+
def _info_status_ssh_keys
|
37
|
+
status_keys = try config.active['cmd_info_status_ssh_keys']
|
38
|
+
status_keys.exitstatus.zero?
|
39
|
+
end
|
40
|
+
end
|
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.26.2
|
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.26.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geospin
|
@@ -259,6 +259,13 @@ 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/cli.rb
|
263
|
+
- lib/takelage/info/status/git.rb
|
264
|
+
- lib/takelage/info/status/gopass.rb
|
265
|
+
- lib/takelage/info/status/gpg.rb
|
266
|
+
- lib/takelage/info/status/header.rb
|
267
|
+
- lib/takelage/info/status/lib.rb
|
268
|
+
- lib/takelage/info/status/ssh.rb
|
262
269
|
- lib/takelage/lib/config.rb
|
263
270
|
- lib/takelage/lib/logging.rb
|
264
271
|
- lib/takelage/lib/project.rb
|
@@ -288,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
295
|
- !ruby/object:Gem::Version
|
289
296
|
version: '0'
|
290
297
|
requirements: []
|
291
|
-
rubygems_version: 3.
|
298
|
+
rubygems_version: 3.2.3
|
292
299
|
signing_key:
|
293
300
|
specification_version: 4
|
294
301
|
summary: takelage devops workflow cli
|