shiny 0.2.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -0
- data/lib/shiny.rb +1 -0
- data/lib/shiny/ansi.rb +49 -46
- data/lib/shiny/basic.rb +6 -0
- data/lib/shiny/core_ext/string.rb +9 -3
- data/lib/shiny/helpers.rb +77 -0
- data/lib/shiny/html.rb +50 -44
- data/spec/shiny_spec.rb +47 -59
- data/spec/string_spec.rb +87 -0
- metadata +21 -5
data/README.rdoc
CHANGED
@@ -41,6 +41,17 @@ Some other html effect examples:
|
|
41
41
|
"overline".html.overline
|
42
42
|
"line-through".html.line_through
|
43
43
|
|
44
|
+
Some terminal helper examples: (include Shiny::Helpers)
|
45
|
+
|
46
|
+
say("green day?", :color => :green)
|
47
|
+
say("fail!", :type => :error)
|
48
|
+
|
49
|
+
log("for later") # default: logfile.log
|
50
|
+
log("there please", "myfile.log")
|
51
|
+
|
52
|
+
wrap("I'm not alone") # surrounded with the default: # char
|
53
|
+
wrap("Oh...", "*") # surrounded with the * char
|
54
|
+
|
44
55
|
== Note on Patches/Pull Requests
|
45
56
|
|
46
57
|
* Fork the project.
|
data/lib/shiny.rb
CHANGED
data/lib/shiny/ansi.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Shiny
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# the
|
2
|
+
# The ansi class serve a great list of color and a few format
|
3
|
+
# methods. To get an overview of all the generetad method, just look
|
4
|
+
# at the CODES hash
|
5
5
|
#
|
6
|
-
# Some
|
6
|
+
# Some color examples:
|
7
7
|
#
|
8
8
|
# puts "magenta".shell.magenta
|
9
9
|
# puts "bold blue".shell.bold.blue
|
@@ -21,43 +21,43 @@ module Shiny
|
|
21
21
|
|
22
22
|
# ansi escape sequences list
|
23
23
|
CODES = {
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
24
|
+
:black => "\e[30m",
|
25
|
+
:red => "\e[31m",
|
26
|
+
:green => "\e[32m",
|
27
|
+
:yellow => "\e[33m",
|
28
|
+
:blue => "\e[34m",
|
29
|
+
:magenta => "\e[35m",
|
30
|
+
:cyan => "\e[36m",
|
31
|
+
:white => "\e[37m",
|
32
|
+
:bright_black => "\e[90m",
|
33
|
+
:bright_red => "\e[91m",
|
34
|
+
:bright_green => "\e[92m",
|
35
|
+
:bright_yellow => "\e[93m",
|
36
|
+
:bright_blue => "\e[94m",
|
37
|
+
:bright_magenta => "\e[95m",
|
38
|
+
:bright_cyan => "\e[96m",
|
39
|
+
:bright_white => "\e[97m",
|
40
|
+
:on_black => "\e[40m",
|
41
|
+
:on_red => "\e[41m",
|
42
|
+
:on_green => "\e[42m",
|
43
|
+
:on_yellow => "\e[43m",
|
44
|
+
:on_blue => "\e[44m",
|
45
|
+
:on_magenta => "\e[45m",
|
46
|
+
:on_cyan => "\e[46m",
|
47
|
+
:on_white => "\e[47m",
|
48
|
+
:on_bright_black => "\e[100m",
|
49
|
+
:on_bright_red => "\e[101m",
|
50
|
+
:on_bright_green => "\e[102m",
|
51
|
+
:on_bright_yellow => "\e[103m",
|
52
|
+
:on_bright_blue => "\e[104m",
|
53
|
+
:on_bright_magenta => "\e[105m",
|
54
|
+
:on_bright_cyan => "\e[106m",
|
55
|
+
:on_bright_white => "\e[107m",
|
56
|
+
:reset => "\e[0m",
|
57
|
+
:bold => "\e[1m",
|
58
|
+
:underline => "\e[4m",
|
59
|
+
:negative => "\e[7m",
|
60
|
+
:blink => "\e[5m"
|
61
61
|
}
|
62
62
|
|
63
63
|
# list of available ansi colors
|
@@ -66,19 +66,22 @@ module Shiny
|
|
66
66
|
# list of available ansi effects
|
67
67
|
EFFECTS = ['bold', 'underline', 'negative', 'blink']
|
68
68
|
|
69
|
-
#
|
69
|
+
# Generate color instance methods
|
70
|
+
# See CODES for a list of the created methods
|
70
71
|
CODES.each do |code, value|
|
71
|
-
next if code ==
|
72
|
-
reset = CODES[
|
72
|
+
next if code == :reset
|
73
|
+
reset = CODES[:reset]
|
73
74
|
class_eval <<-DEF
|
74
|
-
def #{code}
|
75
|
+
def #{code.to_s}
|
75
76
|
@string = "#{value}" + @string + "#{reset}"
|
76
77
|
self
|
77
78
|
end
|
78
79
|
DEF
|
79
80
|
end
|
80
81
|
|
81
|
-
#
|
82
|
+
# Remove all ansi escape sequences from the string
|
83
|
+
#
|
84
|
+
# @return [String] from ansi escape sequences cleaned
|
82
85
|
def blank
|
83
86
|
@string.gsub(/\e\[[0-9]+m/,'')
|
84
87
|
end
|
data/lib/shiny/basic.rb
CHANGED
@@ -2,16 +2,22 @@ require 'shiny/basic'
|
|
2
2
|
require 'shiny/ansi'
|
3
3
|
require 'shiny/html'
|
4
4
|
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# html, to serve all the functionality.
|
5
|
+
# Extend the ruby core string class with ansi escape
|
6
|
+
# sequences and html methods through two proxy methods
|
8
7
|
class String
|
8
|
+
|
9
|
+
# Serves ansi escape sequence method through a new ansi object
|
10
|
+
#
|
11
|
+
# @return [Shiny::ANSI] a new object
|
9
12
|
def ansi
|
10
13
|
Shiny::ANSI.new(self)
|
11
14
|
end
|
12
15
|
|
13
16
|
alias shell ansi
|
14
17
|
|
18
|
+
# Serves ansi escape sequence method through a new html object
|
19
|
+
#
|
20
|
+
# @return [Shiny::HTML] a new object
|
15
21
|
def html
|
16
22
|
Shiny::HTML.new(self)
|
17
23
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Shiny
|
2
|
+
module Helpers
|
3
|
+
# Send a message to the $stdout stream
|
4
|
+
#
|
5
|
+
# @example Print a message
|
6
|
+
# "Shiny.message('What is that?')" #=> "What is that?\n"
|
7
|
+
#
|
8
|
+
# @example Print message whitout linebreak
|
9
|
+
# "Shiny.message('What is that?', :linebreak => false)" #=> "What is that?"
|
10
|
+
#
|
11
|
+
# @example Print message in red
|
12
|
+
# "Shiny.message('red!', :color => :red)" #=> "\e[31mred!\e[0m\n"
|
13
|
+
#
|
14
|
+
# @example Print a success message
|
15
|
+
# "Shiny.message('success', :type => :success)" #=> "\e[32msuccess\e[0m\n"
|
16
|
+
#
|
17
|
+
# @param [String] the message which should send to $stdout
|
18
|
+
# @option options [Boolean] :linebreak ('true')
|
19
|
+
# @option options [Symbol] :color ('white') The message color
|
20
|
+
# @option options [Symbol] :type The message type ':error' or ':success'
|
21
|
+
def say(message, options={})
|
22
|
+
options[:linebreak] = true unless options.has_key?(:linebreak)
|
23
|
+
|
24
|
+
message = message.ansi.send(options[:color]) if options[:color]
|
25
|
+
message = format(message, options[:type]) unless options[:color]
|
26
|
+
message = message.to_s + "\n" if options[:linebreak]
|
27
|
+
|
28
|
+
$stdout.print message
|
29
|
+
end
|
30
|
+
|
31
|
+
# Log a message in to a logfile
|
32
|
+
#
|
33
|
+
# @param [String] the message which should be logged into file
|
34
|
+
# @param [String] filename ('logfile.log') the name of the logile
|
35
|
+
def log(message, filename="logfile.log")
|
36
|
+
File.open(filename, "a+") do |f|
|
37
|
+
f << "#{Time.now}: #{message}\n"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Send a linebreak to the $stdout stream
|
42
|
+
#
|
43
|
+
# @param [Integer] amount ('1') Amount of linebreaks
|
44
|
+
def linebreak(amount=1)
|
45
|
+
$stdout.print "\n" * amount
|
46
|
+
end
|
47
|
+
|
48
|
+
# Wrap a message with a special sign and send it to the $stdout stream
|
49
|
+
#
|
50
|
+
# @param [String] the message which should be wrapped
|
51
|
+
# @param [String] sign ('#') The character around the message
|
52
|
+
def wrap(message, sign="#")
|
53
|
+
sign = sign[0] if sign.length > 1
|
54
|
+
around = sign * (message.length + 4) + "\n"
|
55
|
+
|
56
|
+
output = ""
|
57
|
+
output << around
|
58
|
+
output << "#{sign} #{message} #{sign}\n"
|
59
|
+
output << around
|
60
|
+
|
61
|
+
$stdout.print output
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def format(message, type)
|
67
|
+
message = case type
|
68
|
+
when :error ; message.ansi.send(:red)
|
69
|
+
when :success ; message.ansi.send(:green)
|
70
|
+
else
|
71
|
+
message
|
72
|
+
end
|
73
|
+
message.to_s
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/lib/shiny/html.rb
CHANGED
@@ -1,63 +1,69 @@
|
|
1
1
|
module Shiny
|
2
2
|
class HTML < Basic
|
3
|
-
# the 17 w3c supported color names
|
4
|
-
# http://www.w3.org/TR/CSS21/syndata.html#value-def-color
|
3
|
+
# List of the 17 w3c supported color names
|
4
|
+
# @see http://www.w3.org/TR/CSS21/syndata.html#value-def-color
|
5
5
|
FORMATS = {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
6
|
+
:black => '<span style="color: black;">',
|
7
|
+
:silver => '<span style="color: silver;">',
|
8
|
+
:gray => '<span style="color: gray;">,',
|
9
|
+
:white => '<span style="color: white;">',
|
10
|
+
:maroon => '<span style="color: maroon;">',
|
11
|
+
:red => '<span style="color: red;">',
|
12
|
+
:purple => '<span style="color: purple;">',
|
13
|
+
:fuchsia => '<span style="color: fuchsia;">',
|
14
|
+
:green => '<span style="color: green;">',
|
15
|
+
:lime => '<span style="color: lime;">',
|
16
|
+
:olive => '<span style="color: olive;">',
|
17
|
+
:yellow => '<span style="color: yellow;">',
|
18
|
+
:navy => '<span style="color: navy;">',
|
19
|
+
:blue => '<span style="color: blue;">',
|
20
|
+
:teal => '<span style="color: teal;">',
|
21
|
+
:aqua => '<span style="color: aqua;">',
|
22
|
+
:orange => '<span style="color: orange;">',
|
23
|
+
:on_black => '<span style="background-color: black;">',
|
24
|
+
:on_silver => '<span style="background-color: silver;">',
|
25
|
+
:on_gray => '<span style="background-color: gray;">',
|
26
|
+
:on_white => '<span style="background-color: white;">',
|
27
|
+
:on_maroon => '<span style="background-color: maroon;">',
|
28
|
+
:on_red => '<span style="background-color: red;">',
|
29
|
+
:on_purple => '<span style="background-color: purple;">',
|
30
|
+
:on_fuchsia => '<span style="background-color: fuchsia;">',
|
31
|
+
:on_green => '<span style="background-color: green;">',
|
32
|
+
:on_lime => '<span style="background-color: lime;">',
|
33
|
+
:on_olive => '<span style="background-color: olive;">',
|
34
|
+
:on_yellow => '<span style="background-color: yellow;">',
|
35
|
+
:on_navy => '<span style="background-color: navy;">',
|
36
|
+
:on_blue => '<span style="background-color: blue;">',
|
37
|
+
:on_teal => '<span style="background-color: teal;">',
|
38
|
+
:on_aqua => '<span style="background-color: aqua;">',
|
39
|
+
:on_orange => '<span style="background-color: orange;">',
|
40
|
+
:bold => '<span style="font-weight: bold;">',
|
41
|
+
:underline => '<span style="text-decoration: underline;">',
|
42
|
+
:overline => '<span style="text-decoration: overline;">',
|
43
|
+
:line_through => '<span style="text-decoration: line-through;">',
|
44
|
+
:blink => '<span style="text-decoration: blink;">'
|
45
45
|
}
|
46
46
|
|
47
|
+
# HTML span begin tag
|
47
48
|
SPAN_BEGIN = "<span>"
|
49
|
+
|
50
|
+
# HTML span end tag
|
48
51
|
SPAN_END = "</span>"
|
49
52
|
|
50
|
-
#
|
53
|
+
# Generate html format instance methods
|
54
|
+
# See FORMATS for a list of created methods
|
51
55
|
FORMATS.each do |name, value|
|
52
56
|
class_eval <<-DEF
|
53
|
-
def #{name}
|
57
|
+
def #{name.to_s}
|
54
58
|
@string = '#{value}' + @string + '#{SPAN_END}'
|
55
59
|
self
|
56
60
|
end
|
57
61
|
DEF
|
58
62
|
end
|
59
63
|
|
60
|
-
#
|
64
|
+
# Remove all html span format tags
|
65
|
+
#
|
66
|
+
# @return [String] from span tags cleaned
|
61
67
|
def blank
|
62
68
|
@string.gsub(/(<span [^>]+>|<\/span>)/, '')
|
63
69
|
end
|
data/spec/shiny_spec.rb
CHANGED
@@ -1,88 +1,76 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
3
|
|
3
4
|
describe Shiny do
|
4
5
|
|
5
|
-
|
6
|
-
class Shiny::Basic
|
7
|
-
def ==(string)
|
8
|
-
to_s == string
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "#ansi" do
|
13
|
-
it 'should return a green string' do
|
14
|
-
"green".shell.green.should == "\e[32mgreen\e[0m"
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'should return an on yellow string' do
|
18
|
-
"on yellow".shell.on_yellow.should == "\e[43mon yellow\e[0m"
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'should return an on bright magenta string' do
|
22
|
-
"on bright magenta".shell.on_bright_magenta.should == "\e[105mon bright magenta\e[0m"
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should return a red on white string' do
|
26
|
-
"red on white".shell.red.on_white.should == "\e[47m\e[31mred on white\e[0m\e[0m"
|
27
|
-
end
|
6
|
+
include Shiny::Helpers
|
28
7
|
|
29
|
-
|
30
|
-
|
8
|
+
describe "#say" do
|
9
|
+
it "should print string to the stdout stream" do
|
10
|
+
$stdout.should_receive(:print).with("hey dude!\n")
|
11
|
+
say("hey dude!")
|
31
12
|
end
|
32
13
|
|
33
|
-
it
|
34
|
-
|
14
|
+
it "should print string without a linebreak" do
|
15
|
+
$stdout.should_receive(:print).with("hey dude, no linebreak please")
|
16
|
+
say("hey dude, no linebreak please", :linebreak => false)
|
35
17
|
end
|
36
18
|
|
37
|
-
it
|
38
|
-
|
19
|
+
it "should print the string as error formated"do
|
20
|
+
$stdout.should_receive(:print).with("\e[31mOh, there is an error!\e[0m\n")
|
21
|
+
say("Oh, there is an error!", :type => :error)
|
39
22
|
end
|
40
23
|
|
41
|
-
it
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
it 'should return a negative string' do
|
46
|
-
"negative".shell.negative.should == "\e[7mnegative\e[0m"
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should return a blinking string' do
|
50
|
-
"blinking".shell.blink.should == "\e[5mblinking\e[0m"
|
24
|
+
it "should print the string as success formated"do
|
25
|
+
$stdout.should_receive(:print).with("\e[32mSuccessfully\e[0m\n")
|
26
|
+
say("Successfully", :type => :success)
|
51
27
|
end
|
28
|
+
end
|
52
29
|
|
53
|
-
|
54
|
-
|
30
|
+
describe "#linebreak" do
|
31
|
+
it "should print a linebreak" do
|
32
|
+
$stdout.should_receive(:print).with("\n")
|
33
|
+
linebreak
|
55
34
|
end
|
56
35
|
|
57
|
-
it
|
58
|
-
|
36
|
+
it "should print 3 linebreaks" do
|
37
|
+
$stdout.should_receive(:print).with("\n\n\n")
|
38
|
+
linebreak(3)
|
59
39
|
end
|
60
40
|
end
|
61
41
|
|
62
|
-
describe "#
|
63
|
-
it
|
64
|
-
|
65
|
-
|
42
|
+
describe "#wrap" do
|
43
|
+
it "should print a wrapped string" do
|
44
|
+
output = "#####################\n"
|
45
|
+
output += "# Hello I'm wrapped #\n"
|
46
|
+
output += "#####################\n"
|
66
47
|
|
67
|
-
|
68
|
-
"
|
48
|
+
$stdout.should_receive(:print).with(output)
|
49
|
+
wrap("Hello I'm wrapped")
|
69
50
|
end
|
70
51
|
|
71
|
-
it
|
72
|
-
|
73
|
-
|
52
|
+
it "should print a wrapped string with other wrap sign" do
|
53
|
+
output = "*********************\n"
|
54
|
+
output += "* Hello I'm wrapped *\n"
|
55
|
+
output += "*********************\n"
|
74
56
|
|
75
|
-
|
76
|
-
"
|
57
|
+
$stdout.should_receive(:print).with(output)
|
58
|
+
wrap("Hello I'm wrapped", "*")
|
77
59
|
end
|
60
|
+
end
|
78
61
|
|
79
|
-
|
80
|
-
|
62
|
+
describe "#log" do
|
63
|
+
it "should log the message in a log file" do
|
64
|
+
log("please log me in!")
|
65
|
+
File.exists?("logfile.log").should == true
|
66
|
+
File.delete("logfile.log")
|
81
67
|
end
|
82
68
|
|
83
|
-
it
|
84
|
-
|
69
|
+
it "should log the message to the 'mylogfile.log' file" do
|
70
|
+
log("Arrrr, another filename", "mylogfile.log")
|
71
|
+
File.exists?("mylogfile.log").should == true
|
72
|
+
File.delete("mylogfile.log")
|
85
73
|
end
|
86
74
|
end
|
87
|
-
|
88
75
|
end
|
76
|
+
|
data/spec/string_spec.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
|
5
|
+
# overwrite for testing
|
6
|
+
class Shiny::Basic
|
7
|
+
def ==(string)
|
8
|
+
to_s == string
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#ansi" do
|
13
|
+
it 'should return a green string' do
|
14
|
+
"green".shell.green.should == "\e[32mgreen\e[0m"
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should return an on yellow string' do
|
18
|
+
"on yellow".shell.on_yellow.should == "\e[43mon yellow\e[0m"
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should return an on bright magenta string' do
|
22
|
+
"on bright magenta".shell.on_bright_magenta.should == "\e[105mon bright magenta\e[0m"
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should return a red on white string' do
|
26
|
+
"red on white".shell.red.on_white.should == "\e[47m\e[31mred on white\e[0m\e[0m"
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should return a bright blue string' do
|
30
|
+
"bright blue".shell.bright_blue.should == "\e[94mbright blue\e[0m"
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should return a black on bright green string' do
|
34
|
+
"black on bright green".shell.black.on_bright_green.should == "\e[102m\e[30mblack on bright green\e[0m\e[0m"
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should return an underlined string' do
|
38
|
+
"underline".shell.underline.should == "\e[4munderline\e[0m"
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should return a bold string' do
|
42
|
+
"bold".shell.bold.should == "\e[1mbold\e[0m"
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should return a negative string' do
|
46
|
+
"negative".shell.negative.should == "\e[7mnegative\e[0m"
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should return a blinking string' do
|
50
|
+
"blinking".shell.blink.should == "\e[5mblinking\e[0m"
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should clear all ansi escape sequences from string' do
|
54
|
+
"\e[47m\e[31mred on white\e[0m\e[0m".shell.blank.should == "red on white"
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should run also with the alias method' do
|
58
|
+
"try the alias method".shell.red.should == "\e[31mtry the alias method\e[0m"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "#html" do
|
63
|
+
it 'should return a bold string' do
|
64
|
+
"bold".html.bold.should == '<span style="font-weight: bold;">bold</span>'
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should return a underlined string' do
|
68
|
+
"underline".html.underline.should == '<span style="text-decoration: underline;">underline</span>'
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should return a overlined string' do
|
72
|
+
"overline".html.overline.should == '<span style="text-decoration: overline;">overline</span>'
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should return a line-through string' do
|
76
|
+
"line-through".html.line_through.should == '<span style="text-decoration: line-through;">line-through</span>'
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should return a blinking string' do
|
80
|
+
"blink".html.blink.should == '<span style="text-decoration: blink;">blink</span>'
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should clear all html formats from string' do
|
84
|
+
'<span style="font-weight: bold;">i\'m blank now!</span>'.html.blank.should == "i'm blank now!"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 3
|
8
8
|
- 1
|
9
|
-
version: 0.
|
9
|
+
version: 0.3.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Samuel Tonini
|
@@ -14,10 +14,24 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-16 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rspec
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 2
|
30
|
+
- 0
|
31
|
+
- 0
|
32
|
+
version: 2.0.0
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
21
35
|
description: Some common nice and shiny ansi escapse sequences and html format tags for the daily grind in the shell and browser.
|
22
36
|
email: tonini.samuel@gmail.com
|
23
37
|
executables: []
|
@@ -30,10 +44,12 @@ files:
|
|
30
44
|
- lib/shiny/ansi.rb
|
31
45
|
- lib/shiny/basic.rb
|
32
46
|
- lib/shiny/core_ext/string.rb
|
47
|
+
- lib/shiny/helpers.rb
|
33
48
|
- lib/shiny/html.rb
|
34
49
|
- lib/shiny.rb
|
35
50
|
- spec/shiny_spec.rb
|
36
51
|
- spec/spec_helper.rb
|
52
|
+
- spec/string_spec.rb
|
37
53
|
- LICENSE
|
38
54
|
- README.rdoc
|
39
55
|
has_rdoc: true
|