<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>TODO.markdown</filename>
    </added>
    <added>
      <filename>bin/minicmd</filename>
    </added>
    <added>
      <filename>bin/minigen</filename>
    </added>
    <added>
      <filename>mini.gemspec</filename>
    </added>
    <added>
      <filename>scripts/minictl.erb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,2 @@
-- thanks to yakischloba and careo on #eventmachine
-- thanks to masuidrive (http://blog.masuidrive.jp/) for a helpful gist which i can't find anymore. it demonstrated irc+eventmachine.
\ No newline at end of file
+- thx 2 yakischloba and careo #eventmachine
+- thx 2 http://blog.masuidrive.jp/ for a irc+eventmachine gist.
\ No newline at end of file</diff>
      <filename>CREDITS.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -42,17 +42,21 @@ you have to be on the control channel for the script to execute. this is the fir
 
 post to `hostname:MINI_WEB_PORT/command/MINI_SECRET`. ie: 
 
-    curl -dtext=&quot;netcat, lolcats, pigs, sweaty snout, nixon!&quot; http://test.com:2345/echo/dscds789svjskdlvsdz789mkvcjvklsd6
+    curl -d &quot;netcat, lolcats, pigs, sweaty snout, nixon&quot; http://localhost:2345/echo/dscds789svjskdlvsdz789mkvcjvklsd6
     
-of course normally, you'd proxy to startup.com:2345 from somthing sitting behind :80. Set the ENV variables before starting mini. 
+of course normally, you'd proxy to startup.com:2345 from something sitting behind :80. Set the ENV variables before starting mini. 
 
-## commands
+## configuration
+
+### commands
 
-you can create commands simply by providing your own miniminimini script. ARGV.first ist the command, the rest is arguments. mini comes bundled with a ruby based miniminimini script which you can extend by adding procs like this: 
+you can create commands simply by providing your own miniminimini script. ARGV.first is the command, the rest is arguments. mini comes bundled with a ruby based miniminimini script which you can extend by adding procs to ~/miniconfig.rb: 
 
       Mini::Bot.commands[&quot;echo&quot;] = lambda { |*args| puts args }
+      
+just write that straight into ~/miniconfig.rb.
 
-## configuration
+### environment
 
 the following environment variables can be used to configure mini. 
 </diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -1,2 +1,2 @@
-%w{ rubygems eventmachine activesupport ostruct json sinatra }.each { |lib| require lib }
+%w{ rubygems eventmachine activesupport ostruct sinatra }.each { |lib| require lib }
 %w{ listener irc web bot }.each { |lib| require File.dirname(__FILE__) + &quot;/mini/#{ lib }&quot; }
\ No newline at end of file</diff>
      <filename>lib/mini.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,17 @@
-#
-#  Runs proc stored in Mini::Bot.commands[command].
-#
 module Mini
   class Bot
     cattr_accessor :commands
     @@commands = {}
     
+    def self.start(options)
+      EventMachine::run do
+        Mini::IRC.connect(options)
+        EventMachine::start_server(&quot;0.0.0.0&quot;, options[:mini_port], Mini::Listener)
+        @@secret = options[:secret]  
+        @@web.run! :port =&gt; options[:web_port]
+      end
+    end
+    
     def self.run(command, args)
       proc = Bot.commands[command]
       proc ? proc.call(args) : (puts &quot;command #{ command } not found. &quot;)</diff>
      <filename>lib/mini/bot.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,3 @@
-#
-#  Connect to and handle IRC. 
-#
 module Mini
   class IRC &lt; EventMachine::Connection
     include EventMachine::Protocols::LineText2
@@ -36,12 +33,13 @@ module Mini
       
       while job = @queue.pop
         sender, cmd = job
-         execute(cmd) if self.moderators.include?(sender)
+        execute(cmd) if self.moderators.include?(sender)
       end
     end
     
     def execute(cmd)
-      say(%x{ miniminimini #{ cmd } })
+      command = &quot;minicmd #{ [*cmd].join(' ') }&quot;
+      say(%x{#{ command }})
     end
     
     def self.connect(options)</diff>
      <filename>lib/mini/irc.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,8 @@
 module Mini
   module Listener
-
-    # echo &quot;#musicteam,#legal,@alice New album uploaded: ...&quot; | nc somemachine 12345.
-    def receive_data(data)
+    def receive_data(data) # echo &quot;#musicteam,#legal,@alice New album uploaded: ...&quot; | nc somemachine 12345.
       all, targets, *payload = *data.match(/^(([\#@]\S+,? ?)*)(.*)$/)
       targets = targets.split(&quot;,&quot;).map { |target| target.strip }.uniq
-      
       IRC.connection.say(payload.pop.strip, targets)
     end
   end</diff>
      <filename>lib/mini/listener.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 @@web = Sinatra.new do
-  get(&quot;/:command/:secret&quot;) do
-    Mini::IRC.connection.execute([params[:command], params.to_yaml].join(&quot; &quot;)) if params[:secret] == ENV['MINI_SECRET']
+  post(&quot;/:command/:secret&quot;) do
+    command, secret = params.delete(&quot;command&quot;), params.delete(&quot;secret&quot;)
+    Mini::IRC.connection.execute([command, params].join(&quot; &quot;)) if @@secret
   end
 end
\ No newline at end of file</diff>
      <filename>lib/mini/web.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>TODO.textile</filename>
    </removed>
    <removed>
      <filename>script/minictl</filename>
    </removed>
    <removed>
      <filename>script/miniminimini</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>0a332a848fc6dc7b1d9321d3bed14ab758f1c24e</id>
    </parent>
  </parents>
  <author>
    <name>Rany Keddo</name>
    <email>rany@playtype.net</email>
  </author>
  <url>http://github.com/purzelrakete/mini/commit/bf23da0091b657d4094c88247b130b54c4e89159</url>
  <id>bf23da0091b657d4094c88247b130b54c4e89159</id>
  <committed-date>2009-03-07T10:37:20-08:00</committed-date>
  <authored-date>2009-03-07T10:37:20-08:00</authored-date>
  <message>gemified and created minictl, minigen</message>
  <tree>80af5dd059b0d8291cedd8a02a01a272a261fdb6</tree>
  <committer>
    <name>Rany Keddo</name>
    <email>rany@playtype.net</email>
  </committer>
</commit>
