takeltau 0.34.12 → 0.35.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/lib/takeltau/completion/cli.rb +1 -1
  3. data/lib/takeltau/default.yml +10 -35
  4. data/lib/takeltau/docker/check/cli.rb +1 -1
  5. data/lib/takeltau/docker/check/daemon.rb +1 -1
  6. data/lib/takeltau/docker/cli.rb +1 -1
  7. data/lib/takeltau/docker/container/check/cli.rb +1 -1
  8. data/lib/takeltau/docker/container/check/existing.rb +1 -1
  9. data/lib/takeltau/docker/container/check/network.rb +1 -1
  10. data/lib/takeltau/docker/container/check/orphaned.rb +1 -1
  11. data/lib/takeltau/docker/container/clean.rb +1 -1
  12. data/lib/takeltau/docker/container/cli.rb +1 -1
  13. data/lib/takeltau/docker/container/command.rb +1 -1
  14. data/lib/takeltau/docker/container/daemon.rb +1 -1
  15. data/lib/takeltau/docker/container/lib.rb +1 -1
  16. data/lib/takeltau/docker/container/login.rb +1 -1
  17. data/lib/takeltau/docker/container/prune.rb +1 -1
  18. data/lib/takeltau/docker/image/cli.rb +1 -1
  19. data/lib/takeltau/docker/image/tag/check.rb +1 -1
  20. data/lib/takeltau/docker/image/tag/cli.rb +1 -1
  21. data/lib/takeltau/docker/image/tag/latest.rb +1 -1
  22. data/lib/takeltau/docker/image/tag/list.rb +1 -1
  23. data/lib/takeltau/docker/image/update.rb +1 -1
  24. data/lib/takeltau/git/check/clean.rb +1 -1
  25. data/lib/takeltau/git/check/cli.rb +14 -14
  26. data/lib/takeltau/git/check/hg.rb +26 -0
  27. data/lib/takeltau/git/check/workspace.rb +1 -1
  28. data/lib/takeltau/git/cli.rb +1 -1
  29. data/lib/takeltau/git/lib.rb +80 -0
  30. data/lib/takeltau/hg/cli.rb +56 -0
  31. data/lib/takeltau/hg/export.rb +18 -0
  32. data/lib/takeltau/hg/pull.rb +45 -0
  33. data/lib/takeltau/hg/push.rb +42 -0
  34. data/lib/takeltau/info/cli.rb +1 -1
  35. data/lib/takeltau/info/project/cli.rb +1 -1
  36. data/lib/takeltau/info/status/bar.rb +1 -1
  37. data/lib/takeltau/info/status/cli.rb +1 -1
  38. data/lib/takeltau/info/status/git.rb +1 -1
  39. data/lib/takeltau/info/status/gopass.rb +1 -1
  40. data/lib/takeltau/info/status/gpg.rb +1 -1
  41. data/lib/takeltau/info/status/lib.rb +1 -1
  42. data/lib/takeltau/info/status/ssh.rb +1 -1
  43. data/lib/takeltau/init/lib.rb +9 -28
  44. data/lib/takeltau/init/packer/cli.rb +4 -14
  45. data/lib/takeltau/init/packer/docker.rb +2 -5
  46. data/lib/takeltau/init/packer/templates/hgclone.tt +8 -0
  47. data/lib/takeltau/init/packer/templates/projectyml.tt +2 -6
  48. data/lib/takeltau/init/takelage/cli.rb +4 -14
  49. data/lib/takeltau/init/takelage/rake.rb +2 -5
  50. data/lib/takeltau/init/takelage/templates/hgclone.tt +2 -0
  51. data/lib/takeltau/lib/config.rb +2 -2
  52. data/lib/takeltau/lib/logging.rb +2 -2
  53. data/lib/takeltau/lib/project.rb +2 -2
  54. data/lib/takeltau/mutagen/check/cli.rb +1 -1
  55. data/lib/takeltau/mutagen/check/daemon.rb +1 -1
  56. data/lib/takeltau/mutagen/cli.rb +1 -1
  57. data/lib/takeltau/mutagen/socket/check.rb +1 -1
  58. data/lib/takeltau/mutagen/socket/cli.rb +1 -1
  59. data/lib/takeltau/mutagen/socket/create.rb +1 -1
  60. data/lib/takeltau/mutagen/socket/list.rb +1 -1
  61. data/lib/takeltau/mutagen/socket/terminate.rb +1 -1
  62. data/lib/takeltau/mutagen/socket/tidy.rb +1 -1
  63. data/lib/takeltau/self/cli.rb +1 -1
  64. data/lib/takeltau/self/config/cli.rb +1 -1
  65. data/lib/takeltau/self/list.rb +1 -1
  66. data/lib/takeltau/version +1 -1
  67. data/lib/takeltau.rb +37 -62
  68. metadata +9 -22
  69. data/lib/takeltau/bit/check/cli.rb +0 -23
  70. data/lib/takeltau/bit/check/workspace.rb +0 -37
  71. data/lib/takeltau/bit/cli.rb +0 -18
  72. data/lib/takeltau/bit/clipboard/cli.rb +0 -73
  73. data/lib/takeltau/bit/clipboard/copy.rb +0 -142
  74. data/lib/takeltau/bit/clipboard/lib.rb +0 -143
  75. data/lib/takeltau/bit/clipboard/paste.rb +0 -60
  76. data/lib/takeltau/bit/clipboard/pull.rb +0 -37
  77. data/lib/takeltau/bit/clipboard/push.rb +0 -37
  78. data/lib/takeltau/bit/require/cli.rb +0 -57
  79. data/lib/takeltau/bit/require/export.rb +0 -34
  80. data/lib/takeltau/bit/require/import.rb +0 -133
  81. data/lib/takeltau/bit/require/lib.rb +0 -19
  82. data/lib/takeltau/bit/scope/add.rb +0 -55
  83. data/lib/takeltau/bit/scope/cli.rb +0 -74
  84. data/lib/takeltau/bit/scope/list.rb +0 -41
  85. data/lib/takeltau/bit/scope/new.rb +0 -44
  86. data/lib/takeltau/bit/scope/ssh.rb +0 -13
  87. data/lib/takeltau/git/check/bit.rb +0 -26
  88. data/lib/takeltau/init/packer/templates/bitrequireyml.tt +0 -13
  89. data/lib/takeltau/init/takelage/templates/bitrequireyml.tt +0 -5
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: takeltau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.12
4
+ version: 0.35.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takelwerk
@@ -205,24 +205,6 @@ files:
205
205
  - bin/tau
206
206
  - lib/Thorfile
207
207
  - lib/takeltau.rb
208
- - lib/takeltau/bit/check/cli.rb
209
- - lib/takeltau/bit/check/workspace.rb
210
- - lib/takeltau/bit/cli.rb
211
- - lib/takeltau/bit/clipboard/cli.rb
212
- - lib/takeltau/bit/clipboard/copy.rb
213
- - lib/takeltau/bit/clipboard/lib.rb
214
- - lib/takeltau/bit/clipboard/paste.rb
215
- - lib/takeltau/bit/clipboard/pull.rb
216
- - lib/takeltau/bit/clipboard/push.rb
217
- - lib/takeltau/bit/require/cli.rb
218
- - lib/takeltau/bit/require/export.rb
219
- - lib/takeltau/bit/require/import.rb
220
- - lib/takeltau/bit/require/lib.rb
221
- - lib/takeltau/bit/scope/add.rb
222
- - lib/takeltau/bit/scope/cli.rb
223
- - lib/takeltau/bit/scope/list.rb
224
- - lib/takeltau/bit/scope/new.rb
225
- - lib/takeltau/bit/scope/ssh.rb
226
208
  - lib/takeltau/completion/cli.rb
227
209
  - lib/takeltau/default.yml
228
210
  - lib/takeltau/docker/check/cli.rb
@@ -245,11 +227,16 @@ files:
245
227
  - lib/takeltau/docker/image/tag/latest.rb
246
228
  - lib/takeltau/docker/image/tag/list.rb
247
229
  - lib/takeltau/docker/image/update.rb
248
- - lib/takeltau/git/check/bit.rb
249
230
  - lib/takeltau/git/check/clean.rb
250
231
  - lib/takeltau/git/check/cli.rb
232
+ - lib/takeltau/git/check/hg.rb
251
233
  - lib/takeltau/git/check/workspace.rb
252
234
  - lib/takeltau/git/cli.rb
235
+ - lib/takeltau/git/lib.rb
236
+ - lib/takeltau/hg/cli.rb
237
+ - lib/takeltau/hg/export.rb
238
+ - lib/takeltau/hg/pull.rb
239
+ - lib/takeltau/hg/push.rb
253
240
  - lib/takeltau/info/cli.rb
254
241
  - lib/takeltau/info/project/cli.rb
255
242
  - lib/takeltau/info/status/bar.rb
@@ -264,13 +251,13 @@ files:
264
251
  - lib/takeltau/init/packer/cli.rb
265
252
  - lib/takeltau/init/packer/docker.rb
266
253
  - lib/takeltau/init/packer/templates/ansiblelint.tt
267
- - lib/takeltau/init/packer/templates/bitrequireyml.tt
268
254
  - lib/takeltau/init/packer/templates/groupvarsprojectyml.tt
255
+ - lib/takeltau/init/packer/templates/hgclone.tt
269
256
  - lib/takeltau/init/packer/templates/playbooksiteyml.tt
270
257
  - lib/takeltau/init/packer/templates/projectyml.tt
271
258
  - lib/takeltau/init/takelage/cli.rb
272
259
  - lib/takeltau/init/takelage/rake.rb
273
- - lib/takeltau/init/takelage/templates/bitrequireyml.tt
260
+ - lib/takeltau/init/takelage/templates/hgclone.tt
274
261
  - lib/takeltau/init/takelage/templates/projectyml.tt
275
262
  - lib/takeltau/init/templates/Rakefile.tt
276
263
  - lib/takeltau/init/templates/gitignore.tt
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Takeltau
4
- # takeltau bit check
5
- class BitCheck < SubCommandBase
6
- include LoggingModule
7
- include SystemModule
8
- include ConfigModule
9
- include BitCheckWorkspace
10
-
11
- #
12
- # bit check workspace
13
- #
14
- desc 'workspace', 'Check if a bit workspace exists'
15
- long_desc <<-LONGDESC.gsub("\n", "\x5")
16
- Check if a bit workspace exists
17
- LONGDESC
18
- # Check if a bit workspace exists.
19
- def workspace
20
- exit bit_check_workspace
21
- end
22
- end
23
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # takeltau bit check workspace
4
- module BitCheckWorkspace
5
- # Backend method for bit check workspace.
6
- # @return [Boolean] is this a bit workspace?
7
- def bit_check_workspace
8
- log.debug 'Check if this is a bit workspace'
9
-
10
- status_repo = _bit_check_workspace_bit_repo
11
- return true if status_repo.exitstatus.zero?
12
-
13
- dir = _bit_check_workspace_dir
14
- log.debug "No bit workspace found in \"#{dir}\""
15
- false
16
- end
17
-
18
- private
19
-
20
- # Check bit repo.
21
- def _bit_check_workspace_bit_repo
22
- cmd_bit_repo =
23
- config.active['cmd_bit_check_workspace_bit_list']
24
-
25
- try cmd_bit_repo
26
- end
27
-
28
- # Get current working directory.
29
- def _bit_check_workspace_dir
30
- cmd_pwd =
31
- config.active['cmd_bit_check_workspace_pwd']
32
-
33
- stdout_str_dir = run cmd_pwd
34
-
35
- stdout_str_dir.chomp
36
- end
37
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Takeltau
4
- # takeltau bit
5
- class Bit < SubCommandBase
6
- desc 'check [COMMAND]', 'Check bit state'
7
- subcommand 'check', BitCheck
8
-
9
- desc 'clipboard [COMMAND]', 'Manage bit clipboard'
10
- subcommand 'clipboard', BitClipboard
11
-
12
- desc 'require [COMMAND]', 'Manage bit requirements'
13
- subcommand 'require', BitRequire
14
-
15
- desc 'scope [COMMAND]', 'Manage bit scopes'
16
- subcommand 'scope', BitScope
17
- end
18
- end
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Takeltau
4
- # takeltau bit clipboard
5
- class BitClipboard < SubCommandBase
6
- include LoggingModule
7
- include ConfigModule
8
- include SystemModule
9
- include GitCheckClean
10
- include GitCheckBit
11
- include GitCheckWorkspace
12
- include BitCheckWorkspace
13
- include BitClipboardLib
14
- include BitClipboardCopy
15
- include BitClipboardPaste
16
- include BitClipboardPull
17
- include BitClipboardPush
18
-
19
- #
20
- # bit copy
21
- #
22
- desc 'copy [DIR] [SCOPE]', 'Copy new [DIR] to [SCOPE]'
23
- long_desc <<-LONGDESC.gsub("\n", "\x5")
24
- Copy a directory as a bit component to a bit remote scope
25
- This command will add a directory as a bit component and tag it.
26
- The id of the component will be created from the directory name.
27
- The directory needs to contain a README.bit file
28
- or else a new README.bit file will be created.
29
- The README.bit will be the main file of the component which must not be deleted.
30
- The tagged bit component will be exported to a bit remote scope.
31
- LONGDESC
32
- # Copy a file or directory as a bit component to a bit remote scope.
33
- def copy(dir_or_file, scope)
34
- exit bit_clipboard_copy dir_or_file, scope
35
- end
36
-
37
- #
38
- # bit paste
39
- #
40
- desc 'paste [COMPONENT] [DIR]', 'Paste bit [COMPONENT] into [DIR]'
41
- long_desc <<-LONGDESC.gsub("\n", "\x5")
42
- Paste a bit component into a directory
43
- LONGDESC
44
- # Paste a bit component into a directory.
45
- def paste(cid, dir)
46
- exit bit_clipboard_paste cid, dir
47
- end
48
-
49
- #
50
- # bit pull
51
- #
52
- desc 'pull', 'Pull all updates for bit components from bit remote scopes'
53
- long_desc <<-LONGDESC.gsub("\n", "\x5")
54
- Pull all updates for bit components from bit remote scopes
55
- LONGDESC
56
- # Pull all updates for bit components from bit remote scopes.
57
- def pull
58
- exit bit_clipboard_pull
59
- end
60
-
61
- #
62
- # bit push
63
- #
64
- desc 'push', 'Push all updates of bit components to bit remote scopes'
65
- long_desc <<-LONGDESC.gsub("\n", "\x5")
66
- Push all updates of bit components to bit remote scopes
67
- LONGDESC
68
- # Push all updates of bit components to bit remote scopes.
69
- def push
70
- exit bit_clipboard_push
71
- end
72
- end
73
- end
@@ -1,142 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # takeltau bit clipboard copy
4
- module BitClipboardCopy
5
- # Backend method for bit copy.
6
- def bit_clipboard_copy(dir, scope)
7
- # remove trailing slash
8
- dir = dir.chomp('/')
9
-
10
- log.debug "Running bit copy \"#{dir}\" to \"#{scope}\""
11
-
12
- return false unless configured? %w[project_root_dir]
13
-
14
- return false unless _bit_clipboard_lib_prepare_workspace
15
-
16
- unless File.directory? dir
17
- log.error "The directory \"#{dir}\" does not exist"
18
- return false
19
- end
20
-
21
- _bit_clipboard_copy_dir dir, scope
22
- end
23
-
24
- private
25
-
26
- # rubocop:disable Metrics/MethodLength
27
- def _bit_clipboard_copy_dir(dir, scope)
28
- log.debug "Adding the directory \"#{dir}\" as a tagged bit component"
29
-
30
- return false unless _bit_clipboard_copy_dir_scope_exists? scope
31
-
32
- return false if _bit_clipboard_copy_readme_bit_exists_in_subdir? dir
33
-
34
- id = _bit_clipboard_lib_id(dir)
35
-
36
- _bit_clipboard_copy_touch_readme_bit dir
37
- _bit_clipboard_copy_add_dir id, dir
38
- _bit_clipboard_copy_tag_dir id
39
- _bit_clipboard_copy_export_to_scope scope
40
- _bit_clipbpard_lib_remove_bit_artifacts
41
- _bit_clipboard_lib_sync_workspace
42
-
43
- log.info "Copied directory \"#{dir}\" as bit component \"#{id}\" " \
44
- "to bit remote scope \"#{scope}\""
45
- end
46
- # rubocop:enable Metrics/MethodLength
47
-
48
- # Touch README.bit if necessary.
49
- def _bit_clipboard_copy_touch_readme_bit(dir)
50
- readme_bit = "#{dir}/README.bit"
51
- return if File.file? readme_bit
52
-
53
- log.info "Creating \"README.bit\" in \"#{dir}\""
54
- File.open(readme_bit, 'w') {}
55
- end
56
-
57
- # Check if a README.bit file exists in a subdirectory.
58
- def _bit_clipboard_copy_readme_bit_exists_in_subdir?(dir)
59
- Dir.glob("#{dir}/**/README.bit").each do |file|
60
- unless file == "#{dir}/README.bit"
61
- log.error 'Nested README.bit file detected'
62
- return true
63
- end
64
- end
65
-
66
- false
67
- end
68
-
69
- # Check if bit scope exists.
70
- def _bit_clipboard_copy_dir_scope_exists?(scope)
71
- bit_dev = config.active['bit_dev_user']
72
-
73
- # check if scope is a candidate for a bit.dev remote scope
74
- if scope.start_with? "#{bit_dev}."
75
- return false unless _bit_clipboard_bit_dev_scope_exists scope
76
- else
77
- return false unless _bit_clipboard_custom_scope_exists scope
78
- end
79
-
80
- true
81
- end
82
-
83
- # Check if bit.dev remote scope exists.
84
- def _bit_clipboard_bit_dev_scope_exists(scope)
85
- cmd_bit_list_scope = format(
86
- config.active['cmd_bit_clipboard_copy_bit_list_scope'],
87
- scope: scope
88
- )
89
-
90
- status = try cmd_bit_list_scope
91
-
92
- return true if status.exitstatus.zero?
93
-
94
- log.error "No bit.dev remote scope \"#{scope}\" found"
95
- false
96
- end
97
-
98
- # Check if bit remote scope is added to local workspace.
99
- def _bit_clipboard_custom_scope_exists(scope)
100
- cmd_bit_list_remotes =
101
- config.active['cmd_bit_clipboard_copy_bit_list_remotes']
102
-
103
- stdout_str = run cmd_bit_list_remotes
104
-
105
- return true if /.*\s+#{scope}\s+.*/m.match? stdout_str
106
-
107
- log.error "No bit remote scope \"#{scope}\" " \
108
- 'found in local bit workspace'
109
- false
110
- end
111
-
112
- # bit tag dir.
113
- def _bit_clipboard_copy_add_dir(id, dir)
114
- cmd_bit_add_dir = format(
115
- config.active['cmd_bit_clipboard_copy_bit_add_dir'],
116
- id: id,
117
- dir: dir
118
- )
119
-
120
- run cmd_bit_add_dir
121
- end
122
-
123
- # bit tag dir.
124
- def _bit_clipboard_copy_tag_dir(id)
125
- cmd_bit_tag_id = format(
126
- config.active['cmd_bit_clipboard_copy_bit_tag_id'],
127
- id: id
128
- )
129
-
130
- run cmd_bit_tag_id
131
- end
132
-
133
- # bit export component to bit remote scope.
134
- def _bit_clipboard_copy_export_to_scope(scope)
135
- cmd_bit_export_to_scope = format(
136
- config.active['cmd_bit_clipboard_copy_bit_export_to_scope'],
137
- scope: scope
138
- )
139
-
140
- run cmd_bit_export_to_scope
141
- end
142
- end
@@ -1,143 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # takeltau bit clipboard lib
4
- module BitClipboardLib
5
- private
6
-
7
- # Run bit status.
8
- def _bit_clipboard_lib_bit_status
9
- log.debug 'Running bit status'
10
-
11
- cmd_bit_status = config.active['cmd_bit_clipboard_lib_bit_status']
12
- run_and_exit cmd_bit_status
13
- end
14
-
15
- # Prepare workspace for bit clipboard.
16
- def _bit_clipboard_lib_prepare_workspace
17
- unless bit_check_workspace
18
- log.error 'No bit workspace'
19
- return false
20
- end
21
-
22
- return true unless git_check_workspace
23
-
24
- _bit_clipboard_lib_prepare_git_workspace
25
- end
26
-
27
- # Prepare git workspace for bit clipboard.
28
- def _bit_clipboard_lib_prepare_git_workspace
29
- unless git_check_bit
30
- log.error 'Not on git main branch'
31
- return false
32
- end
33
-
34
- unless git_check_clean
35
- log.error 'No clean git workspace'
36
- return false
37
- end
38
-
39
- _bit_clipboard_lib_git_pull
40
- end
41
-
42
- # Remove bit artifacts.
43
- def _bit_clipbpard_lib_remove_bit_artifacts
44
- log.debug 'Removing bit artifacts'
45
-
46
- # Remove node_modules directory.
47
- FileUtils.remove_entry_secure('node_modules', force: true)
48
-
49
- # Remove index.bit files recursively.
50
- Dir.glob('./**/index.bit').each do |file|
51
- FileUtils.remove_entry_secure(file, force: true)
52
- end
53
-
54
- # Remove package.json file.
55
- FileUtils.remove_entry_secure('package.json', force: true)
56
- end
57
-
58
- # Sync workspace with upstream.
59
- def _bit_clipboard_lib_sync_workspace
60
- log.debug 'Syncing git workspace'
61
-
62
- path = config.active['project_root_dir']
63
- file = "#{path}/.bitmap"
64
- message = 'Update .bitmap'
65
-
66
- _bit_clipboard_lib_git_add file
67
- _bit_clipboard_lib_git_commit message
68
- _bit_clipboard_lib_git_push
69
- end
70
-
71
- # git add .bitmap.
72
- def _bit_clipboard_lib_git_add(file)
73
- log.debug "Adding \"#{file}\" to git"
74
-
75
- cmd_bit_clipboard_git_add = format(
76
- config.active['cmd_bit_clipboard_git_add'],
77
- file: file
78
- )
79
- run cmd_bit_clipboard_git_add
80
- end
81
-
82
- # git commit -m "Update .bitmap".
83
- def _bit_clipboard_lib_git_commit(message)
84
- log.debug "Committing to git with message \"#{message}\""
85
-
86
- cmd_bit_clipboard_git_commit = format(
87
- config.active['cmd_bit_clipboard_git_commit'],
88
- message: message
89
- )
90
-
91
- run cmd_bit_clipboard_git_commit
92
- end
93
-
94
- # git push origin main.
95
- def _bit_clipboard_lib_git_push
96
- log.debug 'Pushing main branch to origin'
97
-
98
- cmd_bit_clipboard_git_push = format(
99
- config.active['cmd_bit_clipboard_git_push'],
100
- main: config.active['git_bit_branch']
101
- )
102
-
103
- run cmd_bit_clipboard_git_push
104
- end
105
-
106
- # git pull.
107
- def _bit_clipboard_lib_git_pull
108
- log.debug 'Updating git workspace'
109
- cmd_bit_clipboard_git_pull = format(
110
- config.active['cmd_bit_clipboard_git_pull'],
111
- main: config.active['git_bit_branch']
112
- )
113
-
114
- return true if try cmd_bit_clipboard_git_pull
115
-
116
- log.error 'Unable to update git workspace'
117
- false
118
- end
119
-
120
- # Generate bit component ID.
121
- def _bit_clipboard_lib_id(name)
122
- id = ''
123
-
124
- # bit restrictions:
125
- # component names can only contain alphanumeric,
126
- # lowercase characters, and the following ["-", "_", "$", "!", "/"]
127
-
128
- # convert directory name to lowercase characters
129
- dir_downcase = name.downcase
130
-
131
- # construct array of allowed characters
132
- allowed_chars = [*('a'..'z'), *('0'..'9'), '-', '_', '$', '!', '/']
133
-
134
- # iterate over directory or file name
135
- # and replace invalid characters with underscore
136
- dir_downcase.split('').each do |char|
137
- id += allowed_chars.include?(char) ? char : '_'
138
- end
139
-
140
- log.debug "Generated bit id \"#{id}\" from \"#{name}\""
141
- id
142
- end
143
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # takeltau bit clipboard paste
4
- module BitClipboardPaste
5
- # Backend method for bit paste.
6
- def bit_clipboard_paste(cid, dir)
7
- log.debug "Running bit paste \"#{cid}\" to \"#{dir}\""
8
-
9
- return false unless configured? %w[project_root_dir]
10
-
11
- return false unless _bit_clipboard_lib_prepare_workspace
12
-
13
- return false unless _bit_clipboard_paste_cid_exists? cid
14
-
15
- _bit_clipboard_paste_import_cid cid, dir
16
- _bit_clipbpard_lib_remove_bit_artifacts
17
- _bit_clipboard_lib_sync_workspace
18
-
19
- log.info "Pasted bit component \"#{cid}\" to directory \"#{dir}\""
20
- true
21
- end
22
-
23
- private
24
-
25
- # paste bit component into directory.
26
- def _bit_clipboard_paste_import_cid(cid, dir)
27
- cmd_bit_import_cid = format(
28
- config.active['cmd_bit_clipboard_paste_bit_import_cid'],
29
- cid: cid,
30
- dir: dir
31
- )
32
-
33
- run cmd_bit_import_cid
34
- end
35
-
36
- # Check if remote component exists.
37
- def _bit_clipboard_paste_cid_exists?(cid)
38
- scope = cid.scan(%r{([^/]*).*}).first.first
39
-
40
- log.debug "Checking if scope \"#{scope}\" " \
41
- "contains component id \"#{cid}\""
42
-
43
- bit_list_scope = _bit_clipboard_paste_cid_exists_list_scope scope
44
-
45
- return true if bit_list_scope.include? "\"id\": \"#{cid}\","
46
-
47
- log.error "No remote component \"#{cid}\""
48
- false
49
- end
50
-
51
- # Get components in remote scope.
52
- def _bit_clipboard_paste_cid_exists_list_scope(scope)
53
- cmd_bit_list_scope = format(
54
- config.active['cmd_bit_clipboard_paste_bit_list_scope'],
55
- scope: scope
56
- )
57
-
58
- run cmd_bit_list_scope
59
- end
60
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # takeltau bit clipboard pull
4
- module BitClipboardPull
5
- # Backend method for bit pull.
6
- def bit_clipboard_pull
7
- log.debug 'Running bit pull'
8
-
9
- return false unless configured? %w[project_root_dir]
10
-
11
- return false unless _bit_clipboard_lib_prepare_workspace
12
-
13
- _bit_clipboard_pull_import_all
14
- _bit_clipboard_pull_checkout_all
15
- _bit_clipbpard_lib_remove_bit_artifacts
16
- _bit_clipboard_lib_sync_workspace
17
- _bit_clipboard_lib_bit_status
18
- end
19
-
20
- private
21
-
22
- # bit import components into workspace.
23
- def _bit_clipboard_pull_import_all
24
- cmd_bit_import_all =
25
- config.active['cmd_bit_clipboard_pull_bit_import_all']
26
-
27
- run cmd_bit_import_all
28
- end
29
-
30
- # Checkout components and merge them.
31
- def _bit_clipboard_pull_checkout_all
32
- cmd_bit_checkout_all =
33
- config.active['cmd_bit_clipboard_pull_bit_checkout_all']
34
-
35
- run cmd_bit_checkout_all
36
- end
37
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # takeltau bit clipboard push
4
- module BitClipboardPush
5
- # Backend method for bit push.
6
- def bit_clipboard_push
7
- log.debug 'Running bit push'
8
-
9
- return false unless configured? %w[project_root_dir]
10
-
11
- return false unless _bit_clipboard_lib_prepare_workspace
12
-
13
- _bit_clipboard_push_tag_all
14
- _bit_clipboard_push_export_all
15
- _bit_clipbpard_lib_remove_bit_artifacts
16
- _bit_clipboard_lib_sync_workspace
17
- _bit_clipboard_lib_bit_status
18
- end
19
-
20
- private
21
-
22
- # bit tag all components.
23
- def _bit_clipboard_push_tag_all
24
- cmd_bit_tag_all =
25
- config.active['cmd_bit_clipboard_push_bit_tag_all']
26
-
27
- run cmd_bit_tag_all
28
- end
29
-
30
- # bit export components.
31
- def _bit_clipboard_push_export_all
32
- cmd_bit_export_all =
33
- config.active['cmd_bit_clipboard_push_bit_export_all']
34
-
35
- run cmd_bit_export_all
36
- end
37
- end
@@ -1,57 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Takeltau
4
- # takeltau bit require
5
- class BitRequire < SubCommandBase
6
- include LoggingModule
7
- include ConfigModule
8
- include SystemModule
9
- include GitCheckClean
10
- include GitCheckBit
11
- include GitCheckWorkspace
12
- include BitCheckWorkspace
13
- include BitScopeList
14
- include BitScopeAdd
15
- include BitClipboardLib
16
- include BitClipboardCopy
17
- include BitClipboardPaste
18
- include BitRequireLib
19
- include BitRequireExport
20
- include BitRequireImport
21
-
22
- # Initialize bit require
23
- def initialize(args = [], local_options = {}, configuration = {})
24
- # initialize thor parent class
25
- super args, local_options, configuration
26
-
27
- @bit_require_file = config.active['bit_require_file']
28
- end
29
-
30
- #
31
- # bit require export
32
- #
33
- desc 'export', 'Create requirements file with bit components.'
34
- long_desc <<-LONGDESC.gsub("\n", "\x5")
35
- Create requirements file with bit components
36
- LONGDESC
37
- # Create requirements file with bit components.
38
- def export
39
- bit_require_yml = bit_require_export
40
- exit false if bit_require_yml == false
41
- say bit_require_yml
42
- true
43
- end
44
-
45
- #
46
- # bit require import
47
- #
48
- desc 'import', 'Import bit components from requirements file.'
49
- long_desc <<-LONGDESC.gsub("\n", "\x5")
50
- Import bit components from requirements file
51
- LONGDESC
52
- # Import bit components from requirements file.
53
- def import
54
- exit bit_require_import
55
- end
56
- end
57
- end