takelage 0.20.2 → 0.21.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 +4 -1
- data/lib/takelage/lib/config.rb +2 -6
- data/lib/takelage/lib/project.rb +6 -6
- data/lib/takelage/lib/system.rb +28 -3
- data/lib/takelage/self/list.rb +14 -10
- 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: eb34019e556b714fcd893cf3141e23a1fbf63aad8bb695e2b205cfffb657a2ee
|
4
|
+
data.tar.gz: a0a2b8c6b6987f52057042ef410b2a94fb5628d519aa9f3c7ede9d4831d04a0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ef2f83567050eaf5578f793417ca4f65de20ce9d1409bef4503793a58b0ba0b8ad9fac6e889c19f33ebb3d20617519714a93e7db92b6e06283520281690ccab
|
7
|
+
data.tar.gz: ba45ccafbddeeda014a74eed0fcad687ad6d2287773cadb7d0aafde9854bc381d8003aea47965196f7faf5f7b3c8205daef0c03696eb0b0328d18838093f030f
|
data/README.md
CHANGED
@@ -186,8 +186,11 @@ source <(tau completion bash)
|
|
186
186
|
|
187
187
|
### Software Tests
|
188
188
|
|
189
|
+
*takelage-cli* uses
|
190
|
+
[minitest](https://github.com/seattlerb/minitest) unit tests.
|
191
|
+
|
189
192
|
*takelage-cli* ships with
|
190
|
-
[cucumber](https://github.com/cucumber/cucumber) ruby tests.
|
193
|
+
[cucumber](https://github.com/cucumber/cucumber) ruby system tests.
|
191
194
|
It uses cucumber's
|
192
195
|
[aruba](https://github.com/cucumber/aruba) extension and especially its
|
193
196
|
[filesystem](https://relishapp.com/cucumber/aruba/v/0-11-0/docs/filesystem)
|
data/lib/takelage/lib/config.rb
CHANGED
@@ -93,9 +93,7 @@ module ConfigModule
|
|
93
93
|
|
94
94
|
return {} unless File.exist? home_file
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
home_yaml.sort.to_h
|
96
|
+
(read_yaml_file(home_file) || {}).sort.to_h
|
99
97
|
end
|
100
98
|
|
101
99
|
# Read custom config file in project root.
|
@@ -104,9 +102,7 @@ module ConfigModule
|
|
104
102
|
|
105
103
|
return {} unless File.exist? project_file
|
106
104
|
|
107
|
-
|
108
|
-
|
109
|
-
project_yaml.sort.to_h
|
105
|
+
(read_yaml_file(project_file) || {}).sort.to_h
|
110
106
|
end
|
111
107
|
|
112
108
|
# Merge active config.
|
data/lib/takelage/lib/project.rb
CHANGED
@@ -34,24 +34,24 @@ module ProjectModule
|
|
34
34
|
|
35
35
|
# Read main YAML file.
|
36
36
|
def _project_read_main
|
37
|
-
|
38
|
-
main_file = "#{
|
37
|
+
path = TakelageProject.instance.config.active['project_root_dir']
|
38
|
+
main_file = "#{path}/" \
|
39
39
|
"#{TakelageProject.instance.config.active['info_project_main']}"
|
40
40
|
|
41
41
|
return {} unless File.exist? main_file
|
42
42
|
|
43
|
-
|
43
|
+
(read_yaml_erb_file(main_file) || {}).sort.to_h
|
44
44
|
end
|
45
45
|
|
46
46
|
# Read private YAML file.
|
47
47
|
def _project_read_private
|
48
|
-
|
49
|
-
private_file = "#{
|
48
|
+
path = TakelageProject.instance.config.active['project_root_dir']
|
49
|
+
private_file = "#{path}/" \
|
50
50
|
"#{TakelageProject.instance.config.active['info_project_private']}"
|
51
51
|
|
52
52
|
return {} unless File.exist? private_file
|
53
53
|
|
54
|
-
private_yaml =
|
54
|
+
private_yaml = read_yaml_erb_file(private_file) || {}
|
55
55
|
|
56
56
|
private_yaml.sort.to_h
|
57
57
|
end
|
data/lib/takelage/lib/system.rb
CHANGED
@@ -20,7 +20,19 @@ module SystemModule
|
|
20
20
|
log.debug "Reading YAML file \"#{file}\""
|
21
21
|
return nil unless _file_exists? file
|
22
22
|
return nil unless _file_read file
|
23
|
-
return nil unless _parse_yaml @
|
23
|
+
return nil unless _parse_yaml file, @content_file
|
24
|
+
|
25
|
+
@content
|
26
|
+
end
|
27
|
+
|
28
|
+
# Read yaml file with erb templates.
|
29
|
+
# @return [Hash] content of yaml file
|
30
|
+
def read_yaml_erb_file(file)
|
31
|
+
log.debug "Reading YAML ERB file \"#{file}\""
|
32
|
+
return nil unless _file_exists? file
|
33
|
+
return nil unless _file_read file
|
34
|
+
return nil unless _parse_erb file, @content_file
|
35
|
+
return nil unless _parse_yaml file, @content_yaml
|
24
36
|
|
25
37
|
@content
|
26
38
|
end
|
@@ -82,7 +94,7 @@ module SystemModule
|
|
82
94
|
# Read yaml file.
|
83
95
|
def _file_read(file)
|
84
96
|
begin
|
85
|
-
@
|
97
|
+
@content_file = File.read file
|
86
98
|
rescue SystemCallError
|
87
99
|
log.debug "Unable to read file \"#{file}\""
|
88
100
|
return false
|
@@ -90,8 +102,21 @@ module SystemModule
|
|
90
102
|
true
|
91
103
|
end
|
92
104
|
|
105
|
+
# Parse erb file.
|
106
|
+
def _parse_erb(file, content_erb)
|
107
|
+
begin
|
108
|
+
@content_yaml = ERB.new(content_erb).result
|
109
|
+
rescue StandardError => e
|
110
|
+
log.debug e.class
|
111
|
+
log.debug "Invalid ERB in YAML file \"#{file}\". " \
|
112
|
+
"#{e.class}: \"#{e.message}\""
|
113
|
+
return false
|
114
|
+
end
|
115
|
+
true
|
116
|
+
end
|
117
|
+
|
93
118
|
# Parse yaml file.
|
94
|
-
def _parse_yaml(content_yaml)
|
119
|
+
def _parse_yaml(file, content_yaml)
|
95
120
|
begin
|
96
121
|
@content = YAML.safe_load content_yaml
|
97
122
|
rescue Psych::SyntaxError
|
data/lib/takelage/self/list.rb
CHANGED
@@ -4,6 +4,13 @@
|
|
4
4
|
module SelfList
|
5
5
|
# Backend method for config self.
|
6
6
|
def self_list
|
7
|
+
_manipulate_output_(_get_thor_list_)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
# Get output of thor list command.
|
13
|
+
def _get_thor_list_
|
7
14
|
# use Thorfile which requires relative takelage.rb
|
8
15
|
thorfile_dir = "#{File.dirname(__FILE__)}/../"
|
9
16
|
|
@@ -12,20 +19,17 @@ module SelfList
|
|
12
19
|
"cd #{thorfile_dir} && " \
|
13
20
|
'thor list' \
|
14
21
|
"'"
|
15
|
-
thor_list = `#{cmd_thor_list}`
|
16
22
|
|
17
|
-
#
|
18
|
-
|
23
|
+
# call thor list command
|
24
|
+
`#{cmd_thor_list}`
|
19
25
|
end
|
20
26
|
|
21
|
-
private
|
22
|
-
|
23
27
|
# Manipulate output of thor list command.
|
24
28
|
def _manipulate_output_(thor_list)
|
25
|
-
thor_list.gsub
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
tau_list = thor_list.gsub("takelage\n", '')
|
30
|
+
tau_list.gsub!("------\n", '')
|
31
|
+
tau_list.gsub!('thor ', 'tau ')
|
32
|
+
tau_list.gsub!(/(.*)takelage:c_l_i:(.*)#(.*)/, '\1\2 #\3')
|
33
|
+
tau_list.gsub!(/.*COMMAND.*\n/, '')
|
30
34
|
end
|
31
35
|
end
|
data/lib/takelage/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.21.0
|