takelage 0.19.2 → 0.20.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/README.md +2 -0
- data/lib/takelage.rb +5 -1
- data/lib/takelage/bit/cli.rb +3 -0
- data/lib/takelage/bit/clipboard/cli.rb +1 -1
- data/lib/takelage/bit/clipboard/copy.rb +8 -8
- data/lib/takelage/bit/clipboard/lib.rb +13 -14
- data/lib/takelage/bit/clipboard/paste.rb +3 -2
- data/lib/takelage/bit/clipboard/pull.rb +2 -2
- data/lib/takelage/bit/clipboard/push.rb +3 -3
- data/lib/takelage/bit/require/cli.rb +57 -0
- data/lib/takelage/bit/require/export.rb +32 -0
- data/lib/takelage/bit/require/import.rb +129 -0
- data/lib/takelage/bit/require/lib.rb +19 -0
- data/lib/takelage/bit/scope/list.rb +2 -2
- data/lib/takelage/default.yml +4 -0
- data/lib/takelage/docker/container/check/existing.rb +1 -0
- data/lib/takelage/docker/container/check/network.rb +1 -0
- data/lib/takelage/docker/container/check/orphaned.rb +1 -0
- data/lib/takelage/docker/container/clean.rb +2 -2
- data/lib/takelage/docker/container/prune.rb +1 -1
- data/lib/takelage/docker/socket/lib.rb +2 -2
- data/lib/takelage/lib/config.rb +4 -2
- data/lib/takelage/lib/logging.rb +2 -0
- data/lib/takelage/lib/subcmd.rb +2 -2
- data/lib/takelage/self/list.rb +1 -0
- data/lib/takelage/version +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff76a5fa994c76003af554e174ec3d4ae3e1a8b4e08caf61df2101e0bedd5607
|
4
|
+
data.tar.gz: 85de4c4db687bfa14385614ba4960314655909775b975c7a32c01aabe7573cb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e51313c752ce726c55d786541ff273a63291e3c31cee20416bf70e2ee48906b3e02ccfef97bbfe1c6164ce1dbad4dc781f5ec1ce0f4e11915495e59cc73f8390
|
7
|
+
data.tar.gz: fb5458e2480025692fb344dba806c595570a756bf59abd45dfe948bc4af0edd4f315c3e7d5f23f2c7511d8b96d1996d4156d1e1e63323de39213f93b1db5c985
|
data/README.md
CHANGED
@@ -52,6 +52,8 @@ tau [bit clipboard copy](features/takelage/bit/bit.clipboard.copy.feature) [DIR]
|
|
52
52
|
tau [bit clipboard paste](features/takelage/bit/bit.clipboard.paste.feature) [COMPONENT] [DIR] | Paste bit [COMPONENT] into [DIR]
|
53
53
|
tau [bit clipboard pull](features/takelage/bit/bit.clipboard.pull.feature) | Pull all updates for bit components from bit remote scopes
|
54
54
|
tau [bit clipboard push](features/takelage/bit/bit.clipboard.push.feature) | Push all updates of bit components to bit remote scopes
|
55
|
+
tau [bit require export](features/takelage/bit/bit.require.export.feature) | Show requirements file of bit components
|
56
|
+
tau [bit require import](features/takelage/bit/bit.require.import.feature) | Import bit components from requirements file
|
55
57
|
tau [bit scope add](features/takelage/bit/bit.scope.add.feature) [SCOPE] | Add a bit [SCOPE]
|
56
58
|
tau [bit scope inbit](features/takelage/bit/bit.scope.inbit.feature) | Log in to bit remote server
|
57
59
|
tau [bit scope list](features/takelage/bit/bit.scope.list.feature) | List bit remote scopes
|
data/lib/takelage.rb
CHANGED
@@ -38,6 +38,10 @@ require_relative 'takelage/bit/clipboard/paste'
|
|
38
38
|
require_relative 'takelage/bit/clipboard/pull'
|
39
39
|
require_relative 'takelage/bit/clipboard/push'
|
40
40
|
require_relative 'takelage/bit/clipboard/cli'
|
41
|
+
require_relative 'takelage/bit/require/lib'
|
42
|
+
require_relative 'takelage/bit/require/export'
|
43
|
+
require_relative 'takelage/bit/require/import'
|
44
|
+
require_relative 'takelage/bit/require/cli'
|
41
45
|
require_relative 'takelage/bit/cli'
|
42
46
|
require_relative 'takelage/completion/cli'
|
43
47
|
require_relative 'takelage/docker/check/running'
|
@@ -112,7 +116,7 @@ module Takelage
|
|
112
116
|
# Initialize global singleton project
|
113
117
|
initialize_project
|
114
118
|
|
115
|
-
#
|
119
|
+
# Prepare for the worst
|
116
120
|
@docker_daemon_running = false
|
117
121
|
|
118
122
|
# fylla bash completion code
|
data/lib/takelage/bit/cli.rb
CHANGED
@@ -9,6 +9,9 @@ module Takelage
|
|
9
9
|
desc 'clipboard [COMMAND]', 'Manage bit clipboard'
|
10
10
|
subcommand 'clipboard', BitClipboard
|
11
11
|
|
12
|
+
desc 'require [COMMAND]', 'Manage bit requirements'
|
13
|
+
subcommand 'require', BitRequire
|
14
|
+
|
12
15
|
desc 'scope [COMMAND]', 'Manage bit scopes'
|
13
16
|
subcommand 'scope', BitScope
|
14
17
|
end
|
@@ -43,7 +43,7 @@ module BitClipboardCopy
|
|
43
43
|
end
|
44
44
|
# rubocop:enable Metrics/MethodLength
|
45
45
|
|
46
|
-
#
|
46
|
+
# Touch README.bit if necessary.
|
47
47
|
def _bit_clipboard_copy_touch_readme_bit(dir)
|
48
48
|
readme_bit = "#{dir}/README.bit"
|
49
49
|
return if File.file? readme_bit
|
@@ -52,7 +52,7 @@ module BitClipboardCopy
|
|
52
52
|
File.open(readme_bit, 'w') {}
|
53
53
|
end
|
54
54
|
|
55
|
-
#
|
55
|
+
# Check if a README.bit file exists in a subdirectory.
|
56
56
|
def _bit_clipboard_copy_readme_bit_exists_in_subdir?(dir)
|
57
57
|
Dir.glob("#{dir}/**/README.bit").each do |file|
|
58
58
|
unless file == "#{dir}/README.bit"
|
@@ -64,7 +64,7 @@ module BitClipboardCopy
|
|
64
64
|
false
|
65
65
|
end
|
66
66
|
|
67
|
-
# Check if bit scope exists
|
67
|
+
# Check if bit scope exists.
|
68
68
|
def _bit_clipboard_copy_dir_scope_exists?(scope)
|
69
69
|
bit_dev = config.active['bit_dev_user']
|
70
70
|
|
@@ -78,7 +78,7 @@ module BitClipboardCopy
|
|
78
78
|
true
|
79
79
|
end
|
80
80
|
|
81
|
-
#
|
81
|
+
# Check if bit.dev remote scope exists.
|
82
82
|
def _bit_clipboard_bit_dev_scope_exists(scope)
|
83
83
|
cmd_bit_list_scope = format(
|
84
84
|
config.active['cmd_bit_clipboard_copy_bit_list_scope'],
|
@@ -93,7 +93,7 @@ module BitClipboardCopy
|
|
93
93
|
false
|
94
94
|
end
|
95
95
|
|
96
|
-
#
|
96
|
+
# Check if bit remote scope is added to local workspace.
|
97
97
|
def _bit_clipboard_custom_scope_exists(scope)
|
98
98
|
cmd_bit_list_remotes =
|
99
99
|
config.active['cmd_bit_clipboard_copy_bit_list_remotes']
|
@@ -107,7 +107,7 @@ module BitClipboardCopy
|
|
107
107
|
false
|
108
108
|
end
|
109
109
|
|
110
|
-
# bit tag dir
|
110
|
+
# bit tag dir.
|
111
111
|
def _bit_clipboard_copy_add_dir(id, dir)
|
112
112
|
cmd_bit_add_dir = format(
|
113
113
|
config.active['cmd_bit_clipboard_copy_bit_add_dir'],
|
@@ -118,7 +118,7 @@ module BitClipboardCopy
|
|
118
118
|
run cmd_bit_add_dir
|
119
119
|
end
|
120
120
|
|
121
|
-
# bit tag dir
|
121
|
+
# bit tag dir.
|
122
122
|
def _bit_clipboard_copy_tag_dir(id)
|
123
123
|
cmd_bit_tag_id = format(
|
124
124
|
config.active['cmd_bit_clipboard_copy_bit_tag_id'],
|
@@ -128,7 +128,7 @@ module BitClipboardCopy
|
|
128
128
|
run cmd_bit_tag_id
|
129
129
|
end
|
130
130
|
|
131
|
-
# bit export component to bit remote scope
|
131
|
+
# bit export component to bit remote scope.
|
132
132
|
def _bit_clipboard_copy_export_to_scope(scope)
|
133
133
|
cmd_bit_export_to_scope = format(
|
134
134
|
config.active['cmd_bit_clipboard_copy_bit_export_to_scope'],
|
@@ -52,29 +52,28 @@ module BitClipboardLib
|
|
52
52
|
log.debug 'Syncing git workspace'
|
53
53
|
|
54
54
|
_rakefile, path = Rake.application.find_rakefile_location
|
55
|
-
|
55
|
+
file = "#{path}/.bitmap"
|
56
|
+
message = 'Update .bitmap'
|
56
57
|
|
57
|
-
_bit_clipboard_lib_git_add
|
58
|
-
_bit_clipboard_lib_git_commit
|
58
|
+
_bit_clipboard_lib_git_add file
|
59
|
+
_bit_clipboard_lib_git_commit message
|
59
60
|
_bit_clipboard_lib_git_push
|
60
61
|
end
|
61
62
|
|
62
|
-
# git add .bitmap
|
63
|
-
def _bit_clipboard_lib_git_add(
|
64
|
-
log.debug "Adding \"#{
|
63
|
+
# git add .bitmap.
|
64
|
+
def _bit_clipboard_lib_git_add(file)
|
65
|
+
log.debug "Adding \"#{file}\" to git"
|
65
66
|
|
66
67
|
cmd_bit_clipboard_git_add = format(
|
67
68
|
config.active['cmd_bit_clipboard_git_add'],
|
68
|
-
file:
|
69
|
+
file: file
|
69
70
|
)
|
70
71
|
run cmd_bit_clipboard_git_add
|
71
72
|
end
|
72
73
|
|
73
|
-
# git commit -m "Update .bitmap"
|
74
|
-
def _bit_clipboard_lib_git_commit(
|
75
|
-
|
76
|
-
|
77
|
-
log.debug "Committing \"#{bitmap}\" to git"
|
74
|
+
# git commit -m "Update .bitmap".
|
75
|
+
def _bit_clipboard_lib_git_commit(message)
|
76
|
+
log.debug "Committing to git with message \"#{message}\""
|
78
77
|
|
79
78
|
cmd_bit_clipboard_git_commit = format(
|
80
79
|
config.active['cmd_bit_clipboard_git_commit'],
|
@@ -84,7 +83,7 @@ module BitClipboardLib
|
|
84
83
|
run cmd_bit_clipboard_git_commit
|
85
84
|
end
|
86
85
|
|
87
|
-
# git push origin master
|
86
|
+
# git push origin master.
|
88
87
|
def _bit_clipboard_lib_git_push
|
89
88
|
log.debug 'Pushing master branch to origin'
|
90
89
|
|
@@ -94,7 +93,7 @@ module BitClipboardLib
|
|
94
93
|
run cmd_bit_clipboard_git_push
|
95
94
|
end
|
96
95
|
|
97
|
-
# git pull
|
96
|
+
# git pull.
|
98
97
|
def _bit_clipboard_lib_git_pull
|
99
98
|
log.debug 'Updating git workspace'
|
100
99
|
cmd_bit_clipboard_git_pull =
|
@@ -20,7 +20,7 @@ module BitClipboardPaste
|
|
20
20
|
|
21
21
|
private
|
22
22
|
|
23
|
-
# paste bit component into directory
|
23
|
+
# paste bit component into directory.
|
24
24
|
def _bit_clipboard_paste_import_cid(cid, dir)
|
25
25
|
cmd_bit_import_cid = format(
|
26
26
|
config.active['cmd_bit_clipboard_paste_bit_import_cid'],
|
@@ -31,6 +31,7 @@ module BitClipboardPaste
|
|
31
31
|
run cmd_bit_import_cid
|
32
32
|
end
|
33
33
|
|
34
|
+
# Check if remote component exists.
|
34
35
|
def _bit_clipboard_paste_cid_exists?(cid)
|
35
36
|
scope = cid.scan(%r{([^/]*).*}).first.first
|
36
37
|
|
@@ -45,7 +46,7 @@ module BitClipboardPaste
|
|
45
46
|
false
|
46
47
|
end
|
47
48
|
|
48
|
-
#
|
49
|
+
# Get components in remote scope.
|
49
50
|
def _bit_clipboard_paste_cid_exists_list_scope(scope)
|
50
51
|
cmd_bit_list_scope = format(
|
51
52
|
config.active['cmd_bit_clipboard_paste_bit_list_scope'],
|
@@ -19,7 +19,7 @@ module BitClipboardPull
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
# bit import components into workspace
|
22
|
+
# bit import components into workspace.
|
23
23
|
def _bit_clipboard_pull_import_all
|
24
24
|
cmd_bit_import_all =
|
25
25
|
config.active['cmd_bit_clipboard_pull_bit_import_all']
|
@@ -27,7 +27,7 @@ module BitClipboardPull
|
|
27
27
|
run cmd_bit_import_all
|
28
28
|
end
|
29
29
|
|
30
|
-
#
|
30
|
+
# Checkout components and merge them.
|
31
31
|
def _bit_clipboard_pull_checkout_all
|
32
32
|
cmd_bit_checkout_all =
|
33
33
|
config.active['cmd_bit_clipboard_pull_bit_checkout_all']
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# takelage bit clipboard push
|
4
4
|
module BitClipboardPush
|
5
|
-
# Backend method for bit push
|
5
|
+
# Backend method for bit push.
|
6
6
|
def bit_clipboard_push
|
7
7
|
log.debug 'Running bit push'
|
8
8
|
|
@@ -19,7 +19,7 @@ module BitClipboardPush
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
# bit tag all components
|
22
|
+
# bit tag all components.
|
23
23
|
def _bit_clipboard_push_tag_all
|
24
24
|
cmd_bit_tag_all =
|
25
25
|
config.active['cmd_bit_clipboard_push_bit_tag_all']
|
@@ -27,7 +27,7 @@ module BitClipboardPush
|
|
27
27
|
run cmd_bit_tag_all
|
28
28
|
end
|
29
29
|
|
30
|
-
# bit export components
|
30
|
+
# bit export components.
|
31
31
|
def _bit_clipboard_push_export_all
|
32
32
|
cmd_bit_export_all =
|
33
33
|
config.active['cmd_bit_clipboard_push_bit_export_all']
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Takelage
|
4
|
+
# takelage bit requiere
|
5
|
+
class BitRequire < SubCommandBase
|
6
|
+
include LoggingModule
|
7
|
+
include ConfigModule
|
8
|
+
include SystemModule
|
9
|
+
include GitCheckClean
|
10
|
+
include GitCheckMaster
|
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
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage bit require export
|
4
|
+
module BitRequireExport
|
5
|
+
# Backend method for bit require export.
|
6
|
+
def bit_require_export
|
7
|
+
log.debug 'Running bit require export'
|
8
|
+
|
9
|
+
components = _bit_require_lib_get_components
|
10
|
+
bitrequire_yml = _bit_require_export_get_bitrequire_yml components
|
11
|
+
|
12
|
+
log.debug "bitrequire.yml of this project:\n#{bitrequire_yml}"
|
13
|
+
bitrequire_yml
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
# Create contents of bitrequire yaml file.
|
19
|
+
# rubocop:disable Metrics/AbcSize
|
20
|
+
def _bit_require_export_get_bitrequire_yml(components)
|
21
|
+
bitrequire = {}
|
22
|
+
components.each do |component|
|
23
|
+
scope = component['id'].clone.gsub!(%r{/.*}, '')
|
24
|
+
name = component['id'].clone.gsub!(%r{#{scope}/}, '')
|
25
|
+
bitrequire['scopes'] = { scope => [] } if bitrequire['scopes'].nil?
|
26
|
+
bitrequire['scopes'] = { scope => [] } unless bitrequire['scopes'].key? scope
|
27
|
+
bitrequire['scopes'][scope] << { 'name' => name }
|
28
|
+
end
|
29
|
+
hash_to_yaml bitrequire
|
30
|
+
end
|
31
|
+
# rubocop:enable Metrics/AbcSize
|
32
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage bit require import
|
4
|
+
module BitRequireImport
|
5
|
+
# Backend method for bit require import.
|
6
|
+
def bit_require_import
|
7
|
+
log.debug 'Running bit require import'
|
8
|
+
|
9
|
+
return false unless _bit_clipboard_lib_prepare_workspace
|
10
|
+
|
11
|
+
return false unless _bit_require_import_check_require_file_exists
|
12
|
+
|
13
|
+
scopes = _bit_require_import_get_scopes_and_components
|
14
|
+
return false unless scopes
|
15
|
+
|
16
|
+
components = _bit_require_import_get_components scopes
|
17
|
+
return false unless components
|
18
|
+
|
19
|
+
return false unless _bit_require_import_add_scopes scopes
|
20
|
+
|
21
|
+
_bit_require_import_paste_components components
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
# Check if a bit requirements file exists.
|
27
|
+
def _bit_require_import_check_require_file_exists
|
28
|
+
return true if File.exist? @bit_require_file
|
29
|
+
|
30
|
+
log.error "No #{@bit_require_file} file found"
|
31
|
+
false
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get scopes and components from requirements file.
|
35
|
+
def _bit_require_import_get_scopes_and_components
|
36
|
+
bit_require = read_yaml_file(@bit_require_file)
|
37
|
+
return bit_require['scopes'] if bit_require.key?('scopes')
|
38
|
+
|
39
|
+
log.error "No scopes in #{@bit_require_file} file"
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
# Get flat components array.
|
44
|
+
def _bit_require_import_get_components(scopes)
|
45
|
+
components_all = []
|
46
|
+
scopes.each do |scope, components|
|
47
|
+
scope_components = _bit_require_import_get_scope_components scope, components
|
48
|
+
return false unless scope_components
|
49
|
+
|
50
|
+
components_all |= scope_components
|
51
|
+
end
|
52
|
+
components_all
|
53
|
+
end
|
54
|
+
|
55
|
+
# Get bit components of a scope.
|
56
|
+
def _bit_require_import_get_scope_components(scope, components)
|
57
|
+
scope_components = []
|
58
|
+
components.each do |component|
|
59
|
+
return false unless _bit_require_import_check_component_valid component, scope
|
60
|
+
|
61
|
+
name = component['name']
|
62
|
+
path = name
|
63
|
+
path = component['path'] if component.key?('path')
|
64
|
+
scope_components << { name: name, path: path, scope: scope }
|
65
|
+
log.debug "Identified bit component \"#{name}\" with path \"#{path}\" in scope \"#{scope}\""
|
66
|
+
end
|
67
|
+
scope_components
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check if there are bit components
|
71
|
+
def _bit_require_import_check_component_valid(component, scope)
|
72
|
+
return true if (component.class == Hash) && component.key?('name')
|
73
|
+
|
74
|
+
log.error "No component in #{scope}"
|
75
|
+
false
|
76
|
+
end
|
77
|
+
|
78
|
+
# Add bit scopes to workspace.
|
79
|
+
def _bit_require_import_add_scopes(scopes)
|
80
|
+
scopes.each do |scope, _components|
|
81
|
+
bit_scope_add scope unless _bit_clipboard_bit_dev_scope_exists scope
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# Paste bit components.
|
86
|
+
def _bit_require_import_paste_components(components)
|
87
|
+
_rakefile, path = Rake.application.find_rakefile_location
|
88
|
+
components.each do |component|
|
89
|
+
next if _bit_require_import_check_component_exists component, path
|
90
|
+
|
91
|
+
return false unless _bit_require_import_paste_component component
|
92
|
+
|
93
|
+
_bit_require_import_commit_component component, path
|
94
|
+
end
|
95
|
+
true
|
96
|
+
end
|
97
|
+
|
98
|
+
# Check if there are bit components
|
99
|
+
def _bit_require_import_check_component_exists(component, path)
|
100
|
+
scope = component[:scope]
|
101
|
+
cid = component[:name]
|
102
|
+
dir = component[:path]
|
103
|
+
dest = "#{path}/#{dir}"
|
104
|
+
cids = _bit_require_lib_get_components_ids
|
105
|
+
return false unless cids.include? "#{scope}/#{cid}"
|
106
|
+
|
107
|
+
log.warn "Skipping existing bit component \"#{scope}/#{cid}\" with path \"#{dest}\""
|
108
|
+
true
|
109
|
+
end
|
110
|
+
|
111
|
+
# Paste a bit component
|
112
|
+
def _bit_require_import_paste_component(component)
|
113
|
+
scope = component[:scope]
|
114
|
+
cid = component[:name]
|
115
|
+
dir = component[:path]
|
116
|
+
bit_clipboard_paste "#{scope}/#{cid}", dir
|
117
|
+
end
|
118
|
+
|
119
|
+
# Commit a bit component
|
120
|
+
def _bit_require_import_commit_component(component, path)
|
121
|
+
scope = component[:scope]
|
122
|
+
cid = component[:name]
|
123
|
+
dir = component[:path]
|
124
|
+
dest = "#{path}/#{dir}"
|
125
|
+
message = "Add bit component \"#{scope}/#{cid}\" to path \"#{dest}\""
|
126
|
+
_bit_clipboard_lib_git_add dest
|
127
|
+
_bit_clipboard_lib_git_commit message
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# takelage bit require lib
|
4
|
+
module BitRequireLib
|
5
|
+
private
|
6
|
+
|
7
|
+
# Get bit components.
|
8
|
+
def _bit_require_lib_get_components
|
9
|
+
cmd_bit_list = config.active['cmd_bit_require_lib_bit_list']
|
10
|
+
bit_list = run cmd_bit_list
|
11
|
+
JSON.parse bit_list
|
12
|
+
end
|
13
|
+
|
14
|
+
# Get bit components ids.
|
15
|
+
def _bit_require_lib_get_components_ids
|
16
|
+
cmd_bit_list_ids = config.active['cmd_bit_require_lib_bit_list_ids']
|
17
|
+
run cmd_bit_list_ids
|
18
|
+
end
|
19
|
+
end
|
@@ -9,7 +9,7 @@ module BitScopeList
|
|
9
9
|
|
10
10
|
return false unless configured? %w[bit_ssh bit_remote]
|
11
11
|
|
12
|
-
# get ssh command from active config
|
12
|
+
# get ssh command from active config.
|
13
13
|
cmd_bit_ssh =
|
14
14
|
config.active['bit_ssh']
|
15
15
|
|
@@ -17,7 +17,7 @@ module BitScopeList
|
|
17
17
|
|
18
18
|
cmd_bit_scope_list = _bit_scope_list_cmd root
|
19
19
|
|
20
|
-
# run ssh command with scope list command
|
20
|
+
# run ssh command with scope list command.
|
21
21
|
scope_list = run "#{cmd_bit_ssh} '#{cmd_bit_scope_list}'"
|
22
22
|
|
23
23
|
# remove bit remote root directory from results
|
data/lib/takelage/default.yml
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
---
|
2
2
|
bit_dev_user: 'takelage'
|
3
3
|
bit_remote: ''
|
4
|
+
bit_require_file: 'bitrequire.yml'
|
4
5
|
bit_root: '/bit'
|
5
6
|
bit_ssh: ''
|
6
7
|
cmd_bit_check_workspace_bit_list: 'bit list'
|
@@ -20,6 +21,9 @@ cmd_bit_clipboard_pull_bit_import_all: 'bit import --ignore-package-json --ignor
|
|
20
21
|
cmd_bit_clipboard_pull_bit_checkout_all: 'bit checkout --ignore-package-json --ignore-dist --skip-update --skip-npm-install --all latest'
|
21
22
|
cmd_bit_clipboard_push_bit_tag_all: 'bit tag --skip-update --skip-tests --all'
|
22
23
|
cmd_bit_clipboard_push_bit_export_all: 'bit export --skip-update --all'
|
24
|
+
cmd_bit_clipboard_export_bit_list: 'bit list --skip-update --json %{scope}'
|
25
|
+
cmd_bit_require_lib_bit_list: 'bit list --skip-update --json'
|
26
|
+
cmd_bit_require_lib_bit_list_ids: 'bit list --skip-update --json --ids'
|
23
27
|
cmd_bit_scope_add_scope: 'bit remote add %{remote}/%{scope}'
|
24
28
|
cmd_bit_scope_list_find_scopes: 'find -L %{root} -name scope.json'
|
25
29
|
cmd_bit_scope_new_bit_init: 'mkdir -p %{root}/%{scope} && cd %{root}/%{scope} && bit init --bare'
|
@@ -16,7 +16,7 @@ module DockerContainerClean
|
|
16
16
|
|
17
17
|
private
|
18
18
|
|
19
|
-
# Check if we are running tau clean inside a takelage container
|
19
|
+
# Check if we are running tau clean inside a takelage container.
|
20
20
|
def _docker_container_clean_harakiri?
|
21
21
|
hostname = ENV['HOSTNAME'] || ''
|
22
22
|
return false unless hostname.start_with? "#{@docker_repo}_"
|
@@ -26,7 +26,7 @@ module DockerContainerClean
|
|
26
26
|
true
|
27
27
|
end
|
28
28
|
|
29
|
-
# Kill all docker containers and return list of networks
|
29
|
+
# Kill all docker containers and return list of networks.
|
30
30
|
def _docker_container_clean_kill_existing_containers
|
31
31
|
networks = []
|
32
32
|
_docker_container_lib_get_containers.each do |container|
|
@@ -23,7 +23,7 @@ module DockerSocketLib
|
|
23
23
|
cmds_start_socket
|
24
24
|
end
|
25
25
|
|
26
|
-
# Get socket start command
|
26
|
+
# Get socket start command.
|
27
27
|
def _docker_socket_lib_get_start_cmd(mode, socket, host, port, path)
|
28
28
|
if mode == 'start'
|
29
29
|
unless _docker_socket_lib_socket_up? socket, host, port, path
|
@@ -45,7 +45,7 @@ module DockerSocketLib
|
|
45
45
|
)
|
46
46
|
end
|
47
47
|
|
48
|
-
# Check if a socket is available by trying to connect to it via TCP
|
48
|
+
# Check if a socket is available by trying to connect to it via TCP.
|
49
49
|
def _docker_socket_lib_socket_up?(socket, host, port, path)
|
50
50
|
error_message = _docker_socket_lib_error_msg socket, host, port, path
|
51
51
|
begin
|
data/lib/takelage/lib/config.rb
CHANGED
@@ -19,6 +19,7 @@ module ConfigModule
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# Initialze config
|
22
|
+
# rubocop:disable Metrics/AbcSize
|
22
23
|
def initialize_config
|
23
24
|
log.debug "takelage version: #{Takelage::VERSION}"
|
24
25
|
log.debug "Current working directory: #{Dir.pwd}"
|
@@ -28,6 +29,7 @@ module ConfigModule
|
|
28
29
|
TakelageConfig.instance.project = _config_read_project
|
29
30
|
TakelageConfig.instance.active = _config_merge_active
|
30
31
|
end
|
32
|
+
# rubocop:enable Metrics/AbcSize
|
31
33
|
|
32
34
|
# @return [Object] global singleton config
|
33
35
|
def config
|
@@ -55,7 +57,7 @@ module ConfigModule
|
|
55
57
|
false
|
56
58
|
end
|
57
59
|
|
58
|
-
# Check if config key is nil or empty
|
60
|
+
# Check if config key is nil or empty.
|
59
61
|
def _check_key_set?(config_key)
|
60
62
|
takel_config_key = TakelageConfig.instance.active[config_key]
|
61
63
|
return true unless takel_config_key.nil? || takel_config_key.empty?
|
@@ -99,7 +101,7 @@ module ConfigModule
|
|
99
101
|
project_yaml.sort.to_h
|
100
102
|
end
|
101
103
|
|
102
|
-
# Merge active config
|
104
|
+
# Merge active config.
|
103
105
|
def _config_merge_active
|
104
106
|
# make a clone or else we'll change the original hash
|
105
107
|
default = TakelageConfig.instance.default.clone
|
data/lib/takelage/lib/logging.rb
CHANGED
@@ -28,12 +28,14 @@ module LoggingModule
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
+
# Get log format.
|
31
32
|
def _logging_get_log_format
|
32
33
|
proc do |severity, _datetime, _progname, msg|
|
33
34
|
"[#{severity}] #{msg}\n"
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
38
|
+
# Get log level.
|
37
39
|
def _logging_get_log_level(loglevel)
|
38
40
|
if %w[FATAL ERROR WARN INFO DEBUG].include? loglevel
|
39
41
|
loglevel
|
data/lib/takelage/lib/subcmd.rb
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
# Thor with subcommands that work correctly with help
|
4
4
|
class SubCommandBase < Thor
|
5
|
-
# Set the subcommand banner
|
5
|
+
# Set the subcommand banner.
|
6
6
|
def self.banner(command, _namespace = nil, _subcommand = false)
|
7
7
|
"#{basename} #{subcommand_prefix} #{command.usage}"
|
8
8
|
end
|
9
9
|
|
10
|
-
# Set the subcommand prefix
|
10
|
+
# Set the subcommand prefix.
|
11
11
|
def self.subcommand_prefix
|
12
12
|
name.gsub(/.*::/, '')
|
13
13
|
.gsub(/^[A-Z]/) { |match| match[0].downcase }
|
data/lib/takelage/self/list.rb
CHANGED
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.20.0
|
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
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geospin
|
@@ -214,6 +214,10 @@ files:
|
|
214
214
|
- lib/takelage/bit/clipboard/paste.rb
|
215
215
|
- lib/takelage/bit/clipboard/pull.rb
|
216
216
|
- lib/takelage/bit/clipboard/push.rb
|
217
|
+
- lib/takelage/bit/require/cli.rb
|
218
|
+
- lib/takelage/bit/require/export.rb
|
219
|
+
- lib/takelage/bit/require/import.rb
|
220
|
+
- lib/takelage/bit/require/lib.rb
|
217
221
|
- lib/takelage/bit/scope/add.rb
|
218
222
|
- lib/takelage/bit/scope/cli.rb
|
219
223
|
- lib/takelage/bit/scope/inbit.rb
|
@@ -284,7 +288,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
284
288
|
requirements:
|
285
289
|
- - ">="
|
286
290
|
- !ruby/object:Gem::Version
|
287
|
-
version: '
|
291
|
+
version: '2.4'
|
288
292
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
289
293
|
requirements:
|
290
294
|
- - ">="
|