takelage 0.5.1 → 0.6.0
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/lib/takelage/bit/clipboard/cli.rb +4 -4
- data/lib/takelage/bit/clipboard/module.rb +37 -13
- data/lib/takelage/bit/scope/cli.rb +4 -5
- data/lib/takelage/bit/scope/module.rb +10 -4
- data/lib/takelage/completion/cli.rb +4 -1
- data/lib/takelage/default.yml +1 -1
- data/lib/takelage/docker/container/check/module.rb +3 -3
- data/lib/takelage/docker/container/module.rb +11 -11
- data/lib/takelage/docker/image/cli.rb +1 -1
- data/lib/takelage/docker/image/module.rb +5 -6
- data/lib/takelage/docker/image/tag/check/module.rb +4 -4
- data/lib/takelage/docker/image/tag/latest/cli.rb +8 -2
- data/lib/takelage/docker/image/tag/latest/module.rb +3 -3
- data/lib/takelage/docker/image/tag/list/cli.rb +8 -2
- data/lib/takelage/docker/image/tag/list/module.rb +3 -3
- data/lib/takelage/docker/socket/cli.rb +2 -2
- data/lib/takelage/docker/socket/module.rb +7 -6
- data/lib/takelage/info/project/cli.rb +12 -3
- data/lib/takelage/self/cli.rb +6 -3
- data/lib/takelage/self/config/cli.rb +16 -4
- data/lib/takelage/self/module.rb +1 -1
- data/lib/takelage/version +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27629dd8d5c67686cf07b09fa4d51e4293f230df5e534d3c8b9a7d0c6225713e
|
4
|
+
data.tar.gz: a44fcab58e4f2cc456e527eeee0adc8a8c2083ea7d010a94a1e01b7183ddda55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d36a0ac626f26b58661d3f3122bcee12eabcadac144fb8b25ffc49c6ab0042381f9523c9ff4c4160444c69565d32bd14fd4c0d4c3ff7cf74a0f83a81ec6e294
|
7
|
+
data.tar.gz: 6410f138c0d2c934d3f76956db801ddd00c5845be5092b1dd1ff83f0d5c89e61062b88714909393bfda7bc1911170cf4913ef8e5e38605ff7472f500a375c75c
|
@@ -27,7 +27,7 @@ module Takelage
|
|
27
27
|
LONGDESC
|
28
28
|
# Copy a file or directory as a bit component to a bit remote scope.
|
29
29
|
def copy(dir_or_file, scope)
|
30
|
-
bit_clipboard_copy dir_or_file, scope
|
30
|
+
exit bit_clipboard_copy dir_or_file, scope
|
31
31
|
end
|
32
32
|
|
33
33
|
#
|
@@ -39,7 +39,7 @@ module Takelage
|
|
39
39
|
LONGDESC
|
40
40
|
# Paste a bit component into a directory.
|
41
41
|
def paste(cid, dir)
|
42
|
-
bit_clipboard_paste cid, dir
|
42
|
+
exit bit_clipboard_paste cid, dir
|
43
43
|
end
|
44
44
|
|
45
45
|
#
|
@@ -51,7 +51,7 @@ module Takelage
|
|
51
51
|
LONGDESC
|
52
52
|
# Pull all updates for bit components from bit remote scopes.
|
53
53
|
def pull
|
54
|
-
bit_clipboard_pull
|
54
|
+
exit bit_clipboard_pull
|
55
55
|
end
|
56
56
|
|
57
57
|
#
|
@@ -63,7 +63,7 @@ module Takelage
|
|
63
63
|
LONGDESC
|
64
64
|
# Push all updates of bit components to bit remote scopes.
|
65
65
|
def push
|
66
|
-
bit_clipboard_push
|
66
|
+
exit bit_clipboard_push
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -7,13 +7,13 @@ module BitClipboardModule
|
|
7
7
|
|
8
8
|
unless bit_check_workspace
|
9
9
|
log.error 'No bit workspace'
|
10
|
-
return
|
10
|
+
return false
|
11
11
|
end
|
12
12
|
|
13
13
|
if git_check_workspace
|
14
14
|
unless git_check_master
|
15
15
|
log.error 'Not on git master branch'
|
16
|
-
return
|
16
|
+
return false
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -35,7 +35,7 @@ module BitClipboardModule
|
|
35
35
|
|
36
36
|
unless status.exitstatus.zero?
|
37
37
|
log.error "No bit.dev remote scope \"#{scope}\" found"
|
38
|
-
return
|
38
|
+
return false
|
39
39
|
end
|
40
40
|
|
41
41
|
else
|
@@ -46,7 +46,7 @@ module BitClipboardModule
|
|
46
46
|
|
47
47
|
unless /.*\s+#{scope}\s+.*/m.match? stdout_str
|
48
48
|
log.error "No bit remote scope \"#{scope}\" found in local bit workspace"
|
49
|
-
return
|
49
|
+
return false
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -54,14 +54,14 @@ module BitClipboardModule
|
|
54
54
|
Dir.glob("#{dir}/**/README.bit").each do |file|
|
55
55
|
unless file == "#{dir}/README.bit"
|
56
56
|
log.error "Nested README.bit file detected"
|
57
|
-
return
|
57
|
+
return false
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
# touch README.bit if necessary
|
62
62
|
readme_bit = "#{dir}/README.bit"
|
63
63
|
unless File.file? readme_bit
|
64
|
-
log.
|
64
|
+
log.info "Creating \"README.bit\" in \"#{dir}\""
|
65
65
|
File.open(readme_bit, 'w') {}
|
66
66
|
end
|
67
67
|
|
@@ -77,7 +77,7 @@ module BitClipboardModule
|
|
77
77
|
run cmd_bit_tag_id
|
78
78
|
else
|
79
79
|
log.error "The directory \"#{dir}\" does not exist"
|
80
|
-
return
|
80
|
+
return false
|
81
81
|
end
|
82
82
|
|
83
83
|
# export component to bit remote scope
|
@@ -89,6 +89,7 @@ module BitClipboardModule
|
|
89
89
|
log.info "Copied directory \"#{dir}\" " +
|
90
90
|
"as bit component \"#{id}\" " +
|
91
91
|
"to bit remote scope \"#{scope}\""
|
92
|
+
true
|
92
93
|
end
|
93
94
|
|
94
95
|
# Backend method for bit paste.
|
@@ -97,16 +98,30 @@ module BitClipboardModule
|
|
97
98
|
|
98
99
|
unless bit_check_workspace
|
99
100
|
log.error 'No bit workspace'
|
100
|
-
return
|
101
|
+
return false
|
101
102
|
end
|
102
103
|
|
103
104
|
if git_check_workspace
|
104
105
|
unless git_check_master
|
105
106
|
log.error 'Not on git master branch'
|
106
|
-
return
|
107
|
+
return false
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
111
|
+
scope = cid.scan(/([^\/]*).*/).first.first
|
112
|
+
|
113
|
+
log.debug "Checking if scope \"#{scope}\" " +
|
114
|
+
"has contains component id \"#{cid}\""
|
115
|
+
|
116
|
+
# get components in remote scope
|
117
|
+
cmd_bit_list_scope = config.active['bit_list_scope'] % {scope: scope}
|
118
|
+
bit_list_scope = run cmd_bit_list_scope
|
119
|
+
|
120
|
+
unless bit_list_scope.include? '"id": "' + cid + '",'
|
121
|
+
log.error "No remote scope \"#{scope}\""
|
122
|
+
return false
|
123
|
+
end
|
124
|
+
|
110
125
|
# paste bit component into directory
|
111
126
|
cmd_bit_import_cid = config.active['bit_import_cid'] % {cid: cid, dir: dir}
|
112
127
|
run cmd_bit_import_cid
|
@@ -115,6 +130,7 @@ module BitClipboardModule
|
|
115
130
|
|
116
131
|
log.info "Pasted bit component \"#{cid}\" " +
|
117
132
|
"to directory \"#{dir}\""
|
133
|
+
true
|
118
134
|
end
|
119
135
|
|
120
136
|
# Backend method for bit pull.
|
@@ -123,13 +139,13 @@ module BitClipboardModule
|
|
123
139
|
|
124
140
|
unless bit_check_workspace
|
125
141
|
log.error 'No bit workspace'
|
126
|
-
return
|
142
|
+
return false
|
127
143
|
end
|
128
144
|
|
129
145
|
if git_check_workspace
|
130
146
|
unless git_check_master
|
131
147
|
log.error 'Not on git master branch'
|
132
|
-
return
|
148
|
+
return false
|
133
149
|
end
|
134
150
|
end
|
135
151
|
|
@@ -144,6 +160,7 @@ module BitClipboardModule
|
|
144
160
|
_remove_bit_artifacts
|
145
161
|
|
146
162
|
log.info "Pulled bit components"
|
163
|
+
true
|
147
164
|
end
|
148
165
|
|
149
166
|
# Backend method for bit push
|
@@ -152,13 +169,13 @@ module BitClipboardModule
|
|
152
169
|
|
153
170
|
unless bit_check_workspace
|
154
171
|
log.error 'No bit workspace'
|
155
|
-
return
|
172
|
+
return false
|
156
173
|
end
|
157
174
|
|
158
175
|
if git_check_workspace
|
159
176
|
unless git_check_master
|
160
177
|
log.error 'Not on git master branch'
|
161
|
-
return
|
178
|
+
return false
|
162
179
|
end
|
163
180
|
end
|
164
181
|
|
@@ -173,6 +190,7 @@ module BitClipboardModule
|
|
173
190
|
_remove_bit_artifacts
|
174
191
|
|
175
192
|
log.info "Pushed bit components"
|
193
|
+
true
|
176
194
|
end
|
177
195
|
|
178
196
|
# Generate bit component ID.
|
@@ -203,6 +221,7 @@ module BitClipboardModule
|
|
203
221
|
def _remove_bit_artifacts
|
204
222
|
_remove_node_modules
|
205
223
|
_remove_index_bit
|
224
|
+
_remove_package_json
|
206
225
|
end
|
207
226
|
|
208
227
|
# Remove node_modules directory.
|
@@ -216,4 +235,9 @@ module BitClipboardModule
|
|
216
235
|
FileUtils.remove_entry_secure(file, force: true)
|
217
236
|
end
|
218
237
|
end
|
238
|
+
|
239
|
+
# Remove package.json file.
|
240
|
+
def _remove_package_json
|
241
|
+
FileUtils.remove_entry_secure('package.json', force: true)
|
242
|
+
end
|
219
243
|
end
|
@@ -21,8 +21,7 @@ module Takelage
|
|
21
21
|
LONGDESC
|
22
22
|
# Add bit remote scope.
|
23
23
|
def add(scope)
|
24
|
-
exit
|
25
|
-
bit_scope_add scope
|
24
|
+
exit bit_scope_add scope
|
26
25
|
end
|
27
26
|
|
28
27
|
#
|
@@ -37,8 +36,7 @@ module Takelage
|
|
37
36
|
LONGDESC
|
38
37
|
# Create new bit remote scope.
|
39
38
|
def new(scope)
|
40
|
-
exit
|
41
|
-
bit_scope_new scope
|
39
|
+
exit bit_scope_new scope
|
42
40
|
end
|
43
41
|
|
44
42
|
#
|
@@ -51,9 +49,10 @@ module Takelage
|
|
51
49
|
LONGDESC
|
52
50
|
# List bit remote scopes.
|
53
51
|
def list
|
54
|
-
exit false unless configured? %w(bit_ssh bit_remote)
|
55
52
|
scopes = bit_scope_list
|
53
|
+
exit false if scopes == false
|
56
54
|
say scopes unless scopes.to_s.strip.empty?
|
55
|
+
true
|
57
56
|
end
|
58
57
|
end
|
59
58
|
end
|
@@ -5,15 +5,17 @@ module BitScopeModule
|
|
5
5
|
def bit_scope_add(scope)
|
6
6
|
log.debug "Adding bit remote scope \"#{scope}\" to local workspace"
|
7
7
|
|
8
|
+
return false unless configured? %w(bit_ssh bit_remote)
|
9
|
+
|
8
10
|
unless bit_check_workspace
|
9
11
|
log.error 'No bit workspace'
|
10
|
-
return
|
12
|
+
return false
|
11
13
|
end
|
12
14
|
|
13
15
|
if git_check_workspace
|
14
16
|
unless git_check_master
|
15
17
|
log.error 'Not on git master branch'
|
16
|
-
return
|
18
|
+
return false
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -22,7 +24,7 @@ module BitScopeModule
|
|
22
24
|
log.debug scope_list
|
23
25
|
unless scope_list.include? scope
|
24
26
|
log.error "The bit remote bit scope \"#{scope}\" doesn't exist"
|
25
|
-
|
27
|
+
return false
|
26
28
|
end
|
27
29
|
|
28
30
|
# get bit remote from active config
|
@@ -40,6 +42,8 @@ module BitScopeModule
|
|
40
42
|
def bit_scope_list
|
41
43
|
log.debug "Listing bit remote scopes"
|
42
44
|
|
45
|
+
return false unless configured? %w(bit_ssh bit_remote)
|
46
|
+
|
43
47
|
# get ssh command from active config
|
44
48
|
cmd_bit_ssh = config.active['bit_ssh']
|
45
49
|
|
@@ -64,11 +68,13 @@ module BitScopeModule
|
|
64
68
|
def bit_scope_new(scope)
|
65
69
|
log.debug "Creating new bit remote scope \"#{scope}\""
|
66
70
|
|
71
|
+
return false unless configured? %w(bit_ssh bit_remote)
|
72
|
+
|
67
73
|
# check if bit remote scope already exists
|
68
74
|
scope_list = bit_scope_list
|
69
75
|
if scope_list.include? scope
|
70
76
|
log.error "The remote bit scope \"#{scope}\" already exists"
|
71
|
-
|
77
|
+
return false
|
72
78
|
end
|
73
79
|
|
74
80
|
# get ssh command from active config
|
data/lib/takelage/default.yml
CHANGED
@@ -7,7 +7,7 @@ bit_export_all: 'bit export --skip-update'
|
|
7
7
|
bit_import_cid: 'bit import --ignore-package-json --skip-update -p %{dir} %{cid}'
|
8
8
|
bit_import_all: 'bit import --skip-update --ignore-package-json -m manual'
|
9
9
|
bit_list_remotes: 'bit remote --skip-update'
|
10
|
-
bit_list_scope: 'bit list --skip-update --
|
10
|
+
bit_list_scope: 'bit list --skip-update --json %{scope}'
|
11
11
|
bit_remote: ''
|
12
12
|
bit_repo: 'bit status'
|
13
13
|
bit_scope_root: '/bit'
|
@@ -6,7 +6,7 @@ module DockerContainerCheckModule
|
|
6
6
|
def docker_container_check_existing(container)
|
7
7
|
log.debug "Checking if container \"#{container}\" is existing"
|
8
8
|
|
9
|
-
|
9
|
+
return false unless docker_check_running
|
10
10
|
|
11
11
|
cmd_docker_existing = 'docker ps ' +
|
12
12
|
"--filter name=^#{container}$ " +
|
@@ -28,7 +28,7 @@ module DockerContainerCheckModule
|
|
28
28
|
def docker_container_check_network(network)
|
29
29
|
log.debug "Checking if network \"#{network}\" is existing"
|
30
30
|
|
31
|
-
|
31
|
+
return false unless docker_check_running
|
32
32
|
|
33
33
|
cmd_docker_network = 'docker network ls ' +
|
34
34
|
'--quiet ' +
|
@@ -50,7 +50,7 @@ module DockerContainerCheckModule
|
|
50
50
|
def docker_container_check_orphaned(container)
|
51
51
|
log.debug "Check if container \"#{container}\" is orphaned"
|
52
52
|
|
53
|
-
|
53
|
+
return false unless docker_check_running
|
54
54
|
|
55
55
|
cmd_docker_orphaned = 'docker exec ' +
|
56
56
|
'--interactive ' +
|
@@ -5,9 +5,9 @@ module DockerContainerModule
|
|
5
5
|
def docker_container_command(command)
|
6
6
|
log.debug "Running command in container"
|
7
7
|
|
8
|
-
|
8
|
+
return false unless docker_check_running
|
9
9
|
|
10
|
-
|
10
|
+
return false unless configured? %w(docker_repo docker_image docker_tag)
|
11
11
|
|
12
12
|
docker_socket_start
|
13
13
|
|
@@ -20,9 +20,9 @@ module DockerContainerModule
|
|
20
20
|
def docker_container_daemon
|
21
21
|
log.debug 'Starting docker container as daemon'
|
22
22
|
|
23
|
-
|
23
|
+
return false unless docker_check_running
|
24
24
|
|
25
|
-
|
25
|
+
return false unless configured? %w(docker_repo docker_image docker_tag)
|
26
26
|
|
27
27
|
_create_network @hostname unless docker_container_check_network @hostname
|
28
28
|
_create_container @hostname unless docker_container_check_existing @hostname
|
@@ -32,9 +32,9 @@ module DockerContainerModule
|
|
32
32
|
def docker_container_login
|
33
33
|
log.debug 'Logging in to docker container'
|
34
34
|
|
35
|
-
|
35
|
+
return false unless docker_check_running
|
36
36
|
|
37
|
-
|
37
|
+
return false unless configured? %w(docker_repo docker_image docker_tag)
|
38
38
|
|
39
39
|
docker_socket_start
|
40
40
|
|
@@ -47,9 +47,9 @@ module DockerContainerModule
|
|
47
47
|
def docker_container_nuke
|
48
48
|
log.debug 'Removing all docker containers'
|
49
49
|
|
50
|
-
|
50
|
+
return false unless docker_check_running
|
51
51
|
|
52
|
-
|
52
|
+
return false unless configured? %w(docker_image)
|
53
53
|
|
54
54
|
networks = []
|
55
55
|
|
@@ -68,9 +68,9 @@ module DockerContainerModule
|
|
68
68
|
def docker_container_purge
|
69
69
|
log.debug 'Removing orphaned docker containers'
|
70
70
|
|
71
|
-
|
71
|
+
return false unless docker_check_running
|
72
72
|
|
73
|
-
|
73
|
+
return false unless configured? %w(docker_image)
|
74
74
|
|
75
75
|
networks = []
|
76
76
|
|
@@ -103,7 +103,7 @@ module DockerContainerModule
|
|
103
103
|
|
104
104
|
unless docker_image_tag_check_local tag
|
105
105
|
log.error "Image \"#{image}\" does not exist"
|
106
|
-
|
106
|
+
return false
|
107
107
|
end
|
108
108
|
|
109
109
|
entrypoint = '/entrypoint.py '
|
@@ -3,15 +3,15 @@ module DockerImageModule
|
|
3
3
|
|
4
4
|
# Backend method for docker image update.
|
5
5
|
def docker_image_update
|
6
|
-
|
6
|
+
return false unless docker_check_running
|
7
7
|
|
8
|
-
|
8
|
+
return false unless configured? %w(docker_repo docker_image docker_tagsurl)
|
9
9
|
|
10
10
|
tag_latest_remote = docker_image_tag_latest_remote
|
11
11
|
|
12
12
|
if tag_latest_remote.to_s.strip.empty?
|
13
13
|
log.error "Unable to get latest remote tag"
|
14
|
-
|
14
|
+
return false
|
15
15
|
end
|
16
16
|
|
17
17
|
tag_latest_local = docker_image_tag_latest_local
|
@@ -19,14 +19,13 @@ module DockerImageModule
|
|
19
19
|
unless tag_latest_local.to_s.strip.empty?
|
20
20
|
if Gem::Version.new(tag_latest_local) >= Gem::Version.new(tag_latest_remote)
|
21
21
|
log.info 'Already up to date.'
|
22
|
-
|
22
|
+
return false
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
cmd_docker_pull_latest = "docker pull #{@docker_repo}/#{@docker_image}:#{tag_latest_remote}"
|
27
|
-
|
28
26
|
log.info "Updating to docker image \"#{@docker_repo}/#{@docker_image}:#{tag_latest_remote}\""
|
29
27
|
|
28
|
+
cmd_docker_pull_latest = "docker pull #{@docker_repo}/#{@docker_image}:#{tag_latest_remote}"
|
30
29
|
run_and_exit cmd_docker_pull_latest
|
31
30
|
end
|
32
31
|
end
|
@@ -6,9 +6,9 @@ module DockerImageTagCheckModule
|
|
6
6
|
def docker_image_tag_check_local(tag)
|
7
7
|
log.debug "Check if local docker image tag \"#{tag}\" exists"
|
8
8
|
|
9
|
-
|
9
|
+
return false unless docker_check_running
|
10
10
|
|
11
|
-
|
11
|
+
return false unless configured? %w(docker_repo docker_image)
|
12
12
|
|
13
13
|
if tag.to_s.strip.empty?
|
14
14
|
log.warn "No local docker image tag specified"
|
@@ -36,9 +36,9 @@ module DockerImageTagCheckModule
|
|
36
36
|
def docker_image_tag_check_remote(tag)
|
37
37
|
log.debug "Check if remote image tag \"#{tag}\" exists"
|
38
38
|
|
39
|
-
|
39
|
+
return false unless docker_check_running
|
40
40
|
|
41
|
-
|
41
|
+
return false unless configured? %w(docker_repo docker_image docker_tagsurl)
|
42
42
|
|
43
43
|
if tag .to_s.strip.empty?
|
44
44
|
log.warn "No remote docker image tag specified"
|
@@ -31,7 +31,10 @@ module Takelage
|
|
31
31
|
LONGDESC
|
32
32
|
# Print latest local docker image tag.
|
33
33
|
def local
|
34
|
-
|
34
|
+
tag_latest_local = docker_image_tag_latest_local
|
35
|
+
exit false if tag_latest_local == false
|
36
|
+
say tag_latest_local
|
37
|
+
true
|
35
38
|
end
|
36
39
|
|
37
40
|
#
|
@@ -44,7 +47,10 @@ module Takelage
|
|
44
47
|
LONGDESC
|
45
48
|
# Print latest remote docker image tag.
|
46
49
|
def remote
|
47
|
-
|
50
|
+
tag_latest_remote = docker_image_tag_latest_remote
|
51
|
+
exit false if tag_latest_remote == false
|
52
|
+
say tag_latest_remote
|
53
|
+
true
|
48
54
|
end
|
49
55
|
end
|
50
56
|
end
|
@@ -6,7 +6,7 @@ module DockerImageTagLatestModule
|
|
6
6
|
def docker_image_tag_latest_local
|
7
7
|
log.debug "Getting latest local docker image tag"
|
8
8
|
|
9
|
-
|
9
|
+
return false unless docker_check_running
|
10
10
|
|
11
11
|
tags = docker_image_tag_list_local
|
12
12
|
|
@@ -22,12 +22,12 @@ module DockerImageTagLatestModule
|
|
22
22
|
def docker_image_tag_latest_remote
|
23
23
|
log.debug "Getting latest remote docker image tag"
|
24
24
|
|
25
|
-
|
25
|
+
return false unless docker_check_running
|
26
26
|
|
27
27
|
tags = docker_image_tag_list_remote
|
28
28
|
|
29
29
|
if tags.nil?
|
30
|
-
log.
|
30
|
+
log.warn "No latest docker remote tag"
|
31
31
|
return ''
|
32
32
|
end
|
33
33
|
|
@@ -29,7 +29,10 @@ module Takelage
|
|
29
29
|
LONGDESC
|
30
30
|
# Print local docker image tags.
|
31
31
|
def local
|
32
|
-
|
32
|
+
tag_list_local = docker_image_tag_list_local
|
33
|
+
exit false if tag_list_local == false
|
34
|
+
say tag_list_local
|
35
|
+
true
|
33
36
|
end
|
34
37
|
|
35
38
|
#
|
@@ -41,7 +44,10 @@ module Takelage
|
|
41
44
|
LONGDESC
|
42
45
|
# Print latest remote docker image tag.
|
43
46
|
def remote
|
44
|
-
|
47
|
+
tag_list_remote = docker_image_tag_list_remote
|
48
|
+
exit false if tag_list_remote == false
|
49
|
+
say tag_list_remote
|
50
|
+
true
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
@@ -26,18 +26,18 @@ module DockerImageTagListModule
|
|
26
26
|
@res = Net::HTTP.get_response URI(@docker_tagsurl)
|
27
27
|
unless @res.code.eql? '200'
|
28
28
|
log.error "Unable to connect to \"#{@docker_tagsurl}\""
|
29
|
-
return
|
29
|
+
return false
|
30
30
|
end
|
31
31
|
rescue SocketError => e
|
32
32
|
log.debug e
|
33
|
-
|
33
|
+
return false
|
34
34
|
end
|
35
35
|
|
36
36
|
begin
|
37
37
|
tags = JSON.parse @res.body
|
38
38
|
rescue JSON::ParserError
|
39
39
|
log.error 'Unable to parse JSON'
|
40
|
-
|
40
|
+
return false
|
41
41
|
end
|
42
42
|
|
43
43
|
tags['tags'].sort_by(&Gem::Version.method(:new))
|
@@ -44,7 +44,7 @@ module Takelage
|
|
44
44
|
LONGDESC
|
45
45
|
# Start sockets for docker container.
|
46
46
|
def start
|
47
|
-
docker_socket_start
|
47
|
+
exit docker_socket_start
|
48
48
|
end
|
49
49
|
|
50
50
|
#
|
@@ -56,7 +56,7 @@ module Takelage
|
|
56
56
|
LONGDESC
|
57
57
|
# Stop sockets for docker container.
|
58
58
|
def stop
|
59
|
-
docker_socket_stop
|
59
|
+
exit docker_socket_stop
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -5,7 +5,7 @@ module DockerSocketModule
|
|
5
5
|
def docker_socket_start
|
6
6
|
log.debug 'Starting sockets for docker container'
|
7
7
|
|
8
|
-
|
8
|
+
return false unless docker_check_running
|
9
9
|
|
10
10
|
cmds_start_socket = _get_socket_start_commands sockets_up = false
|
11
11
|
|
@@ -13,25 +13,25 @@ module DockerSocketModule
|
|
13
13
|
log.debug 'Request sudo so that subsequent background tasks run without delay'
|
14
14
|
|
15
15
|
cmd_sudo_true = config.active['sudo_true']
|
16
|
-
|
17
16
|
run cmd_sudo_true
|
18
17
|
end
|
19
18
|
|
20
19
|
cmds_start_socket.each do |cmd_start_socket|
|
21
20
|
run_and_fork cmd_start_socket
|
22
21
|
end
|
22
|
+
|
23
|
+
true
|
23
24
|
end
|
24
25
|
|
25
26
|
# Backend method for docker socket stop.
|
26
27
|
def docker_socket_stop
|
27
28
|
log.debug 'Stopping sockets for docker container'
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
cmd_ps = config.active['docker_socket_ps']
|
30
|
+
return false unless docker_check_running
|
32
31
|
|
33
32
|
# get process list
|
34
33
|
# assuming format: "pid command"
|
34
|
+
cmd_ps = config.active['docker_socket_ps']
|
35
35
|
stdout_str = run cmd_ps
|
36
36
|
|
37
37
|
cmds_start_socket = _get_socket_start_commands sockets_up = true
|
@@ -51,11 +51,12 @@ module DockerSocketModule
|
|
51
51
|
log.debug "Killing PID #{pid}"
|
52
52
|
|
53
53
|
cmd_kill = config.active['docker_socket_kill'] % {pid: pid}
|
54
|
-
|
55
54
|
run cmd_kill
|
56
55
|
end
|
57
56
|
end
|
58
57
|
end
|
58
|
+
|
59
|
+
true
|
59
60
|
end
|
60
61
|
|
61
62
|
# get socket start commands
|
@@ -17,7 +17,10 @@ module Takelage
|
|
17
17
|
LONGDESC
|
18
18
|
# Print active project info.
|
19
19
|
def active
|
20
|
-
|
20
|
+
project_active_yaml = hash_to_yaml(project.active)
|
21
|
+
exit false if project_active_yaml == false
|
22
|
+
say project_active_yaml
|
23
|
+
true
|
21
24
|
end
|
22
25
|
|
23
26
|
#
|
@@ -29,7 +32,10 @@ module Takelage
|
|
29
32
|
LONGDESC
|
30
33
|
# Print private project info.
|
31
34
|
def private
|
32
|
-
|
35
|
+
project_private_yaml = hash_to_yaml(project.private)
|
36
|
+
exit false if project_private_yaml == false
|
37
|
+
say project_private_yaml
|
38
|
+
true
|
33
39
|
end
|
34
40
|
|
35
41
|
#
|
@@ -41,7 +47,10 @@ module Takelage
|
|
41
47
|
LONGDESC
|
42
48
|
# Print main project info.
|
43
49
|
def main
|
44
|
-
|
50
|
+
project_main_yaml = hash_to_yaml(project.main)
|
51
|
+
exit false if project_main_yaml == false
|
52
|
+
say project_main_yaml
|
53
|
+
true
|
45
54
|
end
|
46
55
|
end
|
47
56
|
end
|
data/lib/takelage/self/cli.rb
CHANGED
@@ -21,7 +21,10 @@ module Takelage
|
|
21
21
|
LONGDESC
|
22
22
|
# List all commands.
|
23
23
|
def list
|
24
|
-
self_list
|
24
|
+
list = self_list
|
25
|
+
exit false if list == false
|
26
|
+
say list
|
27
|
+
true
|
25
28
|
end
|
26
29
|
|
27
30
|
#
|
@@ -31,10 +34,10 @@ module Takelage
|
|
31
34
|
long_desc <<-LONGDESC.gsub("\n", "\x5")
|
32
35
|
Print takelage semantic version number
|
33
36
|
LONGDESC
|
34
|
-
#Print takelage semantic version number.
|
35
|
-
# @return [String] semantic version number
|
37
|
+
# Print takelage semantic version number.
|
36
38
|
def version
|
37
39
|
say VERSION
|
40
|
+
true
|
38
41
|
end
|
39
42
|
end
|
40
43
|
end
|
@@ -22,7 +22,10 @@ module Takelage
|
|
22
22
|
LONGDESC
|
23
23
|
# Print takelage default configuration.
|
24
24
|
def default
|
25
|
-
|
25
|
+
config_default_yaml = hash_to_yaml(config.default)
|
26
|
+
exit false if config_default_yaml == false
|
27
|
+
say config_default_yaml
|
28
|
+
true
|
26
29
|
end
|
27
30
|
|
28
31
|
#
|
@@ -36,7 +39,10 @@ module Takelage
|
|
36
39
|
LONGDESC
|
37
40
|
# Print takelage home config file configuration.
|
38
41
|
def home
|
39
|
-
|
42
|
+
config_home_yaml = hash_to_yaml(config.home)
|
43
|
+
exit false if config_home_yaml == false
|
44
|
+
say config_home_yaml
|
45
|
+
true
|
40
46
|
end
|
41
47
|
|
42
48
|
#
|
@@ -50,7 +56,10 @@ module Takelage
|
|
50
56
|
LONGDESC
|
51
57
|
# Print takelage home config file configuration.
|
52
58
|
def project
|
53
|
-
|
59
|
+
config_project_yaml = hash_to_yaml(config.project)
|
60
|
+
exit false if config_project_yaml == false
|
61
|
+
say config_project_yaml
|
62
|
+
true
|
54
63
|
end
|
55
64
|
|
56
65
|
#
|
@@ -64,7 +73,10 @@ module Takelage
|
|
64
73
|
LONGDESC
|
65
74
|
# Print active takelage configuration.
|
66
75
|
def active
|
67
|
-
|
76
|
+
config_active_yaml = hash_to_yaml(config.active)
|
77
|
+
exit false if config_active_yaml == false
|
78
|
+
say config_active_yaml
|
79
|
+
true
|
68
80
|
end
|
69
81
|
end
|
70
82
|
end
|
data/lib/takelage/self/module.rb
CHANGED
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|