template-ruby 1.1.2 → 2.0.1

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: c0da0a2d800fe1644ebdd96c1efba802f8d144bcc25c86feec00ad6c2af8cccc
4
- data.tar.gz: 907c5556b45b39649b0b11902ba1acecc1ea6d9990bc0b5502bd7f482f1cb21f
3
+ metadata.gz: 02efbb590c32f919cf8fbb7971d6947c9b92618553ae8ffa25abc18465a64842
4
+ data.tar.gz: 78556d98401ece5898c26f5985ccb38711bb34c1c22f95d052ede5b16acaf6e1
5
5
  SHA512:
6
- metadata.gz: eb785a3c3228ef2ad261c40ffdfafcbc94f77d1a3ce31b97487e8c99b75132335f24eed8e90fd2b8019185b8ecc8e5c8ba76a851ecb17db4d703001f970f87f1
7
- data.tar.gz: 565fbfee90bf052bbc7bb3aaead5d73c70e7aee417f5b3a35690faff4559491c1c3ed1d2aa8e69e842e90e578be1c239753d8ae63850af25d87112be02734af2
6
+ metadata.gz: aaac5a0cd6118e290dfd63ae798e3ae488b45133bb4535d28960a979f07de26367687dc519dcd1ed210b9ed390e157b6e3046897c2c35445d4c4569e8f9aee00
7
+ data.tar.gz: bf90e457676be57fc18774fbe162f1e3729c13d681c9a17bd88142b69487a46ac88d43ec0e73e6a53ac26c13c0a7b85776a29abacc8c8b77016f6ae61403a4da
@@ -1,15 +1,15 @@
1
1
  ---
2
- version: 2
3
2
  updates:
4
- - directory: "/"
5
- package-ecosystem: github-actions
6
- schedule:
7
- interval: daily
8
- - directory: "/"
9
- package-ecosystem: npm
10
- schedule:
11
- interval: daily
12
- - directory: "/"
13
- package-ecosystem: bundler
14
- schedule:
15
- interval: daily
3
+ - directory: "/"
4
+ package-ecosystem: github-actions
5
+ schedule:
6
+ interval: daily
7
+ - directory: "/"
8
+ package-ecosystem: npm
9
+ schedule:
10
+ interval: daily
11
+ - directory: "/"
12
+ package-ecosystem: bundler
13
+ schedule:
14
+ interval: daily
15
+ version: 2
@@ -1,37 +1,38 @@
1
- name: CI
2
- on: push
1
+ ---
3
2
  jobs:
4
3
  bundler-audit:
5
4
  name: Bundler Audit
6
5
  runs-on: ubuntu-latest
7
6
  steps:
8
- - uses: actions/checkout@v4
9
- - uses: ruby/setup-ruby@v1
10
- with:
11
- bundler-cache: true
12
- - run: bin/bundler-audit check --update
7
+ - uses: actions/checkout@v4
8
+ - uses: ruby/setup-ruby@v1
9
+ with:
10
+ bundler-cache: true
11
+ - run: bin/bundler-audit check --update
12
+ npm-audit:
13
+ name: npm Audit
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-node@v4
18
+ - run: npm audit
13
19
  rspec:
14
20
  name: Test
15
21
  runs-on: ubuntu-latest
16
22
  steps:
17
- - uses: actions/checkout@v4
18
- - uses: ruby/setup-ruby@v1
19
- with:
20
- bundler-cache: true
21
- - run: bin/test
23
+ - uses: actions/checkout@v4
24
+ - uses: ruby/setup-ruby@v1
25
+ with:
26
+ bundler-cache: true
27
+ - run: bin/test
22
28
  rubocop:
23
29
  name: Rubocop
24
30
  runs-on: ubuntu-latest
25
31
  steps:
26
- - uses: actions/checkout@v4
27
- - uses: ruby/setup-ruby@v1
28
- with:
29
- bundler-cache: true
30
- - run: bin/rubocop
31
- npm-audit:
32
- name: npm Audit
33
- runs-on: ubuntu-latest
34
- steps:
35
- - uses: actions/checkout@v4
36
- - uses: actions/setup-node@v4
37
- - run: npm audit
32
+ - uses: actions/checkout@v4
33
+ - uses: ruby/setup-ruby@v1
34
+ with:
35
+ bundler-cache: true
36
+ - run: bin/rubocop
37
+ name: CI
38
+ 'on': push
data/.node-version CHANGED
@@ -1 +1 @@
1
- 22.5.1
1
+ 26.3.1
data/.npm-version ADDED
@@ -0,0 +1 @@
1
+ 11.17.0
data/.rubocop.yml CHANGED
@@ -1,19 +1,25 @@
1
1
  ---
2
2
  AllCops:
3
3
  Exclude:
4
- - "*/node_modules/**/*"
5
- - "*/vendor/**/*"
6
- - node_modules/**/*
7
- - vendor/**/*
4
+ - "**/node_modules/**/*"
5
+ - "**/vendor/**/*"
6
+ - "**/db/schema.rb"
8
7
  NewCops: enable
8
+ TargetRubyVersion: 4.0
9
9
  Layout/ClosingHeredocIndentation:
10
10
  Enabled: false
11
+ Layout/ElseAlignment:
12
+ Enabled: false
13
+ Layout/EndAlignment:
14
+ Enabled: false
11
15
  Layout/FirstArgumentIndentation:
12
16
  Enabled: false
13
17
  Layout/HashAlignment:
14
18
  Enabled: false
15
19
  Layout/HeredocIndentation:
16
20
  Enabled: false
21
+ Layout/IndentationWidth:
22
+ Enabled: false
17
23
  Layout/LineEndStringConcatenationIndentation:
18
24
  Enabled: false
19
25
  Layout/LineLength:
@@ -22,12 +28,20 @@ Layout/MultilineMethodCallIndentation:
22
28
  Enabled: false
23
29
  Layout/MultilineOperationIndentation:
24
30
  Enabled: false
31
+ Layout/SpaceAroundKeyword:
32
+ Enabled: false
33
+ Layout/SpaceInsideHashLiteralBraces:
34
+ Enabled: false
35
+ Lint/ConstantDefinitionInBlock:
36
+ Enabled: false
25
37
  Lint/EmptyClass:
26
38
  Enabled: false
27
39
  Lint/MissingSuper:
28
40
  Enabled: false
29
41
  Lint/PercentStringArray:
30
42
  Enabled: false
43
+ Lint/SafeNavigationChain:
44
+ Enabled: false
31
45
  Lint/ShadowingOuterLocalVariable:
32
46
  Enabled: false
33
47
  Lint/SuppressedException:
@@ -42,6 +56,8 @@ Metrics/BlockLength:
42
56
  Enabled: false
43
57
  Metrics/ClassLength:
44
58
  Enabled: false
59
+ Metrics/CollectionLiteralLength:
60
+ Enabled: false
45
61
  Metrics/CyclomaticComplexity:
46
62
  Enabled: false
47
63
  Metrics/MethodLength:
@@ -56,8 +72,12 @@ Naming/FileName:
56
72
  Enabled: false
57
73
  Naming/MethodParameterName:
58
74
  Enabled: false
75
+ Naming/PredicateMethod:
76
+ Enabled: false
59
77
  Naming/VariableNumber:
60
78
  Enabled: false
79
+ Performance/Sum:
80
+ Enabled: false
61
81
  Performance/UnfreezeString:
62
82
  Enabled: false
63
83
  RSpec/AnyInstance:
@@ -76,6 +96,8 @@ RSpec/NoExpectationExample:
76
96
  Enabled: false
77
97
  RSpec/PendingWithoutReason:
78
98
  Enabled: false
99
+ Rails/BulkChangeTable:
100
+ Enabled: false
79
101
  Rails/Delegate:
80
102
  Enabled: false
81
103
  Rails/DynamicFindBy:
@@ -90,6 +112,8 @@ Rails/Presence:
90
112
  Enabled: false
91
113
  Rails/Present:
92
114
  Enabled: false
115
+ Rails/SkipsModelValidations:
116
+ Enabled: false
93
117
  Rails/ThreeStateBooleanColumn:
94
118
  Enabled: false
95
119
  Rails/TimeZone:
@@ -106,6 +130,8 @@ Style/EmptyMethod:
106
130
  Enabled: false
107
131
  Style/IfUnlessModifier:
108
132
  Enabled: false
133
+ Style/Lambda:
134
+ Enabled: false
109
135
  Style/MultilineBlockChain:
110
136
  Enabled: false
111
137
  Style/NestedTernaryOperator:
@@ -116,11 +142,10 @@ Style/StringLiterals:
116
142
  Enabled: false
117
143
  Style/StringLiteralsInInterpolation:
118
144
  Enabled: false
119
- require:
120
- - rubocop-factory_bot
121
- - rubocop-performance
122
- - rubocop-rails
123
- - rubocop-rake
124
- - rubocop-rspec
125
- - rubocop-rspec_rails
126
- - rubocop-capybara
145
+ plugins:
146
+ - rubocop-performance
147
+ - rubocop-rails
148
+ - rubocop-rake
149
+ - rubocop-rspec
150
+ - rubocop-capybara
151
+ - rubocop-rspec_rails
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.5
1
+ 4.0.5
data/.tool-versions CHANGED
@@ -1,3 +1,2 @@
1
- ruby 3.3.5
2
- yarn 1.22.22
3
- nodejs 22.5.1
1
+ ruby 4.0.5
2
+ nodejs 26.3.1
data/Gemfile CHANGED
@@ -4,18 +4,15 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- ruby "3.3.5"
8
-
9
- gem "rspec"
10
- gem "ruby-prof"
7
+ ruby "4.0.5"
11
8
 
12
9
  gem "bundler-audit"
13
-
14
- gem "rubocop-factory_bot"
10
+ gem "dorian"
11
+ gem "rspec"
12
+ gem "rubocop-capybara"
15
13
  gem "rubocop-performance"
16
14
  gem "rubocop-rails"
17
15
  gem "rubocop-rake"
18
16
  gem "rubocop-rspec"
19
17
  gem "rubocop-rspec_rails"
20
-
21
- gem "rubocop-capybara"
18
+ gem "ruby-prof"
data/Gemfile.lock CHANGED
@@ -1,129 +1,247 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- template-ruby (1.1.2)
5
- code-ruby
6
- dorian-arguments
7
- language-ruby
4
+ template-ruby (2.0.1)
5
+ code-ruby (>= 5.0.9, < 6)
6
+ dorian-arguments (>= 2.0.1, < 3)
7
+ language-ruby (>= 2.0.1, < 3)
8
8
  zeitwerk
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.2.1)
13
+ activesupport (8.1.3.1)
14
14
  base64
15
15
  bigdecimal
16
16
  concurrent-ruby (~> 1.0, >= 1.3.1)
17
17
  connection_pool (>= 2.2.5)
18
18
  drb
19
19
  i18n (>= 1.6, < 2)
20
+ json
20
21
  logger (>= 1.4.2)
21
22
  minitest (>= 5.1)
22
23
  securerandom (>= 0.3)
23
24
  tzinfo (~> 2.0, >= 2.0.5)
24
- ast (2.4.2)
25
- base64 (0.2.0)
26
- bigdecimal (3.1.8)
27
- bundler-audit (0.9.2)
28
- bundler (>= 1.2.0, < 3)
25
+ uri (>= 0.13.1)
26
+ ast (2.4.3)
27
+ base64 (0.3.0)
28
+ bigdecimal (4.1.2)
29
+ bundler-audit (0.9.3)
30
+ bundler (>= 1.2.0)
29
31
  thor (~> 1.0)
30
- code-ruby (1.1.1)
31
- activesupport
32
- bigdecimal
33
- did-you-mean
34
- dorian-arguments
35
- json
36
- language-ruby
37
- zeitwerk
38
- concurrent-ruby (1.3.4)
39
- connection_pool (2.4.1)
32
+ cmdparse (3.0.7)
33
+ code-ruby (5.0.9)
34
+ activesupport (>= 7.1.6, < 9)
35
+ base64 (>= 0.3.0, < 1)
36
+ bigdecimal (>= 4.1.2, < 5)
37
+ did-you-mean (>= 0.1.1, < 1)
38
+ dorian-arguments (>= 2.0.1, < 3)
39
+ icalendar (>= 2.12.4, < 3)
40
+ json (>= 2.21.2, < 3)
41
+ language-ruby (>= 2.0.1, < 3)
42
+ mail (>= 2.9.1, < 3)
43
+ net-http (>= 0.9.1, < 1)
44
+ net-smtp (>= 0.5.1, < 1)
45
+ nokogiri (>= 1.19.4, < 2)
46
+ uri (>= 1.1.1, < 2)
47
+ zeitwerk (>= 2.8.3, < 3)
48
+ concurrent-ruby (1.3.8)
49
+ connection_pool (3.0.2)
50
+ csv (3.3.6)
51
+ date (3.5.1)
40
52
  did-you-mean (0.1.1)
41
53
  levenshtein (>= 0.2.0)
42
- diff-lcs (1.5.1)
43
- dorian-arguments (1.2.1)
44
- bigdecimal
45
- drb (2.2.1)
46
- i18n (1.14.5)
54
+ diff-lcs (1.6.2)
55
+ dorian (3.0.2)
56
+ csv (>= 3.3.6, < 4)
57
+ dorian-arguments (>= 2.0.1, < 3)
58
+ dorian-eval (>= 2.0.1, < 3)
59
+ dorian-progress (>= 2.0.1, < 3)
60
+ dorian-to_struct (>= 3.0.1, < 4)
61
+ haml (>= 7.5.1, < 8.0)
62
+ hexapdf (>= 1.10.0, < 2)
63
+ json (>= 2.21.2, < 3)
64
+ mini_racer (>= 0.22.1, < 1)
65
+ ostruct (>= 0.6.3, < 1)
66
+ parallel (>= 2.1.0, < 3.0)
67
+ syntax_tree (>= 6.3.0, < 7)
68
+ syntax_tree-haml (>= 4.0.3, < 5)
69
+ syntax_tree-xml (>= 0.1.0, < 1)
70
+ terminal-table (>= 4.0.0, < 5)
71
+ w_syntax_tree-erb (>= 0.12.0, < 1)
72
+ yaml (>= 0.4.0, < 1)
73
+ dorian-arguments (2.0.1)
74
+ bigdecimal (>= 3.1, < 5)
75
+ dorian-eval (2.0.1)
76
+ yaml (>= 0.3, < 1)
77
+ dorian-progress (2.0.1)
78
+ ruby-progressbar (>= 1.13, < 2)
79
+ dorian-to_struct (3.0.1)
80
+ drb (2.2.3)
81
+ geom2d (0.4.1)
82
+ haml (7.5.1)
83
+ prism (>= 1.1.0)
84
+ temple (>= 0.8.2)
85
+ thor
86
+ tilt
87
+ hexapdf (1.10.0)
88
+ cmdparse (~> 3.0, >= 3.0.3)
89
+ geom2d (~> 0.4, >= 0.4.1)
90
+ openssl (>= 2.2.1)
91
+ strscan (>= 3.1.2)
92
+ i18n (1.15.2)
47
93
  concurrent-ruby (~> 1.0)
48
- json (2.7.2)
49
- language-ruby (1.0.1)
94
+ icalendar (2.12.4)
95
+ base64
96
+ ice_cube (~> 0.16)
97
+ logger
98
+ ostruct
99
+ ice_cube (0.17.0)
100
+ json (2.21.2)
101
+ language-ruby (2.0.1)
50
102
  dorian-arguments
51
103
  zeitwerk
52
- language_server-protocol (3.17.0.3)
104
+ language_server-protocol (3.17.0.6)
53
105
  levenshtein (0.2.2)
54
- logger (1.6.1)
55
- minitest (5.25.1)
56
- parallel (1.26.3)
57
- parser (3.3.5.0)
106
+ libv8-node (24.12.0.1-arm64-darwin)
107
+ libv8-node (24.12.0.1-x86_64-linux)
108
+ lint_roller (1.1.0)
109
+ logger (1.7.0)
110
+ mail (2.9.1)
111
+ logger
112
+ mini_mime (>= 0.1.1)
113
+ net-imap
114
+ net-pop
115
+ net-smtp
116
+ mini_mime (1.1.5)
117
+ mini_racer (0.22.1)
118
+ libv8-node (~> 24.12.0.1)
119
+ minitest (6.0.6)
120
+ drb (~> 2.0)
121
+ prism (~> 1.5)
122
+ net-http (0.9.1)
123
+ uri (>= 0.11.1)
124
+ net-imap (0.6.6)
125
+ date
126
+ net-protocol
127
+ net-pop (0.1.2)
128
+ net-protocol
129
+ net-protocol (0.3.0)
130
+ timeout
131
+ net-smtp (0.5.1)
132
+ net-protocol
133
+ nokogiri (1.19.4-arm64-darwin)
134
+ racc (~> 1.4)
135
+ nokogiri (1.19.4-x86_64-linux-gnu)
136
+ racc (~> 1.4)
137
+ openssl (4.0.2)
138
+ ostruct (0.6.3)
139
+ parallel (2.1.0)
140
+ parser (3.3.12.0)
58
141
  ast (~> 2.4.1)
59
142
  racc
143
+ prettier_print (1.2.1)
144
+ prism (1.9.0)
60
145
  racc (1.8.1)
61
- rack (3.1.7)
146
+ rack (3.2.7)
62
147
  rainbow (3.1.1)
63
- regexp_parser (2.9.2)
64
- rspec (3.13.0)
148
+ regexp_parser (2.12.0)
149
+ rspec (3.13.2)
65
150
  rspec-core (~> 3.13.0)
66
151
  rspec-expectations (~> 3.13.0)
67
152
  rspec-mocks (~> 3.13.0)
68
- rspec-core (3.13.1)
153
+ rspec-core (3.13.6)
69
154
  rspec-support (~> 3.13.0)
70
- rspec-expectations (3.13.2)
155
+ rspec-expectations (3.13.5)
71
156
  diff-lcs (>= 1.2.0, < 2.0)
72
157
  rspec-support (~> 3.13.0)
73
- rspec-mocks (3.13.1)
158
+ rspec-mocks (3.13.8)
74
159
  diff-lcs (>= 1.2.0, < 2.0)
75
160
  rspec-support (~> 3.13.0)
76
- rspec-support (3.13.1)
77
- rubocop (1.66.1)
78
- json (~> 2.3)
79
- language_server-protocol (>= 3.17.0)
80
- parallel (~> 1.10)
161
+ rspec-support (3.13.7)
162
+ rubocop (1.90.0)
163
+ json (>= 2.3)
164
+ language_server-protocol (~> 3.17.0.2)
165
+ lint_roller (~> 1.1.0)
166
+ parallel (>= 1.10)
81
167
  parser (>= 3.3.0.2)
82
168
  rainbow (>= 2.2.2, < 4.0)
83
- regexp_parser (>= 2.4, < 3.0)
84
- rubocop-ast (>= 1.32.2, < 2.0)
169
+ regexp_parser (>= 2.9.3, < 3.0)
170
+ rubocop-ast (>= 1.49.0, < 2.0)
85
171
  ruby-progressbar (~> 1.7)
86
- unicode-display_width (>= 2.4.0, < 3.0)
87
- rubocop-ast (1.32.3)
88
- parser (>= 3.3.1.0)
89
- rubocop-capybara (2.21.0)
90
- rubocop (~> 1.41)
91
- rubocop-factory_bot (2.26.1)
92
- rubocop (~> 1.61)
93
- rubocop-performance (1.21.1)
94
- rubocop (>= 1.48.1, < 2.0)
95
- rubocop-ast (>= 1.31.1, < 2.0)
96
- rubocop-rails (2.26.0)
172
+ unicode-display_width (>= 2.4.0, < 4.0)
173
+ rubocop-ast (1.50.0)
174
+ parser (>= 3.3.7.2)
175
+ prism (~> 1.7)
176
+ rubocop-capybara (3.0.0)
177
+ lint_roller (~> 1.1)
178
+ rubocop (~> 1.81)
179
+ rubocop-performance (1.27.0)
180
+ lint_roller (~> 1.1)
181
+ rubocop (>= 1.89.0, < 2.0)
182
+ rubocop-ast (>= 1.47.1, < 2.0)
183
+ rubocop-rails (2.37.0)
97
184
  activesupport (>= 4.2.0)
185
+ lint_roller (~> 1.1)
98
186
  rack (>= 1.1)
99
- rubocop (>= 1.52.0, < 2.0)
100
- rubocop-ast (>= 1.31.1, < 2.0)
101
- rubocop-rake (0.6.0)
102
- rubocop (~> 1.0)
103
- rubocop-rspec (3.0.4)
104
- rubocop (~> 1.61)
105
- rubocop-rspec_rails (2.30.0)
106
- rubocop (~> 1.61)
107
- rubocop-rspec (~> 3, >= 3.0.1)
108
- ruby-prof (1.7.0)
187
+ rubocop (>= 1.89.0, < 2.0)
188
+ rubocop-ast (>= 1.44.0, < 2.0)
189
+ rubocop-rake (0.7.1)
190
+ lint_roller (~> 1.1)
191
+ rubocop (>= 1.72.1)
192
+ rubocop-rspec (3.10.2)
193
+ lint_roller (~> 1.1)
194
+ regexp_parser (>= 2.0)
195
+ rubocop (~> 1.86, >= 1.86.2)
196
+ rubocop-rspec_rails (2.32.0)
197
+ lint_roller (~> 1.1)
198
+ rubocop (~> 1.72, >= 1.72.1)
199
+ rubocop-rspec (~> 3.5)
200
+ ruby-prof (2.0.5)
201
+ base64
202
+ ostruct
109
203
  ruby-progressbar (1.13.0)
110
- securerandom (0.3.1)
111
- thor (1.3.2)
204
+ securerandom (0.4.1)
205
+ strscan (3.1.8)
206
+ syntax_tree (6.3.0)
207
+ prettier_print (>= 1.2.0)
208
+ syntax_tree-haml (4.0.3)
209
+ haml (>= 5.2)
210
+ prettier_print (>= 1.2.1)
211
+ syntax_tree (>= 6.0.0)
212
+ syntax_tree-xml (0.1.0)
213
+ prettier_print
214
+ syntax_tree (>= 2.0.1)
215
+ temple (0.10.7)
216
+ terminal-table (4.0.0)
217
+ unicode-display_width (>= 1.1.1, < 4)
218
+ thor (1.5.0)
219
+ tilt (2.9.0)
220
+ timeout (0.6.1)
112
221
  tzinfo (2.0.6)
113
222
  concurrent-ruby (~> 1.0)
114
- unicode-display_width (2.5.0)
115
- zeitwerk (2.6.18)
223
+ unicode-display_width (3.2.0)
224
+ unicode-emoji (~> 4.1)
225
+ unicode-emoji (4.2.0)
226
+ uri (1.1.1)
227
+ w_syntax_tree-erb (0.12.0)
228
+ prettier_print (~> 1.2, >= 1.2.0)
229
+ syntax_tree (~> 6.1, >= 6.1.1)
230
+ yaml (0.4.0)
231
+ zeitwerk (2.8.3)
116
232
 
117
233
  PLATFORMS
118
234
  arm64-darwin-22
119
235
  arm64-darwin-23
236
+ arm64-darwin-24
237
+ arm64-darwin-25
120
238
  x86_64-linux
121
239
 
122
240
  DEPENDENCIES
123
241
  bundler-audit
242
+ dorian
124
243
  rspec
125
244
  rubocop-capybara
126
- rubocop-factory_bot
127
245
  rubocop-performance
128
246
  rubocop-rails
129
247
  rubocop-rake
@@ -133,7 +251,7 @@ DEPENDENCIES
133
251
  template-ruby!
134
252
 
135
253
  RUBY VERSION
136
- ruby 3.3.5p100
254
+ ruby 4.0.5
137
255
 
138
256
  BUNDLED WITH
139
- 2.5.18
257
+ 4.0.15
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.2
1
+ 2.0.1
data/bin/dorian ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'dorian' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
12
+
13
+ bundle_binstub = File.expand_path("bundle", __dir__)
14
+
15
+ if File.file?(bundle_binstub)
16
+ if File.read(bundle_binstub, 300).include?(
17
+ "This file was generated by Bundler"
18
+ )
19
+ load(bundle_binstub)
20
+ else
21
+ abort(
22
+ "Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
23
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again."
24
+ )
25
+ end
26
+ end
27
+
28
+ require "rubygems"
29
+ require "bundler/setup"
30
+
31
+ load Gem.bin_path("dorian", "dorian")
@@ -11,11 +11,65 @@ class Template
11
11
  end
12
12
 
13
13
  def parse
14
- ::Template::Parser::Template.parse(input)
14
+ parts = []
15
+ text = +""
16
+ cursor = 0
17
+
18
+ while cursor < input.length
19
+ if input[cursor, 2] == '\\{'
20
+ text << "{"
21
+ cursor += 2
22
+ elsif input[cursor] == "{"
23
+ parts << { text: text } unless text.empty?
24
+ text = +""
25
+
26
+ closing_cursor = closing_curly_bracket(cursor + 1)
27
+ code = input[(cursor + 1)...closing_cursor]
28
+ parts << { code: ::Code::Parser.parse(code).to_raw }
29
+ cursor = closing_cursor + (closing_cursor < input.length ? 1 : 0)
30
+ else
31
+ text << input[cursor]
32
+ cursor += 1
33
+ end
34
+ end
35
+
36
+ parts << { text: text } unless text.empty?
37
+ parts << { text: "" } if parts.empty?
38
+ Language::Output.from_raw(parts)
15
39
  end
16
40
 
17
41
  private
18
42
 
19
43
  attr_reader :input
44
+
45
+ def closing_curly_bracket(cursor)
46
+ depth = 0
47
+ quote = nil
48
+
49
+ while cursor < input.length
50
+ character = input[cursor]
51
+
52
+ if quote
53
+ if character == "\\"
54
+ cursor += 2
55
+ next
56
+ end
57
+
58
+ quote = nil if character == quote
59
+ elsif ["'", '"'].include?(character)
60
+ quote = character
61
+ elsif character == "{"
62
+ depth += 1
63
+ elsif character == "}"
64
+ return cursor if depth.zero?
65
+
66
+ depth -= 1
67
+ end
68
+
69
+ cursor += 1
70
+ end
71
+
72
+ cursor
73
+ end
20
74
  end
21
75
  end
data/lib/template.rb CHANGED
@@ -15,6 +15,7 @@ class Template
15
15
  @error = error
16
16
  @timeout = timeout || DEFAULT_TIMEOUT
17
17
  @context = ::Code::Object::Context.new
18
+ @object = ::Code::Object::Global.new
18
19
  end
19
20
 
20
21
  def self.parse(input, timeout: DEFAULT_TIMEOUT)
@@ -33,7 +34,17 @@ class Template
33
34
  def evaluate
34
35
  Timeout.timeout(timeout) do
35
36
  parsed = Template.parse(input)
36
- Node::Template.new(parsed).evaluate(context:, output:, error:)
37
+ Node::Template.new(parsed).evaluate(
38
+ context:,
39
+ error:,
40
+ global_control_flow_root: true,
41
+ input: StringIO.new,
42
+ object:,
43
+ output:,
44
+ previous_object: object,
45
+ source: input,
46
+ timeout:
47
+ )
37
48
 
38
49
  output.is_a?(StringIO) ? output.string : ""
39
50
  end
@@ -41,5 +52,5 @@ class Template
41
52
 
42
53
  private
43
54
 
44
- attr_reader :input, :timeout, :output, :error, :context
55
+ attr_reader :input, :timeout, :output, :error, :context, :object
45
56
  end
data/package-lock.json CHANGED
@@ -6,8 +6,8 @@
6
6
  "": {
7
7
  "license": "MIT",
8
8
  "engines": {
9
- "node": "22.5.1",
10
- "npm": "10.8.2"
9
+ "node": "26.3.1",
10
+ "npm": "11.17.0"
11
11
  }
12
12
  }
13
13
  }
data/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "MIT",
3
3
  "engines": {
4
- "node": "22.5.1",
5
- "npm": "10.8.2"
4
+ "node": "26.3.1",
5
+ "npm": "11.17.0"
6
6
  }
7
7
  }
@@ -4,7 +4,10 @@ require "spec_helper"
4
4
 
5
5
  RSpec.describe Template do
6
6
  [
7
- ["{name = :Dorian nothing}Hello {name}", "Hello Dorian"]
7
+ ["{name = :Dorian nothing}Hello {name}", "Hello Dorian"],
8
+ ['{"}"}', "}"],
9
+ ["\\{name}", "{name}"],
10
+ ["", ""]
8
11
  ].each do |input, expected|
9
12
  it "#{input} == #{expected}" do
10
13
  expect(described_class.evaluate(input)).to eq(expected)
@@ -12,10 +12,10 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "https://github.com/dorianmariecom/template-ruby"
13
13
  s.license = "MIT"
14
14
  s.executables = "template"
15
- s.add_dependency "code-ruby"
16
- s.add_dependency "dorian-arguments"
17
- s.add_dependency "language-ruby"
15
+ s.add_dependency "code-ruby", ">= 5.0.9", "< 6"
16
+ s.add_dependency "dorian-arguments", ">= 2.0.1", "< 3"
17
+ s.add_dependency "language-ruby", ">= 2.0.1", "< 3"
18
18
  s.add_dependency "zeitwerk"
19
19
  s.metadata["rubygems_mfa_required"] = "true"
20
- s.required_ruby_version = ">= 3.3.0"
20
+ s.required_ruby_version = ">= 4.0"
21
21
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: template-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-09-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: code-ruby
@@ -16,42 +15,60 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
18
+ version: 5.0.9
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '6'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
23
25
  requirements:
24
26
  - - ">="
25
27
  - !ruby/object:Gem::Version
26
- version: '0'
28
+ version: 5.0.9
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '6'
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: dorian-arguments
29
34
  requirement: !ruby/object:Gem::Requirement
30
35
  requirements:
31
36
  - - ">="
32
37
  - !ruby/object:Gem::Version
33
- version: '0'
38
+ version: 2.0.1
39
+ - - "<"
40
+ - !ruby/object:Gem::Version
41
+ version: '3'
34
42
  type: :runtime
35
43
  prerelease: false
36
44
  version_requirements: !ruby/object:Gem::Requirement
37
45
  requirements:
38
46
  - - ">="
39
47
  - !ruby/object:Gem::Version
40
- version: '0'
48
+ version: 2.0.1
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '3'
41
52
  - !ruby/object:Gem::Dependency
42
53
  name: language-ruby
43
54
  requirement: !ruby/object:Gem::Requirement
44
55
  requirements:
45
56
  - - ">="
46
57
  - !ruby/object:Gem::Version
47
- version: '0'
58
+ version: 2.0.1
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '3'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: 2.0.1
69
+ - - "<"
70
+ - !ruby/object:Gem::Version
71
+ version: '3'
55
72
  - !ruby/object:Gem::Dependency
56
73
  name: zeitwerk
57
74
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +94,7 @@ files:
77
94
  - ".github/workflows/ci.yml"
78
95
  - ".gitignore"
79
96
  - ".node-version"
97
+ - ".npm-version"
80
98
  - ".prettierignore"
81
99
  - ".rspec"
82
100
  - ".rubocop.yml"
@@ -90,6 +108,7 @@ files:
90
108
  - bin/bundle
91
109
  - bin/bundle-audit
92
110
  - bin/bundler-audit
111
+ - bin/dorian
93
112
  - bin/rspec
94
113
  - bin/rubocop
95
114
  - bin/template
@@ -114,7 +133,6 @@ licenses:
114
133
  - MIT
115
134
  metadata:
116
135
  rubygems_mfa_required: 'true'
117
- post_install_message:
118
136
  rdoc_options: []
119
137
  require_paths:
120
138
  - lib
@@ -122,15 +140,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
140
  requirements:
123
141
  - - ">="
124
142
  - !ruby/object:Gem::Version
125
- version: 3.3.0
143
+ version: '4.0'
126
144
  required_rubygems_version: !ruby/object:Gem::Requirement
127
145
  requirements:
128
146
  - - ">="
129
147
  - !ruby/object:Gem::Version
130
148
  version: '0'
131
149
  requirements: []
132
- rubygems_version: 3.5.16
133
- signing_key:
150
+ rubygems_version: 4.0.17
134
151
  specification_version: 4
135
152
  summary: templating language
136
153
  test_files: []