hamlit 2.14.0-java → 2.14.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9163c80fc74063f1aab7a0b3e70dcfc6e2287394403430984f6a81c6889e1a6f
4
- data.tar.gz: fa89e8eccdc02d3e60b6e5978663ac91a7b1ee491903017fb2e1233168992bd1
3
+ metadata.gz: 12e7f9d445db00655f325ed05d5be2890b7ef3eb2db14607c82d10f37921d85d
4
+ data.tar.gz: aba41ac7a5d489acce14d157d0f36dd8f0308d32c22348d0ccb70bdf4c93c6aa
5
5
  SHA512:
6
- metadata.gz: 455784941d0c600eee62032bba661c0aee671f10883b56509200635f4f3cf128f783c1a3184089ad9260ed362e5c720efe28b10518ac9a5f146c8d138a35e83e
7
- data.tar.gz: ab336937b54d70b05b071b707aeafe811bf7b2ce126f804d50ed34ea60695249b517e49a6b1d498e6d29cc67ed170d5609148ae232aadde322ce45a5145676eb
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
- VERSION = '2.14.0'
3
+ VERSION = '2.14.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.0
4
+ version: 2.14.1
5
5
  platform: java
6
6
  authors:
7
7
  - Takashi Kokubun