Permalink
Browse files

Added colour to several sorts of output.

  • Loading branch information...
1 parent 64e46d7 commit e27ca54f4cba6ade6f93c52d85e314e93eba6063 Pistos committed Nov 30, 2009
Showing with 9 additions and 9 deletions.
  1. +2 −2 github-hook.rb
  2. +1 −1 key-value-store.rb
  3. +2 −2 reby-twitter.rb
  4. +4 −4 url-summary.rb
View
@@ -82,7 +82,7 @@ def receive_data( data )
author = cdata[ 'author' ][ 'name' ]
message = cdata[ 'message' ].gsub( /\s+/, ' ' )[ 0..384 ]
url = zepto_url( cdata[ 'url' ] )
- text = "[github] [\00303#{repo}\003] <\00307#{author}\003> #{message} #{url}"
+ text = "[\00300github\003] [\00303#{repo}\003] <\00307#{author}\003> #{message} #{url}"
if channels.nil? or channels.empty?
say "Unknown repo: '#{repo}'", '#mathetes'
@@ -108,7 +108,7 @@ def receive_data( data )
shas.each do |sha|
s[ sha ] = true
end
- say "[github] [\00303#{repo}\003] #{commits.size} commits by: \00307#{authors.join( ', ' )}\003 #{first_url}", channel
+ say "[\00300github\003] [\00303#{repo}\003] #{commits.size} commits by: \00307#{authors.join( ', ' )}\003 #{first_url}", channel
end
end
View
@@ -14,7 +14,7 @@ def initialize
end
def say( message, channel )
- $reby.putserv "PRIVMSG #{channel} :[kv] #{message}"
+ $reby.putserv "PRIVMSG #{channel} :[\00300kv\003] #{message}"
end
def info( nick, userhost, handle, channel, args )
View
@@ -113,7 +113,7 @@ def say_tweet( tweet )
tweet_id = tweet.id.to_i
src = tweet.user.screen_name
text = clean_text( tweet.text )
- alert = "[twitter] <#{src}> #{text}"
+ alert = "[\00300twitter\003] <#{src}> #{text}"
channels = CHANNELS[ src ] || [ 'Pistos' ]
channels.each do |channel|
if not @seen[ channel ].include?( tweet_id )
@@ -127,7 +127,7 @@ def say_search_tweet( tweet, channels = [ 'Pistos' ] )
tweet_id = tweet[ 'id' ].to_i
src = tweet[ 'from_user' ]
text = clean_text( tweet[ 'text' ] )
- alert = "[twitter] <#{src}> #{text}"
+ alert = "[\00300twitter\003] <#{src}> #{text}"
channels.each do |channel|
if not @seen[ channel ].include?( tweet_id )
say alert, channel
View
@@ -68,7 +68,7 @@ def summarize_url( url, channel )
fetch url
end
rescue EOFError, ByteLimitExceededException
- $reby.log "[URL] Byte limit reached reading #{url} (document reached #{@doc_text.length} bytes)"
+ $reby.log "[\00300URL\003] Byte limit reached reading #{url} (document reached #{@doc_text.length} bytes)"
end
doc = Nokogiri::HTML( @doc_text )
@@ -98,7 +98,7 @@ def summarize_url( url, channel )
summary = summary.strip.gsub( /\s+/, ' ' )
if summary.length > 10
summary = summary.split( /\n/ )[ 0 ]
- say "[URL] #{summary[ 0...160 ]}#{summary.size > 159 ? '[...]' : ''}", channel
+ say "[\00300URL\003] #{summary[ 0...160 ]}#{summary.size > 159 ? '[...]' : ''}", channel
end
end
rescue Timeout::Error
@@ -137,7 +137,7 @@ def sawPRIVMSG( from, keyword, text )
json = http.read
tweet = JSON.parse( json )
escaped_text = CGI.unescapeHTML( tweet[ 'text' ].gsub( '&quot;', '"' ).gsub( '&amp;', '&' ) ).gsub( /\s/, ' ' )
- say "[twitter] <#{tweet[ 'user' ][ 'screen_name' ]}> #{escaped_text}", channel
+ say "[\00300twitter\003] <#{tweet[ 'user' ][ 'screen_name' ]}> #{escaped_text}", channel
end
when %r{(http://github.com/.+?/(.+?)/commit/.+)}
doc = Nokogiri::HTML( open( $1 ) )
@@ -151,7 +151,7 @@ def sawPRIVMSG( from, keyword, text )
number_files[:added] = doc.css( 'div#toc ul li.added' ).size
number_files[:removed] = doc.css( 'div#toc ul li.removed' ).size
- s = "[github] [#{project}] <#{author}> #{commit_message} {+#{number_files[ :added ]}/-#{number_files[ :removed ]}/*#{number_files[ :modified ]}}"
+ s = "[\00300github\003] [#{project}] <#{author}> #{commit_message} {+#{number_files[ :added ]}/-#{number_files[ :removed ]}/*#{number_files[ :modified ]}}"
say s, channel
when %r|(http://(?:[0-9a-zA-Z-]+\.)+[a-zA-Z]+(?:/[0-9a-zA-Z#{"\303\244-\303\256"}~!@#%&./?=_+-]*)?)|u
summarize_url $1, channel

0 comments on commit e27ca54

Please sign in to comment.