hamlit 2.14.0 → 2.14.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: b0dd1ca39e91d8b97650a58dc54295f36ca458b1ce288f455f0fa491001ecd97
4
- data.tar.gz: af3c286e679b04ab3167345c9a28051d2820936ebbd650af0b991f2d42e1f1a8
3
+ metadata.gz: 3a301e3719b15a8bd389c69273087c6133a0f64a50794e256106c65fb402a652
4
+ data.tar.gz: f5548a7ca946d6339a4767c13fc4dfcf8779274a95d179dccabf4ceb269aa35e
5
5
  SHA512:
6
- metadata.gz: a27aa422478e18e66c99eca5c4ca1b2d1e71da1856cd1a395fc76e55322fafebaffc11e6fea8bbee1ab4ad1061a33e908b01dfc004587c122de6014f4dae31ea
7
- data.tar.gz: 66e6ad8a235d06cae17c9f9ca761d446eb1b0a7f975d56475f0234387354d91cdcbfdc4632a3ab1c0901cf5ccbb93361216906062d416d039abe3ce1bb3ec096
6
+ metadata.gz: c5858d26f7573e085d1da827a3d9eee1a6c8252e8a6a0459a8e1022dc99a2cb15cce1bd4931ffc2df26815e85a717df0fd119f3585d605aaeb67a5c7c38021df
7
+ data.tar.gz: 6fa9187e20778096808fce4e997df74c67b9d980ba4219baf55b64f9930b87c3b35b21a74c50355c6a443750e6d5465d6b6977dd322aeea5bdc7ecdb57d44519
@@ -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
@@ -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: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -391,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
391
391
  - !ruby/object:Gem::Version
392
392
  version: '0'
393
393
  requirements: []
394
- rubygems_version: 3.2.3
394
+ rubygems_version: 3.3.0.dev
395
395
  signing_key:
396
396
  specification_version: 4
397
397
  summary: High Performance Haml Implementation