Skip to content

Instantly share code, notes, and snippets.

@mkaito
Created July 27, 2012 02:49
Show Gist options
  • Save mkaito/3185932 to your computer and use it in GitHub Desktop.
Save mkaito/3185932 to your computer and use it in GitHub Desktop.

Revisions

  1. Kaito Michishige revised this gist Aug 6, 2012. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions post-receive
    Original file line number Diff line number Diff line change
    @@ -4,15 +4,16 @@
    require 'net/http'

    branches = []
    cnum = 0
    STDIN.each do |line|
    (oldrev, newref, refname) = line.split
    (oldref, newref, refname) = line.split
    branches.push `git rev-parse --symbolic --abbrev-ref #{refname}`.chomp
    cnum += `git log --format=oneline #{oldref}..#{newref} | wc -l`.chomp
    end

    branches = branches.uniq.join(", ")
    repo = ENV['GL_REPO']
    user = ENV['GL_USER']
    cnum = STDIN.length

    uri = URI('http://memorici.de:54545/hubot/git/pushed/spaceships/')
    Net::HTTP.post_form uri, 'user' => user, 'num' => cnum, 'branch' => branches, 'repo' => repo
    Net::HTTP.post_form uri, 'user' => user, 'num' => cnum, 'branch' => branches, 'repo' => repo
  2. Kaito Michishige created this gist Jul 27, 2012.
    18 changes: 18 additions & 0 deletions post-receive
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/usr/bin/env ruby
    # Notify hubot when someone pushes.

    require 'net/http'

    branches = []
    STDIN.each do |line|
    (oldrev, newref, refname) = line.split
    branches.push `git rev-parse --symbolic --abbrev-ref #{refname}`.chomp
    end

    branches = branches.uniq.join(", ")
    repo = ENV['GL_REPO']
    user = ENV['GL_USER']
    cnum = STDIN.length

    uri = URI('http://memorici.de:54545/hubot/git/pushed/spaceships/')
    Net::HTTP.post_form uri, 'user' => user, 'num' => cnum, 'branch' => branches, 'repo' => repo