Module: InfoStatusGit

Included in:
Takelage::InfoStatus
Defined in:
lib/takelage/info/status/git.rb

Overview

takelage info status git

Instance Method Summary collapse

Instance Method Details

#info_status_gitBoolean

Backend method for info status git. rubocop:disable Metrics/MethodLength rubocop:disable Metrics/AbcSize

Returns:

  • (Boolean)

    is the git gpg signing key available?



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/takelage/info/status/git.rb', line 9

def info_status_git
  log.debug 'Check git status'

  root = config.active['project_root_dir']

  if root.chomp.empty?
    log.error 'Cannot determine project root directory'
    log.warn 'Is there a Rakefile in the project root directory?'
    return false
  end

  unless git_check_workspace(root)
    log.error 'Project root directory is not a git workspace'
    return false
  end

  if _info_status_lib_git_name(root).chomp.empty?
    log.error 'git config user.name is not available'
    return false
  end

  if _info_status_lib_git_email(root).chomp.empty?
    log.error 'git config user.email is not available'
    return false
  end

  key = _info_status_lib_git_signingkey(root)

  unless _info_status_lib_git_key_available(key).exitstatus.zero?
    log.error 'git config user.signingkey is not available'
    return false
  end

  log.debug 'git config is available'
  true
end