colorize 0.7.1 → 0.7.2

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: e5c5eebff741d463a64631a114639080a071daa5
4
- data.tar.gz: bcf92072d401eff652efd8b2535383b394e972f1
3
+ metadata.gz: 08a6c1aa3ca40c8747c5fb2f38e09e1917226416
4
+ data.tar.gz: faf34c7659e88abdf6eeab8d3edd2f4e7cc17cbc
5
5
  SHA512:
6
- metadata.gz: 7d2a1a40d37e2c928c38f0209beed07cd22f2f009aebf6c4da8d5d18b4d2e8a92e7d41ffbbcde018b78416a796dddfe0404aee38e7b892f1affafc4cb1ed9611
7
- data.tar.gz: eddf5713fb76550945849f69fa9eefe3a4e50b82d97885838cb26e578098cab12852dc034e6ecb091cab27235c3772df182f552ae4123165d1510c6649952f16
6
+ metadata.gz: 730baa609cc36db7c9e414a3496adbc8cccdda637a9baaf73103f72ec377ef3a99e9e550bf9ec08f88ac27926d491e62cfd9c4d4cf488984c66d76d9aa57d965
7
+ data.tar.gz: b194e1444dff7a82ea0e24ade7627c215549136b8816da892a268f988af57e10f70eade5e3add0f8f730a197a50e776414ebf8740c8b2ea5287455aeba29fd48
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.7.2 / 2014-04-08
2
+ * tests cleanups
3
+ * gem release date fixed
4
+
5
+ == 0.7.1 / 2014-04-02
6
+ * handling wrong color values
7
+
1
8
  == 0.7.0 / 2014-03-12
2
9
  * refactored to use regexp pattern matching
3
10
  * works with frozen strings
@@ -1,11 +1,11 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'colorize'
3
- s.version = '0.7.1'
3
+ s.version = '0.7.2'
4
4
 
5
5
  s.authors = ['fazibear']
6
6
  s.email = 'fazibear@gmail.com'
7
7
 
8
- s.date = '2012-09-15'
8
+ s.date = Time.now.strftime("%Y-%m-%d")
9
9
 
10
10
  s.homepage = 'http://github.com/fazibear/colorize'
11
11
  s.description = 'Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences.'
@@ -22,10 +22,8 @@ Gem::Specification.new do |s|
22
22
  'colorize.gemspec',
23
23
  'lib/colorize.rb',
24
24
  'test/test_colorize.rb',
25
- 'test/test_helper.rb'
26
25
  ]
27
26
  s.test_files = [
28
- 'test/test_helper.rb',
29
27
  'test/test_colorize.rb'
30
28
  ]
31
29
  end
@@ -78,7 +78,7 @@ class String
78
78
  match[0] = MODES[params[:mode]] if params[:mode] && MODES[params[:mode]]
79
79
  match[1] = COLORS[params[:color]] + COLOR_OFFSET if params[:color] && COLORS[params[:color]]
80
80
  match[2] = COLORS[params[:background]] + BACKGROUND_OFFSET if params[:background] && COLORS[params[:background]]
81
- elsif (params.instance_of?(Symbol)) && params
81
+ elsif (params.instance_of?(Symbol))
82
82
  match[1] = COLORS[params] + COLOR_OFFSET if params && COLORS[params]
83
83
  end
84
84
 
@@ -1,66 +1,84 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/colorize'
2
3
 
3
4
  class TestColorize < Test::Unit::TestCase
4
5
  def test_blue_symbol
5
- assert 'This is blue'.colorize(:blue) == "\e[0;34;49mThis is blue\e[0m"
6
+ assert_equal 'This is blue'.colorize(:blue),
7
+ "\e[0;34;49mThis is blue\e[0m"
6
8
  end
7
9
 
8
10
  def test_incorrect_symbol
9
- assert 'This is incorrect color'.colorize(:bold) == "\e[0;39;49mThis is incorrect color\e[0m"
11
+ assert_equal 'This is incorrect color'.colorize(:bold),
12
+ "\e[0;39;49mThis is incorrect color\e[0m"
10
13
  end
11
-
14
+
12
15
  def test_incorrect_hash
13
- assert 'This is incorrect color'.colorize(:color => :bold) == "\e[0;39;49mThis is incorrect color\e[0m"
14
- assert 'This is incorrect color'.colorize(:mode => :green) == "\e[0;39;49mThis is incorrect color\e[0m"
15
- assert 'This is incorrect color'.colorize(:background => :bold) == "\e[0;39;49mThis is incorrect color\e[0m"
16
+ assert_equal 'This is incorrect color'.colorize(:color => :bold),
17
+ "\e[0;39;49mThis is incorrect color\e[0m"
18
+
19
+ assert_equal 'This is incorrect color'.colorize(:mode => :green),
20
+ "\e[0;39;49mThis is incorrect color\e[0m"
21
+
22
+ assert_equal 'This is incorrect color'.colorize(:background => :bold),
23
+ "\e[0;39;49mThis is incorrect color\e[0m"
16
24
  end
17
25
 
18
26
  def test_blue_hash
19
- assert 'This is also blue'.colorize(:color => :blue) == "\e[0;34;49mThis is also blue\e[0m"
27
+ assert_equal 'This is also blue'.colorize(:color => :blue),
28
+ "\e[0;34;49mThis is also blue\e[0m"
20
29
  end
21
30
 
22
31
  def test_light_blue_symbol
23
- assert 'This is light blue'.colorize(:light_blue) == "\e[0;94;49mThis is light blue\e[0m"
32
+ assert_equal 'This is light blue'.colorize(:light_blue),
33
+ "\e[0;94;49mThis is light blue\e[0m"
24
34
  end
25
35
 
26
36
  def test_light_blue_with_red_background_hash
27
- assert 'This is light blue with red background'.colorize(:color => :light_blue, :background => :red) == "\e[0;94;41mThis is light blue with red background\e[0m"
37
+ assert_equal 'This is light blue with red background'.colorize(:color => :light_blue, :background => :red),
38
+ "\e[0;94;41mThis is light blue with red background\e[0m"
28
39
  end
29
-
40
+
30
41
  def test_light_blue_with_red_background_symbol_and_hash
31
- assert 'This is light blue with red background'.colorize(:light_blue).colorize(:background => :red) == "\e[0;94;41mThis is light blue with red background\e[0m"
42
+ assert_equal 'This is light blue with red background'.colorize(:light_blue).colorize(:background => :red),
43
+ "\e[0;94;41mThis is light blue with red background\e[0m"
32
44
  end
33
-
45
+
34
46
  def test_blue_with_red_background_method
35
- assert 'This is blue text on red'.blue.on_red == "\e[0;34;41mThis is blue text on red\e[0m"
47
+ assert_equal 'This is blue text on red'.blue.on_red,
48
+ "\e[0;34;41mThis is blue text on red\e[0m"
36
49
  end
37
50
 
38
51
  def test_red_with_blue_background_symbol_and_method
39
- assert 'This is red on blue'.colorize(:red).on_blue == "\e[0;31;44mThis is red on blue\e[0m"
52
+ assert_equal 'This is red on blue'.colorize(:red).on_blue,
53
+ "\e[0;31;44mThis is red on blue\e[0m"
40
54
  end
41
55
 
42
56
  def test_red_with_blue_background_and_underline_sumbol_and_methods
43
- assert 'This is red on blue and underline'.colorize(:red).on_blue.underline == "\e[4;31;44mThis is red on blue and underline\e[0m"
57
+ assert_equal 'This is red on blue and underline'.colorize(:red).on_blue.underline,
58
+ "\e[4;31;44mThis is red on blue and underline\e[0m"
44
59
  end
45
60
 
46
61
  def test_blue_with_red_background_and_blink_methods
47
- assert 'This is blue text on red'.blue.on_red.blink == "\e[5;34;41mThis is blue text on red\e[0m"
62
+ assert_equal 'This is blue text on red'.blue.on_red.blink,
63
+ "\e[5;34;41mThis is blue text on red\e[0m"
48
64
  end
49
65
 
50
66
  def test_uncolorize
51
- assert 'This is uncolorized'.blue.on_red.uncolorize == "This is uncolorized"
67
+ assert_equal 'This is uncolorized'.blue.on_red.uncolorize,
68
+ "This is uncolorized"
52
69
  end
53
70
 
54
71
  def test_colorized?
55
- assert 'Red'.red.colorized? == true
56
- assert 'Blue'.colorized? == false
57
- assert 'Green'.blue.green.uncolorize.colorized? == false
72
+ assert_equal 'Red'.red.colorized?, true
73
+ assert_equal 'Blue'.colorized?, false
74
+ assert_equal 'Green'.blue.green.uncolorize.colorized?, false
58
75
  end
59
76
 
60
77
  def test_concatenated_strings_on_green
61
- assert ('none' + 'red'.red + 'none' + 'blue'.blue + 'none').on_green == "\e[0;39;42mnone\e[0m\e[0;31;42mred\e[0m\e[0;39;42mnone\e[0m\e[0;34;42mblue\e[0m\e[0;39;42mnone\e[0m"
78
+ assert_equal ('none' + 'red'.red + 'none' + 'blue'.blue + 'none').on_green,
79
+ "\e[0;39;42mnone\e[0m\e[0;31;42mred\e[0m\e[0;39;42mnone\e[0m\e[0;34;42mblue\e[0m\e[0;39;42mnone\e[0m"
62
80
  end
63
-
81
+
64
82
  def test_concatenated_strings_uncolorize
65
83
  assert ('none' + 'red'.red + 'none' + 'blue'.blue + 'none').uncolorize == "nonerednonebluenone"
66
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - fazibear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2012-09-15 00:00:00.000000000 Z
11
+ date: 2014-04-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby String class extension. Adds methods to set text color, background
14
14
  color and, text effects on ruby console and command line output, using ANSI escape
@@ -25,7 +25,6 @@ files:
25
25
  - colorize.gemspec
26
26
  - lib/colorize.rb
27
27
  - test/test_colorize.rb
28
- - test/test_helper.rb
29
28
  homepage: http://github.com/fazibear/colorize
30
29
  licenses:
31
30
  - GPL-2
@@ -51,5 +50,4 @@ signing_key:
51
50
  specification_version: 4
52
51
  summary: Add color methods to String class
53
52
  test_files:
54
- - test/test_helper.rb
55
53
  - test/test_colorize.rb
@@ -1,2 +0,0 @@
1
- require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/colorize'