handlebarsjs 0.5.7 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11fa1ae2d5651494b88fba96cffddf5fbf61a4a4bca2d558af4bf4c9bdab7051
4
- data.tar.gz: ba0da5f90e25cb0d9aa93d3b0da33c1a7bd46051d194f37a6423831cad83e39b
3
+ metadata.gz: da7d6a66b78d59642bb2921f13da3553de5c243db72a73e23a08a94d5368d1d5
4
+ data.tar.gz: e3b07b2f9a72fe5f9f8176e53d40a910bbe0d3410a68132205d6394672c0b601
5
5
  SHA512:
6
- metadata.gz: 9c56cb2167139c856225497aa504d8bd4c3352b262427eeb812491a9dbe67d7a334c7034b48e16d55e7c455adff584e978894812971e75379e964fbc37880ad6
7
- data.tar.gz: e3534532930b1ed409d34c8ab48444c7313016c01d928043650d2c84e5203ff34a5a7ada22ea2bf15c9525ca931c35712f31d331bf90af2758eef99dfb08f826
6
+ metadata.gz: a685ca3d7d3a37da9d67920af181b073287f39b95e24d4b583e95569d9b89fb404950ad0bfe6abab7baf5f23004b7f21bad429a9c6d01cdfd37721835b4daa2e
7
+ data.tar.gz: 03a18b7a98a9284fb0e82cf005520234003c200e814c66054d78e4ffedd05e74eb4620309d410ee67b26660e8aa38ac9dcee4eadb2f433d8736e51c216dc5625
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,24 @@
1
+ ## [0.6.1](https://github.com/klueless-io/handlebarsjs/compare/v0.6.0...v0.6.1) (2022-07-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add configuration and bump mini_racer, libv8 version ([7295f1d](https://github.com/klueless-io/handlebarsjs/commit/7295f1d98d9f461b4c95fd9ad587b2c9a37bbb96))
7
+
8
+ # [0.6.0](https://github.com/klueless-io/handlebarsjs/compare/v0.5.7...v0.6.0) (2022-07-13)
9
+
10
+
11
+ ### Features
12
+
13
+ * align cmdlet/helper GEM versions ([396bed1](https://github.com/klueless-io/handlebarsjs/commit/396bed1e44a865cca51bed0ba2190d099f69c8d3))
14
+
15
+ ## [0.5.7](https://github.com/klueless-io/handlebarsjs/compare/v0.5.6...v0.5.7) (2022-07-13)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add catgegory default configurations ([8046805](https://github.com/klueless-io/handlebarsjs/commit/80468055f94e36ea682dbbfd26e7eb527db9ff82))
21
+
1
22
  ## [0.5.6](https://github.com/klueless-io/handlebarsjs/compare/v0.5.5...v0.5.6) (2022-07-13)
2
23
 
3
24
 
@@ -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,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Handlebarsjs
4
+ # Pre-configure default helpers for each category
5
+ class HandlebarsConfigurationDefaults
6
+ def add_array_defaults
7
+ KConfig.configure do |config|
8
+ config.handlebars.helper(:join, Handlebarsjs::Helpers::Array::Join.new)
9
+ config.handlebars.helper(:join_pre, Handlebarsjs::Helpers::Array::JoinPre.new)
10
+ config.handlebars.helper(:join_post, Handlebarsjs::Helpers::Array::JoinPost.new)
11
+ end
12
+ end
13
+
14
+ def add_case_defaults
15
+ KConfig.configure do |config|
16
+ config.handlebars.helper(:back_slash, Handlebarsjs::Helpers::Case::BackSlash.new)
17
+ config.handlebars.helper(:camel, Handlebarsjs::Helpers::Case::Camel.new)
18
+ config.handlebars.helper(:constant, Handlebarsjs::Helpers::Case::Constant.new)
19
+ config.handlebars.helper(:dash, Handlebarsjs::Helpers::Case::Dash.new)
20
+ config.handlebars.helper(:dot, Handlebarsjs::Helpers::Case::Dot.new)
21
+ config.handlebars.helper(:double_colon, Handlebarsjs::Helpers::Case::DoubleColon.new)
22
+ config.handlebars.helper(:human, Handlebarsjs::Helpers::Case::Human.new)
23
+ config.handlebars.helper(:lamel, Handlebarsjs::Helpers::Case::Lamel.new)
24
+ config.handlebars.helper(:lower, Handlebarsjs::Helpers::Case::Lower.new)
25
+ config.handlebars.helper(:slash, Handlebarsjs::Helpers::Case::Slash.new)
26
+ config.handlebars.helper(:snake, Handlebarsjs::Helpers::Case::Snake.new)
27
+ config.handlebars.helper(:title, Handlebarsjs::Helpers::Case::Title.new)
28
+ config.handlebars.helper(:upper, Handlebarsjs::Helpers::Case::Upper.new)
29
+ end
30
+ end
31
+
32
+ def add_comparison_defaults
33
+ KConfig.configure do |config|
34
+ config.handlebars.helper(:and, Handlebarsjs::Helpers::Comparison::And.new)
35
+ config.handlebars.helper(:default, Handlebarsjs::Helpers::Comparison::Default.new)
36
+ config.handlebars.helper(:eq, Handlebarsjs::Helpers::Comparison::Eq.new)
37
+ config.handlebars.helper(:gt, Handlebarsjs::Helpers::Comparison::Gt.new)
38
+ config.handlebars.helper(:gte, Handlebarsjs::Helpers::Comparison::Gte.new)
39
+ config.handlebars.helper(:lt, Handlebarsjs::Helpers::Comparison::Lt.new)
40
+ config.handlebars.helper(:lte, Handlebarsjs::Helpers::Comparison::Lte.new)
41
+ config.handlebars.helper(:ne, Handlebarsjs::Helpers::Comparison::Ne.new)
42
+ config.handlebars.helper(:or, Handlebarsjs::Helpers::Comparison::Or.new)
43
+ end
44
+ end
45
+
46
+ def add_inflection_defaults
47
+ KConfig.configure do |config|
48
+ config.handlebars.helper(:ordinal, Handlebarsjs::Helpers::Inflection::Ordinal.new)
49
+ config.handlebars.helper(:ordinalize, Handlebarsjs::Helpers::Inflection::Ordinalize.new)
50
+ config.handlebars.helper(:pluralize, Handlebarsjs::Helpers::Inflection::Pluralize.new)
51
+ config.handlebars.helper(:pluralize_number, Handlebarsjs::Helpers::Inflection::PluralizeNumber.new)
52
+ config.handlebars.helper(:pluralize_number_word, Handlebarsjs::Helpers::Inflection::PluralizeNumberWord.new)
53
+ config.handlebars.helper(:singularize, Handlebarsjs::Helpers::Inflection::Singularize.new)
54
+ end
55
+ end
56
+ end
57
+ 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.5.7'
4
+ VERSION = '0.6.2'
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.
@@ -35,8 +37,8 @@ module Handlebarsjs
35
37
  @engine = nil
36
38
  end
37
39
 
38
- def process_template(template, options = {})
39
- @engine.process_template(template, options)
40
+ def render(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.5.7",
3
+ "version": "0.6.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "handlebarsjs",
9
- "version": "0.5.7",
9
+ "version": "0.6.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handlebarsjs",
3
- "version": "0.5.7",
3
+ "version": "0.6.2",
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebarsjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -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,8 +92,10 @@ 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
100
  - lib/handlebarsjs/helpers/array/default_configuration.rb
99
101
  - lib/handlebarsjs/helpers/array/join.rb