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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ee693f49e7208ff644370725aa2b7b9888ebac0647f2657545e515fec328ed4
4
- data.tar.gz: 9f3892276803dffd61a614ebbad278aec4883fa08e7df3ed3831e3ed99bf4dc3
3
+ metadata.gz: a30cfa9bcd56b29ef4168d36ae33b98bb75f3632b4602526fbe2942e0867df8b
4
+ data.tar.gz: e570b2329be8821eb4bfa5f66011d5c1a8c0d0acfe72585fb2a91bb78ae37a57
5
5
  SHA512:
6
- metadata.gz: efee32f318d52bccf99f3695a24a9c129b2096754a9dff942cc84c1204ee9843b19af36f6d8271624e5dad7f40d3e3d8714ce85d45642399c3ea14aa009173ce
7
- data.tar.gz: fb369f890ae3103193f69599517a36e0bc20897daf14bed46fd0706ee9628578f1ade9006ba47da97f941d08a8c86bb6ec340aeaf5d41e942bc3dc286507a2cc
6
+ metadata.gz: f5c18014c5bf5cb1ae465ee1559ffe8cadd538e5eff78d06866f9b4f9c973c031a9b058cee13ddd09cfc7469f7d45dc9eafe1154116383dda81c52d491faaf28
7
+ data.tar.gz: dd4695e78af9f23e223b4397e96cadc6d1ead91300501aa39d3432ec02e53718c7483b45b39702e633d31e6fd8f71f5e0f86e6f7b73cb99270ccedfd670b3336
@@ -1,5 +1,6 @@
1
1
  Copyright (c) 2010 Chris Wanstrath
2
2
  Copyright (c) 2016 Konstantin Gredeskoul
3
+ Copyright (c) 2026 Konstantin Gredeskoul
3
4
 
4
5
  MIT License
5
6
 
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
 
2
2
  [![RSpecs](https://github.com/kigster/colored2/actions/workflows/ruby-ci.yml/badge.svg)](https://github.com/kigster/colored2/actions/workflows/ruby-ci.yml)
3
3
  [![Rubocop](https://github.com/kigster/colored2/actions/workflows/rubocop-ci.yml/badge.svg)](https://github.com/kigster/colored2/actions/workflows/rubocop-ci.yml)
4
+ ![coverage](docs/badges/coverage_badge.svg)
4
5
 
5
6
  ![Gem Version](https://img.shields.io/gem/v/colored2?style=for-the-badge&color=0AF) ![MIT License](https://img.shields.io/badge/license-MIT-blue?style=for-the-badge&color=0AF) [![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg?style=for-the-badge&color=F6F)](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
- ![Gem Total Downloads](https://img.shields.io/gem/dt/colored2?style=for-the-badge&color=A0F)
12
+ [![Gem Total Downloads](https://img.shields.io/gem/dt/colored2?style=for-the-badge&color=A0F)](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
- ![](doc/colored2-session1.png)
31
+ ![session1](docs/img/colored2-session1.avif)
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
- ![](doc/colored2-session2.png)
66
+ ![session2](docs/img/colored2-session2.avif)
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 'bundler'
4
- require 'bundler/gem_tasks'
5
-
6
- begin
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('rm -rf pkg/ tmp/ coverage/ ' )
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('gem install pkg/*')
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
- shell("find . -type f -exec chmod 644 {} \\;")
42
- shell("find . -type d -exec chmod 755 {} \\;")
43
- shell("find bin -type f -exec chmod 755 {} \\; 2>/dev/null")
44
- shell("find exe -type f -exec chmod 755 {} \\; 2>/dev/null")
45
- shell("pwd -P && mkdir pkg && chmod -R g+r,g+x,o+r,o+x pkg")
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 'Builds the gem into the pkg/ folder'
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]
@@ -2,25 +2,25 @@
2
2
 
3
3
  module Colored2
4
4
  COLORS = {
5
- black: 30,
6
- red: 31,
7
- green: 32,
8
- yellow: 33,
9
- blue: 34,
5
+ black: 30,
6
+ red: 31,
7
+ green: 32,
8
+ yellow: 33,
9
+ blue: 34,
10
10
  magenta: 35,
11
- cyan: 36,
12
- white: 37
11
+ cyan: 36,
12
+ white: 37
13
13
  }.freeze
14
14
 
15
15
  EFFECTS = {
16
- no_color: 0,
17
- bold: 1,
18
- dark: 2,
19
- italic: 3,
16
+ no_color: 0,
17
+ bold: 1,
18
+ dark: 2,
19
+ italic: 3,
20
20
  underlined: 4,
21
- reversed: 7,
22
- plain: 21, # non-bold
23
- normal: 22
21
+ reversed: 7,
22
+ plain: 21, # non-bold
23
+ normal: 22
24
24
  }.freeze
25
25
 
26
26
  class Code
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Colored2
4
- VERSION = '4.0.3'
4
+ VERSION = '4.1.0'
5
5
  end
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.3
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: 2025-01-18 00:00:00.000000000 Z
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: 3.4.10
71
- signing_key:
71
+ rubygems_version: 4.0.23
72
72
  specification_version: 4
73
- summary: Add even more color to your life.
73
+ summary: Zero dependencies ANSI coloring gem for Ruby objects.
74
74
  test_files: []
75
75
  ...