takelage 0.22.0 → 0.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/takelage.rb +1 -1
- data/lib/takelage/bit/clipboard/cli.rb +1 -1
- data/lib/takelage/bit/clipboard/copy.rb +1 -1
- data/lib/takelage/bit/clipboard/lib.rb +12 -8
- data/lib/takelage/bit/clipboard/paste.rb +1 -1
- data/lib/takelage/bit/require/cli.rb +1 -1
- data/lib/takelage/bit/require/import.rb +1 -1
- data/lib/takelage/bit/scope/add.rb +2 -2
- data/lib/takelage/bit/scope/cli.rb +1 -1
- data/lib/takelage/default.yml +4 -3
- data/lib/takelage/docker/socket/host.rb +14 -4
- data/lib/takelage/git/check/cli.rb +7 -7
- data/lib/takelage/git/check/main.rb +26 -0
- data/lib/takelage/lib/logging.rb +1 -1
- data/lib/takelage/lib/subcmd.rb +2 -0
- data/lib/takelage/version +1 -1
- metadata +2 -2
- data/lib/takelage/git/check/master.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: 240831f6c4308e8336a2d476a4ff3f5b728804e7e03d4e1463c9262fff7d2b56
|
4
|
+
data.tar.gz: 85d29bb364dbaf5758f51813a1f6388c9ad6babd417da65d30b6907283147c9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfa4649517e1818407361da9e3a17832cb010dbcc6d79139e05e95f355838ae175f09b5959b338972b7953b1a11d8fdf04b31b21f8c7c6451026b93837cd1c55
|
7
|
+
data.tar.gz: ad5526d627c8cdb72d21936de73c8990782eb85f908ed405eab683bcc67b8e03dab564891636d919ab65c2cf4cce1d329efc4f28e8bd192d2ce2d60b64d15046
|
data/README.md
CHANGED
@@ -81,7 +81,7 @@ tau [docker socket scheme](features/cucumber/features/docker/docker.socket.schem
|
|
81
81
|
tau [docker socket start](features/cucumber/features/docker/docker.socket.start.feature) | Start sockets for docker container
|
82
82
|
tau [docker socket stop](features/cucumber/features/docker/docker.socket.stop.feature) | Stop sockets for docker container
|
83
83
|
tau [git check clean](features/cucumber/features/git/git.check.clean.feature) | Check if the git workspace is clean
|
84
|
-
tau [git check
|
84
|
+
tau [git check main](features/cucumber/features/git/git.check.main.feature) | Check if we are on the git main branch
|
85
85
|
tau [git check workspace](features/cucumber/features/git/git.check.workspace.feature) | Check if a git workspace exists
|
86
86
|
tau [info project active](features/cucumber/features/info/info.project.active.feature) | Print active project info
|
87
87
|
tau [info project main](features/cucumber/features/info/info.project.main.feature) | Print main project info
|
data/lib/takelage.rb
CHANGED
@@ -21,7 +21,7 @@ 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/main'
|
25
25
|
require_relative 'takelage/git/check/workspace'
|
26
26
|
require_relative 'takelage/git/check/cli'
|
27
27
|
require_relative 'takelage/git/cli'
|
@@ -71,7 +71,7 @@ module BitClipboardCopy
|
|
71
71
|
bit_dev = config.active['bit_dev_user']
|
72
72
|
|
73
73
|
# check if scope is a candidate for a bit.dev remote scope
|
74
|
-
if scope.start_with? bit_dev
|
74
|
+
if scope.start_with? "#{bit_dev}."
|
75
75
|
return false unless _bit_clipboard_bit_dev_scope_exists scope
|
76
76
|
else
|
77
77
|
return false unless _bit_clipboard_custom_scope_exists scope
|
@@ -26,8 +26,8 @@ module BitClipboardLib
|
|
26
26
|
|
27
27
|
# Prepare git workspace for bit clipboard.
|
28
28
|
def _bit_clipboard_lib_prepare_git_workspace
|
29
|
-
unless
|
30
|
-
log.error 'Not on git
|
29
|
+
unless git_check_main
|
30
|
+
log.error 'Not on git main branch'
|
31
31
|
return false
|
32
32
|
end
|
33
33
|
|
@@ -91,12 +91,14 @@ module BitClipboardLib
|
|
91
91
|
run cmd_bit_clipboard_git_commit
|
92
92
|
end
|
93
93
|
|
94
|
-
# git push origin
|
94
|
+
# git push origin main.
|
95
95
|
def _bit_clipboard_lib_git_push
|
96
|
-
log.debug 'Pushing
|
96
|
+
log.debug 'Pushing main branch to origin'
|
97
97
|
|
98
|
-
cmd_bit_clipboard_git_push =
|
99
|
-
config.active['cmd_bit_clipboard_git_push']
|
98
|
+
cmd_bit_clipboard_git_push = format(
|
99
|
+
config.active['cmd_bit_clipboard_git_push'],
|
100
|
+
main: config.active['git_main_branch']
|
101
|
+
)
|
100
102
|
|
101
103
|
run cmd_bit_clipboard_git_push
|
102
104
|
end
|
@@ -104,8 +106,10 @@ module BitClipboardLib
|
|
104
106
|
# git pull.
|
105
107
|
def _bit_clipboard_lib_git_pull
|
106
108
|
log.debug 'Updating git workspace'
|
107
|
-
cmd_bit_clipboard_git_pull =
|
108
|
-
config.active['cmd_bit_clipboard_git_pull']
|
109
|
+
cmd_bit_clipboard_git_pull = format(
|
110
|
+
config.active['cmd_bit_clipboard_git_pull'],
|
111
|
+
main: config.active['git_main_branch']
|
112
|
+
)
|
109
113
|
|
110
114
|
return true if try cmd_bit_clipboard_git_pull
|
111
115
|
|
@@ -42,7 +42,7 @@ module BitClipboardPaste
|
|
42
42
|
|
43
43
|
bit_list_scope = _bit_clipboard_paste_cid_exists_list_scope scope
|
44
44
|
|
45
|
-
return true if bit_list_scope.include?
|
45
|
+
return true if bit_list_scope.include? "\"id\": \"#{cid}\","
|
46
46
|
|
47
47
|
log.error "No remote component \"#{cid}\""
|
48
48
|
false
|
@@ -71,7 +71,7 @@ module BitRequireImport
|
|
71
71
|
|
72
72
|
# Check if there are bit components
|
73
73
|
def _bit_require_import_check_component_valid(component, scope)
|
74
|
-
return true if
|
74
|
+
return true if component.instance_of?(Hash) && component.key?('name')
|
75
75
|
|
76
76
|
log.error "No component in #{scope}"
|
77
77
|
false
|
data/lib/takelage/default.yml
CHANGED
@@ -14,8 +14,8 @@ cmd_bit_clipboard_copy_bit_tag_id: 'bit tag --skip-update --skip-tests %{id}'
|
|
14
14
|
cmd_bit_clipboard_copy_bit_export_to_scope: 'bit export --skip-update %{scope}'
|
15
15
|
cmd_bit_clipboard_git_add: 'git add %{file}'
|
16
16
|
cmd_bit_clipboard_git_commit: 'git commit --message="%{message}"'
|
17
|
-
cmd_bit_clipboard_git_pull: 'git pull origin
|
18
|
-
cmd_bit_clipboard_git_push: 'git push origin
|
17
|
+
cmd_bit_clipboard_git_pull: 'git pull origin %{main}'
|
18
|
+
cmd_bit_clipboard_git_push: 'git push origin %{main}'
|
19
19
|
cmd_bit_clipboard_paste_bit_list_scope: 'bit list --skip-update --json %{scope}'
|
20
20
|
cmd_bit_clipboard_paste_bit_import_cid: 'bit import --ignore-package-json --ignore-dist --skip-update --path %{dir} %{cid}'
|
21
21
|
cmd_bit_clipboard_pull_bit_import_all: 'bit import --ignore-package-json --ignore-dist --skip-update'
|
@@ -54,7 +54,7 @@ cmd_docker_socket_stop_docker_socket_kill: 'sudo kill -SIGTERM %{pid}'
|
|
54
54
|
cmd_git_check_clean_git_unstaged: 'git diff --exit-code'
|
55
55
|
cmd_git_check_clean_git_uncommitted: 'git diff --cached --exit-code'
|
56
56
|
cmd_git_check_clean_git_status: 'git status --porcelain'
|
57
|
-
|
57
|
+
cmd_git_check_main_git_branch: 'git symbolic-ref HEAD'
|
58
58
|
cmd_git_check_workspace_git_repo: 'git -C . rev-parse'
|
59
59
|
cmd_git_check_workspace_pwd: 'pwd'
|
60
60
|
docker_debug: 'ansible/roles/takel-takelage/files/takelscripts'
|
@@ -68,5 +68,6 @@ docker_socket_gpg_agent_port: 17874
|
|
68
68
|
docker_socket_gpg_ssh_agent_port: 17875
|
69
69
|
docker_tag: 'latest'
|
70
70
|
docker_user: 'takelage'
|
71
|
+
git_main_branch: 'main'
|
71
72
|
info_project_main: 'project.yml'
|
72
73
|
info_project_private: 'private/project.yml'
|
@@ -6,6 +6,17 @@ module DockerSocketHost
|
|
6
6
|
def docker_socket_host
|
7
7
|
log.debug 'Getting docker socket host ip address'
|
8
8
|
|
9
|
+
socket_host = _docker_socket_host_get_socket_host
|
10
|
+
|
11
|
+
log.debug "Docker socket host ip address is \"#{socket_host}\""
|
12
|
+
|
13
|
+
socket_host
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
# Get the socket host, i.e. the ip of the docker host.
|
19
|
+
def _docker_socket_host_get_socket_host
|
9
20
|
socket_host = '127.0.0.1'
|
10
21
|
|
11
22
|
addr_infos = Socket.getifaddrs
|
@@ -13,13 +24,12 @@ module DockerSocketHost
|
|
13
24
|
# if interface docker0 exists (== linux host)
|
14
25
|
# then return the ip address
|
15
26
|
addr_infos.each do |addr_info|
|
16
|
-
if addr_info.name == 'docker0'
|
17
|
-
socket_host = addr_info.addr.ip_address
|
27
|
+
if (addr_info.name == 'docker0') && addr_info.addr.ipv4?
|
28
|
+
socket_host = addr_info.addr.ip_address
|
29
|
+
break
|
18
30
|
end
|
19
31
|
end
|
20
32
|
|
21
|
-
log.debug "Docker socket host ip address is \"#{socket_host}\""
|
22
|
-
|
23
33
|
socket_host
|
24
34
|
end
|
25
35
|
end
|
@@ -7,7 +7,7 @@ module Takelage
|
|
7
7
|
include SystemModule
|
8
8
|
include ConfigModule
|
9
9
|
include GitCheckClean
|
10
|
-
include
|
10
|
+
include GitCheckMain
|
11
11
|
include GitCheckWorkspace
|
12
12
|
|
13
13
|
#
|
@@ -23,15 +23,15 @@ module Takelage
|
|
23
23
|
end
|
24
24
|
|
25
25
|
#
|
26
|
-
# git check
|
26
|
+
# git check main
|
27
27
|
#
|
28
|
-
desc '
|
28
|
+
desc 'main', 'Check if we are on the git main branch'
|
29
29
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
30
|
-
Check if we are on the git
|
30
|
+
Check if we are on the git main branch
|
31
31
|
LONGDESC
|
32
|
-
# Check if we are on the git
|
33
|
-
def
|
34
|
-
exit
|
32
|
+
# Check if we are on the git main branch.
|
33
|
+
def main
|
34
|
+
exit git_check_main
|
35
35
|
end
|
36
36
|
|
37
37
|
#
|
@@ -0,0 +1,26 @@
|
|
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).strip.split('/')[-1]
|
25
|
+
end
|
26
|
+
end
|
data/lib/takelage/lib/logging.rb
CHANGED
data/lib/takelage/lib/subcmd.rb
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
# Thor with subcommands that work correctly with help
|
4
4
|
class SubCommandBase < Thor
|
5
5
|
# Set the subcommand banner.
|
6
|
+
# rubocop:disable Style/OptionalBooleanParameter
|
6
7
|
def self.banner(command, _namespace = nil, _subcommand = false)
|
7
8
|
"#{basename} #{subcommand_prefix} #{command.usage}"
|
8
9
|
end
|
10
|
+
# rubocop:enable Style/OptionalBooleanParameter
|
9
11
|
|
10
12
|
# Set the subcommand prefix.
|
11
13
|
def self.subcommand_prefix
|
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.22.
|
1
|
+
0.22.1
|
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.22.
|
4
|
+
version: 0.22.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geospin
|
@@ -261,7 +261,7 @@ files:
|
|
261
261
|
- lib/takelage/docker/socket/stop.rb
|
262
262
|
- lib/takelage/git/check/clean.rb
|
263
263
|
- lib/takelage/git/check/cli.rb
|
264
|
-
- lib/takelage/git/check/
|
264
|
+
- lib/takelage/git/check/main.rb
|
265
265
|
- lib/takelage/git/check/workspace.rb
|
266
266
|
- lib/takelage/git/cli.rb
|
267
267
|
- lib/takelage/info/cli.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# takelage git check master
|
4
|
-
module GitCheckMaster
|
5
|
-
# Backend method for git check master.
|
6
|
-
# @return [Boolean] are we on the git master branch?
|
7
|
-
def git_check_master
|
8
|
-
log.debug 'Check if we are on the git master branch'
|
9
|
-
|
10
|
-
return false unless git_check_workspace
|
11
|
-
|
12
|
-
branch = _git_check_master_get_branch
|
13
|
-
log.debug "We are on git branch \"#{branch}\""
|
14
|
-
|
15
|
-
branch == 'master'
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
# Get git branch.
|
21
|
-
def _git_check_master_get_branch
|
22
|
-
cmd_get_branch =
|
23
|
-
config.active['cmd_git_check_master_git_branch']
|
24
|
-
(run cmd_get_branch).strip.split('/')[-1]
|
25
|
-
end
|
26
|
-
end
|