Created
November 15, 2010 16:27
-
-
Save alx/700547 to your computer and use it in GitHub Desktop.
jabber bot to deploy rails app
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 'rubygems' | |
require 'jabber/bot' | |
# Create a new bot | |
bot = Jabber::Bot.new({ | |
:name => 'Git Rails Bot', | |
:jabber_id => '[email protected]', | |
:password => 'same-password-everywhere', | |
:master => ["[email protected]"], | |
:is_public => true, | |
:status => 'Hello, I am Deploy Bot.', | |
:presence => :chat, | |
:priority => 10, | |
:silent => true, | |
:debug => true | |
}) | |
bot.add_command( | |
:syntax => 'pull <branch>', | |
:description => 'pull branch', | |
:regex => /^pull\s+.+$/ | |
) do |sender, message| | |
system "cd /var/app/dedi1/current; git pull origin #{message}" | |
end | |
bot.add_command( | |
:syntax => 'restart', | |
:description => 'restart app', | |
:regex => /^restart$/ | |
) do |sender, message| | |
system "touch /var/app/dedi1/current/tmp/restart.txt" | |
end | |
# Unleash the bot | |
bot.connect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment