rainbow 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 831ab2db7f80a9a72f2993f1e7b4f3ffa08a4495
4
- data.tar.gz: 0f842d288049511c94a95ce9b8a9210cf5e2344b
2
+ SHA256:
3
+ metadata.gz: 8a63baad6cad3bf3127e8dfbfb9393f05b6a92122af6f1fd7b3cf5ffe44b4e05
4
+ data.tar.gz: 8db71093ce37873fa8b009981488cce3ee63cfad85365dd96f416dc4790d4d97
5
5
  SHA512:
6
- metadata.gz: ecde479bb8ea6f267200efaf03be79e7141bf6fccd7a7191960b2f9f52d809120a943a341f467f0a01c982ff11bf8bd23e66c8732d3af0b22643be5da13b55ec
7
- data.tar.gz: b11241f918993558e8a4d248d9eb4b458793e926e10e7e387d5dabaf9e15a988adeda1441c93b3be9d051c939fbf566b2493ba9f8df8eff0bbf629bf36798cac
6
+ metadata.gz: c5d8c29b3d25fcc2a85919143a628e2de3250beb08ec10c228c5fe2b759af567b962e9c78b65bc9fc39db33b643af4556cb05565e45027f25695e2ee1275a115
7
+ data.tar.gz: 2872ac2c71afebbfb362b86e93f03b3b7b0fe376497fdcd4ce4ce296fa03be4521ca0ed84de3ef24228783842bdff17f4ce3c2f79ad4cfe6faa9896b25e229af
data/Changelog.md CHANGED
@@ -1,10 +1,18 @@
1
1
  # Rainbow changelog
2
2
 
3
- ## 3.0.0 (2017-10-24)
3
+ ## 3.1.0 (2020-08-26)
4
4
 
5
+ - added `cross_out` aka `strike`
6
+ - hexadecimal color names supported better, see #83
7
+ - gemspec: list files using a Ruby expression, avoiding git
8
+
9
+ ## 3.0.0 (2017-11-29)
10
+
11
+ * added String refinement
12
+ * added new `Rainbow.uncolor` method
5
13
  * dropped MRI 1.9.3 compatibility
6
14
  * dropped MRI 2.0 compatibility
7
- * removed rake dependency
15
+ * removed Rake dependency
8
16
 
9
17
  ## 2.2.2 (2017-04-21)
10
18
 
data/README.markdown CHANGED
@@ -29,6 +29,8 @@ puts Rainbow("this is red").red + " and " + Rainbow("this on yellow bg").bg(:yel
29
29
  # => "\e[31mthis is red\e[0m and \e[43mthis on yellow bg\e[0m and \e[4m\e[1meven bright underlined!\e[0m"
30
30
  ```
31
31
 
32
+ ![Screenshot of the previous code in a terminal](https://user-images.githubusercontent.com/132/132943811-93747cc5-bdaf-43a2-a1a4-a1f18e805eba.png)
33
+
32
34
  Or, [watch this video example](https://asciinema.org/a/J928KpHoUQ0sl54ulOSOLE71E?rows=20&speed=2.5)
33
35
 
34
36
  ### Rainbow presenter API
@@ -44,6 +46,7 @@ Rainbow presenter adds the following methods to presented string:
44
46
  * `hide`
45
47
  * `faint` (not well supported by terminal emulators)
46
48
  * `italic` (not well supported by terminal emulators)
49
+ * `cross_out`, `strike`
47
50
 
48
51
  Text color can also be changed by calling a method named by a color:
49
52
 
metadata CHANGED
@@ -1,30 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainbow
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Kulik
8
8
  - Olle Jonsson
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-11-29 00:00:00.000000000 Z
12
+ date: 2022-01-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.3'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '3'
21
24
  type: :development
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: '1.3'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
28
34
  description: Colorize printed text on ANSI terminals
29
35
  email:
30
36
  - m@ku1ik.com
@@ -32,46 +38,14 @@ executables: []
32
38
  extensions: []
33
39
  extra_rdoc_files: []
34
40
  files:
35
- - ".gitignore"
36
- - ".rubocop.yml"
37
- - ".rubocop_todo.yml"
38
- - ".travis.yml"
39
41
  - Changelog.md
40
- - Gemfile
41
- - Guardfile
42
42
  - LICENSE
43
43
  - README.markdown
44
- - Rakefile
45
- - appveyor.yml
46
- - lib/rainbow.rb
47
- - lib/rainbow/color.rb
48
- - lib/rainbow/ext/string.rb
49
- - lib/rainbow/global.rb
50
- - lib/rainbow/null_presenter.rb
51
- - lib/rainbow/presenter.rb
52
- - lib/rainbow/refinement.rb
53
- - lib/rainbow/string_utils.rb
54
- - lib/rainbow/version.rb
55
- - lib/rainbow/wrapper.rb
56
- - lib/rainbow/x11_color_names.rb
57
- - rainbow.gemspec
58
- - spec/integration/instance_spec.rb
59
- - spec/integration/rainbow_spec.rb
60
- - spec/integration/refinement_spec.rb
61
- - spec/integration/string_spec.rb
62
- - spec/integration/uncolor_spec.rb
63
- - spec/spec_helper.rb
64
- - spec/support/presenter_shared_examples.rb
65
- - spec/unit/color_spec.rb
66
- - spec/unit/null_presenter_spec.rb
67
- - spec/unit/presenter_spec.rb
68
- - spec/unit/string_utils_spec.rb
69
- - spec/unit/wrapper_spec.rb
70
44
  homepage: https://github.com/sickill/rainbow
71
45
  licenses:
72
46
  - MIT
73
47
  metadata: {}
74
- post_install_message:
48
+ post_install_message:
75
49
  rdoc_options: []
76
50
  require_paths:
77
51
  - lib
@@ -79,28 +53,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
79
53
  requirements:
80
54
  - - ">="
81
55
  - !ruby/object:Gem::Version
82
- version: 2.1.0
56
+ version: 2.3.0
83
57
  required_rubygems_version: !ruby/object:Gem::Requirement
84
58
  requirements:
85
59
  - - ">="
86
60
  - !ruby/object:Gem::Version
87
61
  version: '0'
88
62
  requirements: []
89
- rubyforge_project:
90
- rubygems_version: 2.6.11
91
- signing_key:
63
+ rubygems_version: 3.0.9
64
+ signing_key:
92
65
  specification_version: 4
93
66
  summary: Colorize printed text on ANSI terminals
94
- test_files:
95
- - spec/integration/instance_spec.rb
96
- - spec/integration/rainbow_spec.rb
97
- - spec/integration/refinement_spec.rb
98
- - spec/integration/string_spec.rb
99
- - spec/integration/uncolor_spec.rb
100
- - spec/spec_helper.rb
101
- - spec/support/presenter_shared_examples.rb
102
- - spec/unit/color_spec.rb
103
- - spec/unit/null_presenter_spec.rb
104
- - spec/unit/presenter_spec.rb
105
- - spec/unit/string_utils_spec.rb
106
- - spec/unit/wrapper_spec.rb
67
+ test_files: []
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/.rubocop.yml DELETED
@@ -1,20 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- AllCops:
4
- DisplayCopNames: true
5
- DisplayStyleGuide: true
6
- TargetRubyVersion: "2.1"
7
- Exclude:
8
- - "spec/**/*"
9
- - "vendor/**/*"
10
- Documentation:
11
- Enabled: false
12
-
13
- HashSyntax:
14
- Enabled: false
15
-
16
- MethodName:
17
- Enabled: false
18
-
19
- StringLiterals:
20
- Enabled: false
data/.rubocop_todo.yml DELETED
@@ -1,29 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2017-06-30 12:37:52 +0200 using RuboCop version 0.49.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- Metrics/AbcSize:
11
- Max: 25
12
-
13
- # Offense count: 1
14
- Metrics/CyclomaticComplexity:
15
- Max: 9
16
-
17
- # Offense count: 1
18
- # Configuration parameters: CountComments.
19
- Metrics/MethodLength:
20
- Max: 23
21
-
22
- # Offense count: 1
23
- # Configuration parameters: CountComments.
24
- Metrics/ModuleLength:
25
- Max: 147
26
-
27
- # Offense count: 1
28
- Metrics/PerceivedComplexity:
29
- Max: 8
data/.travis.yml DELETED
@@ -1,24 +0,0 @@
1
- language: ruby
2
- cache:
3
- bundler: true
4
-
5
- before_install:
6
- - gem install bundler
7
-
8
- bundler_args: --without guard development
9
-
10
- matrix:
11
- include:
12
- - rvm: 2.1.10
13
- - rvm: 2.2.7
14
- - rvm: 2.3.4
15
- - rvm: 2.4.1
16
- - rvm: jruby-9.1.14.0
17
- jdk: oraclejdk8
18
- - rvm: 2.2.7
19
- install: true # This skips 'bundle install'
20
- script: gem build rainbow && gem install *.gem
21
-
22
- env:
23
- global:
24
- - JRUBY_OPTS=--debug
data/Gemfile DELETED
@@ -1,28 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- gem 'rake'
6
-
7
- group :test do
8
- gem 'coveralls', require: false
9
- gem 'rspec'
10
- end
11
-
12
- group :development do
13
- gem 'mutant-rspec'
14
- end
15
-
16
- group :test, :development do
17
- gem 'rubocop', '~> 0.51.0'
18
- end
19
-
20
- group :guard do
21
- gem 'guard'
22
- gem 'guard-rspec'
23
- end
24
-
25
- platform :rbx do
26
- gem 'json'
27
- gem 'rubysl'
28
- end
data/Guardfile DELETED
@@ -1,8 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard :rspec, cmd: 'rspec --color' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { "spec" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
data/Rakefile DELETED
@@ -1,9 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- require 'rspec/core/rake_task'
4
- RSpec::Core::RakeTask.new
5
-
6
- require 'rubocop/rake_task'
7
- RuboCop::RakeTask.new
8
-
9
- task default: %i[spec rubocop]
data/appveyor.yml DELETED
@@ -1,40 +0,0 @@
1
- ---
2
-
3
- version: "{build}"
4
-
5
- install:
6
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
7
- - bundle config --local path vendor/bundle
8
- - bundle install --jobs 3 --retry 3 --without guard development
9
-
10
- build: off
11
-
12
- cache:
13
- - vendor/bundle
14
-
15
- init:
16
- - git config --global core.autocrlf true
17
-
18
- before_test:
19
- - ruby -v
20
- - gem -v
21
- - bundle -v
22
-
23
- test_script:
24
- - bundle exec rake
25
-
26
- environment:
27
- matrix:
28
- - RUBY_VERSION: 21
29
- - RUBY_VERSION: 21-x64
30
- - RUBY_VERSION: 22
31
- - RUBY_VERSION: 22-x64
32
- - RUBY_VERSION: 23
33
- - RUBY_VERSION: 23-x64
34
-
35
- matrix:
36
- fast_finish: true
37
-
38
- branches:
39
- only:
40
- - master
data/lib/rainbow/color.rb DELETED
@@ -1,143 +0,0 @@
1
- module Rainbow
2
- class Color
3
- attr_reader :ground
4
-
5
- def self.build(ground, values)
6
- unless [1, 3].include?(values.size)
7
- raise ArgumentError,
8
- "Wrong number of arguments for color definition, should be 1 or 3"
9
- end
10
-
11
- color = values.size == 1 ? values.first : values
12
-
13
- case color
14
- # NOTE: Properly handle versions before/after Ruby 2.4.0.
15
- # Ruby 2.4+ unifies Fixnum & Bignum into Integer.
16
- # However previous versions would still use Fixnum.
17
- # To avoid missing `Fixnum` input, call `0.class` which would
18
- # return either `Integer` or `Fixnum`.
19
- when 0.class
20
- Indexed.new(ground, color)
21
- when Symbol
22
- if Named.color_names.include?(color)
23
- Named.new(ground, color)
24
- elsif X11Named.color_names.include?(color)
25
- X11Named.new(ground, color)
26
- else
27
- raise ArgumentError,
28
- "Unknown color name, valid names: " +
29
- (Named.color_names + X11Named.color_names).join(', ')
30
- end
31
- when Array
32
- RGB.new(ground, *color)
33
- when String
34
- RGB.new(ground, *parse_hex_color(color))
35
- end
36
- end
37
-
38
- def self.parse_hex_color(hex)
39
- hex = hex.sub(/^#/, '')
40
- r = hex[0..1].to_i(16)
41
- g = hex[2..3].to_i(16)
42
- b = hex[4..5].to_i(16)
43
-
44
- [r, g, b]
45
- end
46
-
47
- class Indexed < Color
48
- attr_reader :num
49
-
50
- def initialize(ground, num)
51
- @ground = ground
52
- @num = num
53
- end
54
-
55
- def codes
56
- code = num + (ground == :foreground ? 30 : 40)
57
-
58
- [code]
59
- end
60
- end
61
-
62
- class Named < Indexed
63
- NAMES = {
64
- black: 0,
65
- red: 1,
66
- green: 2,
67
- yellow: 3,
68
- blue: 4,
69
- magenta: 5,
70
- cyan: 6,
71
- white: 7,
72
- default: 9
73
- }.freeze
74
-
75
- def self.color_names
76
- NAMES.keys
77
- end
78
-
79
- def self.valid_names
80
- color_names.join(', ')
81
- end
82
-
83
- def initialize(ground, name)
84
- unless Named.color_names.include?(name)
85
- raise ArgumentError,
86
- "Unknown color name, valid names: #{self.class.valid_names}"
87
- end
88
-
89
- super(ground, NAMES[name])
90
- end
91
- end
92
-
93
- class RGB < Indexed
94
- attr_reader :r, :g, :b
95
-
96
- def self.to_ansi_domain(value)
97
- (6 * (value / 256.0)).to_i
98
- end
99
-
100
- def initialize(ground, *values)
101
- if values.min < 0 || values.max > 255
102
- raise ArgumentError, "RGB value outside 0-255 range"
103
- end
104
-
105
- super(ground, 8)
106
- @r, @g, @b = values
107
- end
108
-
109
- def codes
110
- super + [5, code_from_rgb]
111
- end
112
-
113
- private
114
-
115
- def code_from_rgb
116
- 16 + self.class.to_ansi_domain(r) * 36 +
117
- self.class.to_ansi_domain(g) * 6 +
118
- self.class.to_ansi_domain(b)
119
- end
120
- end
121
-
122
- class X11Named < RGB
123
- include X11ColorNames
124
-
125
- def self.color_names
126
- NAMES.keys
127
- end
128
-
129
- def self.valid_names
130
- color_names.join(', ')
131
- end
132
-
133
- def initialize(ground, name)
134
- unless X11Named.color_names.include?(name)
135
- raise ArgumentError,
136
- "Unknown color name, valid names: #{self.class.valid_names}"
137
- end
138
-
139
- super(ground, *NAMES[name])
140
- end
141
- end
142
- end
143
- end
@@ -1,54 +0,0 @@
1
- require 'rainbow'
2
-
3
- module Rainbow
4
- module Ext
5
- module String
6
- module InstanceMethods
7
- def foreground(*color)
8
- Rainbow(self).foreground(*color)
9
- end
10
-
11
- alias color foreground
12
- alias colour foreground
13
-
14
- def background(*color)
15
- Rainbow(self).background(*color)
16
- end
17
-
18
- def reset
19
- Rainbow(self).reset
20
- end
21
-
22
- def bright
23
- Rainbow(self).bright
24
- end
25
-
26
- def faint
27
- Rainbow(self).faint
28
- end
29
-
30
- def italic
31
- Rainbow(self).italic
32
- end
33
-
34
- def underline
35
- Rainbow(self).underline
36
- end
37
-
38
- def blink
39
- Rainbow(self).blink
40
- end
41
-
42
- def inverse
43
- Rainbow(self).inverse
44
- end
45
-
46
- def hide
47
- Rainbow(self).hide
48
- end
49
- end
50
- end
51
- end
52
- end
53
-
54
- ::String.send(:include, Rainbow::Ext::String::InstanceMethods)
@@ -1,23 +0,0 @@
1
- require_relative 'wrapper'
2
-
3
- module Rainbow
4
- def self.global
5
- @global ||= Wrapper.new
6
- end
7
-
8
- def self.enabled
9
- global.enabled
10
- end
11
-
12
- def self.enabled=(value)
13
- global.enabled = value
14
- end
15
-
16
- def self.uncolor(string)
17
- StringUtils.uncolor(string)
18
- end
19
- end
20
-
21
- def Rainbow(string)
22
- Rainbow.global.wrap(string.to_s)
23
- end
@@ -1,93 +0,0 @@
1
- module Rainbow
2
- class NullPresenter < ::String
3
- def color(*_values)
4
- self
5
- end
6
-
7
- def background(*_values)
8
- self
9
- end
10
-
11
- def reset
12
- self
13
- end
14
-
15
- def bright
16
- self
17
- end
18
-
19
- def faint
20
- self
21
- end
22
-
23
- def italic
24
- self
25
- end
26
-
27
- def underline
28
- self
29
- end
30
-
31
- def blink
32
- self
33
- end
34
-
35
- def inverse
36
- self
37
- end
38
-
39
- def hide
40
- self
41
- end
42
-
43
- def black
44
- self
45
- end
46
-
47
- def red
48
- self
49
- end
50
-
51
- def green
52
- self
53
- end
54
-
55
- def yellow
56
- self
57
- end
58
-
59
- def blue
60
- self
61
- end
62
-
63
- def magenta
64
- self
65
- end
66
-
67
- def cyan
68
- self
69
- end
70
-
71
- def white
72
- self
73
- end
74
-
75
- def method_missing(method_name, *args)
76
- if Color::X11Named.color_names.include?(method_name) && args.empty?
77
- self
78
- else
79
- super
80
- end
81
- end
82
-
83
- def respond_to_missing?(method_name, *args)
84
- Color::X11Named.color_names.include?(method_name) && args.empty? || super
85
- end
86
-
87
- alias foreground color
88
- alias fg color
89
- alias bg background
90
- alias bold bright
91
- alias dark faint
92
- end
93
- end