hamlit 2.8.2 → 2.8.3
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 -1
- data/lib/hamlit/cli.rb +20 -16
- data/lib/hamlit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cee8b3d62bf9479cc9787e47bba7c4cdc7e51df
|
4
|
+
data.tar.gz: 9845f57cf95715759f6e9ff5e51f7aba5d2ccfd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71ca2927c45f44b7ec808d514f99ca522251813afd026962d4ebee7cb4944bd6b2157a334a6c7d3ca48273324ba7b8728bc24575fee2772aa9583b88647549b6
|
7
|
+
data.tar.gz: 7f6788475f225077b149d34b01884e6689cd862ded4dc7e40024a8949061990d987bb6da6f33c362fc4c7b5022a384d19c0d60c38aef78164c8f1298c7eb03eb
|
data/CHANGELOG.md
CHANGED
@@ -4,11 +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.8.3](https://github.com/k0kubun/hamlit/compare/v2.8.2...v2.8.3) - 2017-06-19
|
8
|
+
|
9
|
+
### Added
|
10
|
+
|
11
|
+
- Add `--color` option to `hamlit parse` and `hamlit temple` commands too.
|
12
|
+
|
7
13
|
## [2.8.2](https://github.com/k0kubun/hamlit/compare/v2.8.1...v2.8.2) - 2017-06-19
|
8
14
|
|
9
15
|
### Added
|
10
16
|
|
11
|
-
- Add `--
|
17
|
+
- Add `--color` option to opt-in coloring in `hamlit compile` command
|
12
18
|
[#111](https://github.com/k0kubun/hamlit/issues/111).
|
13
19
|
|
14
20
|
## [2.8.1](https://github.com/k0kubun/hamlit/compare/v2.8.0...v2.8.1) - 2017-04-03
|
data/lib/hamlit/cli.rb
CHANGED
@@ -21,21 +21,19 @@ module Hamlit
|
|
21
21
|
option :color, type: :boolean, default: false, aliases: %w[-c]
|
22
22
|
def compile(file)
|
23
23
|
code = generate_code(file)
|
24
|
-
|
25
|
-
colored_puts generate_code(file)
|
26
|
-
else
|
27
|
-
puts code
|
28
|
-
end
|
24
|
+
puts_code(code, color: options[:color])
|
29
25
|
end
|
30
26
|
|
31
27
|
desc 'temple HAML', 'Show temple intermediate expression'
|
28
|
+
option :color, type: :boolean, default: false, aliases: %w[-c]
|
32
29
|
def temple(file)
|
33
|
-
|
30
|
+
pp_object(generate_temple(file), color: options[:color])
|
34
31
|
end
|
35
32
|
|
36
33
|
desc 'parse HAML', 'Show parse result'
|
34
|
+
option :color, type: :boolean, default: false, aliases: %w[-c]
|
37
35
|
def parse(file)
|
38
|
-
|
36
|
+
pp_object(generate_ast(file), color: options[:color])
|
39
37
|
end
|
40
38
|
|
41
39
|
desc 'version', 'Show the used hamlit version'
|
@@ -101,18 +99,24 @@ module Hamlit
|
|
101
99
|
render(args.first.to_s)
|
102
100
|
end
|
103
101
|
|
104
|
-
def
|
105
|
-
|
106
|
-
|
102
|
+
def puts_code(code, color: false)
|
103
|
+
if color
|
104
|
+
require 'pry'
|
105
|
+
puts Pry.Code(code).highlighted
|
106
|
+
else
|
107
|
+
puts code
|
108
|
+
end
|
107
109
|
end
|
108
110
|
|
109
111
|
# Enable colored pretty printing only for development environment.
|
110
|
-
def
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
112
|
+
def pp_object(arg, color: false)
|
113
|
+
if color
|
114
|
+
require 'pry'
|
115
|
+
Pry::ColorPrinter.pp(arg)
|
116
|
+
else
|
117
|
+
require 'pp'
|
118
|
+
pp(arg)
|
119
|
+
end
|
116
120
|
end
|
117
121
|
end
|
118
122
|
end
|
data/lib/hamlit/version.rb
CHANGED