colored2 4.0.0 → 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: 931fcb1dc0aebdc4cee8c0b71849879b22878076547172885d4a15fc6bd19e80
4
- data.tar.gz: 07263f510c64006915085ba83c1c4ca84e16208c93ebe9696a4802eb6f4afb59
3
+ metadata.gz: a30cfa9bcd56b29ef4168d36ae33b98bb75f3632b4602526fbe2942e0867df8b
4
+ data.tar.gz: e570b2329be8821eb4bfa5f66011d5c1a8c0d0acfe72585fb2a91bb78ae37a57
5
5
  SHA512:
6
- metadata.gz: 7434349bb14787804acb8cf8692e522f0accf8d751ef45672bce10171ad4bce61318df04676af58dbf64a5fbe399e89f1b741e7ba6b0c5c8b608db7a42085874
7
- data.tar.gz: 3a8a6bf7fe16badb197728f645c8e16c5c48f7f933e3c2e5d68a2b1dbdc24c6706638a8d39ae1fc38dec68a4f1348c2db673c6d21a80b5f314355b95a6601ff5
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,13 +1,19 @@
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
- [![Gem Version](https://badge.fury.io/rb/colored2.svg)](https://badge.fury.io/rb/colored2)
6
- [![Gitter](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/colored2)
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)
7
7
 
8
- ## Colored2
8
+ # Colored2
9
9
 
10
- This is an actively maintained fork of Chris (defunkt) Wanstrath's gem [colored](https://github.com/defunkt/colored), which appears to be no longer supported.
10
+ The most downloaded ANSI color gem you'll find :-)
11
+
12
+ [![Gem Total Downloads](https://img.shields.io/gem/dt/colored2?style=for-the-badge&color=A0F)](https://rubygems.org/gems/colored2)
13
+
14
+ ## Backstory
15
+
16
+ It's an actively maintained fork of Chris [@defunkt](https://github.com/defunkt) Wanstrath's gem [colored](https://github.com/defunkt/colored), which appears to be no longer supported. So instead of accepting this as a pull request, a new gem was born.
11
17
 
12
18
  This fork comes with a slightly spruced up syntax, some additional features, and a test suite written in [RSpec](http://rspec.info/).
13
19
 
@@ -22,7 +28,7 @@ In addition to the simple syntax of the original gem, which affected only the st
22
28
 
23
29
  If no block or argument is provided, the color is left open-ended, and must be explicitly reset – when using the 'bang' notation.
24
30
 
25
- ![](doc/colored2-session1.png)
31
+ ![session1](docs/img/colored2-session1.avif)
26
32
 
27
33
  ### Complete set of colors:
28
34
 
@@ -57,7 +63,7 @@ To color numbers, require the following file, which automatically decorates `Int
57
63
 
58
64
  Below is an `IRB` — session that shows a slightly more advanced usage.
59
65
 
60
- ![](doc/colored2-session2.png)
66
+ ![session2](docs/img/colored2-session2.avif)
61
67
 
62
68
  ## Additional Helpers
63
69
 
@@ -87,6 +93,10 @@ Or install it yourself as:
87
93
 
88
94
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
89
95
 
96
+ ## Support
97
+
98
+
99
+
90
100
  ## Contributing
91
101
 
92
102
  Bug reports and pull requests are welcome on GitHub at [https://github.com/kigster/colored2](https://github.com/kigster/colored2).
data/Rakefile CHANGED
@@ -1,17 +1,46 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- require 'bundler'
4
- require 'bundler/gem_tasks'
5
- require 'rake/clean'
6
-
7
- CLEAN.include %w(pkg coverage *.gem)
8
-
9
- begin
10
- require 'rspec/core/rake_task'
11
- RSpec::Core::RakeTask.new(:spec)
12
- rescue LoadError => e
13
- warn "Error loading task: #{e.message}"
14
- exit 1
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "timeout"
6
+ require "yard"
7
+
8
+ def shell(*args)
9
+ puts "running: #{args.join(' ')}"
10
+ system(args.join(" "))
11
+ end
12
+
13
+ task :clean do
14
+ shell("rm -rf pkg/ tmp/ coverage/ doc/")
15
15
  end
16
16
 
17
- task default: [:spec]
17
+ task gem: [:build] do
18
+ shell("gem install pkg/*")
19
+ end
20
+
21
+ task permissions: [:clean] do
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 {} +")
27
+ end
28
+
29
+ desc "Build the gem locally"
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
@@ -59,7 +59,7 @@ module Colored2
59
59
 
60
60
  class BackgroundColor < TextColor
61
61
  def value
62
- super 10
62
+ super(10)
63
63
  end
64
64
  end
65
65
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Colored2
4
- VERSION = '4.0.0'
4
+ VERSION = '4.1.0'
5
5
  end
data/lib/colored2.rb CHANGED
@@ -52,7 +52,7 @@ module Colored2
52
52
  surround_with_color(color:, color_self: true, string:, &block)
53
53
  end
54
54
 
55
- define_method("#{color}!".to_sym) do |string = nil, &block|
55
+ define_method(:"#{color}!") do |string = nil, &block|
56
56
  surround_with_color(color:, color_self: false, string:, &block)
57
57
  end
58
58
  end
@@ -64,7 +64,7 @@ module Colored2
64
64
  surround_with_color(effect:, color_self: true, string:, &block)
65
65
  end
66
66
 
67
- define_method("#{effect}!".to_sym) do |string = nil, &block|
67
+ define_method(:"#{effect}!") do |string = nil, &block|
68
68
  surround_with_color(effect:, color_self: false, string:, &block)
69
69
  end
70
70
  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.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: 2023-08-24 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.13
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
  ...