hamlit 2.14.0-java → 2.14.1-java
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/CHANGELOG.md +7 -0
- data/lib/hamlit/cli.rb +17 -1
- data/lib/hamlit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12e7f9d445db00655f325ed05d5be2890b7ef3eb2db14607c82d10f37921d85d
|
4
|
+
data.tar.gz: aba41ac7a5d489acce14d157d0f36dd8f0308d32c22348d0ccb70bdf4c93c6aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cda20fa1c3a3f5148f88fde34009b642dfaff2f54bd938125489dc715da351baab227818e5eacaa88f4d3dc974b83ee8f28d5210e3b2edde833ff7f4ad9e47b4
|
7
|
+
data.tar.gz: 5481a01d7a890d3392c50c35e24de66f324578ba2ba3588dbe33d00cddaa7a5f78fe2a6a972584a04aba8b300cdd417a9e5bacfcc2756ee9d4877356fc8037f0
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. This
|
|
4
4
|
project adheres to [Semantic Versioning](http://semver.org/). This change log is based upon
|
5
5
|
[keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog).
|
6
6
|
|
7
|
+
## [2.14.1](https://github.com/k0kubun/hamlit/compare/v2.14.0...v2.14.1) - 2021-01-07
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Add `-c` option to `hamlit compile` that works like `haml -c` [#166](https://github.com/k0kubun/hamlit/issues/166)
|
12
|
+
*Thanks to @knightq*
|
13
|
+
|
7
14
|
## [2.14.0](https://github.com/k0kubun/hamlit/compare/v2.13.2...v2.14.0) - 2021-01-07
|
8
15
|
|
9
16
|
### Changed
|
data/lib/hamlit/cli.rb
CHANGED
@@ -13,14 +13,22 @@ module Hamlit
|
|
13
13
|
def render(file)
|
14
14
|
process_load_options
|
15
15
|
code = generate_code(file)
|
16
|
-
puts eval(code)
|
16
|
+
puts eval(code, binding, file)
|
17
17
|
end
|
18
18
|
|
19
19
|
desc 'compile HAML', 'Show compile result'
|
20
20
|
option :actionview, type: :boolean, default: false, aliases: %w[-a]
|
21
21
|
option :color, type: :boolean, default: true
|
22
|
+
option :check, type: :boolean, default: false, aliases: %w[-c]
|
22
23
|
def compile(file)
|
23
24
|
code = generate_code(file)
|
25
|
+
if options[:check]
|
26
|
+
if error = validate_ruby(code, file)
|
27
|
+
abort error.message.split("\n").first
|
28
|
+
end
|
29
|
+
puts "Syntax OK"
|
30
|
+
return
|
31
|
+
end
|
24
32
|
puts_code(code, color: options[:color])
|
25
33
|
end
|
26
34
|
|
@@ -134,5 +142,13 @@ module Hamlit
|
|
134
142
|
pp(arg)
|
135
143
|
end
|
136
144
|
end
|
145
|
+
|
146
|
+
def validate_ruby(code, file)
|
147
|
+
begin
|
148
|
+
eval("BEGIN {return nil}; #{code}", binding, file)
|
149
|
+
rescue ::SyntaxError # Not to be confused with Hamlit::SyntaxError
|
150
|
+
$!
|
151
|
+
end
|
152
|
+
end
|
137
153
|
end
|
138
154
|
end
|
data/lib/hamlit/version.rb
CHANGED