takeltau 0.37.1 → 0.38.2

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: 293a71b537a49394f198b0a1479285f57e43d899ccaffdcf64f18e91a95a4445
4
- data.tar.gz: 00e04f3a868ac61e81660b4e37e74a83d055c72d591ca53be88e04c48b32e488
3
+ metadata.gz: 3cdad12eeefa3b06fdce78f798f07ddae95be2cd83e14e8bfc9159df38480a3e
4
+ data.tar.gz: 4f4be3e7401333306784e7f343cfd049633a3998d08871ceabd137af582f7243
5
5
  SHA512:
6
- metadata.gz: 4f259593b1df8171bcd2400ba152a55c430b3c535e8c8f5abe6cbc3e66c4484947e32472d0ff612e848f0429ee96424306329f0a7abc063f116c9610396fb628
7
- data.tar.gz: b71b36fcba29683483fa39e35e46293dac09c61c6b1603977605ab0eacf16eefe12867058160544ac21774b05a0f34b95c24baf7b915c18530a60cebb3fe3dcc
6
+ metadata.gz: 858ce1e3ace8d154329c0be1420a939116fc38cd8e56a9f73e431dac27bd43338a42db045bf32aed92d306d62a32328cd1fa6eae6f49c7cb5c192fa77b30cc29
7
+ data.tar.gz: fcd3ad170d599873e11803450f26b3065a593b1826cbc8b156caeee1e8659fc98523ca4668edec0cfd743a961d35586c374ddb13182fb95d7dd74faab8837042
data/README.md CHANGED
@@ -95,24 +95,26 @@ tau [info status bar](features/cucumber/features/info/info.status.bar.feature) |
95
95
  tau [info status git](features/cucumber/features/info/info.status.git.feature) | Check git status
96
96
  tau [info status gopass](features/cucumber/features/info/info.status.gopass.feature) | Check gopass status
97
97
  tau [info status gpg](features/cucumber/features/info/info.status.gpg.feature) | Check gpg status
98
+ tau [info status hg](features/cucumber/features/info/info.status.hg.feature) | Check hg status
98
99
  tau [info status mutagen](features/cucumber/features/info/info.status.mutagen.feature) | Check mutagen status
99
100
  tau [info status ssh](features/cucumber/features/info/info.status.ssh.feature) | Check ssh status
100
- tau [init packer docker](features/cucumber/features/info/init.packer.docker.feature) | Initialize packer project for docker images
101
+ tau [init packer docker](features/cucumber/features/init/init.packer.docker.feature) | Initialize packer project for docker images
102
+ tau [init takelage rake](features/cucumber/features/init/init.takelage.rake.feature) | Initialize takelage rake project
101
103
  tau [mutagen check daemon](features/cucumber/features/mutagen/mutagen.check.daemon.feature)) | Check if mutagen host conenction is available
102
104
  tau [mutagen socket check](features/cucumber/features/mutagen/mutagen.socket.check.feature) [SOCKET] | Check if mutagen [SOCKET] exists
103
105
  tau [mutagen socket create](features/cucumber/features/mutagen/mutagen.socket.create.feature) [NAME] [IN] [OUT] | Create a mutagen socket [NAME] from [IN] to [OUT] of the container
104
106
  tau [mutagen socket list](features/cucumber/features/mutagen/mutagen.socket.list.feature) | List mutagen sockets
105
- tau [mutagen socket tidy](features/cucumber/features/mutagen/mutagen.socket.tidy.feature) | Remove mutagen daemon files
106
107
  tau [mutagen socket terminate](features/cucumber/features/mutagen/mutagen.socket.terminate.feature) [SOCKET] | Terminate a mutagen [SOCKET]
108
+ tau [mutagen socket tidy](features/cucumber/features/mutagen/mutagen.socket.tidy.feature) | Remove mutagen daemon files
109
+ tau [self commands](features/cucumber/features/self/self.commands.feature) | List all commands
107
110
  tau [self config active](features/cucumber/features/self/self.config.active.feature) | Print active takelage configuration
108
111
  tau [self config default](features/cucumber/features/self/self.config.default.feature) | Print takelage default configuration
109
112
  tau [self config home](features/cucumber/features/self/self.config.home.feature) | Print takelage home config file configuration
110
113
  tau [self config project](features/cucumber/features/self/self.config.project.feature) | Print takelage project config file configuration
111
- tau [self commands](features/cucumber/features/self/self.commands.feature) | List all commands
112
114
  tau [self version](features/cucumber/features/self/self.version.feature) | Print tau semantic version number
113
115
  tau clean | Alias for tau [docker container clean](features/cucumber/features/docker/docker.container.clean.feature)
114
- tau config | Alias for tau [self config active](features/cucumber/features/self/self.config.active.feature)
115
116
  tau commands | Alias for tau [self commands](features/cucumber/features/self/self.commands.feature)
117
+ tau config | Alias for tau [self config active](features/cucumber/features/self/self.config.active.feature)
116
118
  tau login | Alias for tau [docker container login](features/cucumber/features/docker/docker.container.login.feature)
117
119
  tau project | Alias for tau [info project active](features/cucumber/features/info/info.project.active.feature)
118
120
  tau prune | Alias for tau [docker container prune](features/cucumber/features/docker/docker.container.prune.feature)
@@ -37,6 +37,7 @@ cmd_info_status_lib_git_key_available: 'gpg --list-key %{key}'
37
37
  cmd_info_status_gopass_root_store: 'gopass config | grep "path" | cut -d " " -f 2'
38
38
  cmd_info_status_gpg_agent: 'gpg-connect-agent /bye'
39
39
  cmd_info_status_gpg_keys: 'gpg --list-keys'
40
+ cmd_info_status_hg_username: 'hg config ui.username'
40
41
  cmd_info_status_ssh_keys: 'ssh-add -l'
41
42
  cmd_info_status_ssh_socket: 'gpgconf --list-dirs agent-ssh-socket'
42
43
  cmd_init_lib_git_init: 'git init && git checkout -b main'
@@ -64,7 +65,10 @@ git_hg_branch: 'main'
64
65
  info_project_main: 'project.yml'
65
66
  info_project_private: 'private/project.yml'
66
67
  login_wait_for_sockets: '0'
67
- mutagen_socket_path_mutagen: '~/.mutagen/daemon/daemon.sock'
68
- mutagen_socket_path_gpg: '~/.gnupg/S.gpg-agent'
69
- mutagen_socket_path_ssh: '~/.gnupg/S.gpg-agent.ssh'
68
+ mutagen_socket_path_mutagen_container: '~/.mutagen/daemon/daemon.sock'
69
+ mutagen_socket_path_mutagen_host: '~/.mutagen/daemon/daemon.sock'
70
+ mutagen_socket_path_gpg_container: '~/.gnupg/S.gpg-agent'
71
+ mutagen_socket_path_gpg_host: '~/.gnupg/S.gpg-agent'
72
+ mutagen_socket_path_ssh_container: '~/.gnupg/S.gpg-agent.ssh'
73
+ mutagen_socket_path_ssh_host: '~/.gnupg/S.gpg-agent.ssh'
70
74
  mutagen_socket_takelage_label: 'type=takelage'
@@ -40,9 +40,12 @@ module Takeltau
40
40
  @hostname = _docker_container_lib_hostname
41
41
  @hostlabel = "hostname=#{@hostname}"
42
42
  @takellabel = config.active['mutagen_socket_takelage_label']
43
- @mutagensock = config.active['mutagen_socket_path_mutagen']
44
- @gpgsock = config.active['mutagen_socket_path_gpg']
45
- @sshsock = config.active['mutagen_socket_path_ssh']
43
+ @mutagensock_container = config.active['mutagen_socket_path_mutagen_container']
44
+ @mutagensock_host = config.active['mutagen_socket_path_mutagen_host']
45
+ @gpgsock_container = config.active['mutagen_socket_path_gpg_container']
46
+ @gpgsock_host = config.active['mutagen_socket_path_gpg_host']
47
+ @sshsock_container = config.active['mutagen_socket_path_ssh_container']
48
+ @sshsock_host = config.active['mutagen_socket_path_ssh_host']
46
49
  end
47
50
  # rubocop:enable Metrics/MethodLength
48
51
  # rubocop:enable Metrics/AbcSize
@@ -10,9 +10,9 @@ module DockerContainerLib
10
10
  def _docker_container_lib_start_sockets
11
11
  return false unless mutagen_check_daemon
12
12
 
13
- mutagen_socket_create 'mutagen', @mutagensock, @mutagensock
14
- mutagen_socket_create 'gpg', @gpgsock, @gpgsock
15
- mutagen_socket_create 'ssh', @sshsock, @sshsock
13
+ mutagen_socket_create 'mutagen', @mutagensock_container, @mutagensock_host
14
+ mutagen_socket_create 'gpg', @gpgsock_container, @gpgsock_host
15
+ mutagen_socket_create 'ssh', @sshsock_container, @sshsock_host
16
16
  end
17
17
 
18
18
  # Create unique docker hostname
@@ -9,18 +9,19 @@ module InfoStatusBar
9
9
  log.debug 'Get status info bar'
10
10
 
11
11
  @bar_list = []
12
+ @bar_status = true
12
13
 
13
14
  _info_status_bar_takelage
14
15
  _info_status_bar_tau
15
16
  _info_status_bar_git
16
17
  _info_status_bar_gopass
17
18
  _info_status_bar_gpg
19
+ _info_status_bar_hg
18
20
  _info_status_bar_mutagen
19
21
  _info_status_bar_ssh
20
22
 
21
- bar = @bar_list.join(' | ')
22
- log.debug "status info bar: #{bar}"
23
- bar
23
+ say @bar_list.join(' | ')
24
+ @bar_status
24
25
  end
25
26
  # rubocop:enable Metrics/MethodLength
26
27
 
@@ -29,7 +30,10 @@ module InfoStatusBar
29
30
  # Add takelage version info to bar.
30
31
  def _info_status_bar_takelage
31
32
  takelage_version_file = '/etc/takelage_version'
32
- return unless _file_exists? takelage_version_file
33
+ unless _file_exists? takelage_version_file
34
+ @bar_status = false
35
+ return false
36
+ end
33
37
 
34
38
  _file_read takelage_version_file
35
39
  @bar_list << "#{config.active['docker_repo']}: #{@content_file.chomp.green}"
@@ -43,12 +47,14 @@ module InfoStatusBar
43
47
  # Add git status info to bar.
44
48
  def _info_status_bar_git
45
49
  @status_git = info_status_git
50
+ @bar_status &&= @status_git
46
51
  @bar_list << ("git: #{@status_git ? 'ok'.green : 'no'.red}")
47
52
  end
48
53
 
49
54
  # Add gopass status info to bar.
50
55
  def _info_status_bar_gopass
51
56
  @status_gopass = info_status_gopass
57
+ @bar_status &&= @status_gopass
52
58
  @bar_list << ("gopass: #{@status_gopass ? 'ok'.green : 'no'.red}")
53
59
  end
54
60
 
@@ -59,17 +65,30 @@ module InfoStatusBar
59
65
  return
60
66
  end
61
67
 
62
- @bar_list << ("gpg: #{info_status_gpg ? 'ok'.green : 'no'.red}")
68
+ status_gpg = info_status_gpg
69
+ @bar_status &&= status_gpg
70
+ @bar_list << ("gpg: #{status_gpg ? 'ok'.green : 'no'.red}")
71
+ end
72
+
73
+ # Add git status info to bar.
74
+ def _info_status_bar_hg
75
+ @status_hg = info_status_hg
76
+ @bar_status &&= @status_hg
77
+ @bar_list << ("hg: #{@status_hg ? 'ok'.green : 'no'.red}")
63
78
  end
64
79
 
65
80
  # Add mutagen status info to bar.
66
81
  def _info_status_bar_mutagen
67
- @bar_list << ("mutagen: #{mutagen_check_daemon ? 'ok'.green : 'no'.red}")
82
+ status_mutagen = mutagen_check_daemon
83
+ @bar_status &&= status_mutagen
84
+ @bar_list << ("mutagen: #{status_mutagen ? 'ok'.green : 'no'.red}")
68
85
  end
69
86
 
70
87
  # Add ssh status info to bar.
71
88
  def _info_status_bar_ssh
72
- @bar_list << ("ssh: #{info_status_ssh ? 'ok'.green : 'no'.red}")
89
+ status_ssh = info_status_ssh
90
+ @bar_status &&= status_ssh
91
+ @bar_list << ("ssh: #{status_ssh ? 'ok'.green : 'no'.red}")
73
92
  end
74
93
  end
75
94
 
@@ -16,6 +16,7 @@ module Takeltau
16
16
  include InfoStatusGit
17
17
  include InfoStatusGopass
18
18
  include InfoStatusGPG
19
+ include InfoStatusHg
19
20
  include InfoStatusSSH
20
21
  include InfoStatusBar
21
22
  include MutagenCheckDaemon
@@ -41,7 +42,7 @@ module Takeltau
41
42
  LONGDESC
42
43
  # Print status info bar.
43
44
  def bar
44
- say info_status_bar
45
+ exit info_status_bar
45
46
  end
46
47
 
47
48
  #
@@ -80,6 +81,18 @@ module Takeltau
80
81
  exit info_status_gpg
81
82
  end
82
83
 
84
+ #
85
+ # info status hg
86
+ #
87
+ desc 'hg', 'Check hg status info'
88
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
89
+ Check hg status info
90
+ LONGDESC
91
+ # Check hg status info.
92
+ def hg
93
+ exit info_status_hg
94
+ end
95
+
83
96
  #
84
97
  # info status mutagen
85
98
  #
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # tau info status hg
4
+ module InfoStatusHg
5
+ # Backend method for info status hg.
6
+ # @return [Boolean] has mercurial been configured?
7
+ def info_status_hg
8
+ log.debug 'Check hg status'
9
+
10
+ unless _info_status_hg_username
11
+ log.error 'hg ui.username is not configured'
12
+ return false
13
+ end
14
+
15
+ log.debug 'hg config is available'
16
+ true
17
+ end
18
+
19
+ private
20
+
21
+ # Check hg username
22
+ def _info_status_hg_username
23
+ status_username = try config.active['cmd_info_status_hg_username']
24
+ status_username.exitstatus.zero?
25
+ end
26
+ end
@@ -5,14 +5,13 @@ module MutagenCheckDaemon
5
5
  # Backend method for mutagen check daemon.
6
6
  # @return [Boolean] is mutagen available?
7
7
  # rubocop:disable Metrics/MethodLength
8
- # rubocop:disable Metrics/AbcSize
9
8
  def mutagen_check_daemon
10
9
  return true if @mutagen_daemon_available
11
10
 
12
- return false unless command_available_else_warn? config.active['cmd_mutagen']
13
-
14
11
  log.debug 'Check mutagen status'
15
12
 
13
+ return false unless _mutagen_check_check_prerequisites
14
+
16
15
  # are we outside of a takelage container?
17
16
  unless _docker_container_lib_check_matrjoschka
18
17
  unless _mutagen_check_daemon_version
@@ -25,11 +24,6 @@ module MutagenCheckDaemon
25
24
  return true
26
25
  end
27
26
 
28
- unless _file_exists? config.active['mutagen_socket_path_mutagen']
29
- log.error 'The mutagen socket is not available'
30
- return false
31
- end
32
-
33
27
  unless _mutagen_check_daemon_host_connection
34
28
  log.error 'A mutagen host connection is not available'
35
29
  return false
@@ -39,11 +33,25 @@ module MutagenCheckDaemon
39
33
  @mutagen_daemon_available = true
40
34
  true
41
35
  end
42
- # rubocop:enable Metrics/AbcSize
43
36
  # rubocop:enable Metrics/MethodLength
44
37
 
45
38
  private
46
39
 
40
+ # Check mutagen prerequisites
41
+ def _mutagen_check_check_prerequisites
42
+ unless _file_exists? config.active['mutagen_socket_path_mutagen_container']
43
+ log.error 'The mutagen socket path in the container is not available'
44
+ return false
45
+ end
46
+
47
+ unless _file_exists? config.active['mutagen_socket_path_mutagen_host']
48
+ log.error 'The mutagen socket path on the host is not available'
49
+ return false
50
+ end
51
+
52
+ command_available_else_error? config.active['cmd_mutagen']
53
+ end
54
+
47
55
  # Check mutagen host connection
48
56
  # rubocop:disable Metrics/MethodLength
49
57
  def _mutagen_check_daemon_host_connection
@@ -27,7 +27,7 @@ module SelfCommands
27
27
  # Manipulate output of thor list command.
28
28
  def _manipulate_output_(thor_list)
29
29
  tau_commands = thor_list.gsub("takeltau\n", '')
30
- tau_commands.gsub!("------\n", '')
30
+ tau_commands.gsub!("--------\n", '')
31
31
  tau_commands.gsub!('thor ', 'tau ')
32
32
  tau_commands.gsub!(/(.*)takeltau:c_l_i:(.*)#(.*)/, '\1\2 #\3')
33
33
  tau_commands.gsub!(/.*COMMAND.*\n/, '')
data/lib/takeltau/version CHANGED
@@ -1 +1 @@
1
- 0.37.1
1
+ 0.38.2
data/lib/takeltau.rb CHANGED
@@ -70,6 +70,7 @@ require_relative 'takeltau/info/status/lib'
70
70
  require_relative 'takeltau/info/status/git'
71
71
  require_relative 'takeltau/info/status/gopass'
72
72
  require_relative 'takeltau/info/status/gpg'
73
+ require_relative 'takeltau/info/status/hg'
73
74
  require_relative 'takeltau/info/status/ssh'
74
75
  require_relative 'takeltau/info/status/bar'
75
76
  require_relative 'takeltau/info/status/cli'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takeltau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.37.1
4
+ version: 0.38.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk
@@ -244,6 +244,7 @@ files:
244
244
  - lib/takeltau/info/status/git.rb
245
245
  - lib/takeltau/info/status/gopass.rb
246
246
  - lib/takeltau/info/status/gpg.rb
247
+ - lib/takeltau/info/status/hg.rb
247
248
  - lib/takeltau/info/status/lib.rb
248
249
  - lib/takeltau/info/status/ssh.rb
249
250
  - lib/takeltau/init/cli.rb