takelage 0.29.13 → 0.30.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/lib/takelage.rb +2 -2
- data/lib/takelage/bit/clipboard/cli.rb +1 -1
- data/lib/takelage/bit/clipboard/lib.rb +3 -3
- data/lib/takelage/bit/require/cli.rb +1 -1
- data/lib/takelage/bit/scope/add.rb +1 -1
- data/lib/takelage/bit/scope/cli.rb +6 -6
- data/lib/takelage/bit/scope/{inbit.rb → ssh.rb} +4 -4
- data/lib/takelage/default.yml +3 -4
- data/lib/takelage/docker/check/daemon.rb +1 -1
- data/lib/takelage/git/check/bit.rb +26 -0
- data/lib/takelage/git/check/cli.rb +13 -13
- data/lib/takelage/lib/system.rb +31 -10
- data/lib/takelage/mutagen/check/daemon.rb +1 -1
- data/lib/takelage/mutagen/socket/cli.rb +0 -1
- data/lib/takelage/mutagen/socket/create.rb +1 -2
- data/lib/takelage/version +1 -1
- metadata +4 -4
- data/lib/takelage/git/check/main.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b2e660e0895362a9d5839d3e28fbc90f4ce1d392ea38e91968616b81cdc93f
|
4
|
+
data.tar.gz: 6a776fe75895b398059e185fdf016fc04eda3a5b46210e4281ab7167bc402ac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30c6f389bc91b999c3545c94cc66f2b8bf6ad4a0701df042a2ab721656382c50b96252cfae756de9322d87f9462dcc2c0bd521bc2814304f6752a809fa31149d
|
7
|
+
data.tar.gz: 2769181f6787f7d8d264dae325f03d3eb3a34e7958571d633ac17078bfd5db391e1eae00bd45673c5006c405c0ed658d36d6bf0952353654212adb7c5f6dfd70
|
data/README.md
CHANGED
@@ -26,7 +26,6 @@ command line script using the
|
|
26
26
|
| *[takelage-bit](https://github.com/geospin-takelage/takelage-bit)* | [![hub.docker.com](https://img.shields.io/docker/v/takelage/bitboard/latest?label=hub.docker.com&sort=semver&color=blue)](https://hub.docker.com/r/takelage/bitboard) |
|
27
27
|
| *[takelage-img-takelslim](https://github.com/geospin-takelage/takelage-img-takelslim)* | [![hub.docker.com](https://img.shields.io/docker/v/takelage/takelslim/latest?label=hub.docker.com&color=blue)](https://hub.docker.com/r/takelage/takelslim) |
|
28
28
|
| *[takelage-img-takelbase](https://github.com/geospin-takelage/takelage-img-takelbase)* | [![hub.docker.com](https://img.shields.io/docker/v/takelage/takelbase/latest?label=hub.docker.com&color=blue)](https://hub.docker.com/r/takelage/takelbase) |
|
29
|
-
| *[takelage-img-multipostgres](https://github.com/geospin-takelage/takelage-img-multipostgres)* | [![hub.docker.com](https://img.shields.io/docker/v/takelage/multipostgres/latest?label=hub.docker.com&color=blue)](https://hub.docker.com/r/takelage/multipostgres) |
|
30
29
|
|
31
30
|
## Framework Status
|
32
31
|
|
@@ -38,7 +37,6 @@ command line script using the
|
|
38
37
|
| *[takelage-bit](https://github.com/geospin-takelage/takelage-bit)* | [![deploy project](https://img.shields.io/github/workflow/status/geospin-takelage/takelage-bit/Build,%20test%20and%20deploy%20project?label=deploy%20project)](https://github.com/geospin-takelage/takelage-bit/actions/workflows/build_test_deploy_project_on_push.yml) | [![test project](https://img.shields.io/github/workflow/status/geospin-takelage/takelage-bit/Build%20and%20test%20project?label=test%20project)](https://github.com/geospin-takelage/takelage-bit/actions/workflows/build_test_project_nightly.yml) | [![test roles](https://img.shields.io/github/workflow/status/geospin-takelage/takelage-bit/Test%20roles?label=test%20roles)](https://github.com/geospin-takelage/takelage-bit/actions/workflows/build_test_roles_nightly.yml) |
|
39
38
|
| *[takelage-img-takelslim](https://github.com/geospin-takelage/takelage-img-takelslim)* | [![deploy project](https://img.shields.io/github/workflow/status/geospin-takelage/takelage-img-takelslim/Build%20and%20deploy%20takelslim?label=deploy%20project)](https://github.com/geospin-takelage/takelage-img-takelslim/actions/workflows/build_deploy_takelslim_nightly.yml) |
|
40
39
|
| *[takelage-img-takelbase](https://github.com/geospin-takelage/takelage-img-takelbase)* | [![deploy project](https://img.shields.io/github/workflow/status/geospin-takelage/takelage-img-takelbase/Build%20and%20deploy%20takelbase?label=deploy%20project)](https://github.com/geospin-takelage/takelage-img-takelbase/actions/workflows/build_deploy_takelbase_nightly.yml) |
|
41
|
-
| *[takelage-img-multipostgres](https://github.com/geospin-takelage/takelage-img-multipostgres)* | [![deploy project](https://img.shields.io/github/workflow/status/geospin-takelage/takelage-img-multipostgres/Build%20and%20deploy%20multipostgres?label=deploy%20project)](https://github.com/geospin-takelage/takelage-img-multipostgres/actions/workflows/build_deploy_multipostgres_nightly.yml) |
|
42
40
|
|
43
41
|
## Installation
|
44
42
|
|
@@ -73,7 +71,7 @@ tau [bit clipboard push](features/cucumber/features/bit/bit.clipboard.push.featu
|
|
73
71
|
tau [bit require export](features/cucumber/features/bit/bit.require.export.feature) | Show requirements file of bit components
|
74
72
|
tau [bit require import](features/cucumber/features/bit/bit.require.import.feature) | Import bit components from requirements file
|
75
73
|
tau [bit scope add](features/cucumber/features/bit/bit.scope.add.feature) [SCOPE] | Add a bit [SCOPE]
|
76
|
-
tau [bit scope
|
74
|
+
tau [bit scope ssh](features/cucumber/features/bit/bit.scope.ssh.feature) | Log in to bit remote server
|
77
75
|
tau [bit scope list](features/cucumber/features/bit/bit.scope.list.feature) | List bit remote scopes
|
78
76
|
tau [bit scope new](features/cucumber/features/bit/bit.scope.new.feature) [SCOPE] | Init a new bit [SCOPE]
|
79
77
|
tau [completion bash](features/cucumber/features/completion/completion.bash.feature) | Print bash completion code
|
@@ -91,7 +89,7 @@ tau [docker image tag latest](features/cucumber/features/docker/docker.image.tag
|
|
91
89
|
tau [docker image tag list](features/cucumber/features/docker/docker.image.tag.list.feature) | Print local docker image tags
|
92
90
|
tau [docker image update](features/cucumber/features/docker/docker.image.update.feature) | Get latest remote docker container
|
93
91
|
tau [git check clean](features/cucumber/features/git/git.check.clean.feature) | Check if the git workspace is clean
|
94
|
-
tau [git check
|
92
|
+
tau [git check bit](features/cucumber/features/git/git.check.bit.feature) | Check if we are on the git bit branch
|
95
93
|
tau [git check workspace](features/cucumber/features/git/git.check.workspace.feature) | Check if a git workspace exists
|
96
94
|
tau [info project active](features/cucumber/features/info/info.project.active.feature) | Print active project info
|
97
95
|
tau [info project dir](features/cucumber/features/info/info.project.dir.feature) | Print project root directory
|
data/lib/takelage.rb
CHANGED
@@ -21,14 +21,14 @@ require_relative 'takelage/lib/config'
|
|
21
21
|
require_relative 'takelage/lib/project'
|
22
22
|
|
23
23
|
require_relative 'takelage/git/check/clean'
|
24
|
-
require_relative 'takelage/git/check/
|
24
|
+
require_relative 'takelage/git/check/bit'
|
25
25
|
require_relative 'takelage/git/check/workspace'
|
26
26
|
require_relative 'takelage/git/check/cli'
|
27
27
|
require_relative 'takelage/git/cli'
|
28
28
|
require_relative 'takelage/bit/check/workspace'
|
29
29
|
require_relative 'takelage/bit/check/cli'
|
30
30
|
require_relative 'takelage/bit/scope/add'
|
31
|
-
require_relative 'takelage/bit/scope/
|
31
|
+
require_relative 'takelage/bit/scope/ssh'
|
32
32
|
require_relative 'takelage/bit/scope/list'
|
33
33
|
require_relative 'takelage/bit/scope/new'
|
34
34
|
require_relative 'takelage/bit/scope/cli'
|
@@ -26,7 +26,7 @@ module BitClipboardLib
|
|
26
26
|
|
27
27
|
# Prepare git workspace for bit clipboard.
|
28
28
|
def _bit_clipboard_lib_prepare_git_workspace
|
29
|
-
unless
|
29
|
+
unless git_check_bit
|
30
30
|
log.error 'Not on git main branch'
|
31
31
|
return false
|
32
32
|
end
|
@@ -97,7 +97,7 @@ module BitClipboardLib
|
|
97
97
|
|
98
98
|
cmd_bit_clipboard_git_push = format(
|
99
99
|
config.active['cmd_bit_clipboard_git_push'],
|
100
|
-
main: config.active['
|
100
|
+
main: config.active['git_bit_branch']
|
101
101
|
)
|
102
102
|
|
103
103
|
run cmd_bit_clipboard_git_push
|
@@ -108,7 +108,7 @@ module BitClipboardLib
|
|
108
108
|
log.debug 'Updating git workspace'
|
109
109
|
cmd_bit_clipboard_git_pull = format(
|
110
110
|
config.active['cmd_bit_clipboard_git_pull'],
|
111
|
-
main: config.active['
|
111
|
+
main: config.active['git_bit_branch']
|
112
112
|
)
|
113
113
|
|
114
114
|
return true if try cmd_bit_clipboard_git_pull
|
@@ -6,11 +6,11 @@ module Takelage
|
|
6
6
|
include LoggingModule
|
7
7
|
include SystemModule
|
8
8
|
include ConfigModule
|
9
|
-
include
|
9
|
+
include GitCheckBit
|
10
10
|
include GitCheckWorkspace
|
11
11
|
include BitCheckWorkspace
|
12
12
|
include BitScopeAdd
|
13
|
-
include
|
13
|
+
include BitScopeSSH
|
14
14
|
include BitScopeList
|
15
15
|
include BitScopeNew
|
16
16
|
|
@@ -60,15 +60,15 @@ module Takelage
|
|
60
60
|
end
|
61
61
|
|
62
62
|
#
|
63
|
-
# bit scope
|
63
|
+
# bit scope ssh
|
64
64
|
#
|
65
|
-
desc '
|
65
|
+
desc 'ssh', 'Log in to bit remote server'
|
66
66
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
67
67
|
Log in to bit remote server
|
68
68
|
LONGDESC
|
69
69
|
# Log in to bit remote server.
|
70
|
-
def
|
71
|
-
exit
|
70
|
+
def ssh
|
71
|
+
exit bit_scope_ssh
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# takelage bit scope
|
4
|
-
module
|
5
|
-
# Backend method for bit scope
|
6
|
-
def
|
3
|
+
# takelage bit scope ssh
|
4
|
+
module BitScopeSSH
|
5
|
+
# Backend method for bit scope ssh.
|
6
|
+
def bit_scope_ssh
|
7
7
|
log.debug 'Logging in to bit remote server'
|
8
8
|
|
9
9
|
return false unless configured? %w[bit_ssh]
|
data/lib/takelage/default.yml
CHANGED
@@ -48,7 +48,7 @@ cmd_docker_image_update_docker_remove_dangling: 'docker image prune --force'
|
|
48
48
|
cmd_git_check_clean_git_unstaged: 'git diff --exit-code'
|
49
49
|
cmd_git_check_clean_git_uncommitted: 'git diff --cached --exit-code'
|
50
50
|
cmd_git_check_clean_git_status: 'git status --porcelain'
|
51
|
-
|
51
|
+
cmd_git_check_bit_get_git_branch: 'git symbolic-ref HEAD'
|
52
52
|
cmd_git_check_workspace_git_repo: 'git -C %{dir} rev-parse'
|
53
53
|
cmd_git_check_workspace_pwd: 'pwd'
|
54
54
|
cmd_info_status_lib_git_name: 'git -C %{root} config user.name'
|
@@ -62,7 +62,7 @@ cmd_info_status_ssh_keys: 'ssh-add -l'
|
|
62
62
|
cmd_info_status_ssh_socket: 'gpgconf --list-dirs agent-ssh-socket'
|
63
63
|
cmd_mutagen_check_daemon_host_connection: 'mutagen forward list --label-selector="%{hostlabel}"'
|
64
64
|
cmd_mutagen_check_daemon_version: 'mutagen version'
|
65
|
-
cmd_mutagen_forward_socket_create: 'mutagen forward create --name=%{socketname} --label=%{hostlabel} --label=%{takellabel}
|
65
|
+
cmd_mutagen_forward_socket_create: 'mutagen forward create --name=%{socketname} --label=%{hostlabel} --label=%{takellabel} docker://%{username}@%{container}:unix:%{containersock} unix:%{hostsock}'
|
66
66
|
cmd_mutagen_forward_socket_check: 'mutagen forward list %{socketname}'
|
67
67
|
cmd_mutagen_forward_socket_terminate: 'mutagen forward terminate %{socketname}'
|
68
68
|
cmd_mutagen_forward_socket_remove: 'rm -f ~/.mutagen/daemon/*'
|
@@ -76,7 +76,7 @@ docker_run_options: '--env GOOGLE_APPLICATION_CREDENTIALS=/hostdir/.google/defau
|
|
76
76
|
docker_shm_size: '512M'
|
77
77
|
docker_tag: 'latest'
|
78
78
|
docker_user: 'takelage'
|
79
|
-
|
79
|
+
git_bit_branch: 'main'
|
80
80
|
info_project_main: 'project.yml'
|
81
81
|
info_project_private: 'private/project.yml'
|
82
82
|
login_wait_for_sockets: '0'
|
@@ -84,4 +84,3 @@ mutagen_socket_path_mutagen: '~/.mutagen/daemon/daemon.sock'
|
|
84
84
|
mutagen_socket_path_gpg: '~/.gnupg/S.gpg-agent'
|
85
85
|
mutagen_socket_path_ssh: '~/.gnupg/S.gpg-agent.ssh'
|
86
86
|
mutagen_socket_takelage_label: 'type=takelage'
|
87
|
-
mutagen_socket_takelage_socket_label: 'type=takelage-socket'
|
@@ -8,7 +8,7 @@ module DockerCheckDaemon
|
|
8
8
|
def docker_check_daemon
|
9
9
|
return true if @docker_daemon_running
|
10
10
|
|
11
|
-
return false unless
|
11
|
+
return false unless command_available_else_error? 'docker'
|
12
12
|
|
13
13
|
log.debug 'Check if the docker daemon is running'
|
14
14
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage git check bit
|
4
|
+
module GitCheckBit
|
5
|
+
# Backend method for git check bit.
|
6
|
+
# @return [Boolean] are we on the git bit branch?
|
7
|
+
def git_check_bit
|
8
|
+
log.debug 'Check if we are on the git bit branch'
|
9
|
+
|
10
|
+
return false unless git_check_workspace
|
11
|
+
|
12
|
+
branch = _git_check_bit_get_branch
|
13
|
+
log.debug "We are on git branch \"#{branch}\""
|
14
|
+
|
15
|
+
branch == config.active['git_bit_branch']
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Get git branch.
|
21
|
+
def _git_check_bit_get_branch
|
22
|
+
cmd_get_branch =
|
23
|
+
config.active['cmd_git_check_bit_get_git_branch']
|
24
|
+
(run cmd_get_branch).chomp.split('/')[-1]
|
25
|
+
end
|
26
|
+
end
|
@@ -7,31 +7,31 @@ module Takelage
|
|
7
7
|
include SystemModule
|
8
8
|
include ConfigModule
|
9
9
|
include GitCheckClean
|
10
|
-
include
|
10
|
+
include GitCheckBit
|
11
11
|
include GitCheckWorkspace
|
12
12
|
|
13
13
|
#
|
14
|
-
# git check
|
14
|
+
# git check bit
|
15
15
|
#
|
16
|
-
desc '
|
16
|
+
desc 'bit', 'Check if we are on the git bit branch'
|
17
17
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
18
|
-
Check if the git
|
18
|
+
Check if we are on the git bit branch
|
19
19
|
LONGDESC
|
20
|
-
# Check if the git
|
21
|
-
def
|
22
|
-
exit
|
20
|
+
# Check if we are on the git bit branch.
|
21
|
+
def bit
|
22
|
+
exit git_check_bit
|
23
23
|
end
|
24
24
|
|
25
25
|
#
|
26
|
-
# git check
|
26
|
+
# git check clean
|
27
27
|
#
|
28
|
-
desc '
|
28
|
+
desc 'clean', 'Check if the git workspace is clean'
|
29
29
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
30
|
-
Check if
|
30
|
+
Check if the git workspace is clean
|
31
31
|
LONGDESC
|
32
|
-
# Check if
|
33
|
-
def
|
34
|
-
exit
|
32
|
+
# Check if the git workspace is clean.
|
33
|
+
def clean
|
34
|
+
exit git_check_clean
|
35
35
|
end
|
36
36
|
|
37
37
|
#
|
data/lib/takelage/lib/system.rb
CHANGED
@@ -7,22 +7,26 @@ require 'yaml'
|
|
7
7
|
# Interaction with the operating system
|
8
8
|
# rubocop:disable Metrics/ModuleLength
|
9
9
|
module SystemModule
|
10
|
-
# Check if a command is available
|
10
|
+
# Check if a command is available else log error message
|
11
11
|
# @return [Boolean] is the command available?
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def command_available_else_error?(command)
|
13
|
+
unless _command_available? command
|
14
|
+
log.error "The command \"#{command}\" is not available"
|
15
|
+
return false
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
+
command_available command
|
19
|
+
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
# Check if a command is available else log warning message
|
22
|
+
# @return [Boolean] is the command available?
|
23
|
+
def command_available_else_warning?(command)
|
24
|
+
unless _command_available? command
|
25
|
+
log.warn "The command \"#{command}\" is not available"
|
21
26
|
return false
|
22
27
|
end
|
23
28
|
|
24
|
-
|
25
|
-
instance_variable_set("@command_available_#{command}", true)
|
29
|
+
command_available command
|
26
30
|
end
|
27
31
|
|
28
32
|
# Convert hash to yaml.
|
@@ -118,6 +122,23 @@ module SystemModule
|
|
118
122
|
|
119
123
|
private
|
120
124
|
|
125
|
+
# Check if command is available
|
126
|
+
def _command_available?(command)
|
127
|
+
return true if instance_variable_get("@command_available_#{command}")
|
128
|
+
|
129
|
+
log.debug "Check if the command \"#{command}\" is available"
|
130
|
+
status = try "which #{command}"
|
131
|
+
return false unless status.exitstatus.zero?
|
132
|
+
|
133
|
+
true
|
134
|
+
end
|
135
|
+
|
136
|
+
# Command is available
|
137
|
+
def command_available(command)
|
138
|
+
log.debug "The command \"#{command}\" is available"
|
139
|
+
instance_variable_set("@command_available_#{command}", true)
|
140
|
+
end
|
141
|
+
|
121
142
|
# Check if file exists.
|
122
143
|
def _file_exists?(file)
|
123
144
|
unless File.exist? File.expand_path(file)
|
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.30.6
|
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.
|
4
|
+
version: 0.30.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geospin
|
@@ -220,9 +220,9 @@ files:
|
|
220
220
|
- lib/takelage/bit/require/lib.rb
|
221
221
|
- lib/takelage/bit/scope/add.rb
|
222
222
|
- lib/takelage/bit/scope/cli.rb
|
223
|
-
- lib/takelage/bit/scope/inbit.rb
|
224
223
|
- lib/takelage/bit/scope/list.rb
|
225
224
|
- lib/takelage/bit/scope/new.rb
|
225
|
+
- lib/takelage/bit/scope/ssh.rb
|
226
226
|
- lib/takelage/completion/cli.rb
|
227
227
|
- lib/takelage/default.yml
|
228
228
|
- lib/takelage/docker/check/cli.rb
|
@@ -245,9 +245,9 @@ files:
|
|
245
245
|
- lib/takelage/docker/image/tag/latest.rb
|
246
246
|
- lib/takelage/docker/image/tag/list.rb
|
247
247
|
- lib/takelage/docker/image/update.rb
|
248
|
+
- lib/takelage/git/check/bit.rb
|
248
249
|
- lib/takelage/git/check/clean.rb
|
249
250
|
- lib/takelage/git/check/cli.rb
|
250
|
-
- lib/takelage/git/check/main.rb
|
251
251
|
- lib/takelage/git/check/workspace.rb
|
252
252
|
- lib/takelage/git/cli.rb
|
253
253
|
- lib/takelage/info/cli.rb
|
@@ -290,7 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
290
290
|
requirements:
|
291
291
|
- - ">="
|
292
292
|
- !ruby/object:Gem::Version
|
293
|
-
version: '2.
|
293
|
+
version: '2.5'
|
294
294
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
295
|
requirements:
|
296
296
|
- - ">="
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# takelage git check main
|
4
|
-
module GitCheckMain
|
5
|
-
# Backend method for git check main.
|
6
|
-
# @return [Boolean] are we on the git main branch?
|
7
|
-
def git_check_main
|
8
|
-
log.debug 'Check if we are on the git main branch'
|
9
|
-
|
10
|
-
return false unless git_check_workspace
|
11
|
-
|
12
|
-
branch = _git_check_main_get_branch
|
13
|
-
log.debug "We are on git branch \"#{branch}\""
|
14
|
-
|
15
|
-
branch == config.active['git_main_branch']
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
# Get git branch.
|
21
|
-
def _git_check_main_get_branch
|
22
|
-
cmd_get_branch =
|
23
|
-
config.active['cmd_git_check_main_git_branch']
|
24
|
-
(run cmd_get_branch).chomp.split('/')[-1]
|
25
|
-
end
|
26
|
-
end
|