takelage 0.26.4 → 0.26.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8bf925e231daeab5d3930c78e761cafef36cf9ae428938df47d32459f0d4b001
4
- data.tar.gz: 3485b85dfdeba7f4da4a67426c2a7ad61a14f9b81118e1305d163880757f5436
3
+ metadata.gz: c85358aee84b4ad7e8e67c54f106705fa7a81738b800e060472ec27989ea8a33
4
+ data.tar.gz: 1712ed57e584a5a9c6eb3cb30583f9c908abbd9a42a462aa770720a91b0be819
5
5
  SHA512:
6
- metadata.gz: 3b6804918d7e81e8d93412b162168bc0617e6bf89443aa86476bfbcf152b33a292f4bf9388848a4390bf5968049d092ca01608048c1b0020e2d270905c20a7d5
7
- data.tar.gz: aafc982404aceecd7f241991dbcb67194ddacda3d088849acfa0f56f7604d03b20c0a07360f5f3581d3d702f1ea4b1de0ece0afef95f3e39d3d4839f60e57852
6
+ metadata.gz: 1724194bc930b8d23c5e5e6395dbc493dde90440752bb3ea0a39539bd705876943b82d12524d8f23b9f682e56a3c0b7b18948d4d8efb6d827b8ec361148c9572
7
+ data.tar.gz: 617b075ad7581e80d3f3ec30c704d24333658d7daa94b893943f98315aeabfbef207cdbe02abf8ea3b0b281a65b4baa03ad89b29036d59e86873bbbd047a5a3b
@@ -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
 
@@ -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 . rev-parse'
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'
@@ -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,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 = 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
+ )
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).strip
32
+ (run cmd_pwd).chomp
31
33
  end
32
34
  end
@@ -7,6 +7,7 @@ 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
@@ -11,18 +11,23 @@ module InfoStatusGit
11
11
 
12
12
  root = config.active['project_root_dir']
13
13
 
14
- if root.strip.empty?
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
- if _info_status_lib_git_name(root).strip.empty?
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).strip.empty?
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.chomp
11
+ root = _info_status_gopass_root_store
12
12
 
13
- if root.strip.empty?
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
@@ -31,7 +31,7 @@ module InfoStatusLib
31
31
  config.active['cmd_info_status_lib_git_signingkey'],
32
32
  root: root
33
33
  )
34
- run cmd_git_signingkey
34
+ (run cmd_git_signingkey).chomp
35
35
  end
36
36
 
37
37
  # Check if git key is available
@@ -8,7 +8,15 @@ module InfoStatusSSH
8
8
  def info_status_ssh
9
9
  log.debug 'Check ssh status'
10
10
 
11
- unless _file_exists? _socket_get_agent_ssh_socket_path
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
12
20
  log.error 'gpg ssh socket is not available'
13
21
  return false
14
22
  end
data/lib/takelage/version CHANGED
@@ -1 +1 @@
1
- 0.26.4
1
+ 0.26.7
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.26.4
4
+ version: 0.26.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geospin