paint 1.0.0 → 1.0.1

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
2
  SHA1:
3
- metadata.gz: 676c869edf2a0dd0a45112ae34b5efe40253383b
4
- data.tar.gz: 36c67ac1e7d1a6251203b426bacd00d5827f2d64
3
+ metadata.gz: 63ed011bd7330b8eeb09f86bf322dd6264fb35eb
4
+ data.tar.gz: 8263d88278c4de5090b21c30fb97ab6e9351979c
5
5
  SHA512:
6
- metadata.gz: 7020dd7dec634ef466ac98c1366e413b5d1c0a728c0bc954f2c57ae47e5c69c2e365bebc13a80ed916e90e74fceb6f502c1b5d5d9bd8f1cd4508273ae9542e70
7
- data.tar.gz: 3575d22aa3cc18df1a1877a2472f43ccdd43f87f99c0d996de0e67f2ba94f819733758206748028b63810ce0aa8c4181346960c9df48661176b3be30b6d89d7f
6
+ metadata.gz: a1d6c016324fedf50b5a45955fbd899eb7f18c3f198d93f949b8de0c00543d9646d78e6f763c584b6b0f5e73b1ecfee08615bb4bf16be1f5f407f3e225d7e400
7
+ data.tar.gz: 9ee54e34fb37fe00208432cc33a3c3332f3ec2c9708d5f19992286136774c86e5a118cdfc0ec3deddbc704e305b2ec8f84e4b676ee9814e1496f9d7bbb1259ad
@@ -1,10 +1,12 @@
1
+ sudo: false
1
2
  language: ruby
2
3
 
3
4
  rvm:
4
- - ruby-head
5
+ - 2.3.0
5
6
  - 2.2
6
7
  - 2.1
7
8
  - 2.0
9
+ - ruby-head
8
10
  - rbx-2
9
11
  - jruby-head
10
12
  - jruby-9000
@@ -1,3 +1,6 @@
1
+ === 1.0.1
2
+ * Fix case of string arguments getting mutated (see gh#14)
3
+
1
4
  === 1.0.0
2
5
  * Improved performance
3
6
  * Option for :random colors removed (see readme)
@@ -1,6 +1,6 @@
1
1
  The MIT LICENSE
2
2
 
3
- Copyright (c) 2011-2015 Jan Lelis
3
+ Copyright (c) 2011-2016 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
@@ -4,10 +4,10 @@ Paint manages terminal colors and effects for you. It combines the strengths of
4
4
 
5
5
  == Features
6
6
  * No string extensions (suitable for library development)
7
+ * Simple API
8
+ * Faster than other terminal color gems ({as of October 2015}[https://gist.github.com/janlelis/91413b9295c81ee873dc])
7
9
  * Supports setting 256 colors (for capable terminals)
8
- * Supports setting any effects (although most terminals won't support it)
9
- * Simple to use
10
- * Faster than most similar gems due to caching
10
+ * Supports setting any terminal effects
11
11
  * Fall-back modes for non-256-color terminals (<tt>Paint.mode</tt>), supported modes:
12
12
  * 256 colors
13
13
  * 16 colors (only ansi colors, combined with bright effect)
@@ -26,7 +26,7 @@ In Ruby do:
26
26
  require 'paint'
27
27
 
28
28
  == Usage
29
- The only method you need to know to get started is: <tt>Paint.[]</tt>
29
+ The only method you need to know is: <tt>Paint.[]</tt>
30
30
 
31
31
  The first argument given to <tt>Paint.[]</tt> is the string to colorize (if the object is not a string, <tt>to_s</tt> will be called on it). The other arguments describe how to modify/colorize the string. Let's learn by example:
32
32
 
@@ -106,8 +106,7 @@ You can choose between four ways to use <tt>Paint.[]</tt> by setting <tt>Paint.m
106
106
 
107
107
  Paint tries to automatically detect the proper value, please open an issue if <tt>Paint.detect_mode</tt> yields a wrong value for you.
108
108
 
109
- == Random ANSI colors
110
-
109
+ == Random ANSI Colors
111
110
  With 1.0, the :random feature was removed, because it interfered with the caching mechanism. If you still need it, you will have to workaround by generating random colors yourself, before passing them into the Paint method:
112
111
 
113
112
  Paint['Ruby', Paint.random] # get one of eight random ansi foreground colors
@@ -128,10 +127,6 @@ There is an extension gem available that allows you to define custom color short
128
127
 
129
128
  == J-_-L
130
129
 
131
- Copyright (c) 2011-2015 Jan Lelis <http://janlelis.com>, released under the MIT license.
130
+ Copyright (c) 2011-2016 Jan Lelis <http://janlelis.com>, released under the MIT license.
132
131
 
133
- Mainly influenced by rainbow[https://github.com/sickill/rainbow] and {term-ansicolor}[https://github.com/flori/term-ansicolor]. Contributors[https://github.com/janlelis/paint/contributors]:
134
- * {CyberShadow}[https://github.com/CyberShadow]
135
- * {korun}[https://github.com/korun]
136
- * {mhaylock}[https://github.com/mhaylock]
137
- * {korny}[https://github.com/rubychan]
132
+ Mainly influenced by rainbow[https://github.com/sickill/rainbow] and {term-ansicolor}[https://github.com/flori/term-ansicolor]. Also see the list of contributors[https://github.com/janlelis/paint/contributors]
data/Rakefile CHANGED
@@ -41,64 +41,5 @@ end
41
41
 
42
42
  desc "Run a Benchmark"
43
43
  task :benchmark do
44
- require 'benchmark'
45
- require 'term/ansicolor'
46
- class String
47
- include Term::ANSIColor
48
- end
49
-
50
- require 'rainbow'
51
- require_relative 'lib/paint'
52
-
53
- n = 100_000
54
- colors = [:black, :red, :green, :yellow, :blue, :magenta, :cyan]
55
- def colors.next
56
- @index ||= 0
57
- at((@index += 1) % size)
58
- end
59
- Benchmark.bmbm 30 do |results|
60
- string = 'Ruby is awesome!'
61
-
62
- results.report 'cycle' do
63
- n.times do
64
- colors.next
65
- end
66
- end
67
-
68
- results.report 'paint' do
69
- n.times do
70
- Paint[string, colors.next]
71
- end
72
- end
73
-
74
- results.report 'term-ansicolor' do
75
- n.times do
76
- string.send(colors.next)
77
- end
78
- end
79
-
80
- results.report 'rainbow' do
81
- n.times do
82
- Rainbow(string).color(colors.next)
83
- end
84
- end
85
-
86
- results.report 'paint with background' do
87
- n.times do
88
- Paint[string, colors.next, colors.next]
89
- end
90
- end
91
-
92
- results.report 'term-ansicolor with background' do
93
- n.times do
94
- string.send(colors.next).send("on_#{colors.next}")
95
- end
96
- end
97
-
98
- results.report 'rainbow with background' do
99
- n.times do
100
- Rainbow(string).color(colors.next).background(colors.next)
101
- end
102
- end
103
- end
44
+ ruby 'benchmark.rb'
104
45
  end
@@ -173,8 +173,8 @@ module Paint
173
173
  end
174
174
 
175
175
  # Creates 256-compatible color from a html-like color string
176
- def hex(string, background = false)
177
- string.tr! '#',''
176
+ def hex(source, background = false)
177
+ string = source.tr '#',''
178
178
  color_code = if string.size == 6
179
179
  string.each_char.each_slice(2).map{ |hex_color| hex_color.join.to_i(16) }
180
180
  else
@@ -1,3 +1,3 @@
1
1
  module Paint
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -34,6 +34,10 @@ Gem::Specification.new do |s|
34
34
  s.requirements = ['Windows: ansicon (https://github.com/adoxa/ansicon) or ConEmu (http://code.google.com/p/conemu-maximus5)']
35
35
  s.add_development_dependency 'rspec', '~> 3.2'
36
36
  s.add_development_dependency 'rake', '~> 10.4'
37
- s.add_development_dependency 'rainbow', '1.1.4'
38
- s.add_development_dependency 'term-ansicolor'
37
+ s.add_development_dependency 'benchmark-ips', '~> 2.3'
38
+ s.add_development_dependency 'rainbow', '~> 2.0'
39
+ s.add_development_dependency 'term-ansicolor', '~> 1.3'
40
+ s.add_development_dependency 'ansi', '~> 1.5'
41
+ s.add_development_dependency 'hansi', '~> 0.1'
42
+ s.add_development_dependency 'pastel', '~> 0.5'
39
43
  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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Lelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-22 00:00:00.000000000 Z
11
+ date: 2016-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -38,34 +38,90 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: benchmark-ips
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.3'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rainbow
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - '='
59
+ - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 1.1.4
61
+ version: '2.0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '='
66
+ - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 1.1.4
68
+ version: '2.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: term-ansicolor
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - ">="
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.3'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.3'
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
+ - - "~>"
60
102
  - !ruby/object:Gem::Version
61
- version: '0'
103
+ version: '0.1'
62
104
  type: :development
63
105
  prerelease: false
64
106
  version_requirements: !ruby/object:Gem::Requirement
65
107
  requirements:
66
- - - ">="
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.1'
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.5'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
67
123
  - !ruby/object:Gem::Version
68
- version: '0'
124
+ version: '0.5'
69
125
  description: 'Terminal painter: No string extensions / 256 color support / effect
70
126
  support. Usage: Paint[''string'', :red, :bright]'
71
127
  email: mail@janlelis.de
@@ -110,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
166
  requirements:
111
167
  - 'Windows: ansicon (https://github.com/adoxa/ansicon) or ConEmu (http://code.google.com/p/conemu-maximus5)'
112
168
  rubyforge_project:
113
- rubygems_version: 2.4.6
169
+ rubygems_version: 2.5.1
114
170
  signing_key:
115
171
  specification_version: 4
116
172
  summary: Terminal painter!