paint 2.2.1 → 2.3.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: 135bf13e5c9d57769e3e312c0dd5baa485a42e493b70d1c8a1eda802af1d78b2
4
- data.tar.gz: 49651386bc399d9156936fabab7a046e311812a1ab14ecd682ca6d0e61f83caf
3
+ metadata.gz: 7658c217a56bead27d98cc354dc18b2ab31a9f0344d11982785b9a21916b042b
4
+ data.tar.gz: 5c94832fd5eae488e54c1bd010247d7d6c65a8b673982783c8bc95207f23d7ab
5
5
  SHA512:
6
- metadata.gz: 28b1dff99750f9625c3d2d40b7521911840192483779fd0b7798fda970e8b6ce1de471e6cc6288d6053bddd9fb81b6a5a999d0d82b5bdb3de53f48dbb7dd9060
7
- data.tar.gz: 6e667bd06608d7a2036369b21d73cc712467fb71f6a8c44e133f68b4ebe31b7a21cf3364ba72342e11fbe91a735f63cc7fcb62d825f696fad48643d07b53f6e5
6
+ metadata.gz: 3a685f6489ea93f5c75bff1a529c3539fef1e6285ad65c2e2fff2a08ec974eb07c70ca1f4c20cc3e5d9e32fcca89d8cf1cd309c02bbcfd4d4e5a77975b479daf
7
+ data.tar.gz: 7d91307247aff2335d72f60e71ec00dcf00db66d3bfd2bd26124ddc0bc9387f3b4c2e96aa6cbabafde63dc46de3193b831b020f4e8a4ec88e7e574a2129912c7
@@ -0,0 +1,68 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ main ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ main ]
20
+
21
+ jobs:
22
+ analyze:
23
+ name: Analyze
24
+ runs-on: ubuntu-latest
25
+ permissions:
26
+ actions: read
27
+ contents: read
28
+ security-events: write
29
+
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ language: [ 'ruby' ]
34
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
35
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
36
+
37
+ steps:
38
+ - name: Checkout repository
39
+ uses: actions/checkout@v2
40
+
41
+ # Initializes the CodeQL tools for scanning.
42
+ - name: Initialize CodeQL
43
+ uses: github/codeql-action/init@v1
44
+ with:
45
+ languages: ${{ matrix.language }}
46
+ # If you wish to specify custom queries, you can do so here or in a config file.
47
+ # By default, queries listed here will override any specified in a config file.
48
+ # Prefix the list here with "+" to use these queries and those in the config file.
49
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
50
+
51
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52
+ # If this step fails, then you should remove it and run the build manually (see below)
53
+ - name: Autobuild
54
+ uses: github/codeql-action/autobuild@v1
55
+
56
+ # ℹ️ Command-line programs to run using the OS shell.
57
+ # 📚 https://git.io/JvXDl
58
+
59
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60
+ # and modify them (or add more) to build your code if your project
61
+ # uses a compiled language
62
+
63
+ #- run: |
64
+ # make bootstrap
65
+ # make release
66
+
67
+ - name: Perform CodeQL Analysis
68
+ uses: github/codeql-action/analyze@v1
@@ -0,0 +1,50 @@
1
+ name: Test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ name: Ruby ${{ matrix.ruby }} (${{ matrix.os }})
8
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
9
+ strategy:
10
+ matrix:
11
+ ruby:
12
+ - 3.1
13
+ - 3.0
14
+ - 2.7
15
+ - jruby-9.3.6.0
16
+ - truffleruby-22.1.0
17
+ os:
18
+ - ubuntu-latest
19
+ - macos-latest
20
+ runs-on: ${{matrix.os}}
21
+ steps:
22
+ - uses: actions/checkout@v2
23
+ - name: Set up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: ${{matrix.ruby}}
27
+ bundler-cache: true
28
+ - name: Run tests
29
+ run: bundle exec rake
30
+
31
+ test-windows:
32
+ name: Ruby ${{ matrix.ruby }} (windows-latest)
33
+ if: "!contains(github.event.head_commit.message, '[skip ci]')"
34
+ strategy:
35
+ matrix:
36
+ ruby:
37
+ - 3.1
38
+ - 3.0
39
+ - 2.7
40
+ runs-on: windows-latest
41
+ steps:
42
+ - uses: actions/checkout@v2
43
+ - name: Set up Ruby
44
+ uses: ruby/setup-ruby@v1
45
+ with:
46
+ ruby-version: ${{matrix.ruby}}
47
+ bundler-cache: true
48
+ - run: cinst ansicon
49
+ - name: Run tests
50
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # CHANGELOG
2
2
 
3
+ ### 2.3.0
4
+
5
+ #### Paint.%() now returns different escape sequences!
6
+
7
+ * Fix #30: Color/effect nesting restores the parent level correctly. More
8
+ verbose ASCII escape sequences are generated to ensure this.
9
+
10
+ #### Other Fixes
11
+
12
+ * Fix #31: Make paint work with frozen strings enabled
13
+ * Also make paint library itself frozen
14
+ * Fix #29: Update dev dependencies
15
+
3
16
  ### 2.2.1
4
17
 
5
18
  * Explicitly set mac's Terminal.app to 256 colors only, fixes #28
data/MIT-LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT LICENSE
2
2
 
3
- Copyright (c) 2011-2020 Jan Lelis
3
+ Copyright (c) 2011-2021 Jan Lelis
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # Ruby Paint [<img src="https://badge.fury.io/rb/paint.svg" />](https://badge.fury.io/rb/paint) [<img src="https://travis-ci.org/janlelis/paint.svg" />](https://travis-ci.org/janlelis/paint)
1
+ # Ruby Paint [<img src="https://badge.fury.io/rb/paint.svg" />](https://badge.fury.io/rb/paint) [<img src="https://github.com/janlelis/paint/workflows/Test/badge.svg" />](https://github.com/janlelis/paint/actions?query=workflow%3ATest)
2
2
 
3
3
  Paint creates terminal colors and effects for you. It combines the strengths of **term-ansicolor**, **rainbow**, and similar projects into a simple to use, however still flexible terminal colors gem with no core extensions by default.
4
4
 
5
- Supported Rubies: **2.7**, **2.6**, **2.5**
5
+ Supported Rubies: **3.1**, **3.0**, **2.7**
6
6
 
7
- Unsupported, but might still work: **2.4**, **2.3**, **2.2**, **2.1**, **2.0**, **1.9**
7
+ Unsupported, but might still work: **2.6**, **2.5**, **2.4**, **2.3**, **2.2**, **2.1**, **2.0**, **1.9**
8
8
 
9
9
  ## Features
10
10
 
11
11
  * No string extensions (suitable for library development)
12
12
  * Simple API
13
- * Faster than other terminal color gems ([as of January 2020](https://gist.github.com/janlelis/91413b9295c81ee873dc))
13
+ * Faster than other terminal color gems ([as of July 2022](https://gist.github.com/janlelis/91413b9295c81ee873dc))
14
14
  * Supports *true color* or 256 colors (for capable terminals)
15
15
  * Allows you to set any terminal effects
16
16
  * `Paint.mode`: Fall-back modes for terminals with less colors, supported modes:
@@ -75,7 +75,7 @@ When you pass multiple colors, the first one is taken as foreground color and th
75
75
 
76
76
  ## Windows Support
77
77
 
78
- For ANSI support in Windows OS, you can use [ansicon](https://github.com/adoxa/ansicon) or [ConEmu](https://conemu.github.io/) or WSL(https://docs.microsoft.com/en-us/windows/wsl/install-win10).
78
+ For ANSI support in Windows OS, you can use [ansicon](https://github.com/adoxa/ansicon) or [ConEmu](https://conemu.github.io/) or [WSL](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
79
79
 
80
80
  ## `Paint.mode`
81
81
 
@@ -157,9 +157,11 @@ From time to time, you might find yourself in a situation where you want to colo
157
157
  Paint%['Yellow string with a %{blue_text} in it', :yellow,
158
158
  blue_text: ["blue text", :blue]
159
159
  ]
160
- # => "\e[33mYellow string with a \e[34mblue text\e[33m in it\e[0m"
160
+ # => "\e[33mYellow string with a \e[34mblue text\e[0m\e[33m in it\e[0m"
161
161
  ```
162
162
 
163
+ Please note that the resulting ASCII escape sequence can be quite verbose since it restores the parent context after the substitution.
164
+
163
165
  ## Utilities
164
166
 
165
167
  The `Paint.random` method generates a random ANSI color you can pass into `Paint.[]`:
@@ -188,7 +190,7 @@ There is an extension gem available which allows you to define custom color defi
188
190
 
189
191
  ## J-_-L
190
192
 
191
- Copyright (c) 2011-2020 Jan Lelis <https://janlelis.com>, released under the
193
+ Copyright (c) 2011-2021 Jan Lelis <https://janlelis.com>, released under the
192
194
  MIT license.
193
195
 
194
196
  Thank you to [rainbow](https://github.com/sickill/rainbow) and [term-ansicolor](https://github.com/flori/term-ansicolor) for ideas and inspiration. Also, a lot of thanks to all the [contributors](https://github.com/janlelis/paint/contributors)!
data/Rakefile CHANGED
@@ -52,3 +52,8 @@ task :rainbow256 do
52
52
  }
53
53
  puts
54
54
  end
55
+
56
+ desc "Start console session with libraries loaded"
57
+ task :irb do
58
+ sh "irb -I ./lib -r paint -r paint/shortcuts"
59
+ end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paint
2
4
  # Clears all colors
3
- NOTHING = "\033[0m".freeze
5
+ NOTHING = "\033[0m"
4
6
 
5
7
  # Number of possible colors in TRUE COLOR mode
6
8
  TRUE_COLOR = 0xFFFFFF
data/lib/paint/pa.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'paint'
2
4
 
3
5
  module Kernel
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "zlib"
2
4
 
3
5
  module Paint
data/lib/paint/util.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Paint
2
4
  # Standalone helpers which add functionality you sometimes need when working with terminal colors
3
5
  class << self
data/lib/paint/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Paint
4
- VERSION = "2.2.1"
4
+ VERSION = "2.3.0"
5
5
  end
data/lib/paint.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'paint/version'
2
4
  require_relative 'paint/constants'
3
5
  require_relative 'paint/util'
@@ -25,9 +27,11 @@ module Paint
25
27
  # Substitutions & Nesting
26
28
  if substitutions
27
29
  substitutions.each{ |key, value|
28
- string.gsub!(
30
+ string = string.gsub(
29
31
  "%{#{key}}",
30
- (value.is_a?(Array) ? self.%(value, current_color) : value.to_s)
32
+ value.is_a?(Array) ?
33
+ self.%(value, clear_color + current_color) :
34
+ value.to_s
31
35
  )
32
36
  }
33
37
  end
data/paint.gemspec CHANGED
@@ -11,12 +11,14 @@ Gem::Specification.new do |s|
11
11
  s.summary = "Terminal painter!"
12
12
  s.description = "Terminal painter with RGB and 256 (fallback) color and terminal effects support. No string extensions! Usage: Paint['string', :red, :bright]"
13
13
  s.license = 'MIT'
14
+ s.metadata = { "rubygems_mfa_required" => "true" }
14
15
 
15
16
  s.files = %w[
16
17
  paint.gemspec
17
18
  Rakefile
18
19
  .rspec
19
- .travis.yml
20
+ .github/workflows/test.yml
21
+ .github/workflows/codeql-analysis.yml
20
22
  lib/paint.rb
21
23
  lib/paint/pa.rb
22
24
  lib/paint/rgb_colors.rb
@@ -32,12 +34,7 @@ Gem::Specification.new do |s|
32
34
  ]
33
35
 
34
36
  s.required_ruby_version = '>= 1.9.3'
35
- s.add_development_dependency 'rspec', '~> 3.2'
36
- s.add_development_dependency 'rake', '~> 12.3'
37
- s.add_development_dependency 'benchmark-ips', '~> 2.7'
38
- s.add_development_dependency 'rainbow', '~> 3.0'
39
- s.add_development_dependency 'term-ansicolor', '~> 1.7'
40
- s.add_development_dependency 'ansi', '~> 1.5'
41
- s.add_development_dependency 'hansi', '~> 0.2'
42
- s.add_development_dependency 'pastel', '~> 0.7'
37
+ s.add_development_dependency 'rspec', '~> 3.11'
38
+ s.add_development_dependency 'rake', '~> 13.0'
39
+ s.add_development_dependency 'benchmark-ips', '~> 2.10'
43
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paint
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Lelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,112 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
19
+ version: '3.11'
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
- version: '3.2'
26
+ version: '3.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.3'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '12.3'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: benchmark-ips
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.7'
47
+ version: '2.10'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.7'
55
- - !ruby/object:Gem::Dependency
56
- name: rainbow
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: term-ansicolor
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.7'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.7'
83
- - !ruby/object:Gem::Dependency
84
- name: ansi
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.5'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '1.5'
97
- - !ruby/object:Gem::Dependency
98
- name: hansi
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '0.2'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '0.2'
111
- - !ruby/object:Gem::Dependency
112
- name: pastel
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.7'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '0.7'
54
+ version: '2.10'
125
55
  description: 'Terminal painter with RGB and 256 (fallback) color and terminal effects
126
56
  support. No string extensions! Usage: Paint[''string'', :red, :bright]'
127
57
  email:
@@ -133,8 +63,9 @@ extra_rdoc_files:
133
63
  - CHANGELOG.md
134
64
  - MIT-LICENSE.txt
135
65
  files:
66
+ - ".github/workflows/codeql-analysis.yml"
67
+ - ".github/workflows/test.yml"
136
68
  - ".rspec"
137
- - ".travis.yml"
138
69
  - CHANGELOG.md
139
70
  - MIT-LICENSE.txt
140
71
  - README.md
@@ -150,7 +81,8 @@ files:
150
81
  homepage: https://github.com/janlelis/paint
151
82
  licenses:
152
83
  - MIT
153
- metadata: {}
84
+ metadata:
85
+ rubygems_mfa_required: 'true'
154
86
  post_install_message:
155
87
  rdoc_options: []
156
88
  require_paths:
@@ -166,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
98
  - !ruby/object:Gem::Version
167
99
  version: '0'
168
100
  requirements: []
169
- rubygems_version: 3.1.2
101
+ rubygems_version: 3.3.7
170
102
  signing_key:
171
103
  specification_version: 4
172
104
  summary: Terminal painter!
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- sudo: false
2
- language: ruby
3
-
4
- rvm:
5
- - 2.7
6
- - 2.6
7
- - 2.5
8
- - 2.4
9
- - 2.3
10
- - 2.2
11
- - 2.1
12
- - 2.0
13
- - 1.9.3
14
- - ruby-head
15
- - jruby-head
16
- - jruby-9.2.9.0
17
- - truffleruby
18
-
19
- matrix:
20
- allow_failures:
21
- - rvm: jruby-head
22
- - rvm: 2.3
23
- - rvm: 2.2
24
- - rvm: 2.1
25
- - rvm: 2.0
26
- - rvm: 1.9.3
27
- - rvm: truffleruby