handlebarsjs 0.6.0 → 0.6.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be20a900e92e33b726da6c5807cba1e183e15c3642fc75493370230ef7f04326
4
- data.tar.gz: '069b8b8358aefa0b753d55883e1c52b53698d94dcf7c9660a019f7d3713789b3'
3
+ metadata.gz: 83ccfdd308c499bfbbb4127a52fa9af19aa1f1cc8d7326b371c16da0f0e45400
4
+ data.tar.gz: 60eea0159f3065bf24798a096298706a13d568fe5417690c1edb46ecedaa4ee5
5
5
  SHA512:
6
- metadata.gz: 79cf9b5f22b8d20fab6d626c11ebedb8d31a52d0c7122f9587d86bd925b3792a9af91aad2ea27d29d360414f91710a9f85ac7e4f3191cd95dda8c6f514c28fa8
7
- data.tar.gz: d29ad4299dc2d9579dd2e31ffbb2abc653fe4d65b9f2ed013e67f0cc20801ca1a8e0d39e72e61ef0b5118bdcb05c5a4c5181f1a293f88bc03400199f2d32cac6
6
+ metadata.gz: bcee4752350cb7d5e2ee11c8ef0a7ca373589b60d9252497e125a815d234582585e0b94be3868505a6aca7bf60c25de6c1b8e98ff0a371c0cd744772c39edaa5
7
+ data.tar.gz: 17ffdd8d6c166a37fcd714c72eec08ca181a76aa2c8e7151d97a07b5feec9c3ef749632a3817b889dfd3366ad65a0156c44fcc178ff8193fc5afd78048aa9521
data/.builders/boot.rb CHANGED
@@ -6,34 +6,11 @@ CONFIG_KEY = :handlebarsjs
6
6
 
7
7
  log.kv 'working folder', Dir.pwd
8
8
 
9
- Handlebars::Helpers.configure do |config|
10
- config.helper_config_file = File.join(Gem.loaded_specs['handlebars-helpers'].full_gem_path, '.handlebars_helpers.json')
11
- config.string_formatter_config_file = File.join(Gem.loaded_specs['handlebars-helpers'].full_gem_path, '.handlebars_string_formatters.json')
12
- end
13
-
14
- def camel
15
- require 'handlebars/helpers/string_formatting/camel'
16
- Handlebars::Helpers::StringFormatting::Camel.new
17
- end
18
-
19
- def titleize
20
- require 'handlebars/helpers/string_formatting/titleize'
21
- Handlebars::Helpers::StringFormatting::Titleize.new
22
- end
23
-
24
- def pluralize
25
- require 'handlebars/helpers/inflection/pluralize'
26
- Handlebars::Helpers::Inflection::Pluralize.new
27
- end
28
-
29
- def singularize
30
- require 'handlebars/helpers/inflection/singularize'
31
- Handlebars::Helpers::Inflection::Singularize.new
32
- end
33
-
34
- def dasherize
35
- require 'handlebars/helpers/string_formatting/dasherize'
36
- Handlebars::Helpers::StringFormatting::Dasherize.new
9
+ KConfig.configure do |config|
10
+ config.handlebars.defaults.add_array_defaults
11
+ config.handlebars.defaults.add_case_defaults
12
+ config.handlebars.defaults.add_comparison_defaults
13
+ config.handlebars.defaults.add_inflection_defaults
37
14
  end
38
15
 
39
16
  def k_builder
data/.rubocop.yml CHANGED
@@ -41,7 +41,7 @@ Metrics/MethodLength:
41
41
  Layout/LineLength:
42
42
  Max: 200
43
43
  # Ignores annotate output
44
- IgnoredPatterns: ['\A# \*\*']
44
+ AllowedPatterns: ['\A# \*\*']
45
45
  IgnoreCopDirectives: true
46
46
 
47
47
  Lint/UnusedMethodArgument:
@@ -87,3 +87,6 @@ Layout/SpaceBeforeComma:
87
87
  Enabled: false
88
88
  # My Preferences - End
89
89
 
90
+ Metrics/AbcSize:
91
+ Exclude:
92
+ - "lib/handlebarsjs/handlebars_configuration_defaults.rb"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [0.6.2](https://github.com/klueless-io/handlebarsjs/compare/v0.6.1...v0.6.2) (2022-07-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update rubocop.yml ([2188ecd](https://github.com/klueless-io/handlebarsjs/commit/2188ecdf7cd1201dbf60087a21467bc598c55c70))
7
+ * update rubocop.yml ([006b69a](https://github.com/klueless-io/handlebarsjs/commit/006b69a061f5acd2d15e302c321730621cf5a212))
8
+
9
+ ## [0.6.1](https://github.com/klueless-io/handlebarsjs/compare/v0.6.0...v0.6.1) (2022-07-13)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * add configuration and bump mini_racer, libv8 version ([7295f1d](https://github.com/klueless-io/handlebarsjs/commit/7295f1d98d9f461b4c95fd9ad587b2c9a37bbb96))
15
+
16
+ # [0.6.0](https://github.com/klueless-io/handlebarsjs/compare/v0.5.7...v0.6.0) (2022-07-13)
17
+
18
+
19
+ ### Features
20
+
21
+ * align cmdlet/helper GEM versions ([396bed1](https://github.com/klueless-io/handlebarsjs/commit/396bed1e44a865cca51bed0ba2190d099f69c8d3))
22
+
1
23
  ## [0.5.7](https://github.com/klueless-io/handlebarsjs/compare/v0.5.6...v0.5.7) (2022-07-13)
2
24
 
3
25
 
@@ -1,24 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Handlebarsjs
4
- # Register this configuration access extension for Handlebars configuration
5
- module HandlebarsConfigurationExtension
6
- def handlebars
7
- return @handlebars if defined? @handlebars
8
-
9
- @handlebars = HandlebarsConfiguration.new
10
- end
11
- end
12
-
13
4
  # handlebars.handlebars_snapshot.add_helper(helper_name, helper)
14
5
  # Structure for storing Cmdlet configuration
15
6
  class HandlebarsConfiguration
16
7
  include KLog::Logging
17
8
 
18
9
  attr_accessor :helpers
10
+ attr_reader :defaults
19
11
 
20
12
  def initialize
21
13
  @helpers = []
14
+ @defaults = Handlebarsjs::HandlebarsConfigurationDefaults.new
22
15
  end
23
16
 
24
17
  HelperConfig = Struct.new(:name, :helper)
@@ -28,5 +21,3 @@ module Handlebarsjs
28
21
  end
29
22
  end
30
23
  end
31
-
32
- KConfig::Configuration.register(:handlebars, Handlebarsjs::HandlebarsConfigurationExtension)
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handlebarsjs
4
+ # Pre-configure default helpers for each category
5
+ class HandlebarsConfigurationDefaults
6
+ def add_all_defaults
7
+ add_array_defaults
8
+ add_case_defaults
9
+ add_comparison_defaults
10
+ add_inflection_defaults
11
+ end
12
+
13
+ def add_array_defaults
14
+ KConfig.configure do |config|
15
+ config.handlebars.helper(:join, Handlebarsjs::Helpers::Array::Join.new)
16
+ config.handlebars.helper(:join_pre, Handlebarsjs::Helpers::Array::JoinPre.new)
17
+ config.handlebars.helper(:join_post, Handlebarsjs::Helpers::Array::JoinPost.new)
18
+ end
19
+ end
20
+
21
+ def add_case_defaults
22
+ KConfig.configure do |config|
23
+ config.handlebars.helper(:back_slash, Handlebarsjs::Helpers::Case::BackSlash.new)
24
+ config.handlebars.helper(:camel, Handlebarsjs::Helpers::Case::Camel.new)
25
+ config.handlebars.helper(:constant, Handlebarsjs::Helpers::Case::Constant.new)
26
+ config.handlebars.helper(:dash, Handlebarsjs::Helpers::Case::Dash.new)
27
+ config.handlebars.helper(:dot, Handlebarsjs::Helpers::Case::Dot.new)
28
+ config.handlebars.helper(:double_colon, Handlebarsjs::Helpers::Case::DoubleColon.new)
29
+ config.handlebars.helper(:human, Handlebarsjs::Helpers::Case::Human.new)
30
+ config.handlebars.helper(:lamel, Handlebarsjs::Helpers::Case::Lamel.new)
31
+ config.handlebars.helper(:lower, Handlebarsjs::Helpers::Case::Lower.new)
32
+ config.handlebars.helper(:slash, Handlebarsjs::Helpers::Case::Slash.new)
33
+ config.handlebars.helper(:snake, Handlebarsjs::Helpers::Case::Snake.new)
34
+ config.handlebars.helper(:title, Handlebarsjs::Helpers::Case::Title.new)
35
+ config.handlebars.helper(:upper, Handlebarsjs::Helpers::Case::Upper.new)
36
+ end
37
+ end
38
+
39
+ def add_comparison_defaults
40
+ KConfig.configure do |config|
41
+ config.handlebars.helper(:and, Handlebarsjs::Helpers::Comparison::And.new)
42
+ config.handlebars.helper(:default, Handlebarsjs::Helpers::Comparison::Default.new)
43
+ config.handlebars.helper(:eq, Handlebarsjs::Helpers::Comparison::Eq.new)
44
+ config.handlebars.helper(:gt, Handlebarsjs::Helpers::Comparison::Gt.new)
45
+ config.handlebars.helper(:gte, Handlebarsjs::Helpers::Comparison::Gte.new)
46
+ config.handlebars.helper(:lt, Handlebarsjs::Helpers::Comparison::Lt.new)
47
+ config.handlebars.helper(:lte, Handlebarsjs::Helpers::Comparison::Lte.new)
48
+ config.handlebars.helper(:ne, Handlebarsjs::Helpers::Comparison::Ne.new)
49
+ config.handlebars.helper(:or, Handlebarsjs::Helpers::Comparison::Or.new)
50
+ end
51
+ end
52
+
53
+ def add_inflection_defaults
54
+ KConfig.configure do |config|
55
+ config.handlebars.helper(:ordinal, Handlebarsjs::Helpers::Inflection::Ordinal.new)
56
+ config.handlebars.helper(:ordinalize, Handlebarsjs::Helpers::Inflection::Ordinalize.new)
57
+ config.handlebars.helper(:pluralize, Handlebarsjs::Helpers::Inflection::Pluralize.new)
58
+ config.handlebars.helper(:pluralize_number, Handlebarsjs::Helpers::Inflection::PluralizeNumber.new)
59
+ config.handlebars.helper(:pluralize_number_word, Handlebarsjs::Helpers::Inflection::PluralizeNumberWord.new)
60
+ config.handlebars.helper(:singularize, Handlebarsjs::Helpers::Inflection::Singularize.new)
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handlebarsjs
4
+ # Register this configuration access extension for Handlebars configuration
5
+ module HandlebarsConfigurationExtension
6
+ def handlebars
7
+ return @handlebars if defined? @handlebars
8
+
9
+ @handlebars = HandlebarsConfiguration.new
10
+ end
11
+ end
12
+ end
13
+
14
+ KConfig::Configuration.register(:handlebars, Handlebarsjs::HandlebarsConfigurationExtension)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Handlebarsjs
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.3'
5
5
  end
data/lib/handlebarsjs.rb CHANGED
@@ -3,11 +3,13 @@
3
3
  require 'mini_racer'
4
4
  require 'cmdlet'
5
5
  require_relative 'handlebarsjs/version'
6
- require_relative 'handlebarsjs/configuration'
7
6
  require_relative 'handlebarsjs/javascript'
8
7
  require_relative 'handlebarsjs/handlebars_snapshot'
9
8
  require_relative 'handlebarsjs/handlebars'
10
9
  require_relative 'handlebarsjs/base_helper'
10
+ require_relative 'handlebarsjs/handlebars_configuration_defaults'
11
+ require_relative 'handlebarsjs/handlebars_configuration'
12
+ require_relative 'handlebarsjs/handlebars_configuration_extension'
11
13
  require_relative '_'
12
14
 
13
15
  # Handlebarsjs is a Ruby wrapper for the Handlebars.js templating engine.
@@ -36,7 +38,7 @@ module Handlebarsjs
36
38
  end
37
39
 
38
40
  def render(template, options = {})
39
- @engine.process_template(template, options)
41
+ engine.process_template(template, options)
40
42
  end
41
43
  end
42
44
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "handlebarsjs",
3
- "version": "0.6.0",
3
+ "version": "0.6.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "handlebarsjs",
9
- "version": "0.6.0",
9
+ "version": "0.6.3",
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": "handlebarsjs",
3
- "version": "0.6.0",
3
+ "version": "0.6.3",
4
4
  "description": "handlebarsjs GEM wraps the handlebars.js library and provides ruby/javascript interoperability",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebarsjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.3
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-13 00:00:00.000000000 Z
11
+ date: 2022-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cmdlet
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.0
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.0
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mini_racer
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '0.6'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '0.6'
55
55
  description: " handlebarsjs GEM wraps the handlebars.js library and provides ruby/javascript
56
56
  interoperability\n"
57
57
  email:
@@ -92,10 +92,11 @@ files:
92
92
  - lib/_.rb
93
93
  - lib/handlebarsjs.rb
94
94
  - lib/handlebarsjs/base_helper.rb
95
- - lib/handlebarsjs/configuration.rb
96
95
  - lib/handlebarsjs/handlebars.rb
96
+ - lib/handlebarsjs/handlebars_configuration.rb
97
+ - lib/handlebarsjs/handlebars_configuration_defaults.rb
98
+ - lib/handlebarsjs/handlebars_configuration_extension.rb
97
99
  - lib/handlebarsjs/handlebars_snapshot.rb
98
- - lib/handlebarsjs/helpers/array/default_configuration.rb
99
100
  - lib/handlebarsjs/helpers/array/join.rb
100
101
  - lib/handlebarsjs/helpers/array/join_post.rb
101
102
  - lib/handlebarsjs/helpers/array/join_pre.rb
@@ -103,7 +104,6 @@ files:
103
104
  - lib/handlebarsjs/helpers/case/camel.rb
104
105
  - lib/handlebarsjs/helpers/case/constant.rb
105
106
  - lib/handlebarsjs/helpers/case/dash.rb
106
- - lib/handlebarsjs/helpers/case/default_configuration.rb
107
107
  - lib/handlebarsjs/helpers/case/dot.rb
108
108
  - lib/handlebarsjs/helpers/case/double_colon.rb
109
109
  - lib/handlebarsjs/helpers/case/human.rb
@@ -115,7 +115,6 @@ files:
115
115
  - lib/handlebarsjs/helpers/case/upper.rb
116
116
  - lib/handlebarsjs/helpers/comparison/and.rb
117
117
  - lib/handlebarsjs/helpers/comparison/default.rb
118
- - lib/handlebarsjs/helpers/comparison/default_configuration.rb
119
118
  - lib/handlebarsjs/helpers/comparison/eq.rb
120
119
  - lib/handlebarsjs/helpers/comparison/gt.rb
121
120
  - lib/handlebarsjs/helpers/comparison/gte.rb
@@ -123,7 +122,6 @@ files:
123
122
  - lib/handlebarsjs/helpers/comparison/lte.rb
124
123
  - lib/handlebarsjs/helpers/comparison/ne.rb
125
124
  - lib/handlebarsjs/helpers/comparison/or.rb
126
- - lib/handlebarsjs/helpers/inflection/default_configuration.rb
127
125
  - lib/handlebarsjs/helpers/inflection/ordinal.rb
128
126
  - lib/handlebarsjs/helpers/inflection/ordinalize.rb
129
127
  - lib/handlebarsjs/helpers/inflection/pluralize.rb
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- KConfig.configure do |config|
4
- config.handlebars.helper(:join, Handlebarsjs::Helpers::Array::Join.new)
5
- config.handlebars.helper(:join_pre, Handlebarsjs::Helpers::Array::JoinPre.new)
6
- config.handlebars.helper(:join_post, Handlebarsjs::Helpers::Array::JoinPost.new)
7
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- KConfig.configure do |config|
4
- config.handlebars.helper(:back_slash, Handlebarsjs::Helpers::Case::BackSlash.new)
5
- config.handlebars.helper(:camel, Handlebarsjs::Helpers::Case::Camel.new)
6
- config.handlebars.helper(:constant, Handlebarsjs::Helpers::Case::Constant.new)
7
- config.handlebars.helper(:dash, Handlebarsjs::Helpers::Case::Dash.new)
8
- config.handlebars.helper(:dot, Handlebarsjs::Helpers::Case::Dot.new)
9
- config.handlebars.helper(:double_colon, Handlebarsjs::Helpers::Case::DoubleColon.new)
10
- config.handlebars.helper(:human, Handlebarsjs::Helpers::Case::Human.new)
11
- config.handlebars.helper(:lamel, Handlebarsjs::Helpers::Case::Lamel.new)
12
- config.handlebars.helper(:lower, Handlebarsjs::Helpers::Case::Lower.new)
13
- config.handlebars.helper(:slash, Handlebarsjs::Helpers::Case::Slash.new)
14
- config.handlebars.helper(:snake, Handlebarsjs::Helpers::Case::Snake.new)
15
- config.handlebars.helper(:title, Handlebarsjs::Helpers::Case::Title.new)
16
- config.handlebars.helper(:upper, Handlebarsjs::Helpers::Case::Upper.new)
17
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- KConfig.configure do |config|
4
- config.handlebars.helper(:and, Handlebarsjs::Helpers::Comparison::And.new)
5
- config.handlebars.helper(:default, Handlebarsjs::Helpers::Comparison::Default.new)
6
- config.handlebars.helper(:eq, Handlebarsjs::Helpers::Comparison::Eq.new)
7
- config.handlebars.helper(:gt, Handlebarsjs::Helpers::Comparison::Gt.new)
8
- config.handlebars.helper(:gte, Handlebarsjs::Helpers::Comparison::Gte.new)
9
- config.handlebars.helper(:lt, Handlebarsjs::Helpers::Comparison::Lt.new)
10
- config.handlebars.helper(:lte, Handlebarsjs::Helpers::Comparison::Lte.new)
11
- config.handlebars.helper(:ne, Handlebarsjs::Helpers::Comparison::Ne.new)
12
- config.handlebars.helper(:or, Handlebarsjs::Helpers::Comparison::Or.new)
13
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- KConfig.configure do |config|
4
- config.handlebars.helper(:ordinal, Handlebarsjs::Helpers::Inflection::Ordinal.new)
5
- config.handlebars.helper(:ordinalize, Handlebarsjs::Helpers::Inflection::Ordinalize.new)
6
- config.handlebars.helper(:pluralize, Handlebarsjs::Helpers::Inflection::Pluralize.new)
7
- config.handlebars.helper(:pluralize_number, Handlebarsjs::Helpers::Inflection::PluralizeNumber.new)
8
- config.handlebars.helper(:pluralize_number_word, Handlebarsjs::Helpers::Inflection::PluralizeNumberWord.new)
9
- config.handlebars.helper(:singularize, Handlebarsjs::Helpers::Inflection::Singularize.new)
10
- end