takelage 0.13.2 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/bin/tau +1 -0
- data/lib/Thorfile +2 -0
- data/lib/takelage/bit/check/cli.rb +2 -2
- data/lib/takelage/bit/check/module.rb +21 -12
- data/lib/takelage/bit/cli.rb +1 -3
- data/lib/takelage/bit/clipboard/cli.rb +2 -4
- data/lib/takelage/bit/clipboard/module.rb +264 -194
- data/lib/takelage/bit/scope/cli.rb +2 -2
- data/lib/takelage/bit/scope/module.rb +64 -59
- data/lib/takelage/completion/cli.rb +2 -2
- data/lib/takelage/docker/check/cli.rb +2 -2
- data/lib/takelage/docker/check/module.rb +6 -8
- data/lib/takelage/docker/cli.rb +2 -3
- data/lib/takelage/docker/container/check/cli.rb +2 -2
- data/lib/takelage/docker/container/check/module.rb +28 -19
- data/lib/takelage/docker/container/cli.rb +13 -10
- data/lib/takelage/docker/container/module.rb +143 -110
- data/lib/takelage/docker/image/check/cli.rb +2 -3
- data/lib/takelage/docker/image/check/module.rb +26 -12
- data/lib/takelage/docker/image/cli.rb +3 -4
- data/lib/takelage/docker/image/module.rb +19 -14
- data/lib/takelage/docker/image/tag/check/cli.rb +2 -3
- data/lib/takelage/docker/image/tag/check/module.rb +33 -17
- data/lib/takelage/docker/image/tag/cli.rb +2 -3
- data/lib/takelage/docker/image/tag/latest/cli.rb +2 -3
- data/lib/takelage/docker/image/tag/latest/module.rb +6 -5
- data/lib/takelage/docker/image/tag/list/cli.rb +2 -3
- data/lib/takelage/docker/image/tag/list/module.rb +19 -16
- data/lib/takelage/docker/socket/cli.rb +2 -3
- data/lib/takelage/docker/socket/module.rb +137 -107
- data/lib/takelage/git/check/cli.rb +2 -2
- data/lib/takelage/git/check/module.rb +53 -35
- data/lib/takelage/git/cli.rb +2 -3
- data/lib/takelage/info/cli.rb +2 -3
- data/lib/takelage/info/project/cli.rb +2 -2
- data/lib/takelage/lib/config.rb +62 -45
- data/lib/takelage/lib/logging.rb +33 -16
- data/lib/takelage/lib/project.rb +43 -28
- data/lib/takelage/lib/subcmd.rb +2 -0
- data/lib/takelage/lib/system.rb +43 -27
- data/lib/takelage/self/cli.rb +2 -0
- data/lib/takelage/self/config/cli.rb +2 -0
- data/lib/takelage/self/module.rb +2 -0
- data/lib/takelage/version +1 -1
- data/lib/takelage.rb +6 -7
- metadata +1 -1
@@ -1,10 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# takelage docker image tag latest module
|
2
4
|
module DockerImageTagLatestModule
|
3
|
-
|
4
5
|
# Backend method for docker image tag latest local.
|
5
6
|
# @return [String] latest local docker image tag
|
6
7
|
def docker_image_tag_latest_local
|
7
|
-
log.debug
|
8
|
+
log.debug 'Getting latest local docker image tag'
|
8
9
|
|
9
10
|
return false unless docker_check_running
|
10
11
|
|
@@ -20,14 +21,14 @@ module DockerImageTagLatestModule
|
|
20
21
|
# Backend method for docker image tag latest remote.
|
21
22
|
# @return [String] latest remote docker image tag
|
22
23
|
def docker_image_tag_latest_remote
|
23
|
-
log.debug
|
24
|
+
log.debug 'Getting latest remote docker image tag'
|
24
25
|
|
25
26
|
return false unless docker_check_running
|
26
27
|
|
27
28
|
tags = docker_image_tag_list_remote
|
28
29
|
|
29
|
-
if tags == false
|
30
|
-
log.warn
|
30
|
+
if tags == false || tags.nil?
|
31
|
+
log.warn 'No latest docker remote tag'
|
31
32
|
return ''
|
32
33
|
end
|
33
34
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Takelage
|
3
4
|
# takelage docker image tag list
|
4
5
|
class DockerImageTagList < SubCommandBase
|
5
|
-
|
6
6
|
include LoggingModule
|
7
7
|
include SystemModule
|
8
8
|
include ConfigModule
|
@@ -11,7 +11,6 @@ module Takelage
|
|
11
11
|
|
12
12
|
# Initialize takelage docker image tag list
|
13
13
|
def initialize(args = [], local_options = {}, configuration = {})
|
14
|
-
|
15
14
|
# initialize thor parent class
|
16
15
|
super args, local_options, configuration
|
17
16
|
|
@@ -1,20 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# takelage docker image tag list module
|
2
4
|
module DockerImageTagListModule
|
3
|
-
|
4
5
|
# Backend method for docker image tag list local.
|
5
6
|
# @return [Array] local docker image tags
|
6
7
|
def docker_image_tag_list_local
|
7
|
-
tags = []
|
8
|
-
|
9
8
|
cmd_docker_tags =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
stdout_str = run cmd_docker_tags
|
9
|
+
format(
|
10
|
+
config.active['cmd_docker_image_tag_list_local_docker_images'],
|
11
|
+
docker_user: @docker_user,
|
12
|
+
docker_repo: @docker_repo
|
13
|
+
)
|
16
14
|
|
17
|
-
tags =
|
15
|
+
tags = (run cmd_docker_tags).split("\n")
|
18
16
|
|
19
17
|
VersionSorter.sort(tags)
|
20
18
|
end
|
@@ -22,19 +20,24 @@ module DockerImageTagListModule
|
|
22
20
|
# Backend method for docker image tag list remote.
|
23
21
|
# @return [Array] remote docker image tags
|
24
22
|
def docker_image_tag_list_remote
|
25
|
-
log.debug
|
26
|
-
|
27
|
-
|
23
|
+
log.debug 'Getting docker remote tags ' \
|
24
|
+
"of \"#{@docker_user}/#{@docker_repo}\" " \
|
25
|
+
"from \"#{@docker_registry}\""
|
26
|
+
_docker_image_tag_list_remote_tags
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
28
30
|
|
31
|
+
# Get docker remote tags.
|
32
|
+
def _docker_image_tag_list_remote_tags
|
29
33
|
user = File.basename @docker_user
|
30
34
|
begin
|
31
35
|
registry = DockerRegistry2.connect(@docker_registry)
|
32
36
|
tags = registry.tags("#{user}/#{@docker_repo}")
|
37
|
+
VersionSorter.sort(tags['tags'])
|
33
38
|
rescue RestClient::Exceptions::OpenTimeout
|
34
39
|
log.error "Timeout while connecting to \"#{@docker_registry}\""
|
35
|
-
|
40
|
+
false
|
36
41
|
end
|
37
|
-
|
38
|
-
VersionSorter.sort(tags['tags'])
|
39
42
|
end
|
40
43
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
+
module Takelage
|
3
4
|
# takelage docker socket
|
4
5
|
class DockerSocket < SubCommandBase
|
5
|
-
|
6
6
|
include LoggingModule
|
7
7
|
include SystemModule
|
8
8
|
include ConfigModule
|
@@ -11,7 +11,6 @@ module Takelage
|
|
11
11
|
|
12
12
|
# Initialize docker socket
|
13
13
|
def initialize(args = [], local_options = {}, configuration = {})
|
14
|
-
|
15
14
|
# initialize thor parent class
|
16
15
|
super args, local_options, configuration
|
17
16
|
|
@@ -1,42 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# takelage docker socket module
|
2
4
|
module DockerSocketModule
|
3
|
-
|
4
5
|
# Backend method for docker socket scheme.
|
5
6
|
def docker_socket_scheme
|
6
7
|
log.debug 'Getting docker socket scheme'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
agent_socket_path.chomp!
|
13
|
-
|
14
|
-
agent_socket_port =
|
15
|
-
config.active['docker_socket_gpg_agent_port']
|
16
|
-
|
17
|
-
cmd_agent_ssh_socket_path =
|
18
|
-
config.active['cmd_docker_socket_config_agent_ssh_socket_path']
|
19
|
-
|
20
|
-
agent_ssh_socket_path = run cmd_agent_ssh_socket_path
|
21
|
-
agent_ssh_socket_path.chomp!
|
22
|
-
|
23
|
-
agent_ssh_socket_port =
|
24
|
-
config.active['docker_socket_gpg_ssh_agent_port']
|
9
|
+
gpg_path = _socket_get_agent_socket_path
|
10
|
+
gpg_port = config.active['docker_socket_gpg_agent_port']
|
11
|
+
ssh_path = _socket_get_agent_ssh_socket_path
|
12
|
+
ssh_port = config.active['docker_socket_gpg_ssh_agent_port']
|
25
13
|
|
26
|
-
socket_scheme =
|
27
|
-
|
28
|
-
|
29
|
-
'host' => @socket_host,
|
30
|
-
'port' => agent_socket_port
|
31
|
-
},
|
32
|
-
'agent-ssh-socket' => {
|
33
|
-
'path' => agent_ssh_socket_path,
|
34
|
-
'host' => @socket_host,
|
35
|
-
'port' => agent_ssh_socket_port
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
log.debug "Docker socket scheme is \n\"\"\"\n#{hash_to_yaml socket_scheme}\"\"\""
|
14
|
+
socket_scheme = _socket_get_scheme gpg_path, gpg_port, ssh_path, ssh_port
|
15
|
+
log.debug 'Docker socket scheme is ' \
|
16
|
+
"\n\"\"\"\n#{hash_to_yaml socket_scheme}\"\"\""
|
40
17
|
|
41
18
|
socket_scheme
|
42
19
|
end
|
@@ -68,16 +45,11 @@ module DockerSocketModule
|
|
68
45
|
|
69
46
|
return false unless docker_check_running
|
70
47
|
|
71
|
-
cmds_start_socket = _get_socket_start_commands
|
72
|
-
|
73
|
-
unless cmds_start_socket.empty?
|
74
|
-
log.debug 'Request sudo so that subsequent background tasks run without delay'
|
48
|
+
cmds_start_socket = _get_socket_start_commands 'start'
|
75
49
|
|
76
|
-
|
77
|
-
config.active['cmd_docker_socket_start_sudo_true']
|
50
|
+
return true if cmds_start_socket.empty?
|
78
51
|
|
79
|
-
|
80
|
-
end
|
52
|
+
_socket_get_sudo
|
81
53
|
|
82
54
|
cmds_start_socket.each do |cmd_start_socket|
|
83
55
|
run_and_fork cmd_start_socket
|
@@ -95,103 +67,161 @@ module DockerSocketModule
|
|
95
67
|
# get process list
|
96
68
|
# assuming format: "pid command"
|
97
69
|
cmd_ps =
|
98
|
-
|
70
|
+
config.active['cmd_docker_socket_stop_docker_socket_ps']
|
99
71
|
|
100
72
|
stdout_str = run cmd_ps
|
101
73
|
|
102
|
-
cmds_start_socket = _get_socket_start_commands
|
74
|
+
cmds_start_socket = _get_socket_start_commands 'stop'
|
103
75
|
|
104
76
|
# loop over process list
|
105
77
|
stdout_str.split(/\n+/).each do |process|
|
78
|
+
_socket_stop_process process, cmds_start_socket
|
79
|
+
end
|
106
80
|
|
107
|
-
|
108
|
-
|
109
|
-
pid = pid_command[0]
|
110
|
-
command = pid_command[1]
|
111
|
-
|
112
|
-
# loop over socket start commands
|
113
|
-
cmds_start_socket.each do |cmd_start_socket|
|
81
|
+
true
|
82
|
+
end
|
114
83
|
|
115
|
-
|
116
|
-
log.debug "Killing PID #{pid}"
|
84
|
+
private
|
117
85
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
86
|
+
# Get gpg agent socket path.
|
87
|
+
def _socket_get_agent_socket_path
|
88
|
+
cmd_agent_socket_path =
|
89
|
+
config.active['cmd_docker_socket_config_agent_socket_path']
|
90
|
+
(run cmd_agent_socket_path).chomp
|
91
|
+
end
|
122
92
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
93
|
+
# Get gpg ssh agent socket path.
|
94
|
+
def _socket_get_agent_ssh_socket_path
|
95
|
+
cmd_agent_ssh_socket_path =
|
96
|
+
config.active['cmd_docker_socket_config_agent_ssh_socket_path']
|
97
|
+
(run cmd_agent_ssh_socket_path).chomp
|
98
|
+
end
|
127
99
|
|
128
|
-
|
100
|
+
# Create socket scheme.
|
101
|
+
def _socket_get_scheme(gpg_path, gpg_port, ssh_path, ssh_port)
|
102
|
+
{ 'agent-socket' => { 'path' => gpg_path,
|
103
|
+
'host' => @socket_host,
|
104
|
+
'port' => gpg_port },
|
105
|
+
'agent-ssh-socket' => { 'path' => ssh_path,
|
106
|
+
'host' => @socket_host,
|
107
|
+
'port' => ssh_port } }
|
129
108
|
end
|
130
109
|
|
131
|
-
#
|
110
|
+
# Get socket start commands.
|
132
111
|
# sockets_up is a boolean which defines if the sockets need to be up
|
133
112
|
# to be included in the resulting array of socket start commands
|
134
|
-
def _get_socket_start_commands
|
113
|
+
def _get_socket_start_commands(mode)
|
135
114
|
cmds_start_socket = []
|
136
115
|
|
137
116
|
# loop over sockets
|
138
117
|
@sockets.each do |socket, socket_config|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
if sockets_up
|
147
|
-
if _socket_up? socket, socket_config
|
148
|
-
cmds_start_socket << cmd_start_socket
|
149
|
-
end
|
150
|
-
else
|
151
|
-
unless _socket_up? socket, socket_config
|
152
|
-
cmds_start_socket << cmd_start_socket
|
153
|
-
end
|
154
|
-
end
|
118
|
+
host = socket_config['host']
|
119
|
+
port = socket_config['port']
|
120
|
+
path = socket_config['path']
|
121
|
+
|
122
|
+
cmd = _get_socket_start_command mode, socket, host, port, path
|
123
|
+
cmds_start_socket.push cmd if cmd
|
155
124
|
end
|
156
125
|
|
157
126
|
cmds_start_socket
|
158
127
|
end
|
159
128
|
|
160
|
-
#
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
129
|
+
# Get socket start command
|
130
|
+
def _get_socket_start_command(mode, socket, host, port, path)
|
131
|
+
if mode == 'start'
|
132
|
+
unless _socket_up? socket, host, port, path
|
133
|
+
return _socket_get_cmd_start_socket(host, port, path)
|
134
|
+
end
|
135
|
+
elsif _socket_up? socket, host, port, path
|
136
|
+
return _socket_get_cmd_start_socket(host, port, path)
|
137
|
+
end
|
138
|
+
nil
|
139
|
+
end
|
166
140
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
141
|
+
# Get socket start command.
|
142
|
+
def _socket_get_cmd_start_socket(host, port, path)
|
143
|
+
format(
|
144
|
+
config.active['cmd_docker_socket_get_start'],
|
145
|
+
host: host,
|
146
|
+
port: port,
|
147
|
+
path: path
|
148
|
+
)
|
149
|
+
end
|
172
150
|
|
173
|
-
|
151
|
+
# Check if a socket is available by trying to connect to it via TCP
|
152
|
+
def _socket_up?(socket, host, port, path)
|
153
|
+
error_message = _socket_get_error_message socket, host, port, path
|
174
154
|
begin
|
175
|
-
Timeout
|
176
|
-
|
177
|
-
s = TCPSocket.new host, port
|
178
|
-
s.close
|
179
|
-
log.debug "Socket \"#{socket}\" available"
|
180
|
-
return true
|
181
|
-
rescue Errno::ECONNREFUSED
|
182
|
-
log.debug "Connection refused: #{error_message}"
|
183
|
-
return false
|
184
|
-
rescue Errno::EHOSTUNREACH
|
185
|
-
log.debug "Host unreachable: #{error_message}"
|
186
|
-
return false
|
187
|
-
rescue SocketError
|
188
|
-
log.debug "Socket error: #{error_message}"
|
189
|
-
return false
|
190
|
-
end
|
155
|
+
Timeout.timeout(1) do
|
156
|
+
_socket_reachable? socket, host, port, error_message
|
191
157
|
end
|
192
158
|
rescue Timeout::Error
|
193
159
|
log.debug "Timeout: #{error_message}"
|
194
|
-
|
160
|
+
false
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
# Create error message.
|
165
|
+
def _socket_get_error_message(socket, host, port, path)
|
166
|
+
'failed to connect to ' \
|
167
|
+
"socket \"#{socket}\" " \
|
168
|
+
"using host \"#{host}\", " \
|
169
|
+
"port \"#{port}\", " \
|
170
|
+
"path \"#{path}\""
|
171
|
+
end
|
172
|
+
|
173
|
+
# Test socket.
|
174
|
+
# rubocop:disable Metrics/MethodLength
|
175
|
+
def _socket_reachable?(socket, host, port, error_message)
|
176
|
+
begin
|
177
|
+
s = TCPSocket.new host, port
|
178
|
+
s.close
|
179
|
+
log.debug "Socket \"#{socket}\" up"
|
180
|
+
return true
|
181
|
+
rescue Errno::ECONNREFUSED
|
182
|
+
log.debug "Connection refused: #{error_message}"
|
183
|
+
rescue Errno::EHOSTUNREACH
|
184
|
+
log.debug "Host unreachable: #{error_message}"
|
185
|
+
rescue SocketError
|
186
|
+
log.debug "Socket error: #{error_message}"
|
187
|
+
end
|
188
|
+
false
|
189
|
+
end
|
190
|
+
|
191
|
+
# rubocop:enable Metrics/MethodLength
|
192
|
+
|
193
|
+
# Kill process.
|
194
|
+
def _socket_kill_pid(pid)
|
195
|
+
log.debug "Killing PID #{pid}"
|
196
|
+
cmd_kill =
|
197
|
+
format(
|
198
|
+
config.active['cmd_docker_socket_stop_docker_socket_kill'],
|
199
|
+
pid: pid
|
200
|
+
)
|
201
|
+
run cmd_kill
|
202
|
+
end
|
203
|
+
|
204
|
+
# Get sudo.
|
205
|
+
def _socket_get_sudo
|
206
|
+
log.debug 'Request sudo so that ' \
|
207
|
+
'subsequent background tasks run without delay'
|
208
|
+
cmd_sudo_true =
|
209
|
+
config.active['cmd_docker_socket_start_sudo_true']
|
210
|
+
run cmd_sudo_true
|
211
|
+
end
|
212
|
+
|
213
|
+
# Stop process.
|
214
|
+
def _socket_stop_process(process, cmds_start_socket)
|
215
|
+
# split processes in process id and process command
|
216
|
+
pid_command = process.strip.split(/ /, 2)
|
217
|
+
pid = pid_command[0]
|
218
|
+
command = pid_command[1]
|
219
|
+
|
220
|
+
# loop over socket start commands
|
221
|
+
cmds_start_socket.each do |cmd_start_socket|
|
222
|
+
next unless command == cmd_start_socket
|
223
|
+
|
224
|
+
_socket_kill_pid pid
|
195
225
|
end
|
196
226
|
end
|
197
227
|
end
|
@@ -1,30 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# takelage git check module
|
2
4
|
module GitCheckModule
|
3
|
-
|
4
5
|
# Backend method for git check clean.
|
5
6
|
# @return [Boolean] is git workspace clean?
|
6
7
|
def git_check_clean
|
7
|
-
log.debug
|
8
|
+
log.debug 'Checking if git workspace is clean'
|
8
9
|
|
9
10
|
return false unless git_check_workspace
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
cmd_git_uncommitted =
|
15
|
-
config.active['cmd_git_check_clean_git_uncommitted']
|
16
|
-
|
17
|
-
cmd_git_status =
|
18
|
-
config.active['cmd_git_check_clean_git_status']
|
19
|
-
|
20
|
-
status_unstaged = try cmd_git_unstaged
|
21
|
-
status_uncommitted = try cmd_git_uncommitted
|
22
|
-
stdout_str_status = run cmd_git_status
|
12
|
+
status_unstaged = _git_get_status_unstaged
|
13
|
+
status_uncommitted = _git_get_status_uncommitted
|
14
|
+
stdout_str_status = _git_get_str_status
|
23
15
|
|
24
16
|
# only return true if neither unstaged nor uncommitted nor empty files
|
25
17
|
sum = status_unstaged.exitstatus +
|
26
|
-
|
27
|
-
|
18
|
+
status_uncommitted.exitstatus +
|
19
|
+
stdout_str_status.length
|
28
20
|
|
29
21
|
sum.zero?
|
30
22
|
end
|
@@ -36,13 +28,7 @@ module GitCheckModule
|
|
36
28
|
|
37
29
|
return false unless git_check_workspace
|
38
30
|
|
39
|
-
|
40
|
-
config.active['cmd_git_check_master_git_branch']
|
41
|
-
|
42
|
-
stdout_str = run cmd_get_branch
|
43
|
-
|
44
|
-
branch = stdout_str.strip.split('/')[-1]
|
45
|
-
|
31
|
+
branch = _git_get_branch
|
46
32
|
log.debug "We are on git branch \"#{branch}\""
|
47
33
|
|
48
34
|
branch == 'master'
|
@@ -52,24 +38,56 @@ module GitCheckModule
|
|
52
38
|
# @return [Boolean] is this a git workspace?
|
53
39
|
def git_check_workspace
|
54
40
|
log.debug 'Check if this is a git workspace'
|
41
|
+
status_repo = _git_get_status_repo
|
42
|
+
dir = _git_get_dir
|
43
|
+
unless status_repo.exitstatus.zero?
|
44
|
+
log.debug "No git workspace found in \"#{dir}\""
|
45
|
+
return false
|
46
|
+
end
|
47
|
+
true
|
48
|
+
end
|
55
49
|
|
56
|
-
|
57
|
-
config.active['cmd_git_check_workspace_git_repo']
|
50
|
+
private
|
58
51
|
|
59
|
-
|
52
|
+
# Get git status of unstaged changes.
|
53
|
+
def _git_get_status_unstaged
|
54
|
+
cmd_git_unstaged =
|
55
|
+
config.active['cmd_git_check_clean_git_unstaged']
|
56
|
+
try cmd_git_unstaged
|
57
|
+
end
|
60
58
|
|
61
|
-
|
62
|
-
|
59
|
+
# Get git status of uncommitted changes.
|
60
|
+
def _git_get_status_uncommitted
|
61
|
+
cmd_git_uncommitted =
|
62
|
+
config.active['cmd_git_check_clean_git_uncommitted']
|
63
|
+
try cmd_git_uncommitted
|
64
|
+
end
|
63
65
|
|
64
|
-
|
66
|
+
# Get git status result.
|
67
|
+
def _git_get_str_status
|
68
|
+
cmd_git_status =
|
69
|
+
config.active['cmd_git_check_clean_git_status']
|
70
|
+
run cmd_git_status
|
71
|
+
end
|
65
72
|
|
66
|
-
|
73
|
+
# Get git branch.
|
74
|
+
def _git_get_branch
|
75
|
+
cmd_get_branch =
|
76
|
+
config.active['cmd_git_check_master_git_branch']
|
77
|
+
(run cmd_get_branch).strip.split('/')[-1]
|
78
|
+
end
|
67
79
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
80
|
+
# Get git repository status.
|
81
|
+
def _git_get_status_repo
|
82
|
+
cmd_git_repo =
|
83
|
+
config.active['cmd_git_check_workspace_git_repo']
|
84
|
+
try cmd_git_repo
|
85
|
+
end
|
72
86
|
|
73
|
-
|
87
|
+
# Get current working directory.
|
88
|
+
def _git_get_dir
|
89
|
+
cmd_pwd =
|
90
|
+
config.active['cmd_git_check_workspace_pwd']
|
91
|
+
(run cmd_pwd).strip
|
74
92
|
end
|
75
93
|
end
|
data/lib/takelage/git/cli.rb
CHANGED
data/lib/takelage/info/cli.rb
CHANGED