Permalink
Browse files

Merge pull request #2 from mpapis/master

improvements
  • Loading branch information...
2 parents a6089bc + 44c004f commit cc705a8f902508189ffac6ca839e02135ce15a3a @steveklabnik committed Mar 19, 2012
Showing with 68 additions and 6 deletions.
  1. +2 −0 .gitignore
  2. +42 −0 README.md
  3. 0 bin/eployday
  4. +7 −2 lib/eployday/cli.rb
  5. +14 −0 lib/eployday/configuration.rb
  6. +2 −3 lib/eployday/deploy.rb
  7. +1 −1 lib/eployday/permission_checker.rb
View
@@ -3,3 +3,5 @@
.bundle
Gemfile.lock
pkg/*
+example.yml
+nohup.out
View
@@ -0,0 +1,42 @@
+# SM Deploy IRC Bot
+
+IRC boot for automatic triggerring `sm deploy`.
+
+# Installation
+
+On server:
+
+ gem install eployday
+
+
+Example for auto deploy on travis-ci tests passed `rvm-site.yml`:
+
+ ---
+ nick: rvm-site-deploy
+ channels:
+ - "#rvm-test"
+ trigger_text: !ruby/regexp /.*The build passed\..*/
+ allowed_users:
+ - travis-ci
+ command: "bdsm deploy"
+
+
+Test run:
+
+ eployday rvm-site.yml
+
+
+Start in background with:
+
+ nohup eployday rvm-site.yml &
+
+
+Log file will be stored in `nohup.out`.
+
+# Development
+
+Development:
+
+ RUBYLIB=./lib ruby bin/eployday example.yml
+
+example.yml is ignored so you can use it development.
View
0 bin/eployday 100644 → 100755
No changes.
View
@@ -1,14 +1,19 @@
require 'cinch'
+require 'eployday/configuration'
require 'eployday/deploy'
module Eployday
class CLI
+ def initialize args
+ raise "configuration file name required" if args.empty?
+ end
+
def run
bot = Cinch::Bot.new do
configure do |c|
- c.nick = "eployday"
+ c.nick = Eployday::Configuration[:nick]
c.server = "irc.freenode.net"
- c.channels = ["#rstatus"]
+ c.channels = Eployday::Configuration[:channels]
c.plugins.plugins = [Deploy]
end
end
@@ -0,0 +1,14 @@
+require 'yaml'
+
+module Eployday
+ class Configuration
+ def initialize args
+ @@configuration = YAML.load_file args
+ end
+ def self.[] key
+ puts "-- configuration[#{key}] => #{@@configuration[key.to_s]}"
+ @@configuration[key.to_s]
+ end
+ end
+ Configuration.new ARGV.first unless ARGV.empty?
+end
View
@@ -5,15 +5,14 @@ module Eployday
class Deploy
include Cinch::Plugin
- match "deploy"
+ match Eployday::Configuration[:trigger_text], :use_prefix => false
def execute(m)
if PermissionChecker.allowed?(m.user)
m.reply "#{m.user.nick}: beginning deploy."
- Kernel.system "sm deploy"
+ Kernel.system Eployday::Configuration[:command]
m.reply "#{m.user.nick}: deploy finished."
end
end
end
end
-
@@ -6,7 +6,7 @@ def allowed?(user, list=load_whitelist)
end
def load_whitelist
- @whitelist = %w[steveklabnik carols10cents wilkie cl0ckw0rk ddagradi]
+ @whitelist = Eployday::Configuration[:allowed_users]
end
end
end

0 comments on commit cc705a8

Please sign in to comment.