handlebars-helpers 0.0.65 → 0.0.74

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: c662284c8c52e28de8f381e5dd2c4ee11bedee4034a2b701c0838075a7cead98
4
- data.tar.gz: 1af1502591258fefec9225591ad2bbbc1b7521d67ca17f777626a845f91328b4
3
+ metadata.gz: f70bb20a653e2c9a3e01812c77aae7cdf0ee5709a359bbb4d3243ebcc440d9a4
4
+ data.tar.gz: b20c4836771738ea1cd86e0cdaf91af8be97ddf99e87f34b001a5bf9f78d7d2e
5
5
  SHA512:
6
- metadata.gz: 30ba4275b1b9d8e7e9081ee45fd030b3dc0722e2800fcd6bbe75e855ee8d48345965fdd221b84b849acca670b89b2ad9abeaef1b47ba7f2bf65a5883624f012d
7
- data.tar.gz: 1a0a23d9573b925dc90f5defc122151870bf76504bc242807784509bc2219efb4f15d8c41868788926ca722a025fceec303b1e36ad6d6f946ee24d9b1bd2cb5b
6
+ metadata.gz: 799126c7777513d5390f31a6d9a214b317e7763caf48f784ea395e9c30a5a2eb18a854eab68626d24352c464f293d2b21415462aca6e969e46af82fee94c0720
7
+ data.tar.gz: eabc9896fc354ad324b9c7b0451ebf5bb6146685a6d544b49fee63bd286f83621ecacb737c299f2af1f465153d0a717e8c90b90d3b57c207713399b737c2419f
@@ -19,7 +19,6 @@ jobs:
19
19
  # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
20
20
  # change this to (see https://github.com/ruby/setup-ruby#versioning):
21
21
  uses: ruby/setup-ruby@v1
22
- # uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
23
22
  with:
24
23
  ruby-version: 2.6
25
24
  # bundler-cache: true # runs 'bundle install' and caches installed gems automatically
@@ -353,6 +353,61 @@
353
353
  }
354
354
  ]
355
355
  },
356
+ {
357
+ "active": true,
358
+ "name": "misc",
359
+ "base_require": "handlebars/helpers/misc",
360
+ "base_namespace": "Handlebars::Helpers::Misc",
361
+ "description": "Miscellaneous handling routines",
362
+ "examples": [
363
+ "https://github.com/helpers/handlebars-helpers/blob/master/lib/misc.js",
364
+ "https://github.com/helpers/handlebars-helpers/blob/master/test/misc.js"
365
+ ],
366
+ "helpers": [
367
+ {
368
+ "name": "safe",
369
+ "description": "value in safe string format",
370
+ "test_in": null,
371
+ "test_out": null,
372
+ "tests": [
373
+ {
374
+ "alias": "safe",
375
+ "expected_value": "\"hello\"",
376
+ "params": [{ "name": "value", "value": "\"hello\"" }],
377
+ "template": "{{safe value}}"
378
+ }
379
+ ],
380
+ "aliases": ["safe"],
381
+ "require_path": "handlebars/helpers/misc/safe",
382
+ "class_namespace": "Handlebars::Helpers::Misc::Safe",
383
+ "is_string_formatter": null
384
+ },
385
+ {
386
+ "name": "noop",
387
+ "description": "NoOp is a wrapper for blocks that does nothing, it is useful with the raw output operator",
388
+ "test_in": null,
389
+ "test_out": null,
390
+ "tests": [
391
+ {
392
+ "alias": "noop",
393
+ "expected_value": "{{no_parse}}",
394
+ "params": [],
395
+ "template": "{{{{noop}}}}{{no_parse}}{{{{/noop}}}}"
396
+ },
397
+ {
398
+ "alias": "raw",
399
+ "expected_value": "{{no_parse}}",
400
+ "params": [],
401
+ "template": "{{{{raw}}}}{{no_parse}}{{{{/raw}}}}"
402
+ }
403
+ ],
404
+ "aliases": ["noop", "raw"],
405
+ "require_path": "handlebars/helpers/misc/noop",
406
+ "class_namespace": "Handlebars::Helpers::Misc::Noop",
407
+ "is_string_formatter": null
408
+ }
409
+ ]
410
+ },
356
411
  {
357
412
  "active": true,
358
413
  "name": "code_ruby",
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Handlebars Helpers
2
2
 
3
- > Handlebars Helpers is a library that provides (x) handlebars helpers across (y) categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
3
+ > Handlebars Helpers is a library that provides <b>42</b> handlebars helpers across <b>5</b> categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
4
+
5
+ This GEM is inspired by the Javascript Library [handlebars-helpers](https://github.com/helpers/handlebars-helpers).
6
+
7
+ I am following a lot of the categories found there, but this GEM is not a one for one match to the existing JS library as I feel it is a bit dated and could use some new helpers and categories may be relevant today.
4
8
 
5
9
  ## Installation
6
10
 
@@ -46,11 +50,35 @@ class SomeRuby; end
46
50
 
47
51
  ## Development
48
52
 
49
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+ Checkout the repo
54
+
55
+ ```bash
56
+ git clone klueless-io/handlebars-helpers
57
+ ```
58
+
59
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
60
+
61
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62
+
63
+ ```bash
64
+ bin/console
65
+
66
+ Handlebars::Helpers::Template.render('{{camel .}}', 'david was here')
67
+ # => "DavidWasHere"
68
+ Handlebars::Helpers::Template.render('{{dasherize .}}', 'david was here')
69
+ # => "david-was-here"
70
+ ```
50
71
 
51
72
  `handlebars-helpers` is setup with Guard, run `guard`, this will watch development file changes and run tests automatically, if successful, it will then run rubocop for style quality.
52
73
 
53
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
74
+ To release a new version, update the version number in `version.rb`, build the gem and push the `.gem` file to [rubygems.org](https://rubygems.org).
75
+
76
+ ```bash
77
+ gem build
78
+ gem push rspec-usecases-?.?.??.gem
79
+ # or push the latest gem
80
+ ls *.gem | sort -r | head -1 | xargs gem push
81
+ ```
54
82
 
55
83
  ## Contributing
56
84
 
data/STORIES.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Handlebars Helpers
2
2
 
3
- > Handlebars Helpers is a library that provides (x) handlebars helpers across (y) categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
3
+ > Handlebars Helpers is a library that provides <b>42</b> handlebars helpers across <b>5</b> categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
4
4
 
5
5
  As a Ruby Developer, I want to use HandlebarsJS with useful helpers, so that I have a rich templating experience
6
6
 
@@ -16,6 +16,7 @@ As a Documentor, I can create usage examples for this GEM, so that I can documen
16
16
 
17
17
  As a Developer, I can release a new version of the GEM, so that the updated Gem appears on rubygems and rubydoc
18
18
 
19
+ - gem release
19
20
  - research automated solution, eg. rake
20
21
  - implement the solution
21
22
 
@@ -26,12 +27,11 @@ As a Developer, I have flexible and modular formatters, so that I can format dat
26
27
 
27
28
  ### Tasks next on list
28
29
 
29
- add support for misc helper category
30
+ add support for string_formatter usage via STRING_FORMATTER.md
30
31
 
31
- - add noop/raw helper
32
- - add safe helper
32
+ add gem release rake task
33
33
 
34
- add support for category count, helper count and formatter count to readme.md
34
+ add support for category and helper count to readme.md
35
35
 
36
36
  ## Stories and tasks
37
37
 
@@ -53,6 +53,16 @@ As a Developer, I can load specific groups of helpers, so that memory consumptio
53
53
 
54
54
  ### Tasks - completed
55
55
 
56
+ check camel P02E04 has correct formatting
57
+
58
+ - tested alpha-numeric coded value with word separation (p02_ef4 &gt; P02Ef4)
59
+ - tested alpha-numeric coded value without word separation (p02ef4 &gt; P02ef4)
60
+
61
+ add support for misc helper category
62
+
63
+ - add noop/raw helper
64
+ - add safe helper
65
+
56
66
  refactor inflections namespace
57
67
 
58
68
  - Move pluralize and singularize to inflections
data/USAGE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Handlebars Helpers
2
2
 
3
- > Handlebars Helpers is a library that provides (x) handlebars helpers across (y) categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
3
+ > Handlebars Helpers is a library that provides <b>42</b> handlebars helpers across <b>5</b> categories, it was built to complement [cowboyd/handlebars.rb](https://github.com/cowboyd/handlebars.rb) with Ruby helpers commonly found in the Javascript community
4
4
 
5
5
  As a Ruby Developer, I want to use HandlebarsJS with useful helpers, so that I have a rich templating experience
6
6
 
data/bin/console CHANGED
@@ -3,7 +3,7 @@
3
3
  # frozen_string_literal: true
4
4
 
5
5
  require 'bundler/setup'
6
- require 'handlebars_helpers'
6
+ require 'handlebars/helpers'
7
7
 
8
8
  # You can add fixtures and/or initialization code here to make experimenting
9
9
  # with your gem easier. You can also use a different console, if you like.
@@ -1,18 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'lib/handlebars/helpers/version'
4
+ require_relative 'lib/handlebars/helpers/statistics'
4
5
 
5
6
  Gem::Specification.new do |spec|
7
+ description = "Handlebars Helpers provides (#{Handlebars::Helpers::HANDLER_COUNT}) handlebars helpers across (#{Handlebars::Helpers::CATEGORY_COUNT}) categories"
8
+
6
9
  spec.required_ruby_version = '>= 2.5'
7
10
  spec.name = 'handlebars-helpers'
8
11
  spec.version = Handlebars::Helpers::VERSION
9
12
  spec.authors = ['David Cruwys']
10
13
  spec.email = ['david@ideasmen.com.au']
11
14
 
12
- spec.summary = 'Handlebars Helpers provides (Nx) handlebars helpers across (Ny) categories'
13
- spec.description = <<-TEXT
14
- Handlebars Helpers provides (Nx) handlebars helpers across (Ny) categories
15
- TEXT
15
+ spec.summary = description
16
+ spec.description = description
16
17
  spec.homepage = 'http://appydave.com/gems/handlebars-helpers'
17
18
  spec.license = 'MIT'
18
19
 
@@ -25,6 +26,7 @@ Gem::Specification.new do |spec|
25
26
  spec.metadata['homepage_uri'] = spec.homepage
26
27
  spec.metadata['source_code_uri'] = 'https://github.com/klueless-io/handlebars-helpers'
27
28
  spec.metadata['changelog_uri'] = 'https://github.com/klueless-io/handlebars-helpers/commits/master'
29
+ spec.metadata['documentation_uri'] = 'https://rubydoc.info/github/klueless-io/handlebars-helpers/master'
28
30
 
29
31
  # Specify which files should be added to the gem when it is released.
30
32
  # The `git ls-files -z` loads the RubyGem files that have been added into git.
@@ -33,10 +35,20 @@ Gem::Specification.new do |spec|
33
35
  f.match(%r{^(test|spec|features)/})
34
36
  end
35
37
  end
38
+
39
+ spec.files.each do |file|
40
+ puts file
41
+ end
36
42
  spec.bindir = 'exe'
37
43
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
38
44
  spec.require_paths = ['lib']
39
- # spec.extensions = ['ext/handlebars_helpers/extconf.rb']
45
+
46
+ spec.extra_rdoc_files = ['README.md', 'STORIES.md', 'USAGE.md']
47
+ spec.rdoc_options += [
48
+ '--title', 'handlebars-helpers by appydave.com',
49
+ '--main', 'README.md',
50
+ '--files', 'STORIES.MD USAGE.MD'
51
+ ]
40
52
 
41
53
  # spec.add_dependency 'tty-box', '~> 0.5.0'
42
54
  spec.add_dependency 'activesupport'
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # reference: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb
4
+ require 'active_support/core_ext/string'
5
+
6
+ require 'handlebars/helpers/base_helper'
7
+
8
+ module Handlebars
9
+ module Helpers
10
+ # Miscellaneous handling routines
11
+ module Misc
12
+ # NoOp is a wrapper for blocks, it does no additional processing.
13
+ # It is useful for embedding blocks into the output when using raw operators {{{{noop}}}}
14
+ class Noop < Handlebars::Helpers::BaseHelper
15
+ # # Parse will do nothing and return.
16
+ # # It is useful for embedding blocks into the output when using raw operators {{{{noop}}}}
17
+ # #
18
+ # # @example
19
+ # #
20
+ # # puts Noop.new.parse()
21
+ # #
22
+ # # @return does nothing, but will allow inner blocks to be processed
23
+ # def parse()
24
+ # end
25
+
26
+ def handlebars_helper
27
+ proc do |context, block|
28
+ # Handlebars::SafeString.new('<div class="bold">' + block.fn(context) + "</div>");
29
+
30
+ block.fn(context)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # reference: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflector/methods.rb
4
+ require 'active_support/core_ext/string'
5
+
6
+ require 'handlebars/helpers/base_safe_string_helper'
7
+
8
+ module Handlebars
9
+ module Helpers
10
+ # Miscellaneous handling routines
11
+ module Misc
12
+ # Safe will return the value with <> and single and double quotes left as is
13
+ class Safe < Handlebars::Helpers::BaseSafeStringHelper
14
+ # Parse will return the value with <> and single and double quotes left as is
15
+ #
16
+ # @example
17
+ #
18
+ # puts Safe.new.parse('<hello>')
19
+ #
20
+ # <hello>
21
+ #
22
+ # @param [String] value that is considered a safe string
23
+ # @return [String] value in safe string format
24
+ def parse(value)
25
+ value = '' if value.nil?
26
+ value
27
+ end
28
+
29
+ def handlebars_helper
30
+ proc do |_context, value|
31
+ wrapper(parse(value))
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Handlebars
4
4
  module Helpers
5
- VERSION = '0.0.65'
5
+ VERSION = '0.0.74'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebars-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.65
4
+ version: 0.0.74
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-22 00:00:00.000000000 Z
11
+ date: 2021-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -38,13 +38,15 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: " Handlebars Helpers provides (Nx) handlebars helpers across (Ny)
42
- categories\n"
41
+ description: Handlebars Helpers provides (42) handlebars helpers across (5) categories
43
42
  email:
44
43
  - david@ideasmen.com.au
45
44
  executables: []
46
45
  extensions: []
47
- extra_rdoc_files: []
46
+ extra_rdoc_files:
47
+ - README.md
48
+ - STORIES.md
49
+ - USAGE.md
48
50
  files:
49
51
  - ".github/workflows/ruby.yml"
50
52
  - ".gitignore"
@@ -93,6 +95,8 @@ files:
93
95
  - lib/handlebars/helpers/inflection/pluralize.rb
94
96
  - lib/handlebars/helpers/inflection/pluralize_by_number.rb
95
97
  - lib/handlebars/helpers/inflection/singularize.rb
98
+ - lib/handlebars/helpers/misc/noop.rb
99
+ - lib/handlebars/helpers/misc/safe.rb
96
100
  - lib/handlebars/helpers/register_helpers.rb
97
101
  - lib/handlebars/helpers/string_formatting/append_if.rb
98
102
  - lib/handlebars/helpers/string_formatting/back_slash.rb
@@ -127,8 +131,15 @@ metadata:
127
131
  homepage_uri: http://appydave.com/gems/handlebars-helpers
128
132
  source_code_uri: https://github.com/klueless-io/handlebars-helpers
129
133
  changelog_uri: https://github.com/klueless-io/handlebars-helpers/commits/master
134
+ documentation_uri: https://rubydoc.info/github/klueless-io/handlebars-helpers/master
130
135
  post_install_message:
131
- rdoc_options: []
136
+ rdoc_options:
137
+ - "--title"
138
+ - handlebars-helpers by appydave.com
139
+ - "--main"
140
+ - README.md
141
+ - "--files"
142
+ - STORIES.MD USAGE.MD
132
143
  require_paths:
133
144
  - lib
134
145
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -142,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
153
  - !ruby/object:Gem::Version
143
154
  version: '0'
144
155
  requirements: []
145
- rubygems_version: 3.2.5
156
+ rubygems_version: 3.2.7
146
157
  signing_key:
147
158
  specification_version: 4
148
- summary: Handlebars Helpers provides (Nx) handlebars helpers across (Ny) categories
159
+ summary: Handlebars Helpers provides (42) handlebars helpers across (5) categories
149
160
  test_files: []