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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 36ec14e388895690831d2699c9d2bf4f8d3c37f3
4
- data.tar.gz: 0151505b707e2808531677275487282eb9603fea
3
+ metadata.gz: 2cee8b3d62bf9479cc9787e47bba7c4cdc7e51df
4
+ data.tar.gz: 9845f57cf95715759f6e9ff5e51f7aba5d2ccfd0
5
5
  SHA512:
6
- metadata.gz: f94ea2e429770cd4cd28879a2300bd59877b25a8ce4be65a4c87834b9ba0098a992380b1c371db466c412817c598757273f8c863f76fd4e0e1de8a50ed286fe6
7
- data.tar.gz: f0889755f2165762003d9e5d8092b4a88f7a22cb23900f0da9f51ed4559156eae17547f5dee51fe62a80080389019c42d611aab224debe3c237ae1c345fff0cd
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 `--no-color` option to disable coloring in `hamlit compile` command
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
- if options[:color]
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
- pp generate_temple(file)
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
- pp generate_ast(file)
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 colored_puts(code)
105
- require 'pry'
106
- puts Pry.Code(code).highlighted
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 pp(arg)
111
- require 'pry'
112
- Pry::ColorPrinter.pp(arg)
113
- rescue LoadError
114
- require 'pp'
115
- super(arg)
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
- VERSION = '2.8.2'
3
+ VERSION = '2.8.3'
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.8.2
4
+ version: 2.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun