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,222 +1,177 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# takelage bit clipboard module
|
2
4
|
module BitClipboardModule
|
3
|
-
|
4
5
|
# Backend method for bit copy.
|
5
6
|
def bit_clipboard_copy(dir, scope)
|
6
|
-
|
7
|
-
|
8
|
-
return false unless _prepare_workspace
|
9
|
-
|
10
|
-
if File.directory? dir
|
11
|
-
|
12
|
-
# remove trailing slash
|
13
|
-
dir = dir.chomp('/')
|
14
|
-
|
15
|
-
log.debug "Adding the directory \"#{dir}\" as a tagged bit component"
|
16
|
-
|
17
|
-
bit_dev =
|
18
|
-
config.active['bit_dev_user']
|
19
|
-
|
20
|
-
# check if scope is a candidate for a bit.dev remote scope
|
21
|
-
if scope.start_with? bit_dev + '.'
|
22
|
-
|
23
|
-
# check if bit.dev remote scope exists
|
24
|
-
cmd_bit_list_scope =
|
25
|
-
config.active['cmd_bit_clipboard_copy_bit_list_scope'] % {
|
26
|
-
scope: scope
|
27
|
-
}
|
28
|
-
|
29
|
-
status = try cmd_bit_list_scope
|
30
|
-
|
31
|
-
unless status.exitstatus.zero?
|
32
|
-
log.error "No bit.dev remote scope \"#{scope}\" found"
|
33
|
-
return false
|
34
|
-
end
|
35
|
-
|
36
|
-
else
|
37
|
-
|
38
|
-
# check if bit remote scope is added to local workspace
|
39
|
-
cmd_bit_list_remotes =
|
40
|
-
config.active['cmd_bit_clipboard_copy_bit_list_remotes']
|
41
|
-
|
42
|
-
stdout_str = run cmd_bit_list_remotes
|
43
|
-
|
44
|
-
unless /.*\s+#{scope}\s+.*/m.match? stdout_str
|
45
|
-
log.error "No bit remote scope \"#{scope}\" found in local bit workspace"
|
46
|
-
return false
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# check if a README.bit file exists in a subdirectory
|
51
|
-
Dir.glob("#{dir}/**/README.bit").each do |file|
|
52
|
-
unless file == "#{dir}/README.bit"
|
53
|
-
log.error "Nested README.bit file detected"
|
54
|
-
return false
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# touch README.bit if necessary
|
59
|
-
readme_bit = "#{dir}/README.bit"
|
60
|
-
unless File.file? readme_bit
|
61
|
-
log.info "Creating \"README.bit\" in \"#{dir}\""
|
62
|
-
File.open(readme_bit, 'w') {}
|
63
|
-
end
|
64
|
-
|
65
|
-
# generate component id from directory name
|
66
|
-
id = _id(dir)
|
67
|
-
|
68
|
-
# get bit add dir command from active config
|
69
|
-
cmd_bit_add_dir =
|
70
|
-
config.active['cmd_bit_clipboard_copy_bit_add_dir'] % {
|
71
|
-
id: id, dir: dir
|
72
|
-
}
|
7
|
+
# remove trailing slash
|
8
|
+
dir = dir.chomp('/')
|
73
9
|
|
74
|
-
|
75
|
-
|
76
|
-
# get bit tag dir command from active config
|
77
|
-
cmd_bit_tag_id =
|
78
|
-
config.active['cmd_bit_clipboard_copy_bit_tag_id'] % {
|
79
|
-
id: id
|
80
|
-
}
|
10
|
+
log.debug "Running bit copy \"#{dir}\" to \"#{scope}\""
|
81
11
|
|
82
|
-
|
12
|
+
return false unless _bit_clipboard_prepare_workspace
|
83
13
|
|
84
|
-
|
14
|
+
unless File.directory? dir
|
85
15
|
log.error "The directory \"#{dir}\" does not exist"
|
86
16
|
return false
|
87
17
|
end
|
88
18
|
|
89
|
-
|
90
|
-
cmd_bit_export_to_scope =
|
91
|
-
config.active['cmd_bit_clipboard_copy_bit_export_to_scope'] % {
|
92
|
-
scope: scope
|
93
|
-
}
|
94
|
-
|
95
|
-
run cmd_bit_export_to_scope
|
96
|
-
|
97
|
-
_remove_bit_artifacts
|
98
|
-
_sync_workspace
|
99
|
-
|
100
|
-
log.info "Copied directory \"#{dir}\" " +
|
101
|
-
"as bit component \"#{id}\" " +
|
102
|
-
"to bit remote scope \"#{scope}\""
|
103
|
-
true
|
19
|
+
_bit_clipboard_copy_dir dir, scope
|
104
20
|
end
|
105
21
|
|
106
22
|
# Backend method for bit paste.
|
107
23
|
def bit_clipboard_paste(cid, dir)
|
108
24
|
log.debug "Running bit paste \"#{cid}\" to \"#{dir}\""
|
109
25
|
|
110
|
-
return false unless
|
111
|
-
|
112
|
-
scope = cid.scan(/([^\/]*).*/).first.first
|
113
|
-
|
114
|
-
log.debug "Checking if scope \"#{scope}\" " +
|
115
|
-
"has contains component id \"#{cid}\""
|
116
|
-
|
117
|
-
# get components in remote scope
|
118
|
-
cmd_bit_list_scope =
|
119
|
-
config.active['cmd_bit_clipboard_paste_bit_list_scope'] % {
|
120
|
-
scope: scope
|
121
|
-
}
|
122
|
-
|
123
|
-
bit_list_scope = run cmd_bit_list_scope
|
124
|
-
|
125
|
-
unless bit_list_scope.include? '"id": "' + cid + '",'
|
126
|
-
log.error "No remote component \"#{cid}\""
|
127
|
-
return false
|
128
|
-
end
|
26
|
+
return false unless _bit_clipboard_prepare_workspace
|
129
27
|
|
130
|
-
|
131
|
-
cmd_bit_import_cid =
|
132
|
-
config.active['cmd_bit_clipboard_paste_bit_import_cid'] % {
|
133
|
-
cid: cid, dir: dir
|
134
|
-
}
|
135
|
-
|
136
|
-
run cmd_bit_import_cid
|
28
|
+
return false unless _bit_clipboard_cid_exists? cid
|
137
29
|
|
30
|
+
_bit_clipboard_import_cid cid, dir
|
138
31
|
_handle_bitignore
|
139
|
-
|
140
|
-
|
32
|
+
_bit_clipbpard_remove_bit_artifacts
|
33
|
+
_bit_clipboard_sync_workspace
|
141
34
|
|
142
|
-
log.info "Pasted bit component \"#{cid}\" "
|
143
|
-
"to directory \"#{dir}\""
|
35
|
+
log.info "Pasted bit component \"#{cid}\" to directory \"#{dir}\""
|
144
36
|
true
|
145
37
|
end
|
146
38
|
|
147
39
|
# Backend method for bit pull.
|
148
40
|
def bit_clipboard_pull
|
149
|
-
log.debug
|
150
|
-
|
151
|
-
return false unless _prepare_workspace
|
152
|
-
|
153
|
-
# import components into workspace
|
154
|
-
cmd_bit_import_all =
|
155
|
-
config.active['cmd_bit_clipboard_pull_bit_import_all']
|
156
|
-
|
157
|
-
run cmd_bit_import_all
|
41
|
+
log.debug 'Running bit pull'
|
158
42
|
|
159
|
-
|
160
|
-
cmd_bit_checkout_all =
|
161
|
-
config.active['cmd_bit_clipboard_pull_bit_checkout_all']
|
162
|
-
|
163
|
-
run cmd_bit_checkout_all
|
43
|
+
return false unless _bit_clipboard_prepare_workspace
|
164
44
|
|
45
|
+
_bit_clipboard_import_all
|
46
|
+
_bit_clipboard_checkout_all
|
165
47
|
_handle_bitignore
|
166
|
-
|
167
|
-
|
48
|
+
_bit_clipbpard_remove_bit_artifacts
|
49
|
+
_bit_clipboard_sync_workspace
|
168
50
|
|
169
|
-
log.info
|
51
|
+
log.info 'Pulled bit components'
|
170
52
|
true
|
171
53
|
end
|
172
54
|
|
173
55
|
# Backend method for bit push
|
174
56
|
def bit_clipboard_push
|
175
|
-
log.debug
|
57
|
+
log.debug 'Running bit push'
|
176
58
|
|
177
|
-
return false unless
|
59
|
+
return false unless _bit_clipboard_prepare_workspace
|
178
60
|
|
179
|
-
|
180
|
-
|
181
|
-
|
61
|
+
_bit_clipboard_tag_all
|
62
|
+
_bit_clipboard_export_all
|
63
|
+
_bit_clipbpard_remove_bit_artifacts
|
64
|
+
_bit_clipboard_sync_workspace
|
182
65
|
|
183
|
-
|
66
|
+
log.info 'Pushed bit components'
|
67
|
+
true
|
68
|
+
end
|
184
69
|
|
185
|
-
|
186
|
-
cmd_bit_export_all =
|
187
|
-
config.active['cmd_bit_clipboard_push_bit_export_all']
|
70
|
+
private
|
188
71
|
|
189
|
-
|
72
|
+
# rubocop:disable Metrics/MethodLength
|
73
|
+
def _bit_clipboard_copy_dir(dir, scope)
|
74
|
+
log.debug "Adding the directory \"#{dir}\" as a tagged bit component"
|
190
75
|
|
191
|
-
|
192
|
-
_sync_workspace
|
76
|
+
return false unless _bit_clipboard_copy_dir_scope_exists scope
|
193
77
|
|
194
|
-
|
195
|
-
|
78
|
+
return false if _bit_clipboard_readme_bit_exists_in_subdir dir
|
79
|
+
|
80
|
+
id = _id(dir)
|
81
|
+
|
82
|
+
_bit_clipboard_touch_readme_bit dir
|
83
|
+
_bit_clipboard_add_dir id, dir
|
84
|
+
_bit_clipboard_tag_dir id
|
85
|
+
_bit_clipboard_export_to_scope scope
|
86
|
+
_bit_clipbpard_remove_bit_artifacts
|
87
|
+
_bit_clipboard_sync_workspace
|
88
|
+
|
89
|
+
log.info "Copied directory \"#{dir}\" as bit component \"#{id}\" " \
|
90
|
+
"to bit remote scope \"#{scope}\""
|
196
91
|
end
|
92
|
+
# rubocop:enable Metrics/MethodLength
|
197
93
|
|
198
94
|
# Genereate .gitignore if bitignore is present
|
199
95
|
def _handle_bitignore
|
200
|
-
log.debug
|
96
|
+
log.debug 'Handling bitgnore files'
|
201
97
|
|
202
98
|
# find all bitgnore files
|
203
|
-
Dir.glob(
|
204
|
-
|
205
|
-
log.debug file
|
206
|
-
|
99
|
+
Dir.glob('./**/bitignore').each do |file|
|
207
100
|
# get directory of bitignore file
|
208
101
|
dir = File.dirname file
|
209
102
|
|
210
103
|
# build gitignore filepath
|
211
|
-
|
212
|
-
|
213
|
-
log.debug gitignore
|
104
|
+
gitignore_file = "#{dir}/.gitignore"
|
214
105
|
|
215
|
-
unless File.exist?
|
106
|
+
unless File.exist? gitignore_file
|
216
107
|
log.debug "Creating \".gitignore\" in \"#{dir}\""
|
217
|
-
File.open(
|
108
|
+
File.open(gitignore_file, 'w') { |gitignore| gitignore.write('*') }
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# touch README.bit if necessary
|
114
|
+
def _bit_clipboard_touch_readme_bit(dir)
|
115
|
+
readme_bit = "#{dir}/README.bit"
|
116
|
+
return if File.file? readme_bit
|
117
|
+
|
118
|
+
log.info "Creating \"README.bit\" in \"#{dir}\""
|
119
|
+
File.open(readme_bit, 'w') {}
|
120
|
+
end
|
121
|
+
|
122
|
+
# check if a README.bit file exists in a subdirectory
|
123
|
+
def _bit_clipboard_readme_bit_exists_in_subdir(dir)
|
124
|
+
Dir.glob("#{dir}/**/README.bit").each do |file|
|
125
|
+
unless file == "#{dir}/README.bit"
|
126
|
+
log.error 'Nested README.bit file detected'
|
127
|
+
return true
|
218
128
|
end
|
219
129
|
end
|
130
|
+
|
131
|
+
false
|
132
|
+
end
|
133
|
+
|
134
|
+
# Check if bit scope exists
|
135
|
+
def _bit_clipboard_copy_dir_scope_exists(scope)
|
136
|
+
bit_dev = config.active['bit_dev_user']
|
137
|
+
|
138
|
+
# check if scope is a candidate for a bit.dev remote scope
|
139
|
+
if scope.start_with? bit_dev + '.'
|
140
|
+
return false unless _bit_clipboard_bit_dev_scope_exists scope
|
141
|
+
else
|
142
|
+
return false unless _bit_clipboard_custom_scope_exists scope
|
143
|
+
end
|
144
|
+
|
145
|
+
true
|
146
|
+
end
|
147
|
+
|
148
|
+
# check if bit.dev remote scope exists
|
149
|
+
def _bit_clipboard_bit_dev_scope_exists(scope)
|
150
|
+
cmd_bit_list_scope = format(
|
151
|
+
config.active['cmd_bit_clipboard_copy_bit_list_scope'],
|
152
|
+
scope: scope
|
153
|
+
)
|
154
|
+
|
155
|
+
status = try cmd_bit_list_scope
|
156
|
+
|
157
|
+
return true if status.exitstatus.zero?
|
158
|
+
|
159
|
+
log.error "No bit.dev remote scope \"#{scope}\" found"
|
160
|
+
false
|
161
|
+
end
|
162
|
+
|
163
|
+
# check if bit remote scope is added to local workspace
|
164
|
+
def _bit_clipboard_custom_scope_exists(scope)
|
165
|
+
cmd_bit_list_remotes =
|
166
|
+
config.active['cmd_bit_clipboard_copy_bit_list_remotes']
|
167
|
+
|
168
|
+
stdout_str = run cmd_bit_list_remotes
|
169
|
+
|
170
|
+
return true if /.*\s+#{scope}\s+.*/m.match? stdout_str
|
171
|
+
|
172
|
+
log.error "No bit remote scope \"#{scope}\" " \
|
173
|
+
'found in local bit workspace'
|
174
|
+
false
|
220
175
|
end
|
221
176
|
|
222
177
|
# Generate bit component ID.
|
@@ -236,7 +191,7 @@ module BitClipboardModule
|
|
236
191
|
# iterate over directory or file name
|
237
192
|
# and replace invalid characters with underscore
|
238
193
|
dir_downcase.split('').each do |char|
|
239
|
-
id +=
|
194
|
+
id += allowed_chars.include?(char) ? char : '_'
|
240
195
|
end
|
241
196
|
|
242
197
|
log.debug "Generated bit id \"#{id}\" from \"#{name}\""
|
@@ -244,14 +199,14 @@ module BitClipboardModule
|
|
244
199
|
end
|
245
200
|
|
246
201
|
# Prepare workspace for bit clipboard.
|
247
|
-
|
202
|
+
# rubocop:disable Metrics/MethodLength
|
203
|
+
def _bit_clipboard_prepare_workspace
|
248
204
|
unless bit_check_workspace
|
249
205
|
log.error 'No bit workspace'
|
250
206
|
return false
|
251
207
|
end
|
252
208
|
|
253
209
|
if git_check_workspace
|
254
|
-
|
255
210
|
unless git_check_master
|
256
211
|
log.error 'Not on git master branch'
|
257
212
|
return false
|
@@ -262,31 +217,36 @@ module BitClipboardModule
|
|
262
217
|
return false
|
263
218
|
end
|
264
219
|
|
265
|
-
|
266
|
-
|
267
|
-
|
220
|
+
return _bit_clipboard_git_pull
|
221
|
+
end
|
222
|
+
|
223
|
+
true
|
224
|
+
end
|
225
|
+
# rubocop:enable Metrics/MethodLength
|
226
|
+
|
227
|
+
def _bit_clipboard_cid_exists?(cid)
|
228
|
+
scope = cid.scan(%r{([^/]*).*}).first.first
|
268
229
|
|
269
|
-
|
230
|
+
log.debug "Checking if scope \"#{scope}\" " \
|
231
|
+
"contains component id \"#{cid}\""
|
270
232
|
|
271
|
-
|
272
|
-
log.error "Unable to update git workspace"
|
273
|
-
return false
|
274
|
-
end
|
233
|
+
bit_list_scope = _bit_clipboard_cid_exists_list_scope scope
|
275
234
|
|
276
|
-
|
235
|
+
return true if bit_list_scope.include? '"id": "' + cid + '",'
|
277
236
|
|
278
|
-
|
237
|
+
log.error "No remote component \"#{cid}\""
|
238
|
+
false
|
279
239
|
end
|
280
240
|
|
281
241
|
# Remove bit artifacts.
|
282
|
-
def
|
283
|
-
log.debug
|
242
|
+
def _bit_clipbpard_remove_bit_artifacts
|
243
|
+
log.debug 'Removing bit artifacts'
|
284
244
|
|
285
245
|
# Remove node_modules directory.
|
286
246
|
FileUtils.remove_entry_secure('node_modules', force: true)
|
287
247
|
|
288
248
|
# Remove index.bit files recursively.
|
289
|
-
Dir.glob(
|
249
|
+
Dir.glob('./**/index.bit').each do |file|
|
290
250
|
FileUtils.remove_entry_secure(file, force: true)
|
291
251
|
end
|
292
252
|
|
@@ -294,38 +254,148 @@ module BitClipboardModule
|
|
294
254
|
FileUtils.remove_entry_secure('package.json', force: true)
|
295
255
|
end
|
296
256
|
|
257
|
+
# bit tag dir
|
258
|
+
def _bit_clipboard_add_dir(id, dir)
|
259
|
+
cmd_bit_add_dir = format(
|
260
|
+
config.active['cmd_bit_clipboard_copy_bit_add_dir'],
|
261
|
+
id: id,
|
262
|
+
dir: dir
|
263
|
+
)
|
264
|
+
|
265
|
+
run cmd_bit_add_dir
|
266
|
+
end
|
267
|
+
|
268
|
+
# bit tag dir
|
269
|
+
def _bit_clipboard_tag_dir(id)
|
270
|
+
cmd_bit_tag_id = format(
|
271
|
+
config.active['cmd_bit_clipboard_copy_bit_tag_id'],
|
272
|
+
id: id
|
273
|
+
)
|
274
|
+
|
275
|
+
run cmd_bit_tag_id
|
276
|
+
end
|
277
|
+
|
278
|
+
# bit export component to bit remote scope
|
279
|
+
def _bit_clipboard_export_to_scope(scope)
|
280
|
+
cmd_bit_export_to_scope = format(
|
281
|
+
config.active['cmd_bit_clipboard_copy_bit_export_to_scope'],
|
282
|
+
scope: scope
|
283
|
+
)
|
284
|
+
|
285
|
+
run cmd_bit_export_to_scope
|
286
|
+
end
|
287
|
+
|
288
|
+
# paste bit component into directory
|
289
|
+
def _bit_clipboard_import_cid(cid, dir)
|
290
|
+
cmd_bit_import_cid = format(
|
291
|
+
config.active['cmd_bit_clipboard_paste_bit_import_cid'],
|
292
|
+
cid: cid,
|
293
|
+
dir: dir
|
294
|
+
)
|
295
|
+
|
296
|
+
run cmd_bit_import_cid
|
297
|
+
end
|
298
|
+
|
299
|
+
# bit import components into workspace
|
300
|
+
def _bit_clipboard_import_all
|
301
|
+
cmd_bit_import_all =
|
302
|
+
config.active['cmd_bit_clipboard_pull_bit_import_all']
|
303
|
+
|
304
|
+
run cmd_bit_import_all
|
305
|
+
end
|
306
|
+
|
307
|
+
# checkout components and merge them
|
308
|
+
def _bit_clipboard_checkout_all
|
309
|
+
cmd_bit_checkout_all =
|
310
|
+
config.active['cmd_bit_clipboard_pull_bit_checkout_all']
|
311
|
+
|
312
|
+
run cmd_bit_checkout_all
|
313
|
+
end
|
314
|
+
|
315
|
+
# bit tag all components
|
316
|
+
def _bit_clipboard_tag_all
|
317
|
+
cmd_bit_tag_all =
|
318
|
+
config.active['cmd_bit_clipboard_push_bit_tag_all']
|
319
|
+
|
320
|
+
run cmd_bit_tag_all
|
321
|
+
end
|
322
|
+
|
323
|
+
# bit export components
|
324
|
+
def _bit_clipboard_export_all
|
325
|
+
cmd_bit_export_all =
|
326
|
+
config.active['cmd_bit_clipboard_push_bit_export_all']
|
327
|
+
|
328
|
+
run cmd_bit_export_all
|
329
|
+
end
|
330
|
+
|
297
331
|
# Sync workspace with upstream.
|
298
|
-
def
|
299
|
-
log.debug
|
332
|
+
def _bit_clipboard_sync_workspace
|
333
|
+
log.debug 'Syncing git workspace'
|
300
334
|
|
301
|
-
|
335
|
+
_rakefile, path = Rake.application.find_rakefile_location
|
302
336
|
bitmap = "#{path}/.bitmap"
|
303
337
|
|
304
|
-
|
338
|
+
_bit_clipboard_git_add bitmap
|
339
|
+
_bit_clipboard_git_commit bitmap
|
340
|
+
_bit_clipboard_git_push
|
341
|
+
end
|
305
342
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
}
|
343
|
+
# git add .bitmap
|
344
|
+
def _bit_clipboard_git_add(bitmap)
|
345
|
+
log.debug "Adding \"#{bitmap}\" to git"
|
310
346
|
|
347
|
+
cmd_bit_clipboard_git_add = format(
|
348
|
+
config.active['cmd_bit_clipboard_git_add'],
|
349
|
+
file: bitmap
|
350
|
+
)
|
311
351
|
run cmd_bit_clipboard_git_add
|
352
|
+
end
|
312
353
|
|
313
|
-
|
354
|
+
# git commit -m "Update .bitmap"
|
355
|
+
def _bit_clipboard_git_commit(bitmap)
|
356
|
+
message = 'Update .bitmap'
|
314
357
|
|
315
358
|
log.debug "Committing \"#{bitmap}\" to git"
|
316
359
|
|
317
|
-
cmd_bit_clipboard_git_commit =
|
318
|
-
|
319
|
-
|
320
|
-
|
360
|
+
cmd_bit_clipboard_git_commit = format(
|
361
|
+
config.active['cmd_bit_clipboard_git_commit'],
|
362
|
+
message: message
|
363
|
+
)
|
321
364
|
|
322
365
|
run cmd_bit_clipboard_git_commit
|
366
|
+
end
|
323
367
|
|
324
|
-
|
368
|
+
# git push origin master
|
369
|
+
def _bit_clipboard_git_push
|
370
|
+
log.debug 'Pushing master branch to origin'
|
325
371
|
|
326
372
|
cmd_bit_clipboard_git_push =
|
327
|
-
|
373
|
+
config.active['cmd_bit_clipboard_git_push']
|
328
374
|
|
329
375
|
run cmd_bit_clipboard_git_push
|
330
376
|
end
|
377
|
+
|
378
|
+
# git pull
|
379
|
+
def _bit_clipboard_git_pull
|
380
|
+
log.debug 'Updating git workspace'
|
381
|
+
cmd_bit_clipboard_git_pull =
|
382
|
+
config.active['cmd_bit_clipboard_git_pull']
|
383
|
+
|
384
|
+
result_git_pull = try cmd_bit_clipboard_git_pull
|
385
|
+
|
386
|
+
return true unless result_git_pull
|
387
|
+
|
388
|
+
log.error 'Unable to update git workspace'
|
389
|
+
false
|
390
|
+
end
|
391
|
+
|
392
|
+
# get components in remote scope
|
393
|
+
def _bit_clipboard_cid_exists_list_scope(scope)
|
394
|
+
cmd_bit_list_scope = format(
|
395
|
+
config.active['cmd_bit_clipboard_paste_bit_list_scope'],
|
396
|
+
scope: scope
|
397
|
+
)
|
398
|
+
|
399
|
+
run cmd_bit_list_scope
|
400
|
+
end
|
331
401
|
end
|