colorer 0.5.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.1
data/colorer.gemspec CHANGED
@@ -1,5 +1,6 @@
1
1
  name = File.basename( __FILE__, '.gemspec' )
2
2
  version = File.read(File.expand_path('../VERSION', __FILE__)).strip
3
+ require 'date'
3
4
 
4
5
  Gem::Specification.new do |s|
5
6
 
@@ -9,7 +10,7 @@ Gem::Specification.new do |s|
9
10
  s.summary = 'Easy ANSI code coloring for strings'
10
11
  s.description = 'Colorer adds the basic ANSI styles to any string, allowing also to define your own stiles'
11
12
 
12
- s.add_development_dependency('irt', [">= 0.7.7"])
13
+ s.add_development_dependency('irt', [">= 0.8.0"])
13
14
 
14
15
  s.files = `git ls-files -z`.split("\0")
15
16
 
data/lib/colorer.rb CHANGED
@@ -43,7 +43,7 @@ module Colorer
43
43
 
44
44
  extend self
45
45
 
46
- @color = true
46
+ @color = RbConfig::CONFIG['host_os'] !~ /mswin|mingw/
47
47
  attr_accessor :color
48
48
 
49
49
  def def_basic_styles(basic=true, force=false)
@@ -64,6 +64,11 @@ module Colorer
64
64
  puts " #{caller[0]}"
65
65
  end
66
66
  styles.each_pair do |meth, style|
67
+ # allows dummy methods (useful for style overriding)
68
+ if style.nil?
69
+ String.class_eval { define_method(meth) { self } }
70
+ next
71
+ end
67
72
  style = [style] unless style.is_a?(Array)
68
73
  codes = style.map do |s|
69
74
  code = s.is_a?(Symbol) ? BASIC_SGR[s] : s
data/test/basic.irt CHANGED
@@ -1,5 +1,3 @@
1
- require 'colorer'
2
-
3
1
  Colorer.def_basic_styles true, true
4
2
 
5
3
  desc "red"
data/test/custom.irt CHANGED
@@ -1,7 +1,6 @@
1
- require 'colorer'
2
-
3
- Colorer.def_custom_styles :errorize => [ :red, :bold, :underline ],
4
- :okeyze => [ :green, :bold ]
1
+ Colorer.def_custom_styles :dummy => nil,
2
+ :errorize => [ :red, :bold, :underline ],
3
+ :okeyze => [ :green, :bold ]
5
4
 
6
5
  desc "errorize"
7
6
  'errorize'.errorize
@@ -12,3 +11,8 @@ desc "okeyze"
12
11
  'okeyize'.okeyze
13
12
  puts _
14
13
  test_value_eql? "\e[0;32;1mokeyize\e[0m"
14
+
15
+ desc "allows dummy styles"
16
+ 'dummy'.dummy
17
+ puts _
18
+ test_value_eql?( "dummy" )
@@ -0,0 +1,3 @@
1
+ $:.unshift File.expand_path('../../lib', __FILE__)
2
+
3
+ require 'colorer'
@@ -1,5 +1,3 @@
1
- require 'colorer'
2
-
3
1
  Colorer.def_basic_styles([:bold, :red], true)
4
2
 
5
3
  desc "red"
data/test/sgr.irt CHANGED
@@ -1,5 +1,3 @@
1
- require 'colorer'
2
-
3
1
  Colorer.def_custom_styles :mixed_sgr => [ :bold, 7 ]
4
2
 
5
3
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 0
10
- version: 0.5.0
8
+ - 6
9
+ - 1
10
+ version: 0.6.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Domizio Demichelis
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-21 00:00:00 -04:00
18
+ date: 2010-12-25 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,12 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 13
29
+ hash: 63
30
30
  segments:
31
31
  - 0
32
- - 7
33
- - 7
34
- version: 0.7.7
32
+ - 8
33
+ - 0
34
+ version: 0.8.0
35
35
  type: :development
36
36
  version_requirements: *id001
37
37
  description: Colorer adds the basic ANSI styles to any string, allowing also to define your own stiles
@@ -51,6 +51,7 @@ files:
51
51
  - lib/colorer.rb
52
52
  - test/basic.irt
53
53
  - test/custom.irt
54
+ - test/irt_helper.rb
54
55
  - test/selected_basic.irt
55
56
  - test/sgr.irt
56
57
  has_rdoc: true