hamlit 2.13.2 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +7 -1
- data/.gitignore +1 -1
- data/CHANGELOG.md +11 -0
- data/README.md +1 -0
- data/lib/hamlit/cli.rb +17 -9
- data/lib/hamlit/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0dd1ca39e91d8b97650a58dc54295f36ca458b1ce288f455f0fa491001ecd97
|
4
|
+
data.tar.gz: af3c286e679b04ab3167345c9a28051d2820936ebbd650af0b991f2d42e1f1a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a27aa422478e18e66c99eca5c4ca1b2d1e71da1856cd1a395fc76e55322fafebaffc11e6fea8bbee1ab4ad1061a33e908b01dfc004587c122de6014f4dae31ea
|
7
|
+
data.tar.gz: 66e6ad8a235d06cae17c9f9ca761d446eb1b0a7f975d56475f0234387354d91cdcbfdc4632a3ab1c0901cf5ccbb93361216906062d416d039abe3ce1bb3ec096
|
data/.github/workflows/test.yml
CHANGED
@@ -21,10 +21,16 @@ jobs:
|
|
21
21
|
- ruby:2.5
|
22
22
|
- ruby:2.6
|
23
23
|
- ruby:2.7
|
24
|
+
- ruby:3.0
|
24
25
|
# TODO: add jruby and truffleruby
|
25
26
|
steps:
|
26
27
|
- uses: actions/checkout@v2
|
28
|
+
- uses: actions/cache@v2
|
29
|
+
with:
|
30
|
+
path: vendor/bundle
|
31
|
+
key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
32
|
+
restore-keys: ${{ runner.os }}-gems-
|
27
33
|
- run: apt-get update && apt-get install -y nodejs # For execjs
|
28
34
|
- name: bundle install
|
29
|
-
run: bundle install -j$(nproc) --retry 3
|
35
|
+
run: bundle config path vendor/bundle && bundle install -j$(nproc) --retry 3
|
30
36
|
- run: bundle exec rake test
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,17 @@ 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.0](https://github.com/k0kubun/hamlit/compare/v2.13.2...v2.14.0) - 2021-01-07
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
|
11
|
+
- CLI changes
|
12
|
+
- Remove `-c` shorthand of `--color`.
|
13
|
+
- Make `--color` default. Please use `--no-color` to disable it.
|
14
|
+
- `--color` uses IRB instead of Pry for syntax highlight.
|
15
|
+
- Syntax highlight of `hamlit compile` is enabled only with IRB of Ruby 2.7+.
|
16
|
+
- Syntax highlight of `hamlit parse` / `hamlit temple` is enabled only with IRB of Ruby 3.1+.
|
17
|
+
|
7
18
|
## [2.13.2](https://github.com/k0kubun/hamlit/compare/v2.13.1...v2.13.2) - 2020-12-27
|
8
19
|
|
9
20
|
### Added
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/hamlit.svg)](http://badge.fury.io/rb/hamlit)
|
4
4
|
[![Build Status](https://travis-ci.org/k0kubun/hamlit.svg?branch=master)](https://travis-ci.org/k0kubun/hamlit)
|
5
|
+
[![test](https://github.com/k0kubun/hamlit/workflows/test/badge.svg)](https://github.com/k0kubun/hamlit/actions?query=workflow%3Atest)
|
5
6
|
|
6
7
|
Hamlit is a high performance [Haml](https://github.com/haml/haml) implementation.
|
7
8
|
|
data/lib/hamlit/cli.rb
CHANGED
@@ -18,20 +18,20 @@ module Hamlit
|
|
18
18
|
|
19
19
|
desc 'compile HAML', 'Show compile result'
|
20
20
|
option :actionview, type: :boolean, default: false, aliases: %w[-a]
|
21
|
-
option :color, type: :boolean, default:
|
21
|
+
option :color, type: :boolean, default: true
|
22
22
|
def compile(file)
|
23
23
|
code = generate_code(file)
|
24
24
|
puts_code(code, color: options[:color])
|
25
25
|
end
|
26
26
|
|
27
27
|
desc 'temple HAML', 'Show temple intermediate expression'
|
28
|
-
option :color, type: :boolean, default:
|
28
|
+
option :color, type: :boolean, default: true
|
29
29
|
def temple(file)
|
30
30
|
pp_object(generate_temple(file), color: options[:color])
|
31
31
|
end
|
32
32
|
|
33
33
|
desc 'parse HAML', 'Show parse result'
|
34
|
-
option :color, type: :boolean, default:
|
34
|
+
option :color, type: :boolean, default: true
|
35
35
|
def parse(file)
|
36
36
|
pp_object(generate_ast(file), color: options[:color])
|
37
37
|
end
|
@@ -107,20 +107,28 @@ module Hamlit
|
|
107
107
|
render(args.first.to_s)
|
108
108
|
end
|
109
109
|
|
110
|
-
def puts_code(code, color:
|
110
|
+
def puts_code(code, color: true)
|
111
|
+
begin
|
112
|
+
require 'irb/color'
|
113
|
+
rescue LoadError
|
114
|
+
color = false
|
115
|
+
end
|
111
116
|
if color
|
112
|
-
|
113
|
-
puts Pry.Code(code).highlighted
|
117
|
+
puts IRB::Color.colorize_code(code)
|
114
118
|
else
|
115
119
|
puts code
|
116
120
|
end
|
117
121
|
end
|
118
122
|
|
119
123
|
# Enable colored pretty printing only for development environment.
|
120
|
-
def pp_object(arg, color:
|
124
|
+
def pp_object(arg, color: true)
|
125
|
+
begin
|
126
|
+
require 'irb/color_printer'
|
127
|
+
rescue LoadError
|
128
|
+
color = false
|
129
|
+
end
|
121
130
|
if color
|
122
|
-
|
123
|
-
Pry::ColorPrinter.pp(arg)
|
131
|
+
IRB::ColorPrinter.pp(arg)
|
124
132
|
else
|
125
133
|
require 'pp'
|
126
134
|
pp(arg)
|
data/lib/hamlit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hamlit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takashi Kokubun
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: temple
|
@@ -376,7 +376,7 @@ homepage: https://github.com/k0kubun/hamlit
|
|
376
376
|
licenses:
|
377
377
|
- MIT
|
378
378
|
metadata: {}
|
379
|
-
post_install_message:
|
379
|
+
post_install_message:
|
380
380
|
rdoc_options: []
|
381
381
|
require_paths:
|
382
382
|
- lib
|
@@ -391,8 +391,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
391
|
- !ruby/object:Gem::Version
|
392
392
|
version: '0'
|
393
393
|
requirements: []
|
394
|
-
rubygems_version: 3.
|
395
|
-
signing_key:
|
394
|
+
rubygems_version: 3.2.3
|
395
|
+
signing_key:
|
396
396
|
specification_version: 4
|
397
397
|
summary: High Performance Haml Implementation
|
398
398
|
test_files: []
|