takelage 0.25.10 → 0.27.0

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: 6e946f65c7d82b399bff9b24ad38f5f35692b1984fb3b24a746b9a79d949ff68
4
- data.tar.gz: 22ca88e0d4c57564caafe1fbabd6fb2ec18fe85da30b78edec4286d0f807555f
3
+ metadata.gz: c8905375283e4a566957acbf6056d8491e973ae25e3267502ae1c1056122b281
4
+ data.tar.gz: 5b0d199884be44aafe06a6f04b2640f58775a6fec580dc77f412a801eb6d8a28
5
5
  SHA512:
6
- metadata.gz: 321defb1e6c775e1fdf69d85fba71f2265602be4db53705b204b4e10096d73c517762e71e910af09cf717bb112f736c1705802ccdfc44a1289ab9e5183f2fbe2
7
- data.tar.gz: 58ab87995c99d0ff2059b9d7def178b3489276e18787c8744c66d43c2bc4d82f80ba959f19e31b3a3084e14c04d99515324ba69ec5b743fc267eb6bb091a8a65
6
+ metadata.gz: 4cf5896dd58d67f1eb18f3fccffa44fe2fd0a0d3807f1571e698d98515275593a295cfdd473505cb0baa4c046eaf4e5151782139f6b57131f4f337bf8cff1c1f
7
+ data.tar.gz: 4df4f6ca6f6367d4abae8565ab7b79cdcd204a2039c8926f0d5daec925956cf99960a70466c1a2659a9c1342ae77fe1b800db1925737f1920bcb33b625856b76
data/README.md CHANGED
@@ -1,4 +1,6 @@
1
- ![takelage image](https://github.com/geospin-takelage/takelage-cli/actions/workflows/test_project_nightly.yml/badge.svg)
1
+ [![takelage image](https://github.com/geospin-takelage/takelage-cli/actions/workflows/test_project_nightly.yml/badge.svg)](https://github.com/geospin-takelage/takelage-cli/actions/workflows/test_project_nightly.yml)
2
+ [![rubygems package](https://img.shields.io/gem/v/takelage?label=rubygems.org&color=blue)](https://rubygems.org/gems/takelage)
3
+ [![license](https://img.shields.io/github/license/geospin-takelage/takelage-cli?label=License&color=blueviolet)](https://github.com/geospin-takelage/takelage-cli/blob/main/LICENSE)
2
4
 
3
5
  # takelage-cli
4
6
 
@@ -23,6 +25,9 @@ The takelage devops framework consists of these projects:
23
25
  | *[takelage-var](https://github.com/geospin-takelage/takelage-var)* | takelage test plugin |
24
26
  | *[takelage-cli](https://github.com/geospin-takelage/takelage-cli)* | takelage command line interface |
25
27
  | *[takelage-bit](https://github.com/geospin-takelage/takelage-bit)* | takelage bit server |
28
+ | *[takelage-img-takelbase](https://github.com/geospin-takelage/takelage-img-takelbase)* | takelage takelbase image |
29
+ | *[takelage-img-takelslim](https://github.com/geospin-takelage/takelage-img-takelslim)* | takelage takelbase image |
30
+ | *[takelage-img-multipostgres](https://github.com/geospin-takelage/takelage-img-multipostgres)* | takelage multipostgres image |
26
31
 
27
32
  ## Installation
28
33
 
@@ -86,6 +91,11 @@ tau [info project active](features/cucumber/features/info/info.project.active.fe
86
91
  tau [info project dir](features/cucumber/features/info/info.project.dir.feature) | Print project root directory
87
92
  tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
88
93
  tau [info project private](features/cucumber/features/info/info.project.private.feature) | Print private project info
94
+ tau [info status git](features/cucumber/features/info/info.status.git.feature) | Check git status info
95
+ tau [info status gopass](features/cucumber/features/info/info.status.gopass.feature) | Check gopass status info
96
+ tau [info status gpg](features/cucumber/features/info/info.status.gpg.feature) | Check gpg status info
97
+ tau [info status header](features/cucumber/features/info/info.status.header.feature) | Print status info header
98
+ tau [info status ssh](features/cucumber/features/info/info.status.ssh.feature) | Check ssh status info
89
99
  tau [self config active](features/cucumber/features/self/self.config.active.feature) | Print active takelage configuration
90
100
  tau [self config default](features/cucumber/features/self/self.config.default.feature) | Print takelage default configuration
91
101
  tau [self config home](features/cucumber/features/self/self.config.home.feature) | Print takelage home config file configuration
@@ -102,6 +112,7 @@ tau project | Alias for tau [info project active](features/cucumber/features/inf
102
112
  tau prune | Alias for tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature)
103
113
  tau pull | Alias for tau [bit clipboard pull](features/cucumber/features/bit/bit.clipboard.pull.feature)
104
114
  tau push | Alias for tau [bit clipboard push](features/cucumber/features/bit/bit.clipboard.push.feature)
115
+ tau status | Alias for tau [docker info status header](features/cucumber/features/info/info.status.header.feature)
105
116
  tau update | Alias for tau [docker image update](features/cucumber/features/docker/docker.image.update.feature)
106
117
  tau version | Alias for tau [self version](features/cucumber/features/self/self.version.feature)
107
118
 
data/lib/takelage.rb CHANGED
@@ -71,6 +71,13 @@ require_relative 'takelage/docker/container/clean'
71
71
  require_relative 'takelage/docker/container/prune'
72
72
  require_relative 'takelage/docker/container/cli'
73
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'
74
81
  require_relative 'takelage/info/project/cli'
75
82
  require_relative 'takelage/info/cli'
76
83
  require_relative 'takelage/self/config/cli'
@@ -203,6 +210,12 @@ module Takelage
203
210
  Takelage::BitClipboard.new.push
204
211
  end
205
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
+
206
219
  desc 'update', 'Alias for tau docker image update'
207
220
  # takelage update: {takelage::DockerImage#update}
208
221
  def update
@@ -32,6 +32,6 @@ module BitCheckWorkspace
32
32
 
33
33
  stdout_str_dir = run cmd_pwd
34
34
 
35
- stdout_str_dir.strip
35
+ stdout_str_dir.chomp
36
36
  end
37
37
  end
@@ -55,7 +55,7 @@ module Takelage
55
55
  def list
56
56
  scopes = bit_scope_list
57
57
  exit false if scopes == false
58
- say scopes unless scopes.to_s.strip.empty?
58
+ say scopes unless scopes.to_s.chomp.empty?
59
59
  true
60
60
  end
61
61
 
@@ -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} --privileged --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}'
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,8 +56,16 @@ 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 . rev-parse'
59
+ cmd_git_check_workspace_git_repo: 'git -C %{dir} 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: ''
@@ -11,7 +11,7 @@ module DockerContainerCheckExisting
11
11
 
12
12
  stdout_str = run _docker_container_cmd_check_existing container
13
13
 
14
- if stdout_str.to_s.strip.empty?
14
+ if stdout_str.to_s.chomp.empty?
15
15
  log.debug "Container \"#{container}\" is not existing"
16
16
  return false
17
17
  end
@@ -11,7 +11,7 @@ module DockerContainerCheckNetwork
11
11
 
12
12
  stdout_str = run _docker_container_cmd_check_network network
13
13
 
14
- if stdout_str.to_s.strip.empty?
14
+ if stdout_str.to_s.chomp.empty?
15
15
  log.debug "Network \"#{network}\" is not existing"
16
16
  return false
17
17
  end
@@ -9,7 +9,7 @@ module DockerImageTagCheck
9
9
 
10
10
  return false unless docker_check_daemon
11
11
 
12
- if tag.to_s.strip.empty?
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.strip.empty?
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.strip.split(/ /, 2)
34
+ pid_command = process.chomp.split(/ /, 2)
35
35
  pid = pid_command[0]
36
36
  command = pid_command[1]
37
37
 
@@ -21,6 +21,6 @@ module GitCheckMain
21
21
  def _git_check_main_get_branch
22
22
  cmd_get_branch =
23
23
  config.active['cmd_git_check_main_git_branch']
24
- (run cmd_get_branch).strip.split('/')[-1]
24
+ (run cmd_get_branch).chomp.split('/')[-1]
25
25
  end
26
26
  end
@@ -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 'Check if this is a git workspace'
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,9 +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 =
23
- config.active['cmd_git_check_workspace_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
+ )
24
25
  try cmd_git_repo
25
26
  end
26
27
 
@@ -28,6 +29,6 @@ module GitCheckWorkspace
28
29
  def _git_check_workspace_get_dir
29
30
  cmd_pwd =
30
31
  config.active['cmd_git_check_workspace_pwd']
31
- (run cmd_pwd).strip
32
+ (run cmd_pwd).chomp
32
33
  end
33
34
  end
@@ -5,5 +5,8 @@ module Takelage
5
5
  class Info < SubCommandBase
6
6
  desc 'project [COMMAND]', 'Get project info'
7
7
  subcommand 'project', InfoProject
8
+
9
+ desc 'status [COMMAND]', 'Get status info'
10
+ subcommand 'status', InfoStatus
8
11
  end
9
12
  end
@@ -0,0 +1,78 @@
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 GitCheckWorkspace
11
+ include InfoStatusLib
12
+ include InfoStatusGit
13
+ include InfoStatusGopass
14
+ include InfoStatusGPG
15
+ include InfoStatusSSH
16
+ include InfoStatusHeader
17
+
18
+ #
19
+ # info status git
20
+ #
21
+ desc 'git', 'Check git status info'
22
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
23
+ Check git status info
24
+ LONGDESC
25
+ # Check git status info.
26
+ def git
27
+ exit info_status_git
28
+ end
29
+
30
+ #
31
+ # info status gopass
32
+ #
33
+ desc 'gopass', 'Check gopass status info'
34
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
35
+ Check gopass status info
36
+ LONGDESC
37
+ # Check gopass status info.
38
+ def gopass
39
+ exit info_status_gopass
40
+ end
41
+
42
+ #
43
+ # info status gpg
44
+ #
45
+ desc 'gpg', 'Check gpg status info'
46
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
47
+ Check gpg status info
48
+ LONGDESC
49
+ # Check gpg status info.
50
+ def gpg
51
+ exit info_status_gpg
52
+ end
53
+
54
+ #
55
+ # info status header
56
+ #
57
+ desc 'header', 'Print status info header'
58
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
59
+ Print status info header
60
+ LONGDESC
61
+ # Print status info header.
62
+ def header
63
+ say info_status_header
64
+ end
65
+
66
+ #
67
+ # info status ssh
68
+ #
69
+ desc 'ssh', 'Check ssh status info'
70
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
71
+ Check ssh status info
72
+ LONGDESC
73
+ # Check ssh status info.
74
+ def ssh
75
+ exit info_status_ssh
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,47 @@
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.chomp.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
+ 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?
26
+ log.error 'git config user.name is not available'
27
+ return false
28
+ end
29
+
30
+ if _info_status_lib_git_email(root).chomp.empty?
31
+ log.error 'git config user.email is not available'
32
+ return false
33
+ end
34
+
35
+ key = _info_status_lib_git_signingkey(root)
36
+
37
+ unless _info_status_lib_git_key_available(key).exitstatus.zero?
38
+ log.error 'git config user.signingkey is not available'
39
+ return false
40
+ end
41
+
42
+ log.debug 'git config is available'
43
+ true
44
+ end
45
+ # rubocop:enable Metrics/AbcSize
46
+ # rubocop:enable Metrics/MethodLength
47
+ 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
12
+
13
+ if root.chomp.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).chomp
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).chomp
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,41 @@
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_auth_sock = ENV['SSH_AUTH_SOCK']
12
+ gpg_ssh_socket = _socket_get_agent_ssh_socket_path
13
+
14
+ unless ssh_auth_sock == gpg_ssh_socket
15
+ log.error 'ssh does not use gpg ssh socket'
16
+ return false
17
+ end
18
+
19
+ unless _file_exists? gpg_ssh_socket
20
+ log.error 'gpg ssh socket is not available'
21
+ return false
22
+ end
23
+
24
+ unless _info_status_ssh_keys
25
+ log.error 'ssh keys are not available'
26
+ return false
27
+ end
28
+
29
+ log.debug 'ssh is available'
30
+ true
31
+ end
32
+ # rubocop:enable Metrics/MethodLength
33
+
34
+ private
35
+
36
+ # Check ssh keys
37
+ def _info_status_ssh_keys
38
+ status_keys = try config.active['cmd_info_status_ssh_keys']
39
+ status_keys.exitstatus.zero?
40
+ end
41
+ end
data/lib/takelage/version CHANGED
@@ -1 +1 @@
1
- 0.25.10
1
+ 0.27.0
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.25.10
4
+ version: 0.27.0
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