colored2 4.0.3 → 4.1.0
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/{LICENSE → LICENSE.txt} +1 -0
- data/README.md +4 -3
- data/Rakefile +29 -32
- data/docs/badges/coverage_badge.svg +21 -0
- data/docs/img/colored2-session1.avif +0 -0
- data/docs/img/colored2-session2.avif +0 -0
- data/lib/colored2/ascii_decorator.rb +2 -1
- data/lib/colored2/codes.rb +14 -14
- data/lib/colored2/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a30cfa9bcd56b29ef4168d36ae33b98bb75f3632b4602526fbe2942e0867df8b
|
|
4
|
+
data.tar.gz: e570b2329be8821eb4bfa5f66011d5c1a8c0d0acfe72585fb2a91bb78ae37a57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5c18014c5bf5cb1ae465ee1559ffe8cadd538e5eff78d06866f9b4f9c973c031a9b058cee13ddd09cfc7469f7d45dc9eafe1154116383dda81c52d491faaf28
|
|
7
|
+
data.tar.gz: dd4695e78af9f23e223b4397e96cadc6d1ead91300501aa39d3432ec02e53718c7483b45b39702e633d31e6fd8f71f5e0f86e6f7b73cb99270ccedfd670b3336
|
data/{LICENSE → LICENSE.txt}
RENAMED
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
[](https://github.com/kigster/colored2/actions/workflows/ruby-ci.yml)
|
|
3
3
|
[](https://github.com/kigster/colored2/actions/workflows/rubocop-ci.yml)
|
|
4
|
+

|
|
4
5
|
|
|
5
6
|
  [](https://app.gitter.im/#/room/#colored2:gitter.im)
|
|
6
7
|
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
|
|
9
10
|
The most downloaded ANSI color gem you'll find :-)
|
|
10
11
|
|
|
11
|
-

|
|
12
|
+
[](https://rubygems.org/gems/colored2)
|
|
12
13
|
|
|
13
14
|
## Backstory
|
|
14
15
|
|
|
@@ -27,7 +28,7 @@ In addition to the simple syntax of the original gem, which affected only the st
|
|
|
27
28
|
|
|
28
29
|
If no block or argument is provided, the color is left open-ended, and must be explicitly reset – when using the 'bang' notation.
|
|
29
30
|
|
|
30
|
-

|
|
31
32
|
|
|
32
33
|
### Complete set of colors:
|
|
33
34
|
|
|
@@ -62,7 +63,7 @@ To color numbers, require the following file, which automatically decorates `Int
|
|
|
62
63
|
|
|
63
64
|
Below is an `IRB` — session that shows a slightly more advanced usage.
|
|
64
65
|
|
|
65
|
-

|
|
66
67
|
|
|
67
68
|
## Additional Helpers
|
|
68
69
|
|
data/Rakefile
CHANGED
|
@@ -1,49 +1,46 @@
|
|
|
1
1
|
# frozen_string_literal: false
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
require 'rspec/core/rake_task'
|
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
9
|
-
rescue LoadError => e
|
|
10
|
-
warn "Error loading rspec task: #{e.message}"
|
|
11
|
-
exit 1
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
begin
|
|
15
|
-
require 'rubocop/rake_task'
|
|
16
|
-
RuboCop::RakeTask.new(:rubocop)
|
|
17
|
-
rescue LoadError => e
|
|
18
|
-
warn "Error loading rubocop task: #{e.message}"
|
|
19
|
-
exit 1
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
task default: [:spec, :rubocop]
|
|
3
|
+
require "bundler/gem_tasks"
|
|
4
|
+
require "rspec/core/rake_task"
|
|
5
|
+
require "timeout"
|
|
6
|
+
require "yard"
|
|
23
7
|
|
|
24
8
|
def shell(*args)
|
|
25
9
|
puts "running: #{args.join(' ')}"
|
|
26
|
-
system(args.join(
|
|
10
|
+
system(args.join(" "))
|
|
27
11
|
end
|
|
28
12
|
|
|
29
|
-
desc 'Clean up any temp or coverage files.'
|
|
30
13
|
task :clean do
|
|
31
|
-
shell(
|
|
14
|
+
shell("rm -rf pkg/ tmp/ coverage/ doc/")
|
|
32
15
|
end
|
|
33
16
|
|
|
34
|
-
desc 'Install the gem locally from the pkg/*.gem file'
|
|
35
17
|
task gem: [:build] do
|
|
36
|
-
shell(
|
|
18
|
+
shell("gem install pkg/*")
|
|
37
19
|
end
|
|
38
20
|
|
|
39
|
-
desc 'Ensure permissions are not an issue'
|
|
40
21
|
task permissions: [:clean] do
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
shell("
|
|
22
|
+
# One traversal replaces a six-level glob chain that printed "No such file
|
|
23
|
+
# or directory" for every level this project does not have, skipped dotfiles
|
|
24
|
+
# entirely, and silently stopped at depth six. .git is pruned: its objects
|
|
25
|
+
# have no business being group-readable.
|
|
26
|
+
shell("find . -path ./.git -prune -o -type d -exec chmod o+rx,g+rx {} + -o -type f -exec chmod o+r,g+r {} +")
|
|
46
27
|
end
|
|
47
28
|
|
|
48
|
-
desc
|
|
29
|
+
desc "Build the gem locally"
|
|
49
30
|
task build: :permissions
|
|
31
|
+
|
|
32
|
+
desc 'Generate YARD docs into ./doc'
|
|
33
|
+
YARD::Rake::YardocTask.new("docs") do |t|
|
|
34
|
+
t.files = %w[lib/**/*.rb - README.md LICENSE.txt CHANGELOG.md docs/badge/coverage_badge.svg]
|
|
35
|
+
t.options = ['--protected', '--private']
|
|
36
|
+
t.options.unshift("--title", '"colored2: ANSI color any Ruby object"')
|
|
37
|
+
t.after = -> do
|
|
38
|
+
# correct the path to the badge in the docs
|
|
39
|
+
system(%q[sed -i '' 's|<img src="docs|<img src="../docs|g' doc/index.html])
|
|
40
|
+
exec("open doc/index.html")
|
|
41
|
+
end if RUBY_PLATFORM =~ /darwin/
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
45
|
+
|
|
46
|
+
task default: :spec
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="99" height="20">
|
|
3
|
+
<linearGradient id="b" x2="0" y2="100%">
|
|
4
|
+
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
|
|
5
|
+
<stop offset="1" stop-opacity=".1"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
<mask id="a">
|
|
8
|
+
<rect width="99" height="20" rx="3" fill="#fff"/>
|
|
9
|
+
</mask>
|
|
10
|
+
<g mask="url(#a)">
|
|
11
|
+
<path fill="#555" d="M0 0h63v20H0z"/>
|
|
12
|
+
<path fill="#4c1" d="M63 0h36v20H63z"/>
|
|
13
|
+
<path fill="url(#b)" d="M0 0h99v20H0z"/>
|
|
14
|
+
</g>
|
|
15
|
+
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
|
16
|
+
<text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
|
|
17
|
+
<text x="31.5" y="14">coverage</text>
|
|
18
|
+
<text x="80" y="15" fill="#010101" fill-opacity=".3">99%</text>
|
|
19
|
+
<text x="80" y="14">99%</text>
|
|
20
|
+
</g>
|
|
21
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -56,6 +56,7 @@ module Colored2
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
extend Forwardable
|
|
59
|
+
|
|
59
60
|
def_delegators :@my_class, :enable!, :disable!
|
|
60
61
|
|
|
61
62
|
attr_accessor :string, :my_class
|
|
@@ -76,7 +77,7 @@ module Colored2
|
|
|
76
77
|
Colored2::Effect.new(options[:effect])
|
|
77
78
|
].compact.join
|
|
78
79
|
|
|
79
|
-
colored = ''
|
|
80
|
+
colored = +''
|
|
80
81
|
colored << escape_sequence if options[:beginning] == :on
|
|
81
82
|
colored << string
|
|
82
83
|
if options[:end]
|
data/lib/colored2/codes.rb
CHANGED
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
module Colored2
|
|
4
4
|
COLORS = {
|
|
5
|
-
black:
|
|
6
|
-
red:
|
|
7
|
-
green:
|
|
8
|
-
yellow:
|
|
9
|
-
blue:
|
|
5
|
+
black: 30,
|
|
6
|
+
red: 31,
|
|
7
|
+
green: 32,
|
|
8
|
+
yellow: 33,
|
|
9
|
+
blue: 34,
|
|
10
10
|
magenta: 35,
|
|
11
|
-
cyan:
|
|
12
|
-
white:
|
|
11
|
+
cyan: 36,
|
|
12
|
+
white: 37
|
|
13
13
|
}.freeze
|
|
14
14
|
|
|
15
15
|
EFFECTS = {
|
|
16
|
-
no_color:
|
|
17
|
-
bold:
|
|
18
|
-
dark:
|
|
19
|
-
italic:
|
|
16
|
+
no_color: 0,
|
|
17
|
+
bold: 1,
|
|
18
|
+
dark: 2,
|
|
19
|
+
italic: 3,
|
|
20
20
|
underlined: 4,
|
|
21
|
-
reversed:
|
|
22
|
-
plain:
|
|
23
|
-
normal:
|
|
21
|
+
reversed: 7,
|
|
22
|
+
plain: 21, # non-bold
|
|
23
|
+
normal: 22
|
|
24
24
|
}.freeze
|
|
25
25
|
|
|
26
26
|
class Code
|
data/lib/colored2/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: colored2
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Wanstrath
|
|
8
8
|
- Konstantin Gredeskoul
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies: []
|
|
14
13
|
description: |+
|
|
15
14
|
This is a heavily modified fork of http://github.com/defunkt/colored gem, with many
|
|
@@ -37,9 +36,12 @@ executables: []
|
|
|
37
36
|
extensions: []
|
|
38
37
|
extra_rdoc_files: []
|
|
39
38
|
files:
|
|
40
|
-
- LICENSE
|
|
39
|
+
- LICENSE.txt
|
|
41
40
|
- README.md
|
|
42
41
|
- Rakefile
|
|
42
|
+
- docs/badges/coverage_badge.svg
|
|
43
|
+
- docs/img/colored2-session1.avif
|
|
44
|
+
- docs/img/colored2-session2.avif
|
|
43
45
|
- lib/colored2.rb
|
|
44
46
|
- lib/colored2/ascii_decorator.rb
|
|
45
47
|
- lib/colored2/codes.rb
|
|
@@ -52,7 +54,6 @@ licenses:
|
|
|
52
54
|
- MIT
|
|
53
55
|
metadata:
|
|
54
56
|
rubygems_mfa_required: 'true'
|
|
55
|
-
post_install_message:
|
|
56
57
|
rdoc_options: []
|
|
57
58
|
require_paths:
|
|
58
59
|
- lib
|
|
@@ -67,9 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
67
68
|
- !ruby/object:Gem::Version
|
|
68
69
|
version: '0'
|
|
69
70
|
requirements: []
|
|
70
|
-
rubygems_version:
|
|
71
|
-
signing_key:
|
|
71
|
+
rubygems_version: 4.0.23
|
|
72
72
|
specification_version: 4
|
|
73
|
-
summary:
|
|
73
|
+
summary: Zero dependencies ANSI coloring gem for Ruby objects.
|
|
74
74
|
test_files: []
|
|
75
75
|
...
|