cmdlet 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbd35f78dbd459eac65f0df1fd2f6aefc16b560b3083140a9ea092dc6cf359ec
4
- data.tar.gz: 27fff2ef08e9df32b43b5bf06d72755893e3a701af8057d55c0379f6ebe82226
3
+ metadata.gz: 49c3beb9fd9aff2b68b44e39e8fcda09b7d54c28413f5295d9bb797c674cf357
4
+ data.tar.gz: 0c3ecef6805fa262aa2869a5375791ba1ff6db080748519977d5c24509d5159d
5
5
  SHA512:
6
- metadata.gz: cf6ea403db6da89cf2f82957773fe648f7eb8883acd112524d44149fb4f8067409b3d17e8240d13b6ab1059883d86ecbadc4efb61bbbec4722cd0bc6620baee6
7
- data.tar.gz: 91153e6f0c1aec787f555ff44afe2469328208bd11f8d8857a05d4da18a7f54cdc00dd12e2a6c774c1d2ec2cd2870a5e23723bc08d9783709fd75fa526d40a35
6
+ metadata.gz: 7785377593e33ed05090b16277252be0ca0f8893fdcda9a70b6a996b2c77d5e8f2dac2b36f952632a11293630f6db697cad854b8edea2104870edcea7af8646c
7
+ data.tar.gz: 6f9183a77a87c437dd6dbcdac568075fb05b184be5f6970ff7205df4b209a1201272870224a3b458f2017c93f175d987f429150fa98acc223c2a8dbfd19f7600
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handlebarsjs
4
+ module Helpers
5
+ # {{cmdlet.category_description}}
6
+ module {{camel cmdlet.category}}
7
+ # {{camel cmdlet.name}}: {{cmdlet.description}}
8
+ class {{camel cmdlet.name}} < Handlebarsjs::BaseHelper
9
+ register_cmdlet(Cmdlet::{{camel cmdlet.category}}::{{camel cmdlet.name}})
10
+
11
+ def to_proc
12
+ ->({{#each cmdlet.parameters}}{{#if ./splat}}{{./splat}}{{/if}}{{./name}}{{#if @last}}{{^}}, {{/if}}{{/each}}, _opts) { wrapper(cmdlet.call({{#each cmdlet.parameters}}{{#if ./splat}}{{./splat}}{{/if}}{{./name}}{{#if @last}}{{^}}, {{/if}}{{/each}})) }
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ {{#each cmdlets}}
4
+ require_relative 'handlebarsjs/helpers/{{category}}/{{name}}'
5
+ {{/each}}
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # {{camel cmdlet.name}}: {{cmdlet.description}}
4
+ RSpec.describe Handlebarsjs::Helpers::{{camel cmdlet.category}}::{{camel cmdlet.name}} do
5
+ let(:helper_name) { :{{cmdlet.name}} }
6
+ let(:helper) { described_class.new }
7
+ let(:handlebars) { Handlebarsjs::Handlebars.new }
8
+
9
+ before { handlebars.handlebars_snapshot.add_helper(helper_name, helper) }
10
+
11
+ describe '#process_template' do
12
+ subject { handlebars.process_template(template, data).squish }
13
+
14
+ let(:lhs) { nil }
15
+ let(:rhs) { nil }
16
+ let(:data) { { lhs: lhs, rhs: rhs } }
17
+
18
+ let(:template) do
19
+ <<~TEXT.chomp
20
+ {{#if (and lhs rhs)}}
21
+ {{^}}
22
+ {{/if}}
23
+ TEXT
24
+ end
25
+ end
26
+ end
data/.builders/boot.rb CHANGED
@@ -46,6 +46,7 @@ KConfig.configure(CONFIG_KEY) do |config|
46
46
  builder_folder = Dir.pwd
47
47
  base_folder = File.expand_path('../', builder_folder)
48
48
  global_template = File.expand_path('~/dev/kgems/k_templates/templates')
49
+ handlebars_folder = File.expand_path('~/dev/kgems/handlebarsjs/')
49
50
 
50
51
  config.template_folders.add(:global_template , global_template)
51
52
  config.template_folders.add(:template , File.expand_path('.templates', Dir.pwd))
@@ -55,6 +56,9 @@ KConfig.configure(CONFIG_KEY) do |config|
55
56
  config.target_folders.add(:spec , :app, 'spec/cmdlet')
56
57
  config.target_folders.add(:builder , builder_folder)
57
58
  config.target_folders.add(:builder_data , :builder, 'data')
59
+ config.target_folders.add(:handlebars , handlebars_folder)
60
+ config.target_folders.add(:handlebars_lib , :handlebars, 'lib')
61
+ config.target_folders.add(:handlebars_spec , :handlebars, 'spec')
58
62
  end
59
63
 
60
64
  KConfig.configuration(CONFIG_KEY).debug
@@ -31,7 +31,12 @@ class CategoryDirector < KDirector::Directors::BaseDirector
31
31
  def generate_require_all_cmdlets
32
32
  cd(:lib)
33
33
  add('_.rb',
34
- template_file: 'require_all_cmdlets.rb',
34
+ template_file: 'cmdlets_require_all.rb',
35
+ cmdlets: data_access.cmdlet.all_cmdlets)
36
+
37
+ cd(:handlebars_lib)
38
+ add('_.rb',
39
+ template_file: 'handlebars_helper_require_all.rb',
35
40
  cmdlets: data_access.cmdlet.all_cmdlets)
36
41
 
37
42
  end
@@ -32,12 +32,20 @@ class CmdletDirector < KDirector::Directors::BaseDirector
32
32
  builder.cmdlets.each do |cmdlet|
33
33
  cmdlet_file = "#{cmdlet[:category]}/#{cmdlet[:name]}.rb"
34
34
  cmdlet_spec_file = "#{cmdlet[:category]}/#{cmdlet[:name]}_spec.rb"
35
+ handlebars_file = "handlebarsjs/helpers/#{cmdlet[:category]}/#{cmdlet[:name]}.rb"
36
+ handlebars_spec_file = "handlebarsjs/helpers/#{cmdlet[:category]}/#{cmdlet[:name]}_spec.rb"
35
37
 
36
38
  cd(:lib)
37
39
  add(cmdlet_file, template_file: 'cmdlet.rb', cmdlet: cmdlet)
38
40
 
39
41
  cd(:spec)
40
42
  add(cmdlet_spec_file, template_file: 'cmdlet_spec.rb', cmdlet: cmdlet, on_exist: :skip)
43
+
44
+ cd(:handlebars_lib)
45
+ add(handlebars_file, template_file: 'handlebars_helper.rb', cmdlet: cmdlet)
46
+
47
+ cd(:handlebars_spec)
48
+ add(handlebars_spec_file, template_file: 'handlebars_helper_spec.rb', cmdlet: cmdlet, on_exist: :skip)
41
49
  end
42
50
 
43
51
  self
@@ -11,7 +11,7 @@ KManager.action :comparison_commands do
11
11
 
12
12
  parameter :values, 'list of values (via *splat) to be checked via AND condition', splat: '*', param_type: 'Object'
13
13
 
14
- ruby <<-RUBY
14
+ ruby <<-RUBY
15
15
  values.all? { |value| value }
16
16
  RUBY
17
17
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.2.1](https://github.com/klueless-io/cmdlet/compare/v0.2.0...v0.2.1) (2022-07-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add case commandlets ([b269f2a](https://github.com/klueless-io/cmdlet/commit/b269f2a770dd698119f360d47756b47bd5b57516))
7
+
1
8
  # [0.2.0](https://github.com/klueless-io/cmdlet/compare/v0.1.2...v0.2.0) (2022-07-10)
2
9
 
3
10
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cmdlet
4
- VERSION = '0.2.1'
4
+ VERSION = '0.3.0'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "cmdlet",
9
- "version": "0.2.1",
9
+ "version": "0.3.0",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cmdlet",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Cmdlet provides a set of functions (wrapped in the command pattern) that perform simple actions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.2.1
4
+ version: 0.3.0
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-10 00:00:00.000000000 Z
11
+ date: 2022-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -49,7 +49,10 @@ files:
49
49
  - ".builders/.templates/FUNCTIONS.MD"
50
50
  - ".builders/.templates/cmdlet.rb"
51
51
  - ".builders/.templates/cmdlet_spec.rb"
52
- - ".builders/.templates/require_all_cmdlets.rb"
52
+ - ".builders/.templates/cmdlets_require_all.rb"
53
+ - ".builders/.templates/handlebars_helper.rb"
54
+ - ".builders/.templates/handlebars_helper_require_all.rb"
55
+ - ".builders/.templates/handlebars_helper_spec.rb"
53
56
  - ".builders/_.rb"
54
57
  - ".builders/boot.rb"
55
58
  - ".builders/data/categories.json"