takelage 0.4.1 → 0.4.2

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: f3317ab0e928960d0be0055030366be34f48d5ed125542070908e05e61122298
4
- data.tar.gz: 1e0c63f18ed4e3d1c15cc7ab1c32f06248401ef745f0465561e6a39d59601ecf
3
+ metadata.gz: eaa220fbcacb62fadb2ff18b8cebf3f02ee8a9c52b5ac74cb552b1c415f44ea1
4
+ data.tar.gz: 6e2868060bdd4e9d7c7a8f2f3c008b7ab32c529af0e96f130c8e154274bdb857
5
5
  SHA512:
6
- metadata.gz: 689a6d073393485e9db17d99817f83c426ce2b82b11ad948a4534f7abed58176b1e7a5de37b011b25d6054ba5fed79104364c4e4b22292801a6857c366ae3490
7
- data.tar.gz: ed13f91551353142defe290d8b1e2c5ef685c82f773ab7c64836597379847219b310e669ab404ef5cf5dfe12f4f185881dc28d7cd91b68975f95af7aa75e9354
6
+ metadata.gz: 6accaf12dae526c5a2b86ea6cbb0406ebfd4137ad919a2074d3e7bc8e6aa0b9acc3043199d88d10bab63e3b561ec9a18f764063dd95be86181740ef5bd3352f1
7
+ data.tar.gz: 5e66d4ba1c4575e63a8558814ecfa490d7a594c126fabe86ff704521e990af919a0a0bb1d93589af7c906d7626d3f8db6872e16e96ab4dde63d4ebbe00b1499e
@@ -84,8 +84,7 @@ module BitClipboardModule
84
84
  cmd_bit_export_to_scope = config.active['bit_export_to_scope'] % {scope: scope}
85
85
  run cmd_bit_export_to_scope
86
86
 
87
- # remove node_modules directory
88
- _rm_node_modules
87
+ _remove_bit_artifacts
89
88
 
90
89
  log.info "Copied directory \"#{dir}\" " +
91
90
  "as bit component \"#{id}\" " +
@@ -112,10 +111,7 @@ module BitClipboardModule
112
111
  cmd_bit_import_cid = config.active['bit_import_cid'] % {cid: cid, dir: dir}
113
112
  run cmd_bit_import_cid
114
113
 
115
- # remove node_modules directory
116
- _rm_node_modules
117
-
118
- FileUtils.remove_entry_secure("#{dir}/index.bit", force: true)
114
+ _remove_bit_artifacts
119
115
 
120
116
  log.info "Pasted bit component \"#{cid}\"" +
121
117
  "to directory \"#{dir}\""
@@ -145,8 +141,7 @@ module BitClipboardModule
145
141
  cmd_bit_checkout_all = config.active['bit_checkout_all']
146
142
  run cmd_bit_checkout_all
147
143
 
148
- # remove node_modules directory
149
- _rm_node_modules
144
+ _remove_bit_artifacts
150
145
 
151
146
  log.info "Pulled bit components"
152
147
  end
@@ -175,8 +170,7 @@ module BitClipboardModule
175
170
  cmd_bit_export_all = config.active['bit_export_all']
176
171
  run cmd_bit_export_all
177
172
 
178
- # remove node_modules directory
179
- _rm_node_modules
173
+ _remove_bit_artifacts
180
174
 
181
175
  log.info "Pushed bit components"
182
176
  end
@@ -205,8 +199,21 @@ module BitClipboardModule
205
199
  id
206
200
  end
207
201
 
202
+ # Remove bit artifacts.
203
+ def _remove_bit_artifacts
204
+ _remove_node_modules
205
+ _remove_index_bit
206
+ end
207
+
208
208
  # Remove node_modules directory.
209
- def _rm_node_modules
209
+ def _remove_node_modules
210
210
  FileUtils.remove_entry_secure('node_modules', force: true)
211
211
  end
212
+
213
+ # Remove index.bit files recursively.
214
+ def _remove_index_bit
215
+ Dir.glob("./**/index.bit").each do |file|
216
+ FileUtils.remove_entry_secure(file, force: true)
217
+ end
218
+ end
212
219
  end
@@ -37,3 +37,4 @@ git_uncommitted: 'git diff --cached --exit-code'
37
37
  info_project_main: 'project.yml'
38
38
  info_project_private: 'private/project.yml'
39
39
  pwd: 'pwd'
40
+ sudo_true: 'sudo true'
@@ -22,6 +22,20 @@ module Takelage
22
22
  exit docker_container_check_existing container
23
23
  end
24
24
 
25
+ #
26
+ # docker container check network
27
+ #
28
+ desc 'network [NETWORK]', 'Check if docker [NETWORK] is existing'
29
+ long_desc <<-LONGDESC.gsub("\n", "\x5")
30
+ Check if docker network is existing
31
+ This check looks for a network with a given name.
32
+ If such a network is existing the result is true else false.
33
+ LONGDESC
34
+ # Check if docker network is existing.
35
+ def network(network)
36
+ exit docker_container_check_network network
37
+ end
38
+
25
39
  #
26
40
  # docker container check orphaned
27
41
  #
@@ -21,6 +21,26 @@ module DockerContainerCheckModule
21
21
  true
22
22
  end
23
23
 
24
+ # Backend method for docker container check network.
25
+ # @return [Boolean] is network existing?
26
+ def docker_container_check_network(network)
27
+ log.debug "Checking if network \"#{network}\" is existing"
28
+
29
+ cmd_docker_network = 'docker network ls ' +
30
+ '--quiet ' +
31
+ "--filter name=#{network}"
32
+
33
+ stdout_str, stderr_str, status = run_and_check cmd_docker_network
34
+
35
+ if stdout_str.to_s.strip.empty?
36
+ log.debug "Network \"#{network}\" is not existing"
37
+ return false
38
+ end
39
+
40
+ log.debug "Network \"#{network}\" is existing"
41
+ true
42
+ end
43
+
24
44
  # Backend method for docker container check orphaned.
25
45
  # @return [Boolean] is container orphaned?
26
46
  def docker_container_check_orphaned(container)
@@ -9,7 +9,7 @@ module DockerContainerModule
9
9
 
10
10
  docker_socket_start
11
11
 
12
- _create_network @hostname unless _network_check_existing @hostname
12
+ _create_network @hostname unless docker_container_check_network @hostname
13
13
  _create_container @hostname unless docker_container_check_existing @hostname
14
14
  _run_command_in_container @hostname, command
15
15
  end
@@ -20,7 +20,7 @@ module DockerContainerModule
20
20
 
21
21
  exit false unless configured? %w(docker_repo docker_image docker_tag)
22
22
 
23
- _create_network @hostname unless _network_check_existing @hostname
23
+ _create_network @hostname unless docker_container_check_network @hostname
24
24
  _create_container @hostname unless docker_container_check_existing @hostname
25
25
  end
26
26
 
@@ -32,7 +32,7 @@ module DockerContainerModule
32
32
 
33
33
  docker_socket_start
34
34
 
35
- _create_network @hostname unless _network_check_existing @hostname
35
+ _create_network @hostname unless docker_container_check_network @hostname
36
36
  _create_container @hostname unless docker_container_check_existing @hostname
37
37
  _enter_container @hostname
38
38
  end
@@ -52,7 +52,7 @@ module DockerContainerModule
52
52
  end
53
53
 
54
54
  networks.each do |network|
55
- _remove_network network if _network_check_existing network
55
+ _remove_network network if docker_container_check_network network
56
56
  end
57
57
  end
58
58
 
@@ -73,7 +73,7 @@ module DockerContainerModule
73
73
  end
74
74
 
75
75
  networks.each do |network|
76
- _remove_network network if _network_check_existing network
76
+ _remove_network network if docker_container_check_network network
77
77
  end
78
78
  end
79
79
 
@@ -194,25 +194,6 @@ module DockerContainerModule
194
194
  stdout_str.split(/\n+/)
195
195
  end
196
196
 
197
- # Check if docker network exists.
198
- def _network_check_existing(network)
199
- log.debug "Checking if network \"#{network}\" is existing"
200
-
201
- cmd_docker_network_exist = 'docker network ls ' +
202
- '--quiet ' +
203
- "--filter name=#{network}"
204
-
205
- stdout_str, stderr_str, status = run_and_check cmd_docker_network_exist
206
-
207
- if stdout_str.to_s.strip.empty?
208
- log.debug "Network \"#{network}\" is not existing"
209
- return false
210
- end
211
-
212
- log.debug "Network \"#{network}\" is existing"
213
- true
214
- end
215
-
216
197
  # Remove docker network.
217
198
  def _remove_network network
218
199
  log.debug "Remove network \"#{network}\""
@@ -10,7 +10,7 @@ module DockerSocketModule
10
10
  unless cmds_start_socket.empty?
11
11
  log.debug 'Request sudo so that subsequent background tasks run without delay'
12
12
 
13
- cmd_sudo_true = 'sudo true'
13
+ cmd_sudo_true = config.active['sudo_true']
14
14
 
15
15
  run cmd_sudo_true
16
16
  end
data/lib/takelage/version CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geospin