Class: Cinch::Plugins::GithubNotifications::Messages
- Inherits:
-
Object
- Object
- Cinch::Plugins::GithubNotifications::Messages
- Defined in:
- lib/cinch/plugins/github_notifications/poster.rb
Class Method Summary collapse
- .commit_comment(info) ⇒ Object
- .create(info) ⇒ Object
- .pull_request(info) ⇒ Object
- .push(info) ⇒ Object
Class Method Details
.commit_comment(info) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/cinch/plugins/github_notifications/poster.rb', line 53 def self.commit_comment(info) actors = info['payload']['comment']['body'].scan(/@([a-z0-9-]+)/i).first if actors.length > 0 last_actor = actors.length == 1 ? nil : actors.pop "[#{info['actor']['login']}] mentioned #{[actors.join(', '),last_actor].compact.join(' and ')} in a comment on #{info['repo']['name']}. #{info['payload']['comment']['url']}" else nil end end |
.create(info) ⇒ Object
49 50 51 |
# File 'lib/cinch/plugins/github_notifications/poster.rb', line 49 def self.create(info) "[#{info['actor']['login']}] created a #{info['payload']['ref_type']} called #{info['payload']['ref']} on #{info['repo']['name']}. #{info['repo']['url']['html_url']}" end |
.pull_request(info) ⇒ Object
39 40 41 42 43 |
# File 'lib/cinch/plugins/github_notifications/poster.rb', line 39 def self.pull_request(info) if info['payload']['action'] != "closed" "[#{info['actor']['login']}] #{info['payload']['action']} a pull request for #{info['repo']['name']}. #{info['payload']['pull_request']['html_url']}" end end |
.push(info) ⇒ Object
45 46 47 |
# File 'lib/cinch/plugins/github_notifications/poster.rb', line 45 def self.push(info) "[#{info['actor']['login']}] pushed #{info['payload']['size']} commit#{info['payload']['size'] == 1 ? '' : 's'} to #{info['repo']['name']}. #{info['repo']['url']['html_url']}" end |