pastel 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +7 -6
- data/CHANGELOG.md +10 -0
- data/Gemfile +2 -1
- data/README.md +3 -1
- data/appveyor.yml +23 -0
- data/lib/pastel.rb +1 -1
- data/lib/pastel/color.rb +1 -1
- data/lib/pastel/decorator_chain.rb +5 -1
- data/lib/pastel/version.rb +1 -1
- data/pastel.gemspec +1 -1
- data/spec/unit/decorate_dsl_spec.rb +4 -0
- data/spec/unit/new_spec.rb +11 -0
- data/tasks/console.rake +1 -0
- metadata +21 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0dff6fb46a4686e16dadf14dbc302c03bec710a
|
4
|
+
data.tar.gz: b3bb1f08fa7a1eb0c6a5529f32d1405419bcc024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aad90942603ae1740ee11c2e213b8e4a1058fb7fdffc52ee42bb3764d7e20b74bdd1759421b5a84513b7e140f3d7d72c6605f23b874d22f8d3654a44ba8233c
|
7
|
+
data.tar.gz: c021e7b94a64d5d3d63288fac62346064c99beb3fbec2f0f9a7c162e6d39d440d72a1f03960b2d5fe0f229ec397c53d2ccac197c13d5f3f7286b190406aeef56
|
data/.travis.yml
CHANGED
@@ -6,18 +6,19 @@ bundler_args: --without yard benchmarks
|
|
6
6
|
script: "bundle exec rake ci"
|
7
7
|
rvm:
|
8
8
|
- 1.9.3
|
9
|
-
- 2.0
|
10
|
-
- 2.1
|
11
|
-
- 2.2
|
12
|
-
-
|
13
|
-
- jruby-
|
14
|
-
- jruby
|
9
|
+
- 2.0.0
|
10
|
+
- 2.1.10
|
11
|
+
- 2.2.5
|
12
|
+
- 2.3.1
|
13
|
+
- jruby-9000
|
15
14
|
- jruby-head
|
16
15
|
- ruby-head
|
16
|
+
- rbx-2
|
17
17
|
matrix:
|
18
18
|
allow_failures:
|
19
19
|
- rvm: ruby-head
|
20
20
|
- rvm: jruby-head
|
21
|
+
- rvm: rbx-2
|
21
22
|
fast_finish: true
|
22
23
|
branches:
|
23
24
|
only: master
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.7.0] - 2016-12-27
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Enabled colors on Windows by default
|
7
|
+
* Update tty-color dependency
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
* Fix Color#decorate to prevent redecoration with the same color
|
11
|
+
|
3
12
|
## [v0.6.1] - 2016-04-09
|
4
13
|
|
5
14
|
### Fixed
|
@@ -86,6 +95,7 @@
|
|
86
95
|
* Change gemspec to include equatable as dependency
|
87
96
|
* Change Delegator to stop creating instances and improve performance
|
88
97
|
|
98
|
+
[v0.7.0]: https://github.com/peter-murach/pastel/compare/v0.6.1...v0.7.0
|
89
99
|
[v0.6.1]: https://github.com/peter-murach/pastel/compare/v0.6.0...v0.6.1
|
90
100
|
[v0.6.0]: https://github.com/peter-murach/pastel/compare/v0.5.3...v0.6.0
|
91
101
|
[v0.5.3]: https://github.com/peter-murach/pastel/compare/v0.5.2...v0.5.3
|
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem 'rspec', '~> 3.
|
6
|
+
gem 'rspec', '~> 3.5.0'
|
7
7
|
gem 'yard', '~> 0.8.7'
|
8
8
|
gem 'benchmark-ips', '~> 2.0.0'
|
9
9
|
end
|
@@ -12,4 +12,5 @@ group :metrics do
|
|
12
12
|
gem 'coveralls', '~> 0.8.9'
|
13
13
|
gem 'simplecov', '~> 0.10.0'
|
14
14
|
gem 'yardstick', '~> 0.9.9'
|
15
|
+
gem 'term-ansicolor', '=1.3.2'
|
15
16
|
end
|
data/README.md
CHANGED
@@ -4,12 +4,14 @@
|
|
4
4
|
# Pastel
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/pastel.svg)][gem]
|
6
6
|
[![Build Status](https://secure.travis-ci.org/piotrmurach/pastel.svg?branch=master)][travis]
|
7
|
+
[![Build status](https://ci.appveyor.com/api/projects/status/9blbjfq42o4v1rk4?svg=true)][appveyor]
|
7
8
|
[![Code Climate](https://codeclimate.com/github/piotrmurach/pastel/badges/gpa.svg)][codeclimate]
|
8
9
|
[![Coverage Status](https://coveralls.io/repos/github/piotrmurach/pastel/badge.svg)][coverage]
|
9
10
|
[![Inline docs](http://inch-ci.org/github/piotrmurach/pastel.svg?branch=master)][inchpages]
|
10
11
|
|
11
12
|
[gem]: http://badge.fury.io/rb/pastel
|
12
13
|
[travis]: http://travis-ci.org/piotrmurach/pastel
|
14
|
+
[appveyor]: https://ci.appveyor.com/project/piotrmurach/pastel
|
13
15
|
[codeclimate]: https://codeclimate.com/github/piotrmurach/pastel
|
14
16
|
[coverage]: https://coveralls.io/github/piotrmurach/pastel
|
15
17
|
[inchpages]: http://inch-ci.org/github/piotrmurach/pastel
|
@@ -367,4 +369,4 @@ $ pastel green 'Unicorns & rainbows!'
|
|
367
369
|
|
368
370
|
## Copyright
|
369
371
|
|
370
|
-
Copyright (c) 2014-
|
372
|
+
Copyright (c) 2014-2017 Piotr Murach. See LICENSE for further details.
|
data/appveyor.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
install:
|
3
|
+
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
4
|
+
- ruby --version
|
5
|
+
- gem --version
|
6
|
+
- bundle install
|
7
|
+
build: off
|
8
|
+
test_script:
|
9
|
+
- bundle exec rake ci
|
10
|
+
environment:
|
11
|
+
matrix:
|
12
|
+
- ruby_version: "193"
|
13
|
+
- ruby_version: "200"
|
14
|
+
- ruby_version: "200-x64"
|
15
|
+
- ruby_version: "21"
|
16
|
+
- ruby_version: "21-x64"
|
17
|
+
- ruby_version: "22"
|
18
|
+
- ruby_version: "22-x64"
|
19
|
+
- ruby_version: "23"
|
20
|
+
- ruby_version: "23-x64"
|
21
|
+
matrix:
|
22
|
+
allow_failures:
|
23
|
+
- ruby_version: "193"
|
data/lib/pastel.rb
CHANGED
@@ -31,7 +31,7 @@ module Pastel
|
|
31
31
|
# @api public
|
32
32
|
def new(options = {})
|
33
33
|
unless options.key?(:enabled)
|
34
|
-
options.merge!(enabled: TTY::Color.color?)
|
34
|
+
options.merge!(enabled: TTY::Color.windows? || TTY::Color.color?)
|
35
35
|
end
|
36
36
|
color = Color.new(options)
|
37
37
|
importer = AliasImporter.new(color, ENV)
|
data/lib/pastel/color.rb
CHANGED
@@ -53,7 +53,7 @@ module Pastel
|
|
53
53
|
def decorate(string, *colors)
|
54
54
|
return string if blank?(string) || !enabled || colors.empty?
|
55
55
|
|
56
|
-
ansi_colors = lookup(*colors)
|
56
|
+
ansi_colors = lookup(*colors.dup.uniq)
|
57
57
|
if eachline
|
58
58
|
string.dup.split(eachline).map! do |line|
|
59
59
|
apply_codes(line, ansi_colors)
|
@@ -16,7 +16,11 @@ module Pastel
|
|
16
16
|
#
|
17
17
|
# @api public
|
18
18
|
def add(decorator)
|
19
|
-
|
19
|
+
if decorators.include?(decorator)
|
20
|
+
self.class.new(decorators)
|
21
|
+
else
|
22
|
+
self.class.new(decorators + [decorator])
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
26
|
# Iterate over list of decorators
|
data/lib/pastel/version.rb
CHANGED
data/pastel.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency 'equatable', '~> 0.5.0'
|
22
|
-
spec.add_dependency 'tty-color', '~> 0.
|
22
|
+
spec.add_dependency 'tty-color', '~> 0.4.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '>= 1.5.0', '< 2.0'
|
25
25
|
spec.add_development_dependency 'rake'
|
@@ -80,6 +80,10 @@ RSpec.describe Pastel, 'coloring dsl' do
|
|
80
80
|
expect(pastel.red(' ')).to eq("\e[31m \e[0m")
|
81
81
|
end
|
82
82
|
|
83
|
+
it "applies color only once" do
|
84
|
+
expect(pastel.red.red.red("unicorn")).to eq(pastel.red("unicorn"))
|
85
|
+
end
|
86
|
+
|
83
87
|
it "raises error when chained with unrecognized color" do
|
84
88
|
expect {
|
85
89
|
pastel.unknown.on_red('unicorn')
|
data/spec/unit/new_spec.rb
CHANGED
@@ -31,6 +31,7 @@ RSpec.describe Pastel, '#new' do
|
|
31
31
|
describe 'options passed in' do
|
32
32
|
it 'defaults enabled to color detection' do
|
33
33
|
allow(TTY::Color).to receive(:color?).and_return(true)
|
34
|
+
allow(TTY::Color).to receive(:windows?).and_return(false)
|
34
35
|
|
35
36
|
pastel = described_class.new
|
36
37
|
|
@@ -38,6 +39,16 @@ RSpec.describe Pastel, '#new' do
|
|
38
39
|
expect(TTY::Color).to have_received(:color?)
|
39
40
|
end
|
40
41
|
|
42
|
+
it "defaults to enabled on Windows" do
|
43
|
+
allow(TTY::Color).to receive(:color?).and_return(false)
|
44
|
+
allow(TTY::Color).to receive(:windows?).and_return(true)
|
45
|
+
|
46
|
+
pastel = described_class.new
|
47
|
+
|
48
|
+
expect(pastel.enabled?).to eq(true)
|
49
|
+
expect(TTY::Color).to_not have_received(:color?)
|
50
|
+
end
|
51
|
+
|
41
52
|
it "sets enabled option" do
|
42
53
|
pastel = described_class.new(enabled: false)
|
43
54
|
expect(pastel.enabled?).to eq(false)
|
data/tasks/console.rake
CHANGED
metadata
CHANGED
@@ -1,75 +1,75 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pastel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equatable
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tty-color
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.4.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.4.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.5.0
|
48
|
-
- - <
|
48
|
+
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '2.0'
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: 1.5.0
|
58
|
-
- - <
|
58
|
+
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '2.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
75
|
description: Terminal strings styling with intuitive and clean API.
|
@@ -79,14 +79,15 @@ executables: []
|
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
|
-
- .gitignore
|
83
|
-
- .rspec
|
84
|
-
- .travis.yml
|
82
|
+
- ".gitignore"
|
83
|
+
- ".rspec"
|
84
|
+
- ".travis.yml"
|
85
85
|
- CHANGELOG.md
|
86
86
|
- Gemfile
|
87
87
|
- LICENSE.txt
|
88
88
|
- README.md
|
89
89
|
- Rakefile
|
90
|
+
- appveyor.yml
|
90
91
|
- assets/pastel_logo.png
|
91
92
|
- assets/screenshot.png
|
92
93
|
- benchmarks/nesting_speed.rb
|
@@ -137,17 +138,17 @@ require_paths:
|
|
137
138
|
- lib
|
138
139
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
140
|
requirements:
|
140
|
-
- -
|
141
|
+
- - ">="
|
141
142
|
- !ruby/object:Gem::Version
|
142
143
|
version: '0'
|
143
144
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
145
|
requirements:
|
145
|
-
- -
|
146
|
+
- - ">="
|
146
147
|
- !ruby/object:Gem::Version
|
147
148
|
version: '0'
|
148
149
|
requirements: []
|
149
150
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
151
|
+
rubygems_version: 2.5.1
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: Terminal strings styling with intuitive and clean API.
|