cmdlet 0.0.5 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.templates/FUNCTIONS.MD +19 -0
  3. data/.builders/.templates/cmdlet.rb +26 -0
  4. data/.builders/.templates/cmdlet_spec.rb +22 -0
  5. data/.builders/.templates/require_all_cmdlets.rb +5 -0
  6. data/.builders/_.rb +11 -1
  7. data/.builders/boot.rb +6 -3
  8. data/.builders/data/categories.json +28 -0
  9. data/.builders/data/cmdlets/array.json +121 -0
  10. data/.builders/data/cmdlets/comparison.json +245 -0
  11. data/.builders/director/category_builder.rb +26 -0
  12. data/.builders/director/category_dao.rb +38 -0
  13. data/.builders/director/category_director.rb +39 -0
  14. data/.builders/director/cmdlet_builder.rb +67 -0
  15. data/.builders/director/cmdlet_child.rb +39 -0
  16. data/.builders/director/cmdlet_dao.rb +29 -0
  17. data/.builders/director/cmdlet_director.rb +60 -0
  18. data/.builders/director/dao.rb +16 -0
  19. data/.builders/documents/commands.rb +222 -28
  20. data/.builders/documents/use_cases.rb +32 -34
  21. data/.builders/documents/x_functions.rb +7 -10
  22. data/.builders/generators/01-bootstrap.rb +112 -112
  23. data/.builders/generators/20-categories.rb +16 -0
  24. data/.builders/generators/30-commands-bak.rb +53 -0
  25. data/.builders/generators/cmdlets/array.rb +109 -0
  26. data/.builders/generators/cmdlets/comparison.rb +164 -0
  27. data/CHANGELOG.md +36 -0
  28. data/Guardfile +1 -1
  29. data/lib/cmdlet/_.rb +14 -0
  30. data/lib/cmdlet/all_commands.rb +3 -0
  31. data/lib/cmdlet/array/join.rb +22 -0
  32. data/lib/cmdlet/array/join_post.rb +22 -0
  33. data/lib/cmdlet/array/join_pre.rb +22 -0
  34. data/lib/cmdlet/base_cmdlet.rb +17 -0
  35. data/lib/cmdlet/comparison/and.rb +16 -0
  36. data/lib/cmdlet/comparison/default.rb +20 -0
  37. data/lib/cmdlet/comparison/eq.rb +20 -0
  38. data/lib/cmdlet/comparison/gt.rb +17 -0
  39. data/lib/cmdlet/comparison/gte.rb +17 -0
  40. data/lib/cmdlet/comparison/lt.rb +17 -0
  41. data/lib/cmdlet/comparison/lte.rb +17 -0
  42. data/lib/cmdlet/comparison/ne.rb +20 -0
  43. data/lib/cmdlet/comparison/or.rb +16 -0
  44. data/lib/cmdlet/configuration.rb +1 -1
  45. data/lib/cmdlet/version.rb +1 -1
  46. data/lib/cmdlet.rb +3 -0
  47. data/package-lock.json +2 -2
  48. data/package.json +1 -1
  49. metadata +39 -5
  50. data/.builders/documents/_.rb +0 -4
  51. data/.builders/documents/categories.rb +0 -24
  52. data/.builders/documents/functions.rb +0 -226
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae44ce26b73b2f24d493ad916c12328b2814e5e670cf8828079e4e7e32cc9f4a
4
- data.tar.gz: a9efa32929e26af9cdda7d207834d025039c049dd365ae79abacd1d7da33c5b0
3
+ metadata.gz: 4aaf22abcff261a22b71b4c4adeaf77dd8d629836936eabb1b20b2d8a61b3a28
4
+ data.tar.gz: 4d249fee0dd48b4774881e16bcc92b303f788e45b22c54c14a321a70468bcabf
5
5
  SHA512:
6
- metadata.gz: c79358c0e425a5dbe5f5441c69afc489eb86034c52122c14a217a2fa0eeb3b19249c578bc002118852a635c1404db62f905f1245813f66edf91db39909d6a18b
7
- data.tar.gz: 795edc645cc8747e9551ac5f8027b738c4d579ca6943b20ec82072d383172e3af7e39e1f6f4788205d80abeb8ba2749c23e1b553b56bef92c6fe04cece21d726
6
+ metadata.gz: ab39c705f59887093ecbf3a8ad2ec66f133bf14048f544b142b3de324fdb25006dfa19bb66efdf5e281d0167bac8b4bd2958769cff3ad8879515f833f24fa5d5
7
+ data.tar.gz: e78c0098b63350dfcc77bb7c6c50d902b8da963a9fc8531639a5c6835df4fdae3158b8518f2efd2f87a2fda9dfd9fb3a573f774159c04fad451dca50da09ac43
@@ -0,0 +1,19 @@
1
+ # Funcky Functions
2
+
3
+ > Funcky provides a set of functions (wrapped in the command pattern) that perform simple actions
4
+
5
+ ## List of categories
6
+
7
+ | Name | Description |
8
+ |-|-|
9
+ {{#each categories}}
10
+ | {{titleize name}} | {{description}} |
11
+ {{/each}}
12
+
13
+ ## List of functions
14
+
15
+ | Category | Name | Alias | Description |
16
+ |-|-|-|-|
17
+ {{#each functions}}
18
+ | {{titleize category}} | `{{name}}` | {{#each alias}}{{surround . '`' '` '}}{{/each}} | {{description}} |
19
+ {{/each}}
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cmdlet
4
+ # {{cmdlet.category_description}}
5
+ module {{camel cmdlet.category}}
6
+ # {{camel cmdlet.name}}: {{cmdlet.description}}
7
+ class {{camel cmdlet.name}} < Cmdlet::BaseCmdlet
8
+ {{#each cmdlet.usecases}}
9
+ # @example
10
+ #
11
+ # puts {{camel ./function}}.new.call({{{nice_inputs}}})
12
+ #
13
+ # {{expected_output}}
14
+ #
15
+ {{/each}}
16
+ #
17
+ {{#each cmdlet.parameters}}
18
+ # @param [{{./param_type}}] {{./name}} - {{./description}}
19
+ {{/each}}
20
+ # @return [String] {{cmdlet.result}}
21
+ def call({{#each cmdlet.parameters}}{{#if ./splat}}{{./splat}}{{/if}}{{./name}}{{#if ./default}} = {{{./default}}}{{/if}}{{#if @last}}{{^}}, {{/if}}{{/each}})
22
+ {{{cmdlet.ruby}}}
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ # {{camel cmdlet.name}}: {{cmdlet.description}}
4
+ RSpec.describe Cmdlet::{{camel cmdlet.category}}::{{camel cmdlet.name}} do
5
+ let(:instance) { described_class.new }
6
+
7
+ describe 'initialize' do
8
+ subject { instance }
9
+
10
+ it { is_expected.not_to be_nil }
11
+ end
12
+
13
+ describe '#call' do
14
+ subject { instance.call(value) }
15
+
16
+ let(:value) { nil }
17
+
18
+ context 'safely handle nil' do
19
+ it { is_expected.to eq('') }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#each cmdlets}}
4
+ require_relative '{{category}}/{{name}}'
5
+ {{/each}}
data/.builders/_.rb CHANGED
@@ -1 +1,11 @@
1
- require_relative './documents/_'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './director/category_dao'
4
+ require_relative './director/cmdlet_dao'
5
+ require_relative './director/dao'
6
+
7
+ require_relative './director/category_builder'
8
+ require_relative './director/category_director'
9
+ require_relative './director/cmdlet_builder'
10
+ require_relative './director/cmdlet_director'
11
+ require_relative './director/cmdlet_child'
data/.builders/boot.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Boot Sequence
2
4
 
3
5
  include KLog::Logging
@@ -49,10 +51,10 @@ KConfig.configure(CONFIG_KEY) do |config|
49
51
  config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
50
52
 
51
53
  config.target_folders.add(:app , base_folder)
52
- config.target_folders.add(:lib , :app, 'lib/funcky')
53
- config.target_folders.add(:spec , :app, 'spec/funcky')
54
+ config.target_folders.add(:lib , :app, 'lib/cmdlet')
55
+ config.target_folders.add(:spec , :app, 'spec/cmdlet')
54
56
  config.target_folders.add(:builder , builder_folder)
55
-
57
+ config.target_folders.add(:builder_data , :builder, 'data')
56
58
  end
57
59
 
58
60
  KConfig.configuration(CONFIG_KEY).debug
@@ -62,6 +64,7 @@ resource_manager = area.resource_manager
62
64
  resource_manager
63
65
  .fileset
64
66
  .glob('*.rb', exclude: ['boot.rb'])
67
+ .glob('documents/**/*.rb')
65
68
  .glob('generators/**/*.rb')
66
69
  resource_manager.add_resources
67
70
 
@@ -0,0 +1,28 @@
1
+ {
2
+ "categories": [
3
+ {
4
+ "name": "case",
5
+ "description": "Tokenize and apply case and/or separator"
6
+ },
7
+ {
8
+ "name": "comparison",
9
+ "description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc."
10
+ },
11
+ {
12
+ "name": "inflection",
13
+ "description": "Inflection handling routines, eg. pluralize, singular, ordinalize"
14
+ },
15
+ {
16
+ "name": "string",
17
+ "description": "String handling helpers"
18
+ },
19
+ {
20
+ "name": "array",
21
+ "description": "Array handling routines, eg. join, join_prefix, join_post"
22
+ },
23
+ {
24
+ "name": "transform",
25
+ "description": "Tokenize and apply case and/or separator"
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,121 @@
1
+ {
2
+ "category_key": "array",
3
+ "cmdlets": [
4
+ {
5
+ "name": "join",
6
+ "description": "join an array of values with separator as a string",
7
+ "result": "new String formed by joining the array elements with seperator",
8
+ "category": "array",
9
+ "category_description": "Array handling routines, eg. join, join_prefix, join_post",
10
+ "base_class_require": null,
11
+ "base_class": null,
12
+ "parameters": [
13
+ {
14
+ "name": "values",
15
+ "description": "array of values to join",
16
+ "splat": null,
17
+ "default": null,
18
+ "param_type": "String|Int"
19
+ },
20
+ {
21
+ "name": "separator",
22
+ "description": "separator between values, defaults to comma",
23
+ "splat": null,
24
+ "default": "','",
25
+ "param_type": "String"
26
+ }
27
+ ],
28
+ "examples": [
29
+
30
+ ],
31
+ "ruby": " return false if values.nil? || values.length == 0\n values = values.reject(&:blank?)\n return '' if values.length.zero?\n\n values.join(separator)\n"
32
+ },
33
+ {
34
+ "name": "join_pre",
35
+ "description": "join an array of values with separator as a string and using the separator at the beginning of string",
36
+ "result": null,
37
+ "category": "array",
38
+ "category_description": "Array handling routines, eg. join, join_prefix, join_post",
39
+ "base_class_require": null,
40
+ "base_class": null,
41
+ "parameters": [
42
+ {
43
+ "name": "values",
44
+ "description": "array of values to join",
45
+ "splat": null,
46
+ "default": null,
47
+ "param_type": "String|Int"
48
+ },
49
+ {
50
+ "name": "separator",
51
+ "description": "separator between values, defaults to comma",
52
+ "splat": null,
53
+ "default": "','",
54
+ "param_type": "String"
55
+ }
56
+ ],
57
+ "examples": [
58
+
59
+ ],
60
+ "ruby": " return '' if values.nil? || !values.is_a?(::Array)\n values = values.reject(&:blank?)\n return '' if values.length.zero?\n\n \"#{separator}#{values.join(separator)}\"\n"
61
+ },
62
+ {
63
+ "name": "join_pre",
64
+ "description": "join an array of values with separator as a string and using the separator at the beginning of string",
65
+ "result": null,
66
+ "category": "array",
67
+ "category_description": "Array handling routines, eg. join, join_prefix, join_post",
68
+ "base_class_require": null,
69
+ "base_class": null,
70
+ "parameters": [
71
+ {
72
+ "name": "values",
73
+ "description": "array of values to join",
74
+ "splat": null,
75
+ "default": null,
76
+ "param_type": "String|Int"
77
+ },
78
+ {
79
+ "name": "separator",
80
+ "description": "separator between values, defaults to comma",
81
+ "splat": null,
82
+ "default": "','",
83
+ "param_type": "String"
84
+ }
85
+ ],
86
+ "examples": [
87
+
88
+ ],
89
+ "ruby": " return '' if values.nil? || !values.is_a?(::Array)\n values = values.reject(&:blank?)\n return '' if values.length.zero?\n\n \"#{separator}#{values.join(separator)}\"\n"
90
+ },
91
+ {
92
+ "name": "join_post",
93
+ "description": "join an array of values with separator as a string and using the separator at the end of string",
94
+ "result": null,
95
+ "category": "array",
96
+ "category_description": "Array handling routines, eg. join, join_prefix, join_post",
97
+ "base_class_require": null,
98
+ "base_class": null,
99
+ "parameters": [
100
+ {
101
+ "name": "values",
102
+ "description": "array of values to join",
103
+ "splat": null,
104
+ "default": null,
105
+ "param_type": "String|Int"
106
+ },
107
+ {
108
+ "name": "separator",
109
+ "description": "separator between values, defaults to comma",
110
+ "splat": null,
111
+ "default": "','",
112
+ "param_type": "String"
113
+ }
114
+ ],
115
+ "examples": [
116
+
117
+ ],
118
+ "ruby": " return '' if values.nil? || !values.is_a?(::Array)\n values = values.reject(&:blank?)\n return '' if values.length.zero?\n\n \"#{values.join(separator)}#{separator}\"\n"
119
+ }
120
+ ]
121
+ }
@@ -0,0 +1,245 @@
1
+ {
2
+ "category_key": "comparison",
3
+ "cmdlets": [
4
+ {
5
+ "name": "and",
6
+ "description": "Return true if **all of** the given values are truthy.",
7
+ "result": "return true when every value is truthy",
8
+ "category": "comparison",
9
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
10
+ "base_class_require": null,
11
+ "base_class": null,
12
+ "parameters": [
13
+ {
14
+ "name": "values",
15
+ "description": "list of values (via *splat) to be checked via AND condition",
16
+ "splat": "*",
17
+ "default": null,
18
+ "param_type": "Object"
19
+ }
20
+ ],
21
+ "examples": [
22
+
23
+ ],
24
+ "ruby": " values.all? { |value| value }\n"
25
+ },
26
+ {
27
+ "name": "default",
28
+ "description": "Return true if **all of** the given values are truthy.",
29
+ "result": "return true when every value is truthy",
30
+ "category": "comparison",
31
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
32
+ "base_class_require": null,
33
+ "base_class": null,
34
+ "parameters": [
35
+ {
36
+ "name": "values",
37
+ "description": "one or more paramaters that may or may not contain nil",
38
+ "splat": "*",
39
+ "default": null,
40
+ "param_type": "Object"
41
+ }
42
+ ],
43
+ "examples": [
44
+
45
+ ],
46
+ "ruby": " default_value = values[-1]\n\n find_value = values[0..-2].find { |value| !value.nil? }\n\n find_value || default_value\n"
47
+ },
48
+ {
49
+ "name": "eq",
50
+ "description": "Return true if two values are equal",
51
+ "result": "return truthy value if left hand side equals right hand side",
52
+ "category": "comparison",
53
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
54
+ "base_class_require": null,
55
+ "base_class": null,
56
+ "parameters": [
57
+ {
58
+ "name": "lhs",
59
+ "description": "lhs - left hand side value",
60
+ "splat": null,
61
+ "default": null,
62
+ "param_type": "Object"
63
+ },
64
+ {
65
+ "name": "rhs",
66
+ "description": "rhs - right hand side value",
67
+ "splat": null,
68
+ "default": null,
69
+ "param_type": "Object"
70
+ }
71
+ ],
72
+ "examples": [
73
+
74
+ ],
75
+ "ruby": " lhs = lhs.to_s if lhs.is_a?(Symbol)\n rhs = rhs.to_s if rhs.is_a?(Symbol)\n\n lhs == rhs\n"
76
+ },
77
+ {
78
+ "name": "gt",
79
+ "description": "Return true if left hand side GREATER THAN right hand side",
80
+ "result": "truthy value if left hand side GREATER THAN right hand side",
81
+ "category": "comparison",
82
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
83
+ "base_class_require": null,
84
+ "base_class": null,
85
+ "parameters": [
86
+ {
87
+ "name": "lhs",
88
+ "description": "lhs - left hand side value",
89
+ "splat": null,
90
+ "default": null,
91
+ "param_type": "Object"
92
+ },
93
+ {
94
+ "name": "rhs",
95
+ "description": "rhs - right hand side value",
96
+ "splat": null,
97
+ "default": null,
98
+ "param_type": "Object"
99
+ }
100
+ ],
101
+ "examples": [
102
+
103
+ ],
104
+ "ruby": " lhs > rhs\n"
105
+ },
106
+ {
107
+ "name": "gte",
108
+ "description": "Return true if left hand side GREATER THAN or EQUAL TO right hand side",
109
+ "result": "truthy value if left hand side GREATER THAN or EQUAL TO right hand side",
110
+ "category": "comparison",
111
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
112
+ "base_class_require": null,
113
+ "base_class": null,
114
+ "parameters": [
115
+ {
116
+ "name": "lhs",
117
+ "description": "lhs - left hand side value",
118
+ "splat": null,
119
+ "default": null,
120
+ "param_type": "Object"
121
+ },
122
+ {
123
+ "name": "rhs",
124
+ "description": "rhs - right hand side value",
125
+ "splat": null,
126
+ "default": null,
127
+ "param_type": "Object"
128
+ }
129
+ ],
130
+ "examples": [
131
+
132
+ ],
133
+ "ruby": " lhs >= rhs\n"
134
+ },
135
+ {
136
+ "name": "lt",
137
+ "description": "Return true if left hand side LESS THAN right hand side",
138
+ "result": "truthy value if left hand side LESS THAN right hand side",
139
+ "category": "comparison",
140
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
141
+ "base_class_require": null,
142
+ "base_class": null,
143
+ "parameters": [
144
+ {
145
+ "name": "lhs",
146
+ "description": "lhs - left hand side value",
147
+ "splat": null,
148
+ "default": null,
149
+ "param_type": "Object"
150
+ },
151
+ {
152
+ "name": "rhs",
153
+ "description": "rhs - right hand side value",
154
+ "splat": null,
155
+ "default": null,
156
+ "param_type": "Object"
157
+ }
158
+ ],
159
+ "examples": [
160
+
161
+ ],
162
+ "ruby": " lhs < rhs\n"
163
+ },
164
+ {
165
+ "name": "lte",
166
+ "description": "Return true if left hand side LESS THAN or EQUAL TO right hand side",
167
+ "result": "truthy value if left hand side LESS THAN or EQUAL TO right hand side",
168
+ "category": "comparison",
169
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
170
+ "base_class_require": null,
171
+ "base_class": null,
172
+ "parameters": [
173
+ {
174
+ "name": "lhs",
175
+ "description": "lhs - left hand side value",
176
+ "splat": null,
177
+ "default": null,
178
+ "param_type": "Object"
179
+ },
180
+ {
181
+ "name": "rhs",
182
+ "description": "rhs - right hand side value",
183
+ "splat": null,
184
+ "default": null,
185
+ "param_type": "Object"
186
+ }
187
+ ],
188
+ "examples": [
189
+
190
+ ],
191
+ "ruby": " lhs <= rhs\n"
192
+ },
193
+ {
194
+ "name": "ne",
195
+ "description": "Return true if left hand side is NOT equal to right hand side",
196
+ "result": "truthy value if left hand side is NOT equal to right hand side",
197
+ "category": "comparison",
198
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
199
+ "base_class_require": null,
200
+ "base_class": null,
201
+ "parameters": [
202
+ {
203
+ "name": "lhs",
204
+ "description": "lhs - left hand side value",
205
+ "splat": null,
206
+ "default": null,
207
+ "param_type": "Object"
208
+ },
209
+ {
210
+ "name": "rhs",
211
+ "description": "rhs - right hand side value",
212
+ "splat": null,
213
+ "default": null,
214
+ "param_type": "Object"
215
+ }
216
+ ],
217
+ "examples": [
218
+
219
+ ],
220
+ "ruby": " lhs = lhs.to_s if lhs.is_a?(Symbol)\n rhs = rhs.to_s if rhs.is_a?(Symbol)\n\n lhs != rhs\n"
221
+ },
222
+ {
223
+ "name": "or",
224
+ "description": "Return true if any value is truthy.",
225
+ "result": "return true when first value is truthy",
226
+ "category": "comparison",
227
+ "category_description": "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.",
228
+ "base_class_require": null,
229
+ "base_class": null,
230
+ "parameters": [
231
+ {
232
+ "name": "values",
233
+ "description": "list of values (via *splat) to be checked via AND condition",
234
+ "splat": "*",
235
+ "default": null,
236
+ "param_type": "Object"
237
+ }
238
+ ],
239
+ "examples": [
240
+
241
+ ],
242
+ "ruby": " values.any? { |value| value }\n"
243
+ }
244
+ ]
245
+ }
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CategoryBuilder < KDirector::Builders::ActionsBuilder
4
+ def category(name, description)
5
+ value = {
6
+ name: name,
7
+ description: description
8
+ }
9
+
10
+ add(:categories, value: value)
11
+
12
+ self
13
+ end
14
+
15
+ def save_categories(**opts)
16
+ k_builder
17
+ .cd(:builder_data)
18
+ .add('categories.json', content: to_json, **opts)
19
+
20
+ self
21
+ end
22
+
23
+ def osave_categories(**opts)
24
+ save_categories(**{ open: true }.merge(opts))
25
+ end
26
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CategoryDao
4
+ attr_reader :k_builder
5
+ attr_reader :load_time
6
+ attr_reader :data
7
+
8
+ def initialize(k_builder)
9
+ @k_builder = k_builder
10
+ @load_time = nil
11
+ @data = nil
12
+ end
13
+
14
+ def file_name
15
+ k_builder.target_folders.join(:builder_data, 'categories.json')
16
+ end
17
+
18
+ def reload?
19
+ @load_time.nil? || @load_time < File.mtime(file_name)
20
+ end
21
+
22
+ def find_category(name)
23
+ result = categories.find { |category| category[:name] == name.to_s }
24
+
25
+ raise "Category #{name} not found" if result.nil?
26
+
27
+ result
28
+ end
29
+
30
+ def categories
31
+ if reload?
32
+ @data = JSON.parse(File.read(file_name), symbolize_names: true)
33
+ @categories = data[:categories]
34
+ @load_time = File.mtime(file_name)
35
+ end
36
+ @categories
37
+ end
38
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CategoryDirector < KDirector::Directors::BaseDirector
4
+ defaults(builder_type: CategoryBuilder, on_exist: :write, on_action: :execute)
5
+
6
+ def category(name, description)
7
+ builder.category(name, description)
8
+
9
+ self
10
+ end
11
+
12
+ def generate
13
+ generate_require_all_cmdlets
14
+
15
+ self
16
+ end
17
+
18
+ def save_categories(**opts)
19
+ cd(:builder_data)
20
+ add('categories.json', content: builder.to_json, **opts)
21
+
22
+ self
23
+ end
24
+
25
+ def osave_categories(**opts)
26
+ save_categories(**{ open: true }.merge(opts))
27
+ end
28
+
29
+ private
30
+
31
+ def generate_require_all_cmdlets
32
+ cd(:lib)
33
+ add('_.rb',
34
+ template_file: 'require_all_cmdlets.rb',
35
+ cmdlets: data_access.cmdlet.all_cmdlets)
36
+
37
+ end
38
+
39
+ end