cmdlet 0.0.7 → 0.1.2
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/.builders/.templates/cmdlet.rb +26 -0
- data/.builders/.templates/{command_spec.rb → cmdlet_spec.rb} +4 -4
- data/.builders/.templates/require_all_cmdlets.rb +5 -0
- data/.builders/_.rb +7 -1
- data/.builders/boot.rb +2 -0
- data/.builders/data/categories.json +2 -10
- data/.builders/data/cmdlets/array.json +121 -0
- data/.builders/data/cmdlets/comparison.json +245 -0
- data/.builders/director/category_builder.rb +26 -0
- data/.builders/director/category_dao.rb +38 -0
- data/.builders/director/category_director.rb +24 -10
- data/.builders/director/cmdlet_builder.rb +27 -34
- data/.builders/director/cmdlet_child.rb +16 -44
- data/.builders/director/cmdlet_dao.rb +29 -0
- data/.builders/director/cmdlet_director.rb +37 -13
- data/.builders/director/dao.rb +16 -0
- data/.builders/documents/commands.rb +15 -16
- data/.builders/documents/use_cases.rb +32 -34
- data/.builders/documents/x_functions.rb +7 -10
- data/.builders/generators/01-bootstrap.rb +112 -112
- data/.builders/generators/20-categories.rb +16 -0
- data/.builders/generators/30-commands-bak.rb +53 -0
- data/.builders/generators/cmdlets/array.rb +109 -0
- data/.builders/generators/cmdlets/comparison.rb +164 -0
- data/CHANGELOG.md +22 -0
- data/Guardfile +1 -1
- data/lib/cmdlet/_.rb +14 -0
- data/lib/cmdlet/array/join.rb +8 -10
- data/lib/cmdlet/array/join_post.rb +22 -0
- data/lib/cmdlet/array/join_pre.rb +22 -0
- data/lib/cmdlet/base_cmdlet.rb +17 -0
- data/lib/cmdlet/comparison/and.rb +16 -0
- data/lib/cmdlet/comparison/default.rb +20 -0
- data/lib/cmdlet/comparison/eq.rb +20 -0
- data/lib/cmdlet/comparison/gt.rb +17 -0
- data/lib/cmdlet/comparison/gte.rb +17 -0
- data/lib/cmdlet/comparison/lt.rb +17 -0
- data/lib/cmdlet/comparison/lte.rb +17 -0
- data/lib/cmdlet/comparison/ne.rb +20 -0
- data/lib/cmdlet/comparison/or.rb +16 -0
- data/lib/cmdlet/version.rb +1 -1
- data/lib/cmdlet.rb +3 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +28 -9
- data/.builders/.templates/all_commands.rb +0 -5
- data/.builders/.templates/command.rb +0 -26
- data/.builders/documents/categories.rb +0 -24
- data/.builders/documents/cmdlets.rb +0 -30
- data/.builders/generators/20-commands.rb +0 -54
- data/.builders/generators/25-categories.rb +0 -20
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Array handling routines, eg. join, join_prefix, join_post
|
5
|
+
module Array
|
6
|
+
# JoinPost: join an array of values with separator as a string and using the separator at the end of string
|
7
|
+
class JoinPost < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] values - array of values to join
|
10
|
+
# @param [String] separator - separator between values, defaults to comma
|
11
|
+
# @return [String]
|
12
|
+
def call(values, separator = ',')
|
13
|
+
return '' if values.nil? || !values.is_a?(::Array)
|
14
|
+
|
15
|
+
values = values.reject(&:blank?)
|
16
|
+
return '' if values.length.zero?
|
17
|
+
|
18
|
+
"#{values.join(separator)}#{separator}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Array handling routines, eg. join, join_prefix, join_post
|
5
|
+
module Array
|
6
|
+
# JoinPre: join an array of values with separator as a string and using the separator at the beginning of string
|
7
|
+
class JoinPre < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [String|Int] values - array of values to join
|
10
|
+
# @param [String] separator - separator between values, defaults to comma
|
11
|
+
# @return [String]
|
12
|
+
def call(values, separator = ',')
|
13
|
+
return '' if values.nil? || !values.is_a?(::Array)
|
14
|
+
|
15
|
+
values = values.reject(&:blank?)
|
16
|
+
return '' if values.length.zero?
|
17
|
+
|
18
|
+
"#{separator}#{values.join(separator)}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# base cmdlet provides an interface for cmdlets
|
5
|
+
class BaseCmdlet
|
6
|
+
def call(value)
|
7
|
+
value
|
8
|
+
end
|
9
|
+
|
10
|
+
# String tokenizer will clean up a string so that
|
11
|
+
# all sorts of case formatted strings can be
|
12
|
+
# represented in a consistent fashion
|
13
|
+
def tokenizer
|
14
|
+
@_tokenizer ||= Funcky.configuration.tokenizer
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# And: Return true if **all of** the given values are truthy.
|
7
|
+
class And < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] values - list of values (via *splat) to be checked via AND condition
|
10
|
+
# @return [String] return true when every value is truthy
|
11
|
+
def call(*values)
|
12
|
+
values.all? { |value| value }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Default: Return true if **all of** the given values are truthy.
|
7
|
+
class Default < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] values - one or more paramaters that may or may not contain nil
|
10
|
+
# @return [String] return true when every value is truthy
|
11
|
+
def call(*values)
|
12
|
+
default_value = values[-1]
|
13
|
+
|
14
|
+
find_value = values[0..-2].find { |value| !value.nil? }
|
15
|
+
|
16
|
+
find_value || default_value
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Eq: Return true if two values are equal
|
7
|
+
class Eq < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] lhs - lhs - left hand side value
|
10
|
+
# @param [Object] rhs - rhs - right hand side value
|
11
|
+
# @return [String] return truthy value if left hand side equals right hand side
|
12
|
+
def call(lhs, rhs)
|
13
|
+
lhs = lhs.to_s if lhs.is_a?(Symbol)
|
14
|
+
rhs = rhs.to_s if rhs.is_a?(Symbol)
|
15
|
+
|
16
|
+
lhs == rhs
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Gt: Return true if left hand side GREATER THAN right hand side
|
7
|
+
class Gt < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] lhs - lhs - left hand side value
|
10
|
+
# @param [Object] rhs - rhs - right hand side value
|
11
|
+
# @return [String] truthy value if left hand side GREATER THAN right hand side
|
12
|
+
def call(lhs, rhs)
|
13
|
+
lhs > rhs
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Gte: Return true if left hand side GREATER THAN or EQUAL TO right hand side
|
7
|
+
class Gte < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] lhs - lhs - left hand side value
|
10
|
+
# @param [Object] rhs - rhs - right hand side value
|
11
|
+
# @return [String] truthy value if left hand side GREATER THAN or EQUAL TO right hand side
|
12
|
+
def call(lhs, rhs)
|
13
|
+
lhs >= rhs
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Lt: Return true if left hand side LESS THAN right hand side
|
7
|
+
class Lt < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] lhs - lhs - left hand side value
|
10
|
+
# @param [Object] rhs - rhs - right hand side value
|
11
|
+
# @return [String] truthy value if left hand side LESS THAN right hand side
|
12
|
+
def call(lhs, rhs)
|
13
|
+
lhs < rhs
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Lte: Return true if left hand side LESS THAN or EQUAL TO right hand side
|
7
|
+
class Lte < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] lhs - lhs - left hand side value
|
10
|
+
# @param [Object] rhs - rhs - right hand side value
|
11
|
+
# @return [String] truthy value if left hand side LESS THAN or EQUAL TO right hand side
|
12
|
+
def call(lhs, rhs)
|
13
|
+
lhs <= rhs
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Ne: Return true if left hand side is NOT equal to right hand side
|
7
|
+
class Ne < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] lhs - lhs - left hand side value
|
10
|
+
# @param [Object] rhs - rhs - right hand side value
|
11
|
+
# @return [String] truthy value if left hand side is NOT equal to right hand side
|
12
|
+
def call(lhs, rhs)
|
13
|
+
lhs = lhs.to_s if lhs.is_a?(Symbol)
|
14
|
+
rhs = rhs.to_s if rhs.is_a?(Symbol)
|
15
|
+
|
16
|
+
lhs != rhs
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Cmdlet
|
4
|
+
# Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.
|
5
|
+
module Comparison
|
6
|
+
# Or: Return true if any value is truthy.
|
7
|
+
class Or < Cmdlet::BaseCmdlet
|
8
|
+
#
|
9
|
+
# @param [Object] values - list of values (via *splat) to be checked via AND condition
|
10
|
+
# @return [String] return true when first value is truthy
|
11
|
+
def call(*values)
|
12
|
+
values.any? { |value| value }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/cmdlet/version.rb
CHANGED
data/lib/cmdlet.rb
CHANGED
@@ -4,8 +4,11 @@
|
|
4
4
|
require 'k_config'
|
5
5
|
require_relative 'cmdlet/version'
|
6
6
|
require_relative 'cmdlet/configuration'
|
7
|
+
require_relative 'cmdlet/base_cmdlet'
|
7
8
|
require_relative 'cmdlet/string_tokenizer'
|
8
9
|
|
10
|
+
require_relative 'cmdlet/_'
|
11
|
+
|
9
12
|
module Cmdlet
|
10
13
|
# raise Cmdlet::Error, 'Sample message'
|
11
14
|
Error = Class.new(StandardError)
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "cmdlet",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.1.2",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "cmdlet",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.1.2",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmdlet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -47,24 +47,30 @@ extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
49
|
- ".builders/.templates/FUNCTIONS.MD"
|
50
|
-
- ".builders/.templates/
|
51
|
-
- ".builders/.templates/
|
52
|
-
- ".builders/.templates/
|
50
|
+
- ".builders/.templates/cmdlet.rb"
|
51
|
+
- ".builders/.templates/cmdlet_spec.rb"
|
52
|
+
- ".builders/.templates/require_all_cmdlets.rb"
|
53
53
|
- ".builders/_.rb"
|
54
54
|
- ".builders/boot.rb"
|
55
55
|
- ".builders/data/categories.json"
|
56
|
+
- ".builders/data/cmdlets/array.json"
|
57
|
+
- ".builders/data/cmdlets/comparison.json"
|
58
|
+
- ".builders/director/category_builder.rb"
|
59
|
+
- ".builders/director/category_dao.rb"
|
56
60
|
- ".builders/director/category_director.rb"
|
57
61
|
- ".builders/director/cmdlet_builder.rb"
|
58
62
|
- ".builders/director/cmdlet_child.rb"
|
63
|
+
- ".builders/director/cmdlet_dao.rb"
|
59
64
|
- ".builders/director/cmdlet_director.rb"
|
60
|
-
- ".builders/
|
61
|
-
- ".builders/documents/cmdlets.rb"
|
65
|
+
- ".builders/director/dao.rb"
|
62
66
|
- ".builders/documents/commands.rb"
|
63
67
|
- ".builders/documents/use_cases.rb"
|
64
68
|
- ".builders/documents/x_functions.rb"
|
65
69
|
- ".builders/generators/01-bootstrap.rb"
|
66
|
-
- ".builders/generators/20-
|
67
|
-
- ".builders/generators/
|
70
|
+
- ".builders/generators/20-categories.rb"
|
71
|
+
- ".builders/generators/30-commands-bak.rb"
|
72
|
+
- ".builders/generators/cmdlets/array.rb"
|
73
|
+
- ".builders/generators/cmdlets/comparison.rb"
|
68
74
|
- ".releaserc.json"
|
69
75
|
- ".rspec"
|
70
76
|
- ".rubocop.yml"
|
@@ -78,8 +84,21 @@ files:
|
|
78
84
|
- bin/console
|
79
85
|
- bin/setup
|
80
86
|
- lib/cmdlet.rb
|
87
|
+
- lib/cmdlet/_.rb
|
81
88
|
- lib/cmdlet/all_commands.rb
|
82
89
|
- lib/cmdlet/array/join.rb
|
90
|
+
- lib/cmdlet/array/join_post.rb
|
91
|
+
- lib/cmdlet/array/join_pre.rb
|
92
|
+
- lib/cmdlet/base_cmdlet.rb
|
93
|
+
- lib/cmdlet/comparison/and.rb
|
94
|
+
- lib/cmdlet/comparison/default.rb
|
95
|
+
- lib/cmdlet/comparison/eq.rb
|
96
|
+
- lib/cmdlet/comparison/gt.rb
|
97
|
+
- lib/cmdlet/comparison/gte.rb
|
98
|
+
- lib/cmdlet/comparison/lt.rb
|
99
|
+
- lib/cmdlet/comparison/lte.rb
|
100
|
+
- lib/cmdlet/comparison/ne.rb
|
101
|
+
- lib/cmdlet/comparison/or.rb
|
83
102
|
- lib/cmdlet/configuration.rb
|
84
103
|
- lib/cmdlet/string_tokenizer.rb
|
85
104
|
- lib/cmdlet/version.rb
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# reference: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb
|
4
|
-
|
5
|
-
module Cmdlet
|
6
|
-
# {{cmdlet.category_description}}
|
7
|
-
module {{camel cmdlet.category}}
|
8
|
-
# {{camel cmdlet.name}}: {{cmdlet.command_description}}
|
9
|
-
class {{camel cmdlet.name}} < Funcky::BaseFunction
|
10
|
-
{{#each cmdlet.usecases}}
|
11
|
-
# @example
|
12
|
-
#
|
13
|
-
# puts {{camel ./function}}.new.parse({{{nice_inputs}}})
|
14
|
-
#
|
15
|
-
# {{expected_output}}
|
16
|
-
#
|
17
|
-
{{/each}}
|
18
|
-
#
|
19
|
-
# @param [String|Int] value - numeric value
|
20
|
-
# @return [String] ordinal suffix that would be required for a number
|
21
|
-
def parse(value)
|
22
|
-
{{{cmdlet.ruby}}}
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
def categories
|
2
|
-
return @categories unless @categories.nil?
|
3
|
-
|
4
|
-
|
5
|
-
result = KDoc.model :document do
|
6
|
-
table :rows do
|
7
|
-
fields :name, :description
|
8
|
-
|
9
|
-
row :case , "Tokenize and apply case and/or separator"
|
10
|
-
row :comparison , "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc."
|
11
|
-
row :inflection , "Inflection handling routines, eg. pluralize, singular, ordinalize"
|
12
|
-
row :string , "String handling helpers"
|
13
|
-
|
14
|
-
row :array , "Array handling routines, eg. join, join_prefix, join_post"
|
15
|
-
row :a_transform , "Tokenize and apply case and/or separator"
|
16
|
-
row :a_comparison , "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc."
|
17
|
-
row :a_inflection , "Inflection handling routines, eg. pluralize, singular, ordinalize"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
@categories = result.raw_data_struct.rows
|
22
|
-
end
|
23
|
-
@categories = nil
|
24
|
-
|
@@ -1,30 +0,0 @@
|
|
1
|
-
def cmdlets
|
2
|
-
commands.map do |command|
|
3
|
-
category = categories.find { |c| c.name == command.category }
|
4
|
-
|
5
|
-
log.error("Category '#{command.category}' not found") unless category
|
6
|
-
|
7
|
-
OpenStruct.new(
|
8
|
-
category: command.category,
|
9
|
-
name: command.name,
|
10
|
-
category_description: category.description,
|
11
|
-
command_description: command.description,
|
12
|
-
ruby: command.ruby,
|
13
|
-
usecases: use_cases
|
14
|
-
.select { |uc| uc.category == command.category && uc.command == command.name }
|
15
|
-
.map { |uc|
|
16
|
-
OpenStruct.new({
|
17
|
-
category: uc.category,
|
18
|
-
command: uc.command,
|
19
|
-
inputs: uc.inputs,
|
20
|
-
nice_inputs: nice_inputs(uc.inputs),
|
21
|
-
expected_output: uc.expected_output
|
22
|
-
})
|
23
|
-
}
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def nice_inputs(values)
|
29
|
-
values.map { |value| value.is_a?(String) ? "'#{value}'" : value }.join(', ')
|
30
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
KManager.action :commands do
|
2
|
-
action do
|
3
|
-
|
4
|
-
puts commands.first.function_description
|
5
|
-
# Ruby Gem Bootstrap
|
6
|
-
director = KDirector::Dsls::BasicDsl
|
7
|
-
.init(k_builder,
|
8
|
-
template_base_folder: '',
|
9
|
-
on_exist: :skip, # %i[skip write compare]
|
10
|
-
on_action: :queue # %i[queue execute]
|
11
|
-
)
|
12
|
-
.blueprint(
|
13
|
-
active: true,
|
14
|
-
name: :build_commands,
|
15
|
-
description: 'Build Commandlets',
|
16
|
-
on_exist: :write) do
|
17
|
-
|
18
|
-
cd(:lib)
|
19
|
-
|
20
|
-
# builder
|
21
|
-
# .add_file('FUNCTIONS.md',
|
22
|
-
# template_file: 'FUNCTIONS.md',
|
23
|
-
# categories: categories.sort_by { |r| r.name },
|
24
|
-
# functions: functions.sort_by { |r| [r.category, r.name] },
|
25
|
-
# on_exist: :write)
|
26
|
-
|
27
|
-
add('all_commands.rb',
|
28
|
-
template_file: 'all_commands.rb',
|
29
|
-
commands: commands.sort_by { |r| [r.category, r.name] },
|
30
|
-
on_exist: :write)
|
31
|
-
|
32
|
-
cmdlets.each do |cmdlet|
|
33
|
-
|
34
|
-
add("#{cmdlet.category}/#{cmdlet.name}.rb",
|
35
|
-
cmdlet: cmdlet,
|
36
|
-
template_file: 'command.rb',
|
37
|
-
on_exist: :write)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
director.play_actions
|
43
|
-
# director.builder.logit
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
KManager.opts.app_name = 'commands'
|
48
|
-
KManager.opts.sleep = 2
|
49
|
-
KManager.opts.reboot_on_kill = 0
|
50
|
-
KManager.opts.reboot_sleep = 4
|
51
|
-
KManager.opts.exception_style = :short
|
52
|
-
KManager.opts.show.time_taken = true
|
53
|
-
KManager.opts.show.finished = true
|
54
|
-
KManager.opts.show.finished_message = 'FINISHED :)'
|
@@ -1,20 +0,0 @@
|
|
1
|
-
KManager.action :categories do
|
2
|
-
action do
|
3
|
-
|
4
|
-
CategoryDirector
|
5
|
-
.init(k_builder,
|
6
|
-
on_exist: :write, # %i[skip write compare]
|
7
|
-
on_action: :execute # %i[queue execute]
|
8
|
-
)
|
9
|
-
.category(:case , "Tokenize and apply case and/or separator")
|
10
|
-
.category(:comparison , "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.")
|
11
|
-
.category(:inflection , "Inflection handling routines, eg. pluralize, singular, ordinalize")
|
12
|
-
.category(:string , "String handling helpers")
|
13
|
-
.category(:a_array , "Array handling routines, eg. join, join_prefix, join_post")
|
14
|
-
.category(:a_transform , "Tokenize and apply case and/or separator")
|
15
|
-
.category(:a_comparison , "Comparison helpers, eg. or, and, equal, not equal, less than, greater than etc.")
|
16
|
-
.category(:a_inflection , "Inflection handling routines, eg. pluralize, singular, ordinalize")
|
17
|
-
.save_categories
|
18
|
-
.category_file
|
19
|
-
end
|
20
|
-
end
|