rainbow 2.1.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +20 -9
- data/Changelog.md +10 -0
- data/Gemfile +1 -1
- data/README.markdown +4 -4
- data/ext/mkrf_conf.rb +22 -0
- data/lib/rainbow.rb +1 -2
- data/lib/rainbow/color.rb +6 -2
- data/lib/rainbow/null_presenter.rb +8 -0
- data/lib/rainbow/presenter.rb +2 -0
- data/lib/rainbow/version.rb +1 -1
- data/rainbow.gemspec +1 -0
- data/spec/support/presenter_shared_examples.rb +1 -1
- data/spec/unit/presenter_spec.rb +11 -0
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 173113b6696213f239638a808f56033abc5b7467
|
4
|
+
data.tar.gz: b4794428b131eb7c0d59e3a4d615e211b159b7d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34d9884acf5dfc1af44737a7059a3ab11a274b5cf6517972182c12237e346d0d0ed89f49652dd9ab813408eef275af8dd4df01b8116e0b767d3b91d7da7f7317
|
7
|
+
data.tar.gz: 9d028c71300949cc03b74fa5869cbeb2e749ce23a4c12ef60501e1fb733cdbb0fa7d0a45f96f3c1e9319f3835ff2ed0fa27c75b7f869c9850e62ba615c1161da
|
data/.travis.yml
CHANGED
@@ -1,11 +1,22 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache:
|
3
|
+
- bundler
|
4
|
+
before_install:
|
5
|
+
- gem update --system
|
6
|
+
- gem install bundler
|
1
7
|
bundler_args: --without guard development
|
2
|
-
rvm:
|
3
|
-
- 1.9.2
|
4
|
-
- 1.9.3
|
5
|
-
- 2.0.0
|
6
|
-
- 2.1.0
|
7
|
-
- rbx
|
8
|
-
- jruby
|
9
8
|
|
10
|
-
|
11
|
-
|
9
|
+
matrix:
|
10
|
+
include:
|
11
|
+
- rvm: 2.0.0
|
12
|
+
- rvm: 2.1.9
|
13
|
+
- rvm: 2.2.6
|
14
|
+
- rvm: 2.3.3
|
15
|
+
- rvm: 2.4.0
|
16
|
+
- rvm: jruby-9.1.6.0
|
17
|
+
jdk: oraclejdk8
|
18
|
+
env:
|
19
|
+
- JRUBY_OPTS=--debug
|
20
|
+
- rvm: 2.2.6
|
21
|
+
install: true # This skips 'bundle install'
|
22
|
+
script: gem build rainbow && gem install *.gem
|
data/Changelog.md
CHANGED
@@ -71,3 +71,13 @@
|
|
71
71
|
* added X11 color support
|
72
72
|
* fixed `require` issue when rainbow is used as a dependency in another gem
|
73
73
|
* improved Windows support
|
74
|
+
|
75
|
+
# 2.2.0 (2016-12-27)
|
76
|
+
|
77
|
+
* improved Windows support
|
78
|
+
* added Ruby 2.4 support
|
79
|
+
* added `bold` alias method for `bright`
|
80
|
+
|
81
|
+
# 2.2.1 (2016-12-28)
|
82
|
+
|
83
|
+
* fixed gem installation (2.2.0 was a broken release)
|
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Rainbow
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/sickill/rainbow.
|
4
|
-
[![Code Climate](https://codeclimate.com/github/sickill/rainbow.
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/sickill/rainbow/badge.
|
3
|
+
[![Build Status](https://travis-ci.org/sickill/rainbow.svg?branch=master)](https://travis-ci.org/sickill/rainbow)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/sickill/rainbow.svg)](https://codeclimate.com/github/sickill/rainbow)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/sickill/rainbow/badge.svg)](https://coveralls.io/r/sickill/rainbow)
|
6
6
|
|
7
7
|
Rainbow is a ruby gem for colorizing printed text on ANSI terminals.
|
8
8
|
|
@@ -155,7 +155,7 @@ instances that are used by formatters with file output.
|
|
155
155
|
|
156
156
|
## Windows support
|
157
157
|
|
158
|
-
For Windows support, you should install the following gems:
|
158
|
+
For Windows support on Ruby < 2.0, you should install the following gems:
|
159
159
|
|
160
160
|
```ruby
|
161
161
|
gem install windows-pr win32console
|
data/ext/mkrf_conf.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/command'
|
3
|
+
require 'rubygems/dependency_installer'
|
4
|
+
|
5
|
+
begin
|
6
|
+
Gem::Command.build_args = ARGV
|
7
|
+
rescue NoMethodError
|
8
|
+
exit 1
|
9
|
+
end
|
10
|
+
|
11
|
+
installer = Gem::DependencyInstaller.new
|
12
|
+
|
13
|
+
begin
|
14
|
+
if RUBY_PLATFORM =~ /mswin|cygwin|mingw/ && RUBY_VERSION.to_i < 2
|
15
|
+
installer.install('windows-pr')
|
16
|
+
installer.install('win32console')
|
17
|
+
end
|
18
|
+
rescue
|
19
|
+
exit 1
|
20
|
+
end
|
21
|
+
|
22
|
+
File.write(File.join(File.dirname(__FILE__), 'Rakefile'), "task :default\n")
|
data/lib/rainbow.rb
CHANGED
@@ -13,8 +13,7 @@ module Rainbow
|
|
13
13
|
|
14
14
|
# On Windows systems, try to load the local ANSI support library if Ruby version < 2
|
15
15
|
# Ruby 2.x on Windows includes ANSI support.
|
16
|
-
|
17
|
-
if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ && RUBY_VERSION.to_i < 2
|
16
|
+
if RUBY_PLATFORM =~ /mswin|cygwin|mingw/ && RUBY_VERSION.to_i < 2
|
18
17
|
begin
|
19
18
|
require 'Win32/Console/ANSI'
|
20
19
|
rescue LoadError
|
data/lib/rainbow/color.rb
CHANGED
@@ -12,13 +12,17 @@ module Rainbow
|
|
12
12
|
color = values.size == 1 ? values.first : values
|
13
13
|
|
14
14
|
case color
|
15
|
-
when
|
15
|
+
when Integer
|
16
16
|
Indexed.new(ground, color)
|
17
17
|
when Symbol
|
18
18
|
if Named.color_names.include?(color)
|
19
19
|
Named.new(ground, color)
|
20
|
-
|
20
|
+
elsif X11Named.color_names.include?(color)
|
21
21
|
X11Named.new(ground, color)
|
22
|
+
else
|
23
|
+
fail ArgumentError,
|
24
|
+
"Unknown color name, valid names: " +
|
25
|
+
(Named.color_names + X11Named.color_names).join(', ')
|
22
26
|
end
|
23
27
|
when Array
|
24
28
|
RGB.new(ground, *color)
|
@@ -21,6 +21,14 @@ module Rainbow
|
|
21
21
|
def cyan; self; end
|
22
22
|
def white; self; end
|
23
23
|
|
24
|
+
def method_missing(method_name,*args)
|
25
|
+
if Color::X11Named.color_names.include? method_name and args.empty? then
|
26
|
+
self
|
27
|
+
else
|
28
|
+
super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
24
32
|
alias_method :foreground, :color
|
25
33
|
alias_method :fg, :color
|
26
34
|
alias_method :bg, :background
|
data/lib/rainbow/presenter.rb
CHANGED
data/lib/rainbow/version.rb
CHANGED
data/rainbow.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
shared_examples_for "presenter with shortcut color methods" do
|
2
|
-
[:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white].each do |name|
|
2
|
+
[:black, :red, :green, :yellow, :blue, :magenta, :cyan, :white, :aqua].each do |name|
|
3
3
|
describe "##{name}" do
|
4
4
|
subject { presenter.public_send(name) }
|
5
5
|
|
data/spec/unit/presenter_spec.rb
CHANGED
@@ -106,6 +106,17 @@ module Rainbow
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
describe '#bold' do
|
110
|
+
subject { presenter.bold }
|
111
|
+
|
112
|
+
it_behaves_like "rainbow string method"
|
113
|
+
|
114
|
+
it 'wraps with 1 code' do
|
115
|
+
subject
|
116
|
+
expect(StringUtils).to have_received(:wrap_with_sgr).with('hello', [1])
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
109
120
|
describe '#italic' do
|
110
121
|
subject { presenter.italic }
|
111
122
|
|
metadata
CHANGED
@@ -1,45 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainbow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Kulik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
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: '1.3'
|
27
27
|
description: Colorize printed text on ANSI terminals
|
28
28
|
email:
|
29
29
|
- m@ku1ik.com
|
30
30
|
executables: []
|
31
|
-
extensions:
|
31
|
+
extensions:
|
32
|
+
- ext/mkrf_conf.rb
|
32
33
|
extra_rdoc_files: []
|
33
34
|
files:
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
35
|
+
- .gitignore
|
36
|
+
- .rubocop.yml
|
37
|
+
- .travis.yml
|
37
38
|
- Changelog.md
|
38
39
|
- Gemfile
|
39
40
|
- Guardfile
|
40
41
|
- LICENSE
|
41
42
|
- README.markdown
|
42
43
|
- Rakefile
|
44
|
+
- ext/mkrf_conf.rb
|
43
45
|
- lib/rainbow.rb
|
44
46
|
- lib/rainbow/color.rb
|
45
47
|
- lib/rainbow/ext/string.rb
|
@@ -73,17 +75,17 @@ require_paths:
|
|
73
75
|
- lib
|
74
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
77
|
requirements:
|
76
|
-
- -
|
78
|
+
- - '>='
|
77
79
|
- !ruby/object:Gem::Version
|
78
80
|
version: 1.9.2
|
79
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
82
|
requirements:
|
81
|
-
- -
|
83
|
+
- - '>='
|
82
84
|
- !ruby/object:Gem::Version
|
83
85
|
version: '0'
|
84
86
|
requirements: []
|
85
87
|
rubyforge_project:
|
86
|
-
rubygems_version: 2.
|
88
|
+
rubygems_version: 2.0.14.1
|
87
89
|
signing_key:
|
88
90
|
specification_version: 4
|
89
91
|
summary: Colorize printed text on ANSI terminals
|