term-ansicolor 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .*.sw[pon]
2
+ Gemfile.lock
3
+ pkg
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # vim: set filetype=ruby et sw=2 ts=2:
2
+
3
+ source :rubygems
4
+
5
+ gemspec
@@ -1,10 +1,10 @@
1
- == ANSI escape sequences in Ruby
1
+ = Term::ANSIColor - ANSI escape sequences in Ruby
2
2
 
3
- === Description
3
+ == Description
4
4
 
5
5
  This library can be used to color/decolor strings using ANSI escape sequences.
6
6
 
7
- === Installation
7
+ == Installation
8
8
 
9
9
  Just type into the command line as root:
10
10
 
@@ -19,7 +19,7 @@ installs it for you:
19
19
 
20
20
  # gem install term-ansicolor
21
21
 
22
- === Download
22
+ == Download
23
23
 
24
24
  The latest version of this library can be downloaded at
25
25
 
@@ -29,7 +29,7 @@ The homepage of this library is located at
29
29
 
30
30
  * http://flori.github.com/term-ansicolor
31
31
 
32
- === Examples
32
+ == Examples
33
33
 
34
34
  Additional to the two executables cdiff and decolor, the file
35
35
  examples/example.rb in the source/gem-distribution shows how this library can
@@ -126,11 +126,11 @@ be used:
126
126
  uncolored("not red anymore".red)
127
127
  ].map { |x| x + "\n" }
128
128
 
129
- === Author
129
+ == Author
130
130
 
131
131
  Florian Frank mailto:flori@ping.de
132
132
 
133
- === License
133
+ == License
134
134
 
135
135
  This is free software; you can redistribute it and/or modify it under the
136
136
  terms of the GNU General Public License Version 2 as published by the Free
data/Rakefile CHANGED
@@ -1,88 +1,30 @@
1
- begin
2
- require 'rake/gempackagetask'
3
- rescue LoadError
4
- end
5
- require 'rake/clean'
6
- require 'rbconfig'
7
- include Config
8
-
9
- PKG_NAME = 'term-ansicolor'
10
- PKG_VERSION = File.read('VERSION').chomp
11
- PKG_FILES = FileList['**/*'].exclude(/(CVS|\.svn|pkg|coverage|doc)/)
12
- CLEAN.include 'coverage', 'doc'
13
-
14
- desc "Installing library"
15
- task :install do
16
- ruby 'install.rb'
17
- end
18
-
19
- desc "Creating documentation"
20
- task :doc do
21
- ruby 'make_doc.rb'
22
- end
23
-
24
-
25
- if defined? Gem
26
- spec = Gem::Specification.new do |s|
27
- s.name = PKG_NAME
28
- s.version = PKG_VERSION
29
- s.summary = "Ruby library that colors strings using ANSI escape sequences"
30
- s.description = ""
31
-
32
- s.files = PKG_FILES.to_a.sort
33
-
34
- s.require_path = 'lib'
35
-
36
- s.has_rdoc = true
37
- s.extra_rdoc_files << 'README'
38
- s.executables << 'cdiff' << 'decolor'
39
- s.rdoc_options << '--main' << 'README' << '--title' << 'Term::ANSIColor'
40
- s.test_files = Dir['tests/*.rb']
41
-
42
- s.author = "Florian Frank"
43
- s.email = "flori@ping.de"
44
- s.homepage = "http://flori.github.com/#{PKG_NAME}"
45
- s.rubyforge_project = PKG_NAME
46
- end
47
-
48
- Rake::GemPackageTask.new(spec) do |pkg|
49
- pkg.need_tar = true
50
- pkg.package_files += PKG_FILES
51
- end
52
- end
53
-
54
- desc m = "Writing version information for #{PKG_VERSION}"
55
- task :version do
56
- puts m
57
- File.open(File.join('lib', 'term', 'ansicolor', 'version.rb'), 'w') do |v|
58
- v.puts <<EOT
59
- module Term
60
- module ANSIColor
61
- # Term::ANSIColor version
62
- VERSION = '#{PKG_VERSION}'
63
- VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
64
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
65
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
66
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
67
- end
68
- end
69
- EOT
1
+ # vim: set filetype=ruby et sw=2 ts=2:
2
+
3
+ require 'gem_hadar'
4
+
5
+ GemHadar do
6
+ name 'term-ansicolor'
7
+ path_name 'term/ansicolor'
8
+ path_module 'Term::ANSIColor'
9
+ author 'Florian Frank'
10
+ email 'flori@ping.de'
11
+ homepage "http://flori.github.com/#{name}"
12
+ summary 'Ruby library that colors strings using ANSI escape sequences'
13
+ description ''
14
+ test_dir 'tests'
15
+ ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock'
16
+ readme 'README.rdoc'
17
+ executables << 'cdiff' << 'decolor'
18
+
19
+ install_library do
20
+ destdir = "#{ENV['DESTDIR']}"
21
+ libdir = CONFIG["sitelibdir"]
22
+ cd 'lib' do
23
+ for file in Dir['**/*.rb']
24
+ dest = destdir + File.join(libdir, File.dirname(file))
25
+ mkdir_p dest
26
+ install file, dest
27
+ end
28
+ end
70
29
  end
71
30
  end
72
-
73
- desc "Run tests"
74
- task :tests do
75
- sh 'testrb -Ilib tests/*.rb'
76
- end
77
- task :test => :tests
78
-
79
- desc "Run tests with coverage"
80
- task :coverage do
81
- sh 'rcov -Ilib tests/*.rb'
82
- end
83
-
84
- desc "Default"
85
- task :default => [ :version ]
86
-
87
- desc "Prepare a release"
88
- task :release => [ :clean, :version, :package ]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
data/doc-main.txt ADDED
@@ -0,0 +1,119 @@
1
+ == Term::ANSIColor - ANSI escape sequences in Ruby
2
+
3
+ === Description
4
+
5
+ This library can be used to color/uncolor strings using ANSI escape sequences.
6
+
7
+ === Author
8
+
9
+ Florian Frank mailto:flori@ping.de
10
+
11
+ === License
12
+
13
+ This is free software; you can redistribute it and/or modify it under the
14
+ terms of the GNU General Public License Version 2 as published by the Free
15
+ Software Foundation: www.gnu.org/copyleft/gpl.html
16
+
17
+ === Download
18
+
19
+ The latest version of this library can be downloaded at
20
+
21
+ * http://rubyforge.org/frs?group_id=391
22
+
23
+ The homepage of this library is located at
24
+
25
+ * http://term-ansicolor.rubyforge.org
26
+
27
+ === Examples
28
+
29
+ The file examples/example.rb in the source/gem-distribution shows how
30
+ this library can be used:
31
+ require 'term/ansicolor'
32
+
33
+ # Use this trick to work around namespace cluttering that
34
+ # happens if you just include Term::ANSIColor:
35
+
36
+ class Color
37
+ class << self
38
+ include Term::ANSIColor
39
+ end
40
+ end
41
+
42
+ print Color.red, Color.bold, "No Namespace cluttering:", Color.clear, "\n"
43
+ print Color.green + "green" + Color.clear, "\n"
44
+ print Color.on_red(Color.green("green")), "\n"
45
+ print Color.yellow { Color.on_black { "yellow on_black" } }, "\n\n"
46
+
47
+ # Or shortcut Term::ANSIColor by assignment:
48
+ c = Term::ANSIColor
49
+
50
+ print c.red, c.bold, "No Namespace cluttering (alternative):", c.clear, "\n"
51
+ print c.green + "green" + c.clear, "\n"
52
+ print c.on_red(c.green("green")), "\n"
53
+ print c.yellow { c.on_black { "yellow on_black" } }, "\n\n"
54
+
55
+ # Anyway, I don't define any of Term::ANSIColor's methods in this example
56
+ # and I want to keep it short:
57
+ include Term::ANSIColor
58
+
59
+ print red, bold, "Usage as constants:", reset, "\n"
60
+ print clear, "clear", reset, reset, "reset", reset,
61
+ bold, "bold", reset, dark, "dark", reset,
62
+ underscore, "underscore", reset, blink, "blink", reset,
63
+ negative, "negative", reset, concealed, "concealed", reset, "|\n",
64
+ black, "black", reset, red, "red", reset, green, "green", reset,
65
+ yellow, "yellow", reset, blue, "blue", reset, magenta, "magenta", reset,
66
+ cyan, "cyan", reset, white, "white", reset, "|\n",
67
+ on_black, "on_black", reset, on_red, "on_red", reset,
68
+ on_green, "on_green", reset, on_yellow, "on_yellow", reset,
69
+ on_blue, "on_blue", reset, on_magenta, "on_magenta", reset,
70
+ on_cyan, "on_cyan", reset, on_white, "on_white", reset, "|\n\n"
71
+
72
+ print red, bold, "Usage as unary argument methods:", reset, "\n"
73
+ print clear("clear"), reset("reset"), bold("bold"), dark("dark"),
74
+ underscore("underscore"), blink("blink"), negative("negative"),
75
+ concealed("concealed"), "|\n",
76
+ black("black"), red("red"), green("green"), yellow("yellow"),
77
+ blue("blue"), magenta("magenta"), cyan("cyan"), white("white"), "|\n",
78
+ on_black("on_black"), on_red("on_red"), on_green("on_green"),#
79
+ on_yellow("on_yellow"), on_blue("on_blue"), on_magenta("on_magenta"),
80
+ on_cyan("on_cyan"), on_white("on_white"), "|\n\n"
81
+
82
+ print red { bold { "Usage as block forms:" } }, "\n"
83
+ print clear { "clear" }, reset { "reset" }, bold { "bold" },
84
+ dark { "dark" }, underscore { "underscore" }, blink { "blink" },
85
+ negative { "negative" }, concealed { "concealed" }, "|\n",
86
+ black { "black" }, red { "red" }, green { "green" },
87
+ yellow { "yellow" }, blue { "blue" }, magenta { "magenta" },
88
+ cyan { "cyan" }, white { "white" }, "|\n",
89
+ on_black { "on_black" }, on_red { "on_red" }, on_green { "on_green" },
90
+ on_yellow { "on_yellow" }, on_blue { "on_blue" },
91
+ on_magenta { "on_magenta" }, on_cyan { "on_cyan" },
92
+ on_white { "on_white" }, "|\n\n"
93
+
94
+ # Usage as Mixin into String or its Subclasses
95
+ class String
96
+ include Term::ANSIColor
97
+ end
98
+
99
+ print "Usage as String Mixins:".red.bold, "\n"
100
+ print "clear".clear, "reset".reset, "bold".bold, "dark".dark,
101
+ "underscore".underscore, "blink".blink, "negative".negative,
102
+ "concealed".concealed, "|\n",
103
+ "black".black, "red".red, "green".green, "yellow".yellow,
104
+ "blue".blue, "magenta".magenta, "cyan".cyan, "white".white, "|\n",
105
+ "on_black".on_black, "on_red".on_red, "on_green".on_green,
106
+ "on_yellow".on_yellow, "on_blue".on_blue, "on_magenta".on_magenta,
107
+ "on_cyan".on_cyan, "on_white".on_white, "|\n\n"
108
+
109
+ symbols = Term::ANSIColor::attributes
110
+ print red { bold { "All supported attributes = " } },
111
+ blue { symbols.inspect }, "\n\n"
112
+
113
+ print "Send symbols to strings:".send(:red).send(:bold), "\n"
114
+ print symbols[12, 8].map { |c| c.to_s.send(c) }, "\n\n"
115
+
116
+ print red { bold { "Make strings monochromatic again:" } }, "\n"
117
+ print [ "red".red, "not red anymore".red.uncolored,
118
+ uncolored { "not red anymore".red }, uncolored("not red anymore".red)
119
+ ].map { |x| x + "\n" }
File without changes
@@ -1,10 +1,8 @@
1
- module Term
2
- module ANSIColor
3
- # Term::ANSIColor version
4
- VERSION = '1.0.5'
5
- VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
- VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
- VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
8
- VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
9
- end
1
+ module Term::ANSIColor
2
+ # Term::ANSIColor version
3
+ VERSION = '1.0.6'
4
+ VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
+ VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
+ VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
7
+ VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
10
8
  end
@@ -1,6 +1,6 @@
1
- require 'term/ansicolor/version'
2
-
3
1
  module Term
2
+ require 'term/ansicolor/version'
3
+
4
4
  # The ANSIColor module can be used for namespacing and mixed into your own
5
5
  # classes.
6
6
  module ANSIColor
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{term-ansicolor}
5
+ s.version = "1.0.6"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = [%q{Florian Frank}]
9
+ s.date = %q{2011-07-21}
10
+ s.description = %q{}
11
+ s.email = %q{flori@ping.de}
12
+ s.executables = [%q{decolor}, %q{cdiff}]
13
+ s.extra_rdoc_files = [%q{README.rdoc}, %q{lib/term/ansicolor/version.rb}, %q{lib/term/ansicolor.rb}]
14
+ s.files = [%q{.gitignore}, %q{CHANGES}, %q{COPYING}, %q{Gemfile}, %q{README.rdoc}, %q{Rakefile}, %q{VERSION}, %q{bin/cdiff}, %q{bin/decolor}, %q{doc-main.txt}, %q{examples/example.rb}, %q{install.rb}, %q{lib/term/ansicolor.rb}, %q{lib/term/ansicolor/.keep}, %q{lib/term/ansicolor/version.rb}, %q{term-ansicolor.gemspec}, %q{tests/ansicolor_test.rb}]
15
+ s.homepage = %q{http://flori.github.com/term-ansicolor}
16
+ s.rdoc_options = [%q{--title}, %q{Term-ansicolor - Ruby library that colors strings using ANSI escape sequences}, %q{--main}, %q{README.rdoc}]
17
+ s.require_paths = [%q{lib}]
18
+ s.rubygems_version = %q{1.8.5}
19
+ s.summary = %q{Ruby library that colors strings using ANSI escape sequences}
20
+ s.test_files = [%q{tests/ansicolor_test.rb}]
21
+
22
+ if s.respond_to? :specification_version then
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
+ s.add_development_dependency(%q<gem_hadar>, ["~> 0.0.8"])
27
+ else
28
+ s.add_dependency(%q<gem_hadar>, ["~> 0.0.8"])
29
+ end
30
+ else
31
+ s.add_dependency(%q<gem_hadar>, ["~> 0.0.8"])
32
+ end
33
+ end
@@ -60,7 +60,7 @@ class ANSIColorTest < Test::Unit::TestCase
60
60
  assert_not_equal foo, foo_colored = Term::ANSIColor.__send__(a) { foo }
61
61
  assert_equal foo, Term::ANSIColor.uncolored { foo_colored }
62
62
  assert_not_equal foo, foo_colored = __send__(a) { foo }
63
- assert_equal foo, uncolored { foo }
63
+ assert_equal foo, uncolored { foo_colored }
64
64
  end
65
65
  end
66
66
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: term-ansicolor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 6
10
+ version: 1.0.6
5
11
  platform: ruby
6
12
  authors:
7
13
  - Florian Frank
@@ -9,60 +15,86 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-03-12 00:00:00 +01:00
13
- default_executable:
14
- dependencies: []
15
-
18
+ date: 2011-07-21 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: gem_hadar
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 15
29
+ segments:
30
+ - 0
31
+ - 0
32
+ - 8
33
+ version: 0.0.8
34
+ type: :development
35
+ version_requirements: *id001
16
36
  description: ""
17
37
  email: flori@ping.de
18
38
  executables:
19
- - cdiff
20
39
  - decolor
40
+ - cdiff
21
41
  extensions: []
22
42
 
23
43
  extra_rdoc_files:
24
- - README
44
+ - README.rdoc
45
+ - lib/term/ansicolor/version.rb
46
+ - lib/term/ansicolor.rb
25
47
  files:
48
+ - .gitignore
26
49
  - CHANGES
27
50
  - COPYING
28
- - README
51
+ - Gemfile
52
+ - README.rdoc
29
53
  - Rakefile
30
54
  - VERSION
31
55
  - bin/cdiff
32
56
  - bin/decolor
57
+ - doc-main.txt
33
58
  - examples/example.rb
34
59
  - install.rb
35
60
  - lib/term/ansicolor.rb
61
+ - lib/term/ansicolor/.keep
36
62
  - lib/term/ansicolor/version.rb
63
+ - term-ansicolor.gemspec
37
64
  - tests/ansicolor_test.rb
38
- has_rdoc: true
39
65
  homepage: http://flori.github.com/term-ansicolor
40
66
  licenses: []
41
67
 
42
68
  post_install_message:
43
69
  rdoc_options:
44
- - --main
45
- - README
46
70
  - --title
47
- - Term::ANSIColor
71
+ - Term-ansicolor - Ruby library that colors strings using ANSI escape sequences
72
+ - --main
73
+ - README.rdoc
48
74
  require_paths:
49
75
  - lib
50
76
  required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
51
78
  requirements:
52
79
  - - ">="
53
80
  - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
54
84
  version: "0"
55
- version:
56
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
57
87
  requirements:
58
88
  - - ">="
59
89
  - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
60
93
  version: "0"
61
- version:
62
94
  requirements: []
63
95
 
64
- rubyforge_project: term-ansicolor
65
- rubygems_version: 1.3.5
96
+ rubyforge_project:
97
+ rubygems_version: 1.8.5
66
98
  signing_key:
67
99
  specification_version: 3
68
100
  summary: Ruby library that colors strings using ANSI escape sequences