Permalink
Browse files

Print a log about status being too long

  • Loading branch information...
1 parent 213714f commit 3e4ec56e44be27ed57451e0ddec1b5e5065d9615 @fabiopelosin fabiopelosin committed Nov 29, 2013
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/cocoapods_notifier/twitter_notifier.rb
@@ -45,17 +45,22 @@ def status_for_pod(pod)
def make_status(name, summary, homepage, social_media_url)
account = account_for_social_media_url(social_media_url)
if account
- message = "[#{name} by #{account}] #{summary}"
+ status = "[#{name} by #{account}] #{summary}"
else
- message = "[#{name}] #{summary}"
+ status = "[#{name}] #{summary}"
end
- if message.length > message_max_length
+ if status.length > message_max_length
max_lenght = message_max_length
- message = truncate_message(message, max_lenght, ELLIPSIS_STRING)
+ status = truncate_message(status, max_lenght, ELLIPSIS_STRING)
end
- message << LINK_SEPARATOR_STRING
- message << homepage
- message
+ status << LINK_SEPARATOR_STRING
+ status << homepage
+
+ if status.length > 140
+ puts "[!] Status too long: `#{status}`".yellow unless $silent
+ end
+
+ status
end
def account_for_social_media_url(url)

0 comments on commit 3e4ec56

Please sign in to comment.