Commit 61b5a68
authored
Ruby CLI: Show compiled source when
This pull request updates the Ruby CLI to show the compiled source when
the `compile` subcommand produced invalid Ruby
**Before**
```
❯ bin/herb compile test.html.erb
Compiled template produced invalid Ruby:
- unexpected end-of-input, assuming it is closing the parent top level context (line 4)
- expected a matching `)` (line 5)
- unexpected end-of-input; expected a `)` to close the arguments (line 4)
```
**After**
```
❯ bin/herb compile test.html.erb
__herb = ::Herb::Engine; _buf = ::String.new; _buf << __herb.h((render Foo.new do; _buf << 'hello'.freeze; end # comment))
_buf << '
'.freeze;
_buf.to_s
Compiled template produced invalid Ruby:
- unexpected end-of-input, assuming it is closing the parent top level context (line 4)
- expected a matching `)` (line 5)
- unexpected end-of-input; expected a `)` to close the arguments (line 4)
```
Inspired while working on #1363compile produces invalid Ruby (#1365)1 parent 8d964bf commit 61b5a68
3 files changed
+29
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
465 | 483 | | |
466 | 484 | | |
467 | 485 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
155 | 162 | | |
156 | 163 | | |
157 | 164 | | |
158 | | - | |
| 165 | + | |
159 | 166 | | |
160 | 167 | | |
161 | 168 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments