cooklang 1.0.0 → 1.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 +4 -4
- data/.github/workflows/test.yml +35 -0
- data/.gitignore +12 -0
- data/.qlty/.gitignore +7 -0
- data/.qlty/configs/.yamllint.yaml +21 -0
- data/.qlty/qlty.toml +101 -0
- data/.rspec +3 -0
- data/.rubocop.yml +340 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +84 -0
- data/README.md +10 -5
- data/Rakefile +12 -0
- data/cooklang.gemspec +35 -0
- data/lib/cooklang/builders/recipe_builder.rb +64 -0
- data/lib/cooklang/builders/step_builder.rb +76 -0
- data/lib/cooklang/lexer.rb +5 -14
- data/lib/cooklang/parser.rb +24 -653
- data/lib/cooklang/parsers/cookware_parser.rb +133 -0
- data/lib/cooklang/parsers/ingredient_parser.rb +179 -0
- data/lib/cooklang/parsers/timer_parser.rb +135 -0
- data/lib/cooklang/processors/element_parser.rb +45 -0
- data/lib/cooklang/processors/metadata_processor.rb +129 -0
- data/lib/cooklang/processors/step_processor.rb +208 -0
- data/lib/cooklang/processors/token_processor.rb +104 -0
- data/lib/cooklang/recipe.rb +25 -15
- data/lib/cooklang/step.rb +12 -2
- data/lib/cooklang/timer.rb +3 -1
- data/lib/cooklang/token_stream.rb +130 -0
- data/lib/cooklang/version.rb +1 -1
- data/spec/comprehensive_spec.rb +179 -0
- data/spec/cooklang_spec.rb +38 -0
- data/spec/fixtures/canonical.yaml +837 -0
- data/spec/formatters/text_spec.rb +189 -0
- data/spec/integration/canonical_spec.rb +211 -0
- data/spec/lexer_spec.rb +357 -0
- data/spec/models/cookware_spec.rb +116 -0
- data/spec/models/ingredient_spec.rb +192 -0
- data/spec/models/metadata_spec.rb +241 -0
- data/spec/models/note_spec.rb +65 -0
- data/spec/models/recipe_spec.rb +171 -0
- data/spec/models/section_spec.rb +65 -0
- data/spec/models/step_spec.rb +236 -0
- data/spec/models/timer_spec.rb +173 -0
- data/spec/parser_spec.rb +398 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/token_stream_spec.rb +278 -0
- metadata +162 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c61d7de5e0471ab52eb21411d501fb1b909a5e1c356b2eeb105a37c971847321
|
4
|
+
data.tar.gz: 24fb626c2590541600acf57b317255adbb6fa75abc34ace698c70c8fcf2a5c90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 723008d0a4ea83eaec6c376f715f47a74edf29230a2fb8fcc2ec13d47250b65adc6027511343de7a6bd3e4d2b833e592add88373e298bf21e98a1fa217358166
|
7
|
+
data.tar.gz: ff3a2b9eb011b525309a7ac19bda34c51eb9dd68f154958af8b164511b1955a61e786dfd3cb45dd51391682700b9b962e2b3a8f54bade6fc1a5d56ea4053b2b3
|
@@ -0,0 +1,35 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ main, master ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ main, master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
strategy:
|
13
|
+
matrix:
|
14
|
+
ruby-version: ['3.2', '3.3', '3.4', '3.5']
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v4
|
18
|
+
|
19
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
bundler-cache: true
|
24
|
+
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rspec
|
27
|
+
|
28
|
+
- name: Run RuboCop
|
29
|
+
run: bundle exec rubocop
|
30
|
+
|
31
|
+
- uses: qltysh/qlty-action/coverage@v2
|
32
|
+
if: matrix.ruby-version == '3.5'
|
33
|
+
with:
|
34
|
+
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
|
35
|
+
files: coverage/.resultset.json
|
data/.gitignore
ADDED
data/.qlty/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
extends: default
|
2
|
+
|
3
|
+
rules:
|
4
|
+
document-start: disable
|
5
|
+
quoted-strings:
|
6
|
+
required: only-when-needed
|
7
|
+
extra-allowed: ["{|}"]
|
8
|
+
key-duplicates: {}
|
9
|
+
octal-values:
|
10
|
+
forbid-implicit-octal: true
|
11
|
+
line-length: disable
|
12
|
+
indentation: disable
|
13
|
+
new-line-at-end-of-file: disable
|
14
|
+
trailing-spaces: disable
|
15
|
+
brackets: disable
|
16
|
+
colons: disable
|
17
|
+
empty-lines: disable
|
18
|
+
comments: disable
|
19
|
+
braces: disable
|
20
|
+
comments-indentation: disable
|
21
|
+
commas: disable
|
data/.qlty/qlty.toml
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# This file was automatically generated by `qlty init`.
|
2
|
+
# You can modify it to suit your needs.
|
3
|
+
# We recommend you to commit this file to your repository.
|
4
|
+
#
|
5
|
+
# This configuration is used by both Qlty CLI and Qlty Cloud.
|
6
|
+
#
|
7
|
+
# Qlty CLI -- Code quality toolkit for developers
|
8
|
+
# Qlty Cloud -- Fully automated Code Health Platform
|
9
|
+
#
|
10
|
+
# Try Qlty Cloud: https://qlty.sh
|
11
|
+
#
|
12
|
+
# For a guide to configuration, visit https://qlty.sh/d/config
|
13
|
+
# Or for a full reference, visit https://qlty.sh/d/qlty-toml
|
14
|
+
config_version = "0"
|
15
|
+
|
16
|
+
exclude_patterns = [
|
17
|
+
"*_min.*",
|
18
|
+
"*-min.*",
|
19
|
+
"*.min.*",
|
20
|
+
"**/.yarn/**",
|
21
|
+
"**/*.d.ts",
|
22
|
+
"**/assets/**",
|
23
|
+
"**/bower_components/**",
|
24
|
+
"**/build/**",
|
25
|
+
"**/cache/**",
|
26
|
+
"**/config/**",
|
27
|
+
"**/db/**",
|
28
|
+
"**/deps/**",
|
29
|
+
"**/dist/**",
|
30
|
+
"**/extern/**",
|
31
|
+
"**/external/**",
|
32
|
+
"**/generated/**",
|
33
|
+
"**/Godeps/**",
|
34
|
+
"**/gradlew/**",
|
35
|
+
"**/mvnw/**",
|
36
|
+
"**/node_modules/**",
|
37
|
+
"**/protos/**",
|
38
|
+
"**/seed/**",
|
39
|
+
"**/target/**",
|
40
|
+
"**/templates/**",
|
41
|
+
"**/testdata/**",
|
42
|
+
"**/vendor/**",
|
43
|
+
"**/.rubocop.yml",
|
44
|
+
"**.github/**",
|
45
|
+
"**/spec/fixtures/canonical.yaml",
|
46
|
+
]
|
47
|
+
|
48
|
+
test_patterns = [
|
49
|
+
"**/test/**",
|
50
|
+
"**/spec/**",
|
51
|
+
"**/*.test.*",
|
52
|
+
"**/*.spec.*",
|
53
|
+
"**/*_test.*",
|
54
|
+
"**/*_spec.*",
|
55
|
+
"**/test_*.*",
|
56
|
+
"**/spec_*.*",
|
57
|
+
]
|
58
|
+
|
59
|
+
[smells]
|
60
|
+
mode = "comment"
|
61
|
+
|
62
|
+
[[source]]
|
63
|
+
name = "default"
|
64
|
+
default = true
|
65
|
+
|
66
|
+
|
67
|
+
[[plugin]]
|
68
|
+
name = "actionlint"
|
69
|
+
|
70
|
+
[[plugin]]
|
71
|
+
name = "markdownlint"
|
72
|
+
drivers = [
|
73
|
+
"lint",
|
74
|
+
]
|
75
|
+
mode = "comment"
|
76
|
+
|
77
|
+
[[plugin]]
|
78
|
+
name = "osv-scanner"
|
79
|
+
|
80
|
+
[[plugin]]
|
81
|
+
name = "ripgrep"
|
82
|
+
mode = "comment"
|
83
|
+
|
84
|
+
[[plugin]]
|
85
|
+
name = "rubocop"
|
86
|
+
version = "1.80.0"
|
87
|
+
package_file = "Gemfile"
|
88
|
+
package_filters = ["rubocop"]
|
89
|
+
|
90
|
+
[[plugin]]
|
91
|
+
name = "trivy"
|
92
|
+
drivers = [
|
93
|
+
"config",
|
94
|
+
"fs-vuln",
|
95
|
+
]
|
96
|
+
|
97
|
+
[[plugin]]
|
98
|
+
name = "trufflehog"
|
99
|
+
|
100
|
+
[[plugin]]
|
101
|
+
name = "yamllint"
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,340 @@
|
|
1
|
+
plugins:
|
2
|
+
- rubocop-performance
|
3
|
+
- rubocop-rspec
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
DisabledByDefault: true
|
7
|
+
SuggestExtensions: false
|
8
|
+
|
9
|
+
# Prefer &&/|| over and/or.
|
10
|
+
Style/AndOr:
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
Layout/ClosingHeredocIndentation:
|
14
|
+
Enabled: true
|
15
|
+
|
16
|
+
Layout/ClosingParenthesisIndentation:
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
# Align comments with method definitions.
|
20
|
+
Layout/CommentIndentation:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
Layout/DefEndAlignment:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
Layout/ElseAlignment:
|
27
|
+
Enabled: true
|
28
|
+
|
29
|
+
# Align `end` with the matching keyword or starting expression except for
|
30
|
+
# assignments, where it should be aligned with the LHS.
|
31
|
+
Layout/EndAlignment:
|
32
|
+
Enabled: true
|
33
|
+
EnforcedStyleAlignWith: variable
|
34
|
+
AutoCorrect: true
|
35
|
+
|
36
|
+
Layout/EndOfLine:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
Layout/EmptyLineAfterMagicComment:
|
40
|
+
Enabled: true
|
41
|
+
|
42
|
+
Layout/EmptyLinesAroundAccessModifier:
|
43
|
+
Enabled: true
|
44
|
+
EnforcedStyle: only_before
|
45
|
+
|
46
|
+
Layout/EmptyLinesAroundBlockBody:
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
# In a regular class definition, no empty lines around the body.
|
50
|
+
Layout/EmptyLinesAroundClassBody:
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
# In a regular method definition, no empty lines around the body.
|
54
|
+
Layout/EmptyLinesAroundMethodBody:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# In a regular module definition, no empty lines around the body.
|
58
|
+
Layout/EmptyLinesAroundModuleBody:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
62
|
+
Style/HashSyntax:
|
63
|
+
Enabled: true
|
64
|
+
EnforcedShorthandSyntax: either
|
65
|
+
|
66
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
67
|
+
# extra level of indentation.
|
68
|
+
Layout/IndentationConsistency:
|
69
|
+
Enabled: true
|
70
|
+
EnforcedStyle: indented_internal_methods
|
71
|
+
Exclude:
|
72
|
+
- '**/*.md'
|
73
|
+
|
74
|
+
# Two spaces, no tabs (for indentation).
|
75
|
+
Layout/IndentationWidth:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Layout/LeadingCommentSpace:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Layout/SpaceAfterColon:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Layout/SpaceAfterComma:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
Layout/SpaceAfterSemicolon:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
91
|
+
Enabled: true
|
92
|
+
|
93
|
+
Layout/SpaceAroundKeyword:
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Layout/SpaceAroundOperators:
|
97
|
+
Enabled: true
|
98
|
+
|
99
|
+
Layout/SpaceBeforeComma:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Layout/SpaceBeforeComment:
|
103
|
+
Enabled: true
|
104
|
+
|
105
|
+
Layout/SpaceBeforeFirstArg:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Style/DefWithParentheses:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
# Defining a method with parameters needs parentheses.
|
112
|
+
Style/MethodDefParentheses:
|
113
|
+
Enabled: true
|
114
|
+
|
115
|
+
Style/ExplicitBlockArgument:
|
116
|
+
Enabled: true
|
117
|
+
|
118
|
+
Style/FrozenStringLiteralComment:
|
119
|
+
Enabled: true
|
120
|
+
EnforcedStyle: always
|
121
|
+
Exclude:
|
122
|
+
- 'actionview/test/**/*.builder'
|
123
|
+
- 'actionview/test/**/*.ruby'
|
124
|
+
- 'actionpack/test/**/*.builder'
|
125
|
+
- 'actionpack/test/**/*.ruby'
|
126
|
+
- 'activestorage/db/migrate/**/*.rb'
|
127
|
+
- 'activestorage/db/update_migrate/**/*.rb'
|
128
|
+
- 'actionmailbox/db/migrate/**/*.rb'
|
129
|
+
- 'actiontext/db/migrate/**/*.rb'
|
130
|
+
- '**/*.md'
|
131
|
+
|
132
|
+
Style/MapToHash:
|
133
|
+
Enabled: true
|
134
|
+
|
135
|
+
Style/RedundantFreeze:
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
# Use `foo {}` not `foo{}`.
|
139
|
+
Layout/SpaceBeforeBlockBraces:
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
# Use `foo { bar }` not `foo {bar}`.
|
143
|
+
Layout/SpaceInsideBlockBraces:
|
144
|
+
Enabled: true
|
145
|
+
EnforcedStyleForEmptyBraces: space
|
146
|
+
|
147
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
148
|
+
Layout/SpaceInsideHashLiteralBraces:
|
149
|
+
Enabled: true
|
150
|
+
|
151
|
+
Layout/SpaceInsideParens:
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
# Check quotes usage according to lint rule below.
|
155
|
+
Style/StringLiterals:
|
156
|
+
Enabled: true
|
157
|
+
EnforcedStyle: double_quotes
|
158
|
+
|
159
|
+
# Detect hard tabs, no hard tabs.
|
160
|
+
Layout/IndentationStyle:
|
161
|
+
Enabled: true
|
162
|
+
|
163
|
+
# Empty lines should not have any spaces.
|
164
|
+
Layout/TrailingEmptyLines:
|
165
|
+
Enabled: true
|
166
|
+
|
167
|
+
# No trailing whitespace.
|
168
|
+
Layout/TrailingWhitespace:
|
169
|
+
Enabled: true
|
170
|
+
|
171
|
+
# Use quotes for string literals when they are enough.
|
172
|
+
Style/RedundantPercentQ:
|
173
|
+
Enabled: true
|
174
|
+
|
175
|
+
Lint/NestedMethodDefinition:
|
176
|
+
Enabled: true
|
177
|
+
|
178
|
+
Lint/AmbiguousOperator:
|
179
|
+
Enabled: true
|
180
|
+
|
181
|
+
Lint/AmbiguousRegexpLiteral:
|
182
|
+
Enabled: true
|
183
|
+
|
184
|
+
Lint/Debugger:
|
185
|
+
Enabled: true
|
186
|
+
DebuggerRequires:
|
187
|
+
- debug
|
188
|
+
|
189
|
+
Lint/DuplicateRequire:
|
190
|
+
Enabled: true
|
191
|
+
|
192
|
+
Lint/DuplicateMagicComment:
|
193
|
+
Enabled: true
|
194
|
+
|
195
|
+
Lint/DuplicateMethods:
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
Lint/ErbNewArguments:
|
199
|
+
Enabled: true
|
200
|
+
|
201
|
+
Lint/EnsureReturn:
|
202
|
+
Enabled: true
|
203
|
+
|
204
|
+
Lint/MissingCopEnableDirective:
|
205
|
+
Enabled: true
|
206
|
+
|
207
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
208
|
+
Lint/RequireParentheses:
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
Lint/RedundantCopDisableDirective:
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Lint/RedundantCopEnableDirective:
|
215
|
+
Enabled: true
|
216
|
+
|
217
|
+
Lint/RedundantRequireStatement:
|
218
|
+
Enabled: true
|
219
|
+
|
220
|
+
Lint/RedundantStringCoercion:
|
221
|
+
Enabled: true
|
222
|
+
|
223
|
+
Lint/RedundantSafeNavigation:
|
224
|
+
Enabled: true
|
225
|
+
|
226
|
+
Lint/UriEscapeUnescape:
|
227
|
+
Enabled: true
|
228
|
+
|
229
|
+
Lint/UselessAssignment:
|
230
|
+
Enabled: true
|
231
|
+
|
232
|
+
Lint/DeprecatedClassMethods:
|
233
|
+
Enabled: true
|
234
|
+
|
235
|
+
Lint/InterpolationCheck:
|
236
|
+
Enabled: true
|
237
|
+
Exclude:
|
238
|
+
- '**/test/**/*'
|
239
|
+
|
240
|
+
Lint/SafeNavigationChain:
|
241
|
+
Enabled: true
|
242
|
+
|
243
|
+
Style/EvalWithLocation:
|
244
|
+
Enabled: true
|
245
|
+
Exclude:
|
246
|
+
- '**/test/**/*'
|
247
|
+
|
248
|
+
Style/ParenthesesAroundCondition:
|
249
|
+
Enabled: true
|
250
|
+
|
251
|
+
Style/HashTransformKeys:
|
252
|
+
Enabled: true
|
253
|
+
|
254
|
+
Style/HashTransformValues:
|
255
|
+
Enabled: true
|
256
|
+
|
257
|
+
Style/RedundantBegin:
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
Style/RedundantReturn:
|
261
|
+
Enabled: true
|
262
|
+
AllowMultipleReturnValues: true
|
263
|
+
|
264
|
+
Style/RedundantRegexpEscape:
|
265
|
+
Enabled: true
|
266
|
+
|
267
|
+
Style/Semicolon:
|
268
|
+
Enabled: true
|
269
|
+
AllowAsExpressionSeparator: true
|
270
|
+
|
271
|
+
# Prefer Foo.method over Foo::method
|
272
|
+
Style/ColonMethodCall:
|
273
|
+
Enabled: true
|
274
|
+
|
275
|
+
Style/TrivialAccessors:
|
276
|
+
Enabled: true
|
277
|
+
|
278
|
+
# Prefer a = b || c over a = b ? b : c
|
279
|
+
Style/RedundantCondition:
|
280
|
+
Enabled: true
|
281
|
+
|
282
|
+
Style/RedundantDoubleSplatHashBraces:
|
283
|
+
Enabled: true
|
284
|
+
|
285
|
+
Style/OpenStructUse:
|
286
|
+
Enabled: true
|
287
|
+
|
288
|
+
Style/ArrayIntersect:
|
289
|
+
Enabled: true
|
290
|
+
|
291
|
+
Style/KeywordArgumentsMerging:
|
292
|
+
Enabled: true
|
293
|
+
|
294
|
+
Performance/BindCall:
|
295
|
+
Enabled: true
|
296
|
+
|
297
|
+
Performance/FlatMap:
|
298
|
+
Enabled: true
|
299
|
+
|
300
|
+
Performance/MapCompact:
|
301
|
+
Enabled: true
|
302
|
+
|
303
|
+
Performance/SelectMap:
|
304
|
+
Enabled: true
|
305
|
+
|
306
|
+
Performance/RedundantMerge:
|
307
|
+
Enabled: true
|
308
|
+
|
309
|
+
Performance/StartWith:
|
310
|
+
Enabled: true
|
311
|
+
|
312
|
+
Performance/EndWith:
|
313
|
+
Enabled: true
|
314
|
+
|
315
|
+
Performance/RegexpMatch:
|
316
|
+
Enabled: true
|
317
|
+
|
318
|
+
Performance/ReverseEach:
|
319
|
+
Enabled: true
|
320
|
+
|
321
|
+
Performance/StringReplacement:
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
Performance/DeletePrefix:
|
325
|
+
Enabled: true
|
326
|
+
|
327
|
+
Performance/DeleteSuffix:
|
328
|
+
Enabled: true
|
329
|
+
|
330
|
+
Performance/InefficientHashSearch:
|
331
|
+
Enabled: true
|
332
|
+
|
333
|
+
Performance/ConstantRegexp:
|
334
|
+
Enabled: true
|
335
|
+
|
336
|
+
Performance/RedundantStringChars:
|
337
|
+
Enabled: true
|
338
|
+
|
339
|
+
Performance/StringInclude:
|
340
|
+
Enabled: true
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cooklang (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.3)
|
10
|
+
diff-lcs (1.6.2)
|
11
|
+
docile (1.4.1)
|
12
|
+
json (2.13.2)
|
13
|
+
language_server-protocol (3.17.0.5)
|
14
|
+
lint_roller (1.1.0)
|
15
|
+
parallel (1.27.0)
|
16
|
+
parser (3.3.9.0)
|
17
|
+
ast (~> 2.4.1)
|
18
|
+
racc
|
19
|
+
prism (1.4.0)
|
20
|
+
racc (1.8.1)
|
21
|
+
rainbow (3.1.1)
|
22
|
+
rake (13.3.0)
|
23
|
+
regexp_parser (2.11.2)
|
24
|
+
rspec (3.13.1)
|
25
|
+
rspec-core (~> 3.13.0)
|
26
|
+
rspec-expectations (~> 3.13.0)
|
27
|
+
rspec-mocks (~> 3.13.0)
|
28
|
+
rspec-core (3.13.5)
|
29
|
+
rspec-support (~> 3.13.0)
|
30
|
+
rspec-expectations (3.13.5)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.13.0)
|
33
|
+
rspec-mocks (3.13.5)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.13.0)
|
36
|
+
rspec-support (3.13.5)
|
37
|
+
rubocop (1.80.0)
|
38
|
+
json (~> 2.3)
|
39
|
+
language_server-protocol (~> 3.17.0.2)
|
40
|
+
lint_roller (~> 1.1.0)
|
41
|
+
parallel (~> 1.10)
|
42
|
+
parser (>= 3.3.0.2)
|
43
|
+
rainbow (>= 2.2.2, < 4.0)
|
44
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
45
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
46
|
+
ruby-progressbar (~> 1.7)
|
47
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
48
|
+
rubocop-ast (1.46.0)
|
49
|
+
parser (>= 3.3.7.2)
|
50
|
+
prism (~> 1.4)
|
51
|
+
rubocop-performance (1.25.0)
|
52
|
+
lint_roller (~> 1.1)
|
53
|
+
rubocop (>= 1.75.0, < 2.0)
|
54
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
55
|
+
rubocop-rspec (3.6.0)
|
56
|
+
lint_roller (~> 1.1)
|
57
|
+
rubocop (~> 1.72, >= 1.72.1)
|
58
|
+
ruby-progressbar (1.13.0)
|
59
|
+
simplecov (0.22.0)
|
60
|
+
docile (~> 1.1)
|
61
|
+
simplecov-html (~> 0.11)
|
62
|
+
simplecov_json_formatter (~> 0.1)
|
63
|
+
simplecov-html (0.13.2)
|
64
|
+
simplecov_json_formatter (0.1.4)
|
65
|
+
unicode-display_width (3.1.5)
|
66
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
67
|
+
unicode-emoji (4.0.4)
|
68
|
+
|
69
|
+
PLATFORMS
|
70
|
+
arm64-darwin-24
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
bundler (~> 2.7)
|
75
|
+
cooklang!
|
76
|
+
rake (~> 13.0)
|
77
|
+
rspec (~> 3.13)
|
78
|
+
rubocop (~> 1.80)
|
79
|
+
rubocop-performance (~> 1.25)
|
80
|
+
rubocop-rspec (~> 3.6)
|
81
|
+
simplecov (~> 0.22.0)
|
82
|
+
|
83
|
+
BUNDLED WITH
|
84
|
+
2.7.1
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Cooklang
|
2
2
|
|
3
|
+

|
4
|
+
[](https://github.com/jamesbrooks/cooklang/actions/workflows/test.yml)
|
5
|
+
[](https://qlty.sh/gh/jamesbrooks/projects/cooklang)
|
6
|
+
[](https://qlty.sh/gh/jamesbrooks/projects/cooklang)
|
7
|
+
|
3
8
|
A Ruby parser for the [Cooklang](https://cooklang.org) recipe markup language.
|
4
9
|
|
5
10
|
## Installation
|
@@ -26,7 +31,7 @@ recipe_text = <<~RECIPE
|
|
26
31
|
>> servings: 4
|
27
32
|
|
28
33
|
Crack @eggs{3} into a bowl, add @flour{125%g} and @milk{250%ml}.
|
29
|
-
|
34
|
+
|
30
35
|
Heat #frying pan over medium heat for ~{5%minutes}.
|
31
36
|
Pour batter and cook until golden.
|
32
37
|
RECIPE
|
@@ -41,7 +46,7 @@ recipe.metadata['servings'] # => 4
|
|
41
46
|
recipe.ingredients.each do |ingredient|
|
42
47
|
puts "#{ingredient.name}: #{ingredient.quantity} #{ingredient.unit}"
|
43
48
|
end
|
44
|
-
# => eggs: 3
|
49
|
+
# => eggs: 3
|
45
50
|
# => flour: 125 g
|
46
51
|
# => milk: 250 ml
|
47
52
|
|
@@ -68,7 +73,7 @@ puts formatter.to_s
|
|
68
73
|
# Recipe object
|
69
74
|
recipe.metadata # Hash of metadata
|
70
75
|
recipe.ingredients # Array of Ingredient objects
|
71
|
-
recipe.cookware # Array of Cookware objects
|
76
|
+
recipe.cookware # Array of Cookware objects
|
72
77
|
recipe.timers # Array of Timer objects
|
73
78
|
recipe.steps # Array of Step objects
|
74
79
|
recipe.steps_text # Array of plain text steps
|
@@ -103,7 +108,7 @@ timer.unit # "minutes"
|
|
103
108
|
# Install dependencies
|
104
109
|
bundle install
|
105
110
|
|
106
|
-
# Run tests
|
111
|
+
# Run tests
|
107
112
|
bundle exec rspec
|
108
113
|
|
109
114
|
# Run linter
|
@@ -121,4 +126,4 @@ Bug reports and pull requests welcome on GitHub.
|
|
121
126
|
|
122
127
|
## License
|
123
128
|
|
124
|
-
MIT License
|
129
|
+
MIT License
|