takeltau 0.36.3 → 0.37.3

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: b2465bad2b7f3f05a0989db146bcd4aeebccb1157c03ccd54a34e2dc6653ad46
4
- data.tar.gz: 5a5a34f4ca5c59e66ef99e6814aea3c07f8f591f9511ee24484473462fe9083c
3
+ metadata.gz: 6e297c80af53f6afcb49ac3728e6c5833a53fdbaf745d1df9f2cc024da99a87e
4
+ data.tar.gz: 29593c7d300c8f960292a9527a778421a41a3b7bea203da4ec6acc25eac7113a
5
5
  SHA512:
6
- metadata.gz: a2ce4ee0a6cbf779b3f0066f46e4ad4a9ec500b704661b9e93b3b27c230246a129552d9dedbafa1ee858bc9482ec13d03b499b915914593799fbd3616cd10f91
7
- data.tar.gz: d1bc6aa9527413db818055b1f6aecc0654352a41fbca79d1c461329b71d2d5ea1d6d2427b0795b268da856c1eab217e3aefdef71b32f9129e68db5f8e708ff78
6
+ metadata.gz: 54d2ce13da764a2d7fa40c344ef139605eafc5e1d6559fdaeb7dea38ff9702b7f57fa99a7c520469dac89f55800aaf2c284fc014f0735ff920dde3397a639867
7
+ data.tar.gz: 0f4d384cfaba7ccb214cfb6a0e780f662703706e706898858a6663257f9d1af3d26cab3daf24b172d583b89936d32b8f44b0d33ff3aed86b81705e6663673d9b
data/README.md CHANGED
@@ -168,7 +168,21 @@ to overwrite defaults like:
168
168
  docker_repo: takelage-mock
169
169
  ```
170
170
 
171
- Furthermore, every external command can be reconfigured.
171
+ - You may prefer to interact with
172
+ [mercurial](https://github.com/takelwerk/takelage-doc/blob/main/doc/tau/hg.md)
173
+ through `tau hg`
174
+ in a different branch than `main` in one project so you may add
175
+ to your *takelage.yml*:
176
+
177
+
178
+ ```yaml
179
+ ---
180
+ git_hg_repo: my_git_hg_branch
181
+ ```
182
+
183
+ Furthermore,
184
+ [every external command](https://github.com/takelwerk/takelage-cli/blob/main/lib/takeltau/default.yml)
185
+ can be reconfigured.
172
186
 
173
187
  ### Project Files
174
188
 
@@ -23,14 +23,13 @@ cmd_git_check_clean_git_status: 'git status --porcelain'
23
23
  cmd_git_check_hg_get_git_branch: 'git symbolic-ref HEAD'
24
24
  cmd_git_check_workspace_git_repo: 'git -C %{dir} rev-parse'
25
25
  cmd_git_check_workspace_pwd: 'pwd'
26
- cmd_git_lib_git_add_all: 'git add --all'
27
26
  cmd_git_lib_git_add_hg_dirs: 'git add \*/.hg/\*'
28
27
  cmd_git_lib_git_commit: 'git commit --message="%{message}"'
29
28
  cmd_git_lib_git_pull_origin: 'git pull origin %{main}'
30
29
  cmd_git_lib_git_push_origin: 'git push origin %{main}'
31
- cmd_hg_list_repos: 'cd %{root}; find * -type d -name ".hg" | parallel -k hg paths default -R {//} -T "hg\ clone\ {url}\ " \; echo {//}'
32
- cmd_hg_pull_repos: 'cd %{root}; find * -type d -name ".hg" | parallel -k echo \; cd {//} \; pwd \; hg pull --update'
33
- cmd_hg_push_repos: 'cd %{root}; find * -type d -name ".hg" | parallel -k echo \; cd {//} \; pwd \; hg commit --addremove --message "Update\ hg\ repos" \; hg bookmark -f main \; hg push'
30
+ cmd_hg_list_repos: 'cd %{root}; find * -type d -name ".hg" | parallel --keep-order hg paths default --repository {//} --template "hg\ clone\ {url}\ " \; echo {//}'
31
+ cmd_hg_pull_repos: 'cd %{root}; find * -type d -name ".hg" | parallel --keep-order echo \; cd {//} \; pwd \; hg pull --update'
32
+ cmd_hg_push_repos: 'cd %{root}; find * -type d -name ".hg" | parallel --keep-order echo \; cd {//} \; pwd \; hg commit --addremove --message "Update\ hg\ repos" \; hg bookmarks --force main \; hg push'
34
33
  cmd_info_status_lib_git_name: 'git -C %{root} config user.name'
35
34
  cmd_info_status_lib_git_email: 'git -C %{root} config user.email'
36
35
  cmd_info_status_lib_git_signingkey: 'git -C %{root} config user.signingKey'
@@ -65,7 +64,10 @@ git_hg_branch: 'main'
65
64
  info_project_main: 'project.yml'
66
65
  info_project_private: 'private/project.yml'
67
66
  login_wait_for_sockets: '0'
68
- mutagen_socket_path_mutagen: '~/.mutagen/daemon/daemon.sock'
69
- mutagen_socket_path_gpg: '~/.gnupg/S.gpg-agent'
70
- mutagen_socket_path_ssh: '~/.gnupg/S.gpg-agent.ssh'
67
+ mutagen_socket_path_mutagen_container: '~/.mutagen/daemon/daemon.sock'
68
+ mutagen_socket_path_mutagen_host: '~/.mutagen/daemon/daemon.sock'
69
+ mutagen_socket_path_gpg_container: '~/.gnupg/S.gpg-agent'
70
+ mutagen_socket_path_gpg_host: '~/.gnupg/S.gpg-agent'
71
+ mutagen_socket_path_ssh_container: '~/.gnupg/S.gpg-agent.ssh'
72
+ mutagen_socket_path_ssh_host: '~/.gnupg/S.gpg-agent.ssh'
71
73
  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
@@ -2,57 +2,54 @@
2
2
 
3
3
  # tau git lib
4
4
  module GitLib
5
- # Pull git workspace.
6
- def git_lib_pull_workspace
7
- log.info 'Pulling git workspace'
5
+ # Prepare git workspace.
6
+ # rubocop:disable Metrics/MethodLength
7
+ def git_lib_prepare_git_workspace
8
+ log.debug 'Prepare git workspace'
8
9
 
9
- _git_lib_git_pull_origin_hg
10
- end
10
+ return false unless configured? %w[project_root_dir]
11
11
 
12
- # Push git workspace.
13
- def git_lib_push_workspace(message)
14
- log.info 'Pushing git workspace'
12
+ unless git_check_hg
13
+ log.error 'Not on git hg branch'
14
+ return false
15
+ end
15
16
 
16
- return false unless _git_lib_git_add_all
17
- return false unless _git_lib_git_commit message
18
- return false unless _git_lib_git_pull_origin_hg
17
+ unless git_check_clean
18
+ log.error 'No clean git workspace'
19
+ return false
20
+ end
19
21
 
20
- _git_lib_git_push_origin_hg
22
+ return true if _git_lib_git_pull_origin_hg
23
+
24
+ log.error 'Unable to pull git workspace'
25
+ false
21
26
  end
27
+ # rubocop:enable Metrics/MethodLength
22
28
 
23
29
  # Push git workspace.
24
30
  def git_lib_push_hg_dirs
25
31
  log.info 'Pushing git workspace'
26
32
 
27
- message = '"Update .hg mercurial directories'
33
+ message = 'Update .hg mercurial directories'
28
34
 
29
35
  return false unless _git_lib_git_add_hg_dirs
30
36
  return false unless _git_lib_git_commit message
31
37
 
32
- _git_lib_git_push_origin_hg
33
- end
34
-
35
- private
36
-
37
- # git add all.
38
- def _git_lib_git_add_all
39
- log.debug 'Adding all files to git'
40
-
41
- cmd_git_add_all = config.active['cmd_git_lib_git_add_all']
38
+ return true if _git_lib_git_push_origin_hg
42
39
 
43
- return true if try cmd_git_add_all
44
-
45
- log.error 'Unable to add all files to git'
40
+ log.error 'Unable to git push .hg mercurial directories'
46
41
  false
47
42
  end
48
43
 
44
+ private
45
+
49
46
  # git add hg dirs.
50
47
  def _git_lib_git_add_hg_dirs
51
48
  log.debug 'Adding all .hg mercurial dirs to git'
52
49
 
53
50
  cmd_git_add_hg_dirs = config.active['cmd_git_lib_git_add_hg_dirs']
54
51
 
55
- return true if try cmd_git_add_hg_dirs
52
+ return true if (try cmd_git_add_hg_dirs).exitstatus.zero?
56
53
 
57
54
  log.error 'Unable to add all .hg mercurial dirs to git'
58
55
  false
@@ -67,7 +64,7 @@ module GitLib
67
64
  message: message
68
65
  )
69
66
 
70
- return true if try cmd_git_commit
67
+ return true if (try cmd_git_commit).exitstatus.zero?
71
68
 
72
69
  log.error 'Unable to commit to git'
73
70
  false
@@ -3,37 +3,18 @@
3
3
  # tau hg pull
4
4
  module HgPull
5
5
  # Backend method for hg pull.
6
- # rubocop:disable Metrics/AbcSize
7
- # rubocop:disable Metrics/MethodLength
8
6
  def hg_pull
9
7
  log.debug 'Pull hg repos'
10
8
 
11
- return false unless configured? %w[project_root_dir]
9
+ return false unless git_lib_prepare_git_workspace
12
10
 
13
- unless git_check_hg
14
- log.error 'Not on git hg branch'
11
+ unless _hg_pull_hg_pull_repos
12
+ log.error 'Unable to tau hg pull'
15
13
  return false
16
14
  end
17
15
 
18
- unless git_check_clean
19
- log.error 'No clean git workspace'
20
- return false
21
- end
22
-
23
- unless git_lib_pull_workspace
24
- log.error 'Unable to pull git workspace'
25
- return false
26
- end
27
-
28
- log.info _hg_pull_hg_pull_repos
29
-
30
- return true if git_lib_push_hg_dirs
31
-
32
- log.error 'Unable to push .hg mercurial directories'
33
- false
16
+ git_lib_push_hg_dirs
34
17
  end
35
- # rubocop:enable Metrics/MethodLength
36
- # rubocop:enable Metrics/AbcSize
37
18
 
38
19
  private
39
20
 
@@ -44,6 +25,8 @@ module HgPull
44
25
  root: config.active['project_root_dir']
45
26
  )
46
27
 
47
- run cmd_hg_pull_repos
28
+ stdout, _, exitstatus = run_and_capture cmd_hg_pull_repos
29
+ log.info stdout
30
+ exitstatus.zero?
48
31
  end
49
32
  end
@@ -3,30 +3,18 @@
3
3
  # tau hg push
4
4
  module HgPush
5
5
  # Backend method for hg push.
6
- # rubocop:disable Metrics/MethodLength
7
6
  def hg_push
8
7
  log.debug 'Push hg repos'
9
8
 
10
- return false unless configured? %w[project_root_dir]
9
+ return false unless git_lib_prepare_git_workspace
11
10
 
12
- unless git_check_hg
13
- log.error 'Not on git hg branch'
11
+ unless _hg_push_hg_push_repos
12
+ log.error 'Unable to tau hg push'
14
13
  return false
15
14
  end
16
15
 
17
- unless git_check_clean
18
- log.error 'No clean git workspace'
19
- return false
20
- end
21
-
22
- log.info _hg_push_hg_push_repos
23
-
24
- return true if git_lib_push_workspace 'tau hg push'
25
-
26
- log.error 'Unable to push git workspace'
27
- false
16
+ git_lib_push_hg_dirs
28
17
  end
29
- # rubocop:enable Metrics/MethodLength
30
18
 
31
19
  private
32
20
 
@@ -37,6 +25,8 @@ module HgPush
37
25
  root: config.active['project_root_dir']
38
26
  )
39
27
 
40
- run cmd_hg_push_repos
28
+ stdout, _, exitstatus = run_and_capture cmd_hg_push_repos
29
+ log.info stdout
30
+ exitstatus.zero?
41
31
  end
42
32
  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
data/lib/takeltau/version CHANGED
@@ -1 +1 @@
1
- 0.36.3
1
+ 0.37.3
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.36.3
4
+ version: 0.37.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk