tuomas-tweetwine 0.1.10 → 0.1.11
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/CHANGELOG.rdoc +4 -0
- data/Rakefile +1 -1
- data/lib/tweetwine/io.rb +13 -11
- data/test/io_test.rb +20 -2
- metadata +3 -3
data/CHANGELOG.rdoc
CHANGED
data/Rakefile
CHANGED
data/lib/tweetwine/io.rb
CHANGED
@@ -57,8 +57,10 @@ module Tweetwine
|
|
57
57
|
end
|
58
58
|
status = record[:status][:text]
|
59
59
|
if @colorize
|
60
|
-
|
61
|
-
|
60
|
+
colorize_all!(:yellow, status, NICK_REGEX)
|
61
|
+
URI.extract(status, ["http", "https"]).each do |url|
|
62
|
+
colorize_first!(:cyan, status, url)
|
63
|
+
end
|
62
64
|
end
|
63
65
|
@output.puts <<-END
|
64
66
|
#{from_user}, #{in_reply_to}#{time_diff_value} #{time_diff_unit} ago:
|
@@ -78,16 +80,16 @@ module Tweetwine
|
|
78
80
|
|
79
81
|
private
|
80
82
|
|
81
|
-
def
|
82
|
-
|
83
|
+
def colorize_all!(color, str, pattern)
|
84
|
+
str.gsub!(pattern) { |s| colorize_str(COLOR_CODES[color.to_sym], s) }
|
85
|
+
end
|
83
86
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
87
|
+
def colorize_first!(color, str, pattern)
|
88
|
+
str.sub!(pattern) { |s| colorize_str(COLOR_CODES[color.to_sym], s) }
|
89
|
+
end
|
90
|
+
|
91
|
+
def colorize!(color, str)
|
92
|
+
str.replace colorize_str(COLOR_CODES[color.to_sym], str)
|
91
93
|
end
|
92
94
|
|
93
95
|
def colorize_str(color_code, str)
|
data/test/io_test.rb
CHANGED
@@ -122,13 +122,13 @@ Hi, @fooman! How are you doing?
|
|
122
122
|
:user => "fooman",
|
123
123
|
:status => {
|
124
124
|
:created_at => Time.at(1),
|
125
|
-
:text => "
|
125
|
+
:text => "Wondering the meaning of life."
|
126
126
|
}
|
127
127
|
}
|
128
128
|
Util.expects(:humanize_time_diff).returns([2, "secs"])
|
129
129
|
@output.expects(:puts).with(<<-END
|
130
130
|
\033[32mfooman\033[0m, 2 secs ago:
|
131
|
-
|
131
|
+
Wondering the meaning of life.
|
132
132
|
|
133
133
|
END
|
134
134
|
)
|
@@ -171,6 +171,24 @@ Three links: \033[36mhttp://bit.ly/18rU_Vx\033[0m \033[36mhttp://is.gd/1qLk3\033
|
|
171
171
|
)
|
172
172
|
@io.show(record)
|
173
173
|
end
|
174
|
+
|
175
|
+
should "highlight nicks in a status" do
|
176
|
+
record = {
|
177
|
+
:user => "barman",
|
178
|
+
:status => {
|
179
|
+
:created_at => Time.at(1),
|
180
|
+
:text => "I salute you @fooman, @barbaz, and @spoonman!",
|
181
|
+
}
|
182
|
+
}
|
183
|
+
Util.expects(:humanize_time_diff).returns([2, "secs"])
|
184
|
+
@output.expects(:puts).with(<<-END
|
185
|
+
\033[32mbarman\033[0m, 2 secs ago:
|
186
|
+
I salute you \033[33m@fooman\033[0m, \033[33m@barbaz\033[0m, and \033[33m@spoonman\033[0m!
|
187
|
+
|
188
|
+
END
|
189
|
+
)
|
190
|
+
@io.show(record)
|
191
|
+
end
|
174
192
|
end
|
175
193
|
|
176
194
|
context "Nick regex" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuomas-tweetwine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tuomas Kareinen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-10 00:00:00 -07:00
|
13
13
|
default_executable: tweetwine
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -54,7 +54,7 @@ licenses:
|
|
54
54
|
post_install_message:
|
55
55
|
rdoc_options:
|
56
56
|
- --title
|
57
|
-
- Tweetwine 0.1.
|
57
|
+
- Tweetwine 0.1.11
|
58
58
|
- --main
|
59
59
|
- README.rdoc
|
60
60
|
- --exclude
|