Module: Octospy::Parser::Repository
- Included in:
- Octospy::Parser
- Defined in:
- lib/octospy/parser/repository.rb
Instance Method Summary collapse
- #parse_commit_comment_event ⇒ Object
- #parse_create_event ⇒ Object
- #parse_delete_event ⇒ Object
- #parse_fork_apply_event ⇒ Object
- #parse_fork_event ⇒ Object
- #parse_public_event ⇒ Object
- #parse_push_event ⇒ Object
Instance Method Details
#parse_commit_comment_event ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/octospy/parser/repository.rb', line 4 def parse_commit_comment_event commit_url = "#{Octokit.web_endpoint}#{@event.repo.name}/commit/#{@event.payload.comment.commit_id}" { status: "commented on commit", title: "#{@event.payload.comment.path}", body: "#{@event.payload.comment.body}".split_lfbl, link: "#{commit_url}#commitcomment-#{@event.payload.comment.id}" } end |
#parse_create_event ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/octospy/parser/repository.rb', line 36 def parse_create_event if @event.payload.ref_type.eql? 'repository' title = @event.repo.name title = "#{title}: #{@event.payload.description}" if @event.payload.description { status: "created repository", title: title, link: "#{Octokit.web_endpoint}#{@event.repo.name}", repository: nil } else { status: "created #{@event.payload.ref_type}:#{@event.payload.ref}", title: @event.payload.description, link: "#{Octokit.web_endpoint}#{@event.repo.name}" } end end |
#parse_delete_event ⇒ Object
55 56 57 58 59 60 |
# File 'lib/octospy/parser/repository.rb', line 55 def parse_delete_event { status: "deleted #{@event.payload.ref_type}:#{@event.payload.ref}", link: "#{Octokit.web_endpoint}#{@event.repo.name}" } end |
#parse_fork_apply_event ⇒ Object
79 80 81 |
# File 'lib/octospy/parser/repository.rb', line 79 def parse_fork_apply_event {} end |
#parse_fork_event ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/octospy/parser/repository.rb', line 62 def parse_fork_event forkee_name = @event.payload.forkee.full_name forkee_lang = @event.payload.forkee.language { status: "forked to #{forkee_name}", title: "#{forkee_lang}: #{@event.payload.forkee.description}", link: "#{Octokit.web_endpoint}#{@event.payload.forkee.full_name}" } end |
#parse_public_event ⇒ Object
72 73 74 75 76 77 |
# File 'lib/octospy/parser/repository.rb', line 72 def parse_public_event { status: "published #{@event.repo.name}", link: "#{Octokit.web_endpoint}#{@event.repo.name}" } end |
#parse_push_event ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/octospy/parser/repository.rb', line 15 def parse_push_event body = [] branch = @event.payload.ref.gsub('refs/heads/', '') @event.payload.commits.each do |commit| verbose_commit = Octokit.commit(@event.repo.name, commit.sha) name = "#{verbose_commit. ? verbose_commit..login : commit..name}" link = "#{Octokit.web_endpoint}#{@event.repo.name}/commit/#{commit.sha}" line = "#{name.to_s.colorize_for_irc.silver}: #{commit.}" line << " - #{link.shorten.to_s.colorize_for_irc.blue}" body = body + "#{line}".split_lfbl end { status: "pushed to #{branch}", body: body, link: "#{Octokit.web_endpoint}#{@event.repo.name}/tree/#{branch}", notice_body: true } end |