Created
November 8, 2013 17:41
-
-
Save jpfuentes2/7374713 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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