Skip to content

Instantly share code, notes, and snippets.

@jpfuentes2
Created November 8, 2013 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpfuentes2/7374713 to your computer and use it in GitHub Desktop.
Save jpfuentes2/7374713 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "clap"
@branch = "master"
@remote = "production"
Clap.run ARGV,
"--branch" => ->(b) { @branch = b },
"--remote" => ->(e) { @remote = e }
puts `git push -v #{@remote} #{@branch}`
if $?.success?
require "flowdock"
begin
info = `git config --get-regexp "user.(name|email)"`.split("\n")
name, email = info.map { |s| s.sub(/user\.(name|email)\s/,'') }
flow = Flowdock::Flow.new(
api_token: ENV["FLOWDOCK_API_TOKEN"],
source: "git-deploy",
project: PROJECT_NAME,
from: { name: name, address: email }
)
flow.push_to_team_inbox(
format: "html",
subject: "#{PROJECT_NAME} deployed #deploy",
content: "Deployed branch #{@branch} -> #{@remote}",
tags: ["deploy"]
)
rescue => e
puts "Could not use Flowdock API to record deploy"
puts e.message
end
else
puts "Error!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment