tilt-handlebars 1.2.0 → 2.0.0
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 +5 -5
- data/.editorconfig +12 -0
- data/.github/workflows/ci.yml +76 -0
- data/.github/workflows/publish.yml +58 -0
- data/.gitignore +14 -15
- data/.rspec +1 -0
- data/.rubocop.yml +189 -0
- data/Appraisals +9 -0
- data/CONTRIBUTING.md +75 -0
- data/Gemfile +3 -1
- data/LICENSE +22 -0
- data/README.md +34 -19
- data/RELEASE_NOTES.md +50 -8
- data/Rakefile +4 -8
- data/bin/audit +8 -0
- data/bin/build +8 -0
- data/bin/bundle +114 -0
- data/bin/bundler-audit +29 -0
- data/bin/console +15 -0
- data/bin/doc +7 -0
- data/bin/lint +8 -0
- data/bin/rake +29 -0
- data/bin/release +25 -0
- data/bin/rspec +29 -0
- data/bin/rubocop +29 -0
- data/bin/setup +13 -0
- data/bin/tag +25 -0
- data/bin/test +7 -0
- data/bin/version +24 -0
- data/gemfiles/tilt_1.gemfile +7 -0
- data/gemfiles/tilt_2.gemfile +7 -0
- data/lib/sinatra/handlebars.rb +10 -6
- data/lib/tilt/handlebars/version.rb +3 -1
- data/lib/tilt/handlebars.rb +57 -46
- data/lib/tilt-handlebars.rb +3 -0
- data/spec/fixtures/helpers.rb +21 -0
- data/spec/fixtures/views/hello.hbs +1 -0
- data/spec/fixtures/views/hello_missing.hbs +1 -0
- data/spec/fixtures/views/hello_partial.hbs +1 -0
- data/spec/fixtures/views/hello_partial2.hbs +1 -0
- data/spec/fixtures/views/partial.hbs +1 -0
- data/spec/fixtures/views/partial2.handlebars +1 -0
- data/spec/sinatra/handlebars_spec.rb +47 -0
- data/spec/spec_coverage.rb +19 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/tilt/handlebars_template_spec.rb +543 -0
- data/spec/tilt_spec.rb +40 -0
- data/tasks/doc.rake +8 -0
- data/tasks/gem.rake +7 -0
- data/tasks/lint.rake +7 -0
- data/tasks/test.rake +10 -0
- data/tilt-handlebars.gemspec +48 -23
- metadata +261 -65
- data/.travis.yml +0 -6
- data/LICENSE.txt +0 -22
- data/test/fixtures/views/hello.hbs +0 -1
- data/test/fixtures/views/missing_partial.hbs +0 -1
- data/test/fixtures/views/partial.hbs +0 -1
- data/test/fixtures/views/partial2.handlebars +0 -1
- data/test/fixtures/views/partial_test.hbs +0 -1
- data/test/fixtures/views/partial_test2.handlebars +0 -1
- data/test/fixtures/views/two_partials.hbs +0 -1
- data/test/sinatra_test.rb +0 -38
- data/test/test_helper.rb +0 -9
- data/test/tilt_handlebarstemplate_test.rb +0 -276
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9a795c64abee7a47bdbf5cbccad24c92f2ffa9216973ae47db4162bd7a302e02
|
4
|
+
data.tar.gz: d59a4be0a82ab8f58b344181e601ec4aa69a5637826ebc1e5a3c2b96c078abc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d37f79d703991c9794ce7e052803948229a31aa58d2be8f3cb57053a6d05d9cc96c320bb8ddb4c774e2eba31522b90fbf6f3a84dce7ef424e38998051b2d304
|
7
|
+
data.tar.gz: 220353821875387c0e1cd5f30df25adf8054861fd7967fd31eff7b0095e4af60f5fb0b1939812e52448511cd81ef93547f499df6870e76a3a7a6ef3c2933db42
|
data/.editorconfig
ADDED
@@ -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
|
-
|
4
|
-
.
|
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
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
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
|
-
[](https://travis-ci.org/jimothyGator/tilt-handlebars)
|
4
|
-
[](https://coveralls.io/r/jimothyGator/tilt-handlebars?branch=develop)
|
5
|
-
[](https://codeclimate.com/github/jimothyGator/tilt-handlebars)
|
6
2
|
|
7
|
-
[](https://rubygems.org/gems/tilt-handlebars)
|
4
|
+
[](https://github.com/gi/tilt-handlebars/actions/workflows/ruby-ci.yml)
|
5
|
+
[](https://codeclimate.com/github/gi/tilt-handlebars/test_coverage)
|
6
|
+
[](https://codeclimate.com/github/gi/tilt-handlebars/maintainability)
|
7
|
+
[](LICENSE.txt)
|
8
8
|
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
-
|
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,11 +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
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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,18 +1,60 @@
|
|
1
|
+
Tilt Handlebars Release Notes
|
2
|
+
=============================
|
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
|
+
|
16
|
+
Version 1.4
|
17
|
+
-----------
|
18
|
+
* Updated to Tilt 2.0. It should still work with Tilt 1.3.
|
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.
|
20
|
+
* Issue #3: Fix "Template engine not found error"
|
21
|
+
|
22
|
+
Version 1.3.1
|
23
|
+
-------------
|
24
|
+
|
25
|
+
* Issue #1: Fix uninitialized constant Tilt::HandlebarsTemplate::Pathname. Thank you, [defeated](https://github.com/defeated) for the patch.
|
26
|
+
|
27
|
+
|
28
|
+
Version 1.3.0
|
29
|
+
-------------
|
30
|
+
2014 January 24
|
31
|
+
|
32
|
+
* Uses Handlebars.js 1.3.0, and handlebars.rb 0.6.0.
|
33
|
+
|
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
|
36
|
+
new version of tilt-handlebars. Alternatively, I could break out Sinatra support
|
37
|
+
into a separate gem. If you use Tilt and Tilt Handlebars without Sinatra, and
|
38
|
+
Tilt 2.0 support is important to you, please file an issue to let me know.
|
39
|
+
|
40
|
+
|
1
41
|
Version 1.2.0
|
2
42
|
-------------
|
3
43
|
2013 September 30
|
4
44
|
|
5
|
-
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
|
46
|
+
version of Handlebars.
|
6
47
|
|
7
|
-
* Updates to handlebars.rb 0.5.0, which brings with it the 1.0.0 release
|
8
|
-
version version of the JavaScript Handlebars, and an updated Ruby Racer
|
9
|
-
Thanks to [Yehuda Katz](https://github.com/wycats)
|
10
|
-
for their continued work on
|
48
|
+
* Updates to handlebars.rb 0.5.0, which brings with it the 1.0.0 release
|
49
|
+
version version of the JavaScript Handlebars, and an updated Ruby Racer
|
50
|
+
(Ruby-JavaScript bridge). Thanks to [Yehuda Katz](https://github.com/wycats)
|
51
|
+
and [Charles Lowell](https://github.com/cowboyd) for their continued work on
|
52
|
+
Handlebars and Handlebars.rb, respectively.
|
11
53
|
|
12
|
-
* Backwards compatibility note: If you are using automatic partials loading
|
13
|
-
|
54
|
+
* Backwards compatibility note: If you are using automatic partials loading with
|
55
|
+
an absolute path, you must now quote the path. For example:
|
14
56
|
|
15
|
-
{{> "/the/path/to/partial
|
57
|
+
{{> "/the/path/to/partial" }}
|
16
58
|
|
17
59
|
This is due to changes in the Handlebars parser.
|
18
60
|
|
data/Rakefile
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
|
2
|
-
require 'rake/testtask'
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
5
|
-
|
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 :
|
7
|
+
task default: [:clobber, :test]
|