jamescook-pow 0.1.0 → 0.1.1

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.
data/README CHANGED
@@ -2,6 +2,9 @@ P O W ! ( Not like prisoner of war, but from the movie Step Brothers where that
2
2
 
3
3
  Override your 'puts' for fun shell coloring.
4
4
 
5
+ Install (with gemcutter as sauce):
6
+ sudo gem install jamescook-pow
7
+
5
8
  Usage:
6
9
  require "pow"
7
10
 
@@ -0,0 +1,46 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in rakefile.rb, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{jamescook-pow}
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["James Cook"]
12
+ s.date = %q{2009-11-19}
13
+ s.description = %q{'puts' with shell colors.}
14
+ s.email = %q{jamecook@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "README",
21
+ "jamescook-pow.gemspec",
22
+ "lib/pow.rb",
23
+ "pow.rb",
24
+ "rakefile.rb",
25
+ "test/pow_test.rb"
26
+ ]
27
+ s.homepage = %q{http://github.com/jamescook/pow}
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = %q{1.3.5}
31
+ s.summary = %q{puts with colors}
32
+ s.test_files = [
33
+ "test/pow_test.rb"
34
+ ]
35
+
36
+ if s.respond_to? :specification_version then
37
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
41
+ else
42
+ end
43
+ else
44
+ end
45
+ end
46
+
data/lib/pow.rb CHANGED
@@ -61,6 +61,7 @@ module Pow
61
61
  # FIXME make this part a method or less fug
62
62
  if options[:misc] && options[:misc].is_a?(Hash)
63
63
  options[:bold] ||= options[:misc][:bold]
64
+ options[:negative] ||= options[:misc][:negative]
64
65
  options[:underline] ||= options[:misc][:underline]
65
66
  options[:background] ||= (options[:misc][:background] || options[:misc][:on])
66
67
  options[:strikethrough] ||= options[:misc][:strikethrough]
@@ -106,6 +107,8 @@ module Pow
106
107
  color = options.fetch(:color){ :white }
107
108
  text = options.fetch(:text){ '' }
108
109
  bold = options.fetch(:bold){ false }
110
+ negative = options.fetch(:negative){ false }
111
+ italic = options.fetch(:italic){ false }
109
112
  underline = options.fetch(:underline){ false }
110
113
  background = options.fetch(:background){ false }
111
114
  concealed = options.fetch(:concealed){ false }
@@ -119,6 +122,10 @@ module Pow
119
122
  result.insert(0, escape_sequence(:bold))
120
123
  end
121
124
 
125
+ if negative
126
+ result.insert(0, escape_sequence(:negative))
127
+ end
128
+
122
129
  if underline
123
130
  result.insert(0, escape_sequence(:underline))
124
131
  end
data/rakefile.rb ADDED
@@ -0,0 +1,14 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "jamescook-pow"
5
+ gemspec.version = "0.1.1"
6
+ gemspec.summary = "puts with colors"
7
+ gemspec.description = "'puts' with shell colors."
8
+ gemspec.email = "jamecook@gmail.com"
9
+ gemspec.homepage = "http://github.com/jamescook/pow"
10
+ gemspec.authors = ["James Cook"]
11
+ end
12
+ rescue LoadError
13
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
14
+ end
data/test/pow_test.rb CHANGED
@@ -21,6 +21,12 @@ class PowTest < Test::Unit::TestCase
21
21
  assert_equal "\e[31mTEST\e[0m\n", @writer.gets
22
22
  end
23
23
 
24
+ def test_puts_with_red_on_background
25
+ @puts.new(:text => "TEST", :color => :red, :background => :purple, :writer => @writer).out!
26
+ @writer.rewind
27
+ assert_equal "\e[45m\e[31mTEST\e[0m\n", @writer.gets #45 purple background, 35 red
28
+ end
29
+
24
30
  def test_puts_with_dark_color #brown = yellow + dark
25
31
  @puts.new(:text => "TEST", :color => :brown, :writer => @writer).out!
26
32
  @writer.rewind
@@ -38,4 +44,10 @@ class PowTest < Test::Unit::TestCase
38
44
  @writer.rewind
39
45
  assert_equal "\e[9m\e[37mTEST\e[0m\n", @writer.gets
40
46
  end
47
+
48
+ def test_puts_with_negative
49
+ @puts.new(:text => "TEST", :negative => :true, :color => :blue, :writer => @writer).out!
50
+ @writer.rewind
51
+ assert_equal "\e[7m\e[34mTEST\e[0m\n", @writer.gets
52
+ end
41
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jamescook-pow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Cook
@@ -24,8 +24,10 @@ extra_rdoc_files:
24
24
  files:
25
25
  - .gitignore
26
26
  - README
27
+ - jamescook-pow.gemspec
27
28
  - lib/pow.rb
28
29
  - pow.rb
30
+ - rakefile.rb
29
31
  - test/pow_test.rb
30
32
  has_rdoc: true
31
33
  homepage: http://github.com/jamescook/pow