Created
November 28, 2012 00:09
-
-
Save chip/4158086 to your computer and use it in GitHub Desktop.
Sinatra app to deploy master branch based on SemaphoreApp payload
This file contains hidden or 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
# Inspired by http://www.travisberry.com/2012/02/hubot-deploy/ | |
require 'rubygems' | |
require 'sinatra' | |
require 'yajl' | |
get '/' do | |
"Whatchu talkin bout, Willis?" | |
end | |
post '/deploy' do | |
puts "Reading request body..." | |
json = request.body.read | |
puts "Parsing JSON data..." | |
data = Yajl::Parser.parse(json) | |
puts data | |
if data['branch_name'] == 'master' && data['result'] == 'passed' | |
command = "cd ~/public_html/rentwb_for_deployment; git pull origin master;" # cap deploy staging" | |
puts command | |
pipe = IO.popen(command) | |
response = pipe.readlines | |
puts response.join | |
else | |
puts "Nothing to do here. Buh-bye" | |
end | |
end |
This file contains hidden or 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
source :rubygems | |
gem 'shotgun' | |
gem 'sinatra' | |
gem 'yajl-ruby' |
NameVirtualHost *:8181
<VirtualHost *:8181>
ServerName 50.56.23.249
DocumentRoot /var/www/deploy/public
<Directory /var/www/deploy/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still need to add Campfire integration