tilt-handlebars 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +5 -5
  2. data/.editorconfig +12 -0
  3. data/.github/workflows/ci.yml +76 -0
  4. data/.github/workflows/publish.yml +58 -0
  5. data/.gitignore +14 -15
  6. data/.rspec +1 -0
  7. data/.rubocop.yml +189 -0
  8. data/Appraisals +9 -0
  9. data/CONTRIBUTING.md +75 -0
  10. data/Gemfile +3 -1
  11. data/LICENSE +22 -0
  12. data/README.md +34 -20
  13. data/RELEASE_NOTES.md +17 -5
  14. data/Rakefile +4 -8
  15. data/bin/audit +8 -0
  16. data/bin/build +8 -0
  17. data/bin/bundle +114 -0
  18. data/bin/bundler-audit +29 -0
  19. data/bin/console +15 -0
  20. data/bin/doc +7 -0
  21. data/bin/lint +8 -0
  22. data/bin/rake +29 -0
  23. data/bin/release +25 -0
  24. data/bin/rspec +29 -0
  25. data/bin/rubocop +29 -0
  26. data/bin/setup +13 -0
  27. data/bin/tag +25 -0
  28. data/bin/test +7 -0
  29. data/bin/version +24 -0
  30. data/gemfiles/tilt_1.gemfile +7 -0
  31. data/gemfiles/tilt_2.gemfile +7 -0
  32. data/lib/sinatra/handlebars.rb +9 -7
  33. data/lib/tilt/handlebars/version.rb +3 -1
  34. data/lib/tilt/handlebars.rb +57 -47
  35. data/lib/tilt-handlebars.rb +3 -0
  36. data/spec/fixtures/helpers.rb +21 -0
  37. data/spec/fixtures/views/hello.hbs +1 -0
  38. data/spec/fixtures/views/hello_missing.hbs +1 -0
  39. data/spec/fixtures/views/hello_partial.hbs +1 -0
  40. data/spec/fixtures/views/hello_partial2.hbs +1 -0
  41. data/spec/fixtures/views/partial.hbs +1 -0
  42. data/spec/fixtures/views/partial2.handlebars +1 -0
  43. data/spec/sinatra/handlebars_spec.rb +47 -0
  44. data/spec/spec_coverage.rb +19 -0
  45. data/spec/spec_helper.rb +23 -0
  46. data/spec/tilt/handlebars_template_spec.rb +543 -0
  47. data/spec/tilt_spec.rb +40 -0
  48. data/tasks/doc.rake +8 -0
  49. data/tasks/gem.rake +7 -0
  50. data/tasks/lint.rake +7 -0
  51. data/tasks/test.rake +10 -0
  52. data/tilt-handlebars.gemspec +48 -27
  53. metadata +255 -74
  54. data/.travis.yml +0 -6
  55. data/LICENSE.txt +0 -22
  56. data/test/fixtures/views/hello.hbs +0 -1
  57. data/test/fixtures/views/missing_partial.hbs +0 -1
  58. data/test/fixtures/views/partial.hbs +0 -1
  59. data/test/fixtures/views/partial2.handlebars +0 -1
  60. data/test/fixtures/views/partial_test.hbs +0 -1
  61. data/test/fixtures/views/partial_test2.handlebars +0 -1
  62. data/test/fixtures/views/two_partials.hbs +0 -1
  63. data/test/sinatra/README.md +0 -7
  64. data/test/sinatra/myapp.rb +0 -12
  65. data/test/sinatra/views/index.handlebars +0 -1
  66. data/test/sinatra_test.rb +0 -38
  67. data/test/test_helper.rb +0 -9
  68. data/test/tilt_handlebarstemplate_test.rb +0 -276
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4393e0de3b15ac3c934d2af2f2ebfbb35d0289c1
4
- data.tar.gz: 860bc8a1081a4d9fb44d917dbb0789bc795c344d
2
+ SHA256:
3
+ metadata.gz: 9a795c64abee7a47bdbf5cbccad24c92f2ffa9216973ae47db4162bd7a302e02
4
+ data.tar.gz: d59a4be0a82ab8f58b344181e601ec4aa69a5637826ebc1e5a3c2b96c078abc3
5
5
  SHA512:
6
- metadata.gz: 7704162d3a2c1aaff3a0b4c5bbccc55d52016a4c47283d5e0e40479122596cdc5ece316c98393580205a8ec2c5cdc979e90538f7533400f65979387abab67ba8
7
- data.tar.gz: d7936aedb0222cb1138565b1f24596d1037b3d07df7db85deba9a85b5e16abde421fc580fa9385f562d3a19d4da0a56e5653420edb8129540ac291bb8415e524
6
+ metadata.gz: 5d37f79d703991c9794ce7e052803948229a31aa58d2be8f3cb57053a6d05d9cc96c320bb8ddb4c774e2eba31522b90fbf6f3a84dce7ef424e38998051b2d304
7
+ data.tar.gz: 220353821875387c0e1cd5f30df25adf8054861fd7967fd31eff7b0095e4af60f5fb0b1939812e52448511cd81ef93547f499df6870e76a3a7a6ef3c2933db42
data/.editorconfig ADDED
@@ -0,0 +1,12 @@
1
+ # EditorConfig: https://editorconfig.org/
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ end_of_line = lf
8
+ indent_size = 2
9
+ indent_style = space
10
+ insert_final_newline = true
11
+ tab_width = 2
12
+ trim_trailing_whitespace = true
@@ -0,0 +1,76 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - develop
7
+ - main
8
+ pull_request:
9
+ branches:
10
+ - develop
11
+ - main
12
+
13
+ jobs:
14
+ coverage:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v2
19
+ - name: Install
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ruby-3
23
+ bundler-cache: true
24
+ - name: Test
25
+ run: bin/test
26
+ - name: Upload
27
+ uses: paambaati/codeclimate-action@v3.0.0
28
+ env:
29
+ CC_TEST_REPORTER_ID: fa0a43df2e210318c8da0958f9f100ab1b278c04f57f923affad8bd9fba23901
30
+ with:
31
+ coverageLocations: ${{ github.workspace }}/spec/reports/coverage/coverage.xml:cobertura
32
+
33
+ lint:
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - name: Checkout
37
+ uses: actions/checkout@v2
38
+ - name: Install
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ruby-3
42
+ bundler-cache: true
43
+ - name: Lint
44
+ run: bin/lint
45
+
46
+ test:
47
+ strategy:
48
+ matrix:
49
+ appraisal:
50
+ - tilt_1
51
+ - tilt_2
52
+ os:
53
+ - macos-latest
54
+ - ubuntu-latest
55
+ ruby:
56
+ - ruby-2.6
57
+ - ruby-2.7
58
+ - ruby-3.0
59
+ - ruby-3.1
60
+ # - jruby
61
+ # - truffleruby
62
+ env:
63
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.appraisal }}.gemfile
64
+ runs-on: ${{ matrix.os }}
65
+ steps:
66
+ - name: Checkout
67
+ uses: actions/checkout@v2
68
+ - name: Install
69
+ uses: ruby/setup-ruby@v1
70
+ with:
71
+ ruby-version: ${{ matrix.ruby }}
72
+ bundler-cache: true
73
+ - name: Test
74
+ run: bin/test
75
+ env:
76
+ COVERAGE: false
@@ -0,0 +1,58 @@
1
+ name: Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ packages: write
11
+
12
+ jobs:
13
+ github:
14
+ name: GitHub
15
+ needs: tag
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v2
20
+ - name: Install
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ruby-3
24
+ bundler-cache: true
25
+ - name: Publish to GitHub
26
+ env:
27
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
28
+ RUBYGEMS_HOST: https://rubygems.pkg.github.com/${{github.repository_owner}}
29
+ run: bin/release
30
+ rubygems:
31
+ name: RubyGems
32
+ needs: tag
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - name: Checkout
36
+ uses: actions/checkout@v2
37
+ - name: Install
38
+ uses: ruby/setup-ruby@v1
39
+ with:
40
+ ruby-version: ruby-3
41
+ bundler-cache: true
42
+ - name: Publish to RubyGems
43
+ env:
44
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_TOKEN}}"
45
+ run: bin/release
46
+ tag:
47
+ name: Git Tag
48
+ runs-on: ubuntu-latest
49
+ steps:
50
+ - name: Checkout
51
+ uses: actions/checkout@v2
52
+ - name: Install
53
+ uses: ruby/setup-ruby@v1
54
+ with:
55
+ ruby-version: ruby-3
56
+ bundler-cache: true
57
+ - name: Tag
58
+ run: bin/tag
data/.gitignore CHANGED
@@ -1,17 +1,16 @@
1
+ /[._]*/
2
+ !/.github/
3
+ /doc/
4
+ /pkg/
5
+ /spec/reports/
6
+ /test/reports/
7
+ /tmp/
8
+ /vendor/
9
+ *.a
10
+ *.bundle
1
11
  *.gem
12
+ *.lock
13
+ *.o
2
14
  *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
15
+ *.so
16
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,189 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rake
4
+ - rubocop-rspec
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.6
8
+ Exclude:
9
+ - bin/**/*
10
+ - vendor/**/*
11
+ NewCops: enable
12
+
13
+ Gemspec/RequireMFA:
14
+ Enabled: false
15
+
16
+ Layout/ArgumentAlignment:
17
+ EnforcedStyle: with_fixed_indentation
18
+
19
+ Layout/BlockAlignment:
20
+ EnforcedStyleAlignWith: start_of_block
21
+
22
+ Layout/CaseIndentation:
23
+ # Disabled because IndentOneStep can't be configured for one-liner cases.
24
+ # See: https://github.com/rubocop-hq/rubocop/issues/6447
25
+ Enabled: false
26
+
27
+ Layout/ClassStructure:
28
+ Enabled: true
29
+
30
+ Layout/EndAlignment:
31
+ EnforcedStyleAlignWith: variable
32
+
33
+ Layout/ExtraSpacing:
34
+ AllowForAlignment: false
35
+ AllowBeforeTrailingComments: false
36
+ ForceEqualSignAlignment: false
37
+
38
+ Layout/FirstArgumentIndentation:
39
+ EnforcedStyle: consistent
40
+
41
+ Layout/FirstArrayElementIndentation:
42
+ EnforcedStyle: consistent
43
+
44
+ Layout/FirstArrayElementLineBreak:
45
+ Enabled: true
46
+
47
+ Layout/FirstHashElementIndentation:
48
+ EnforcedStyle: consistent
49
+
50
+ Layout/FirstHashElementLineBreak:
51
+ Enabled: true
52
+
53
+ Layout/FirstMethodArgumentLineBreak:
54
+ Enabled: false
55
+
56
+ Layout/FirstMethodParameterLineBreak:
57
+ Enabled: true
58
+
59
+ Layout/HeredocArgumentClosingParenthesis:
60
+ Enabled: true
61
+
62
+ Layout/LineLength:
63
+ Max: 80
64
+
65
+ Layout/MultilineArrayLineBreaks:
66
+ Enabled: true
67
+
68
+ Layout/MultilineHashKeyLineBreaks:
69
+ Enabled: true
70
+
71
+ Layout/MultilineMethodArgumentLineBreaks:
72
+ Enabled: true
73
+
74
+ # Layout/MultilineMethodCallBraceLayout:
75
+ # EnforcedStyle: new_line
76
+
77
+ Layout/MultilineMethodCallIndentation:
78
+ EnforcedStyle: indented
79
+
80
+ Layout/MultilineMethodDefinitionBraceLayout:
81
+ EnforcedStyle: new_line
82
+
83
+ Layout/MultilineOperationIndentation:
84
+ EnforcedStyle: indented
85
+
86
+ Layout/ParameterAlignment:
87
+ EnforcedStyle: with_fixed_indentation
88
+
89
+ Lint/DuplicateBranch:
90
+ Enabled: true
91
+
92
+ Lint/DuplicateRegexpCharacterClassElement:
93
+ Enabled: true
94
+
95
+ Lint/EmptyBlock:
96
+ Enabled: true
97
+ AllowComments: true
98
+
99
+ Lint/EmptyClass:
100
+ Enabled: true
101
+ AllowComments: true
102
+
103
+ Lint/HeredocMethodCallPosition:
104
+ Enabled: true
105
+
106
+ Lint/NoReturnInBeginEndBlocks:
107
+ Enabled: true
108
+
109
+ Metrics/BlockLength:
110
+ CountAsOne:
111
+ - array
112
+ - hash
113
+ - heredoc
114
+ Exclude:
115
+ - "*.gemspec"
116
+ - spec/**/*_spec.rb
117
+ - test/**/*_test.rb
118
+
119
+ Metrics/ClassLength:
120
+ CountAsOne:
121
+ - array
122
+ - hash
123
+ - heredoc
124
+ Max: 120
125
+
126
+ Metrics/MethodLength:
127
+ CountAsOne:
128
+ - array
129
+ - hash
130
+ - heredoc
131
+ Max: 20
132
+
133
+ Metrics/ModuleLength:
134
+ CountAsOne:
135
+ - array
136
+ - hash
137
+ - heredoc
138
+
139
+ Metrics/ParameterLists:
140
+ Max: 10
141
+
142
+ Naming/FileName:
143
+ Exclude:
144
+ - lib/tilt-handlebars.rb
145
+
146
+ RSpec/ExampleLength:
147
+ CountAsOne:
148
+ - array
149
+ - hash
150
+ - heredoc
151
+
152
+ RSpec/MultipleMemoizedHelpers:
153
+ Max: 20
154
+
155
+ RSpec/NestedGroups:
156
+ Max: 8
157
+
158
+ Style/BlockDelimiters:
159
+ EnforcedStyle: semantic
160
+ AllowBracesOnProceduralOneLiners: true
161
+
162
+ Style/Documentation:
163
+ Enabled: false
164
+
165
+ Style/FrozenStringLiteralComment:
166
+ Exclude:
167
+ - "**/*.gemfile"
168
+
169
+ Style/StringLiterals:
170
+ EnforcedStyle: double_quotes
171
+ ConsistentQuotesInMultiline: true
172
+
173
+ Style/StringLiteralsInInterpolation:
174
+ EnforcedStyle: double_quotes
175
+
176
+ Style/SymbolArray:
177
+ EnforcedStyle: brackets
178
+
179
+ Style/TrailingCommaInArguments:
180
+ EnforcedStyleForMultiline: comma
181
+
182
+ Style/TrailingCommaInArrayLiteral:
183
+ EnforcedStyleForMultiline: comma
184
+
185
+ Style/TrailingCommaInHashLiteral:
186
+ EnforcedStyleForMultiline: comma
187
+
188
+ Style/WordArray:
189
+ EnforcedStyle: brackets
data/Appraisals ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise "tilt-1" do
4
+ gem "tilt", "~> 1"
5
+ end
6
+
7
+ appraise "tilt-2" do
8
+ gem "tilt", "~> 2"
9
+ end
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,75 @@
1
+ # Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub:
4
+ https://github.com/gi/tilt-handlebars.
5
+
6
+ 1. Fork the repository: https://github.com/gi/tilt-handlebars.
7
+ 1. Create an issue branch: `git checkout -b issue-N/summary origin/develop`)
8
+ 1. Run [setup](#Setup): `bin/setup`.
9
+ 1. Add tests for your updates.
10
+ 1. Run [tests](#Test): `bin/test`.
11
+ 1. Run linter: `bin/lint`.
12
+ 1. Commit changes: `git commit -am '[#N] Summary'`.
13
+ 1. Push changes: `git push origin head`.
14
+ 1. Create a pull request targeting `develop`.
15
+
16
+ ## Branches
17
+
18
+ This repository follows a modified version of the
19
+ [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow):
20
+ * The default development branch is `develop`.
21
+ * The main release branch is `main`.
22
+
23
+ ## Development
24
+
25
+ ### Setup
26
+
27
+ Run `bin/setup` to install dependencies.
28
+
29
+ ### Console
30
+
31
+ Run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ ### Test
34
+
35
+ Run `bin/test` to run the tests.
36
+
37
+ ### Install
38
+
39
+ Run `bin/rake install` to install this gem onto your local machine.
40
+
41
+ ## Releases
42
+
43
+ Releases are created automatically by continuous deployment.
44
+
45
+ ***Please avoid creating releases manually.***
46
+
47
+ To create a new release:
48
+ 1. Checkout a new branch from `develop`:
49
+ ```sh
50
+ git fetch origin develop
51
+ git checkout -b release-x.y.z origin/develop
52
+ ```
53
+ 1. Update the version number:
54
+ ```sh
55
+ bin/version x.y.z
56
+ bin/setup
57
+ ```
58
+ 1. Update the changelog:
59
+ - add mising entries
60
+ - move `[Unreleased]` to `[x.y.z] - YYYY-MM-DD`
61
+ 1. Commit the changes:
62
+ ```sh
63
+ git commit -m 'vx.y.z'
64
+ ```
65
+ 1. Push the new branch:
66
+ ```sh
67
+ git push -u origin head
68
+ ```
69
+ 1. Create a merge/pull request to `main`.
70
+
71
+ When the `main` branch is updated, continuous deployment will tag and push a new
72
+ release.
73
+
74
+ Afterwards:
75
+ 1. Create a merge/pull request from `main` to `develop`.
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in tilt-handlebars.gemspec
4
6
  gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Jim Cushing
4
+ Copyright (c) 2021 Zach Gianos
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,25 +1,33 @@
1
1
  # Tilt::Handlebars
2
- <a href="http://badge.fury.io/rb/tilt-handlebars"><img src="https://badge.fury.io/rb/tilt-handlebars@2x.png" alt="Gem Version" height="18"></a>
3
- [![Build Status](https://travis-ci.org/jimothyGator/tilt-handlebars.png?branch=develop)](https://travis-ci.org/jimothyGator/tilt-handlebars)
4
- [![Coverage Status](https://coveralls.io/repos/jimothyGator/tilt-handlebars/badge.png?branch=develop)](https://coveralls.io/r/jimothyGator/tilt-handlebars?branch=develop)
5
- [![Code Climate](https://codeclimate.com/github/jimothyGator/tilt-handlebars.png)](https://codeclimate.com/github/jimothyGator/tilt-handlebars)
6
2
 
7
- [![Codeship Status](https://www.codeship.io/projects/71da7c90-ee55-0130-eff4-7205960840ac/status)](https://www.codeship.io/projects/6182)
3
+ [![Gem Version](https://badge.fury.io/rb/tilt-handlebars.svg)](https://rubygems.org/gems/tilt-handlebars)
4
+ [![Build Status](https://github.com/gi/tilt-handlebars/actions/workflows/ruby-ci.yml/badge.svg)](https://github.com/gi/tilt-handlebars/actions/workflows/ruby-ci.yml)
5
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/19d544fcb843a50db1a2/test_coverage)](https://codeclimate.com/github/gi/tilt-handlebars/test_coverage)
6
+ [![Maintainability](https://api.codeclimate.com/v1/badges/19d544fcb843a50db1a2/maintainability)](https://codeclimate.com/github/gi/tilt-handlebars/maintainability)
7
+ [![MIT License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.txt)
8
8
 
9
- Adds support for [Handlebars.rb](https://github.com/cowboyd/handlebars.rb) template
10
- engine to [Tilt](https://github.com/rtomayko/tilt).
9
+ A [Tilt](https://github.com/rtomayko/tilt) interface for the official JavaScript
10
+ implementation of the [Handlebars.js](https://handlebarsjs.com) template engine.
11
11
 
12
- See the [Handlebars.js](http://handlebarsjs.com) site for syntax.
12
+ [Handlebars::Engine](https://github.com/gi/handlebars-ruby) provides the API
13
+ wrapper. [MiniRacer](https://github.com/rubyjs/mini_racer) provides the
14
+ JavaScript execution environment.
15
+
16
+ See [Handlebars.js](http://handlebarsjs.com) for template syntax.
17
+
18
+ See [Handlebars::Engine](https://github.com/gi/handlebars-ruby) for API syntax.
13
19
 
14
20
  ## Installation
15
21
 
16
22
  Add this line to your application's Gemfile:
17
23
 
18
- gem 'tilt-handlebars'
24
+ ```ruby
25
+ gem 'tilt-handlebars'
26
+ ```
19
27
 
20
28
  And then execute:
21
29
 
22
- $ bundle
30
+ $ bundle install
23
31
 
24
32
  Or install it yourself as:
25
33
 
@@ -27,7 +35,7 @@ Or install it yourself as:
27
35
 
28
36
  ## Usage
29
37
 
30
- Create a Handlebars template file with either a `.hbs` or `.handlebars` extension.
38
+ Create a Handlebars template file with either a `.hbs` or `.handlebars` extension.
31
39
 
32
40
  Example, in `hello.hbs`:
33
41
 
@@ -50,7 +58,7 @@ Output:
50
58
 
51
59
  ### Partials
52
60
 
53
- Partials are a file that can be loaded into another. For example, you may define a web page with
61
+ Partials are a file that can be loaded into another. For example, you may define a web page with
54
62
  a master layout (`layout.hbs`), which includes a header (`header.hbs`) and footer (`footer.hbs`).
55
63
  In this case, `header.hbs` and `footer.hbs` would be partials; `layout.hbs` includes these partials.
56
64
 
@@ -69,7 +77,7 @@ In this case, `header.hbs` and `footer.hbs` would be partials; `layout.hbs` incl
69
77
  </html>
70
78
  ```
71
79
 
72
- Notice that you do not include the `.hbs` file extension in the partial name. Tilt Handlebars
80
+ Notice that you do not include the `.hbs` file extension in the partial name. Tilt Handlebars
73
81
  will look for the partial relative to the enclosing file (`layout.hbs` in this example) with
74
82
  either a `.hbs` or `.handlebars` extension.
75
83
 
@@ -94,12 +102,18 @@ This will use the template file named `views/hello.hbs`.
94
102
  Partials can also be used with Sinatra. As described previously, partials will be loaded
95
103
  relative to the enclosing template (e.g., in the `views` directory).
96
104
 
105
+ ## Changelog
106
+
107
+ See [RELEASE_NOTES.md](RELEASE_NOTES.md) for more details.
108
+
97
109
  ## Contributing
98
110
 
99
- 1. Fork it
100
- 2. Create your feature branch (`git checkout -b my-new-feature`)
101
- 3. Add tests, preferrably using Minitest::Spec for consistency.
102
- 4. Run tests with `bundle exec rake test`.
103
- 5. Commit your changes (`git commit -am 'Add some feature'`)
104
- 6. Push to the branch (`git push origin my-new-feature`)
105
- 7. Create new Pull Request
111
+ Bug reports and pull requests are welcome on GitHub:
112
+ https://github.com/gi/tilt-handlebars.
113
+
114
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
115
+
116
+ ## License
117
+
118
+ The gem is available as open source under the terms of the
119
+ [MIT License](https://opensource.org/licenses/MIT).
data/RELEASE_NOTES.md CHANGED
@@ -1,10 +1,22 @@
1
1
  Tilt Handlebars Release Notes
2
2
  =============================
3
3
 
4
+ Version 2.0
5
+ -----------
6
+ * Updated engine to [Handlebars::Engine](https://github.com/gi/handlebars-ruby).
7
+ * Updated build/deploy to GitHub Actions:
8
+ - test against macos-latest and ubuntu-latest
9
+ - test against tilt 1.x and 2.x
10
+ - test against ruby 2.6, 2.7, 3.0, and 3.1
11
+ - test coverage
12
+ - lint
13
+ * Updated specs/tests to [RSpec](https://rspec.info/).
14
+ * Updated readme/documentation.
15
+
4
16
  Version 1.4
5
17
  -----------
6
18
  * Updated to Tilt 2.0. It should still work with Tilt 1.3.
7
- * Updated to [Handlebars.rb](https://github.com/cowboyd/handlebars.rb) 0.7.0 and [Handlebars.js](3.0)
19
+ * Updated to [Handlebars.rb](https://github.com/cowboyd/handlebars.rb) 0.7.0 and [Handlebars.js](https://github.com/wycats/handlebars.js/) 3.0.
8
20
  * Issue #3: Fix "Template engine not found error"
9
21
 
10
22
  Version 1.3.1
@@ -19,8 +31,8 @@ Version 1.3.0
19
31
 
20
32
  * Uses Handlebars.js 1.3.0, and handlebars.rb 0.6.0.
21
33
 
22
- Note: Tilt Handlebars currently uses Tilt 1.4.x, because Sinatra is not yet
23
- compatible with Tilt 2.0. Once Sinatra is updated for Tilt 2.0, I'll release a
34
+ Note: Tilt Handlebars currently uses Tilt 1.4.x, because Sinatra is not yet
35
+ compatible with Tilt 2.0. Once Sinatra is updated for Tilt 2.0, I'll release a
24
36
  new version of tilt-handlebars. Alternatively, I could break out Sinatra support
25
37
  into a separate gem. If you use Tilt and Tilt Handlebars without Sinatra, and
26
38
  Tilt 2.0 support is important to you, please file an issue to let me know.
@@ -30,13 +42,13 @@ Version 1.2.0
30
42
  -------------
31
43
  2013 September 30
32
44
 
33
- This version is recommend for all users, as it brings support for the release
45
+ This version is recommend for all users, as it brings support for the release
34
46
  version of Handlebars.
35
47
 
36
48
  * Updates to handlebars.rb 0.5.0, which brings with it the 1.0.0 release
37
49
  version version of the JavaScript Handlebars, and an updated Ruby Racer
38
50
  (Ruby-JavaScript bridge). Thanks to [Yehuda Katz](https://github.com/wycats)
39
- and [Charles Lowell](https://github.com/cowboyd) for their continued work on
51
+ and [Charles Lowell](https://github.com/cowboyd) for their continued work on
40
52
  Handlebars and Handlebars.rb, respectively.
41
53
 
42
54
  * Backwards compatibility note: If you are using automatic partials loading with
data/Rakefile CHANGED
@@ -1,11 +1,7 @@
1
- require "bundler/gem_tasks"
2
- require 'rake/testtask'
1
+ # frozen_string_literal: true
3
2
 
4
- desc 'Run tests (default)'
5
- Rake::TestTask.new(:test) do |t|
6
- t.test_files = FileList['test/*_test.rb']
7
- t.ruby_opts = ['-Itest']
8
- t.ruby_opts << '-rubygems' if defined? Gem
3
+ Dir.glob("tasks/**/*.rake") do |file|
4
+ import(file)
9
5
  end
10
6
 
11
- task :default => :test
7
+ task default: [:clobber, :test]
data/bin/audit ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ root = File.absolute_path("..", __dir__)
5
+ audit = File.absolute_path("bundler-audit", __dir__)
6
+
7
+ Dir.chdir(root)
8
+ exec([audit, "audit"], "--update", *ARGV)
data/bin/build ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ root = File.absolute_path("..", __dir__)
5
+ rake = File.absolute_path("rake", __dir__)
6
+
7
+ Dir.chdir(root)
8
+ exec([rake, "rake"], "build", *ARGV)