Skip to content

Commit

Permalink
Present.ly service added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Bleigh committed Sep 26, 2008
1 parent bd0b415 commit 9962467
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/presently
Expand Up @@ -5,8 +5,8 @@ Install Notes
-------------

1. subdomain (for a Present.ly account)
2. group_name (OPTIONAL; will broadcast as a group instead of as system)
3. username (user must be an admin [without a group] or manager of specified group)
2. group_name (OPTIONAL; will broadcast as a group or as the system if group is 'system')
3. username (user must be a manager of the specified group or admin for 'system')

Developer Notes
---------------
Expand Down
10 changes: 6 additions & 4 deletions services/presently.rb
Expand Up @@ -2,19 +2,19 @@
repository = payload['repository']['name']
url = URI.parse("https://#{data['subdomain']}.presentlyapp.com/api/twitter/statuses/update.xml")

receiver = (data['group'].nil? || data['group'] == '') ? 'system' : data['group']
prefix = (data['group'].nil? || data['group'] == '') ? '' : "b #{data['group']} "

payload['commits'].each do |commit|

status = "b #{receiver} [#{repository}] #{commit['author']['name']} - #{commit['message']}"
status = "#{prefix}[#{repository}] #{commit['author']['name']} - #{commit['message']}"
status = status[0...137] + '...' if status.length > 140

paste = "\"Commit #{commit['id']}\":#{commit['url']}\n\n"
paste << "#{commit['message']}\n\n"

%w(added modified removed).each do |kind|
commit[kind].each do |filename|
paste << "* #{kind.capitalize} '#{filename}'\n"
paste << "* *#{kind.capitalize}* '#{filename}'\n"
end
end

Expand All @@ -27,6 +27,8 @@
'paste_text' => paste
)

Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
net = Net::HTTP.new(url.host, 443)
net.use_ssl = true
net.start { |http| http.request(req) }
end
end

0 comments on commit 9962467

Please sign in to comment.