dye 0.1.3 → 0.1.4

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.
Files changed (6) hide show
  1. data/README.rdoc +5 -12
  2. data/VERSION +1 -1
  3. data/dye.gemspec +13 -18
  4. data/lib/dye.rb +1 -0
  5. metadata +36 -38
  6. data/Rakefile +0 -60
@@ -1,4 +1,4 @@
1
- = colorer
1
+ = dye
2
2
 
3
3
  Easy ANSI code coloring for strings in libraries.
4
4
 
@@ -6,7 +6,7 @@ Easy ANSI code coloring for strings in libraries.
6
6
 
7
7
  require 'dye'
8
8
 
9
- # you can use directly use Dye.dye for basic styles
9
+ # you can directly use Dye.dye for basic styles
10
10
  Dye.dye "a red bold underlined text on white background", :red, :bold, :underline, :onwhite
11
11
 
12
12
  # you can define custom styles in your classes or modules
@@ -51,13 +51,6 @@ Easy ANSI code coloring for strings in libraries.
51
51
  # !strict_ansi?
52
52
  Dye.sgr(:cyan, :bold) #=> "\e[36m\e[1m"
53
53
 
54
- === Feedback!!!
55
-
56
- This is feedback-driven software. Just send me a line about you and/or what you think about it:
57
- that will be a wonderful contribution that will help me to keep improving (and documenting) this software.
58
-
59
- My email address is ddnexus at gmail.com ... waiting for your. Ciao.
60
-
61
54
  == Features
62
55
 
63
56
  * Does not define methods in String
@@ -101,8 +94,8 @@ The Dye gem instead does not have the same problem, although its syntax is not s
101
94
 
102
95
  === Custom Styles
103
96
 
104
- You can define your own custom styles by aggregating any basic styles names,
105
- besides can also add native SGR (Select Graphic Rendition) parameters (0..109) to any style::
97
+ You can define your own custom styles by aggregating any basic styles names, besides can also add native SGR
98
+ (Select Graphic Rendition) parameters (0..109) to any style:
106
99
 
107
100
  custom_styles = { :errorize => [ :red, :bold, :underline ],
108
101
  :okize => [ :green, :bold ],
@@ -139,4 +132,4 @@ by explicitly setting it:
139
132
 
140
133
  == Copyright
141
134
 
142
- Copyright (c) 2010-2011 Domizio Demichelis. See LICENSE for details.
135
+ Copyright (c) 2010-2012 Domizio Demichelis. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
@@ -1,26 +1,21 @@
1
- name = File.basename( __FILE__, '.gemspec' )
2
1
  version = File.read(File.expand_path('../VERSION', __FILE__)).strip
3
2
  require 'date'
4
3
 
5
4
  Gem::Specification.new do |s|
6
-
7
- s.authors = ["Domizio Demichelis"]
8
- s.email = 'dd.nexus@gmail.com'
9
- s.homepage = 'http://github.com/ddnexus/dye'
10
- s.summary = 'Easy ANSI code coloring for strings in libraries'
11
- s.description = 'Dye adds the basic ANSI styles to any string, allowing also to define your own stiles'
12
-
13
- s.add_development_dependency('irt', [">= 1.1.2"])
14
-
15
- s.files = `git ls-files -z`.split("\0")
16
-
17
- s.name = name
18
- s.version = version
19
- s.date = Date.today.to_s
20
-
5
+ s.name = 'dye'
6
+ s.authors = ["Domizio Demichelis"]
7
+ s.email = 'dd.nexus@gmail.com'
8
+ s.homepage = 'http://github.com/ddnexus/dye'
9
+ s.summary = 'Easy ANSI code coloring for strings in libraries'
10
+ s.description = 'Dye adds the basic ANSI styles to any string, allowing also to define your own stiles'
11
+ s.extra_rdoc_files = ["README.rdoc"]
12
+ s.require_paths = ["lib"]
13
+ s.files = `git ls-files -z`.split("\0")
14
+ s.version = version
15
+ s.date = Date.today.to_s
21
16
  s.required_rubygems_version = ">= 1.3.6"
22
- s.rdoc_options = ["--charset=UTF-8"]
23
- s.require_paths = ["lib"]
17
+ s.rdoc_options = ["--charset=UTF-8"]
24
18
 
19
+ s.add_development_dependency('irt', [">= 1.1.2"])
25
20
  end
26
21
 
data/lib/dye.rb CHANGED
@@ -61,6 +61,7 @@ module Dye
61
61
  end
62
62
 
63
63
  def strip_ansi(string)
64
+ return '' if string.nil?
64
65
  string.gsub(/\e\[[\d;]+m/, '')
65
66
  end
66
67
 
metadata CHANGED
@@ -1,42 +1,43 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dye
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
4
5
  prerelease:
5
- version: 0.1.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Domizio Demichelis
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-02-17 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-07-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: irt
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
24
21
  version: 1.1.2
25
22
  type: :development
26
- version_requirements: *id001
27
- description: Dye adds the basic ANSI styles to any string, allowing also to define your own stiles
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.1.2
30
+ description: Dye adds the basic ANSI styles to any string, allowing also to define
31
+ your own stiles
28
32
  email: dd.nexus@gmail.com
29
33
  executables: []
30
-
31
34
  extensions: []
32
-
33
- extra_rdoc_files: []
34
-
35
- files:
35
+ extra_rdoc_files:
36
+ - README.rdoc
37
+ files:
36
38
  - .gitignore
37
39
  - LICENSE
38
40
  - README.rdoc
39
- - Rakefile
40
41
  - VERSION
41
42
  - dye.gemspec
42
43
  - lib/dye.rb
@@ -46,33 +47,30 @@ files:
46
47
  - test/module.irt
47
48
  - test/raw_sgr.irt
48
49
  - test/sgr.irt
49
- has_rdoc: true
50
50
  homepage: http://github.com/ddnexus/dye
51
51
  licenses: []
52
-
53
52
  post_install_message:
54
- rdoc_options:
53
+ rdoc_options:
55
54
  - --charset=UTF-8
56
- require_paths:
55
+ require_paths:
57
56
  - lib
58
- required_ruby_version: !ruby/object:Gem::Requirement
57
+ required_ruby_version: !ruby/object:Gem::Requirement
59
58
  none: false
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: "0"
64
- required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
64
  none: false
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
69
68
  version: 1.3.6
70
69
  requirements: []
71
-
72
70
  rubyforge_project:
73
- rubygems_version: 1.5.0
71
+ rubygems_version: 1.8.24
74
72
  signing_key:
75
73
  specification_version: 3
76
74
  summary: Easy ANSI code coloring for strings in libraries
77
75
  test_files: []
78
-
76
+ has_rdoc:
data/Rakefile DELETED
@@ -1,60 +0,0 @@
1
- name = 'dye'
2
-
3
- def ensure_clean(action, force=false)
4
- if !force && ! `git status -s`.empty?
5
- puts <<-EOS.gsub(/^ {6}/, '')
6
- Rake task aborted: the working tree is dirty!
7
- If you know what you are doing you can use \`rake #{action}[force]\`"
8
- EOS
9
- exit(1)
10
- end
11
- end
12
-
13
- desc "Install the gem"
14
- task :install, :force do |t, args|
15
- ensure_clean(:install, args.force)
16
- orig_version = version = File.read('VERSION').strip
17
- begin
18
- commit_id = `git log -1 --format="%h" HEAD`.strip
19
- version = "#{orig_version}.#{commit_id}"
20
- File.open('VERSION', 'w') {|f| f.puts version }
21
- gem_name = "#{name}-#{version}.gem"
22
- sh %(gem build #{name}.gemspec)
23
- sh %(gem install #{gem_name} --local --no-rdoc --no-ri)
24
- puts <<-EOS.gsub(/^ {6}/, '')
25
-
26
- *******************************************************************************
27
- * NOTICE *
28
- *******************************************************************************
29
- * The version id of locally installed gems is comparable to a --pre version: *
30
- * i.e. it is alphabetically ordered (not numerically ordered), besides it *
31
- * includes the sah1 commit id which is not aphabetically ordered, so be sure *
32
- * your application picks the version you really intend to use *
33
- *******************************************************************************
34
-
35
- EOS
36
- ensure
37
- remove_entry_secure gem_name, true
38
- File.open('VERSION', 'w') {|f| f.puts orig_version }
39
- end
40
- end
41
-
42
- desc %(Remove all the "#{name}" installed gems and executables and install this version)
43
- task :clean_install, :force do |t, args|
44
- ensure_clean(:install, args.force)
45
- sh %(gem uninstall #{name} --all --ignore-dependencies --executables)
46
- Rake::Task['install'].invoke(args.force)
47
- end
48
-
49
- desc "Push the gem to rubygems.org"
50
- task :push, :force do |t, args|
51
- begin
52
- ensure_clean(:push, args.force)
53
- version = File.read('VERSION').strip
54
- gem_name = "#{name}-#{version}.gem"
55
- sh %(gem build #{name}.gemspec)
56
- sh %(gem push #{gem_name})
57
- ensure
58
- remove_entry_secure gem_name, true
59
- end
60
- end