Skip to content

Commit

Permalink
correctly calls the script
Browse files Browse the repository at this point in the history
  • Loading branch information
purzelrakete committed Feb 20, 2009
1 parent 267f115 commit 551b79d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
8 changes: 7 additions & 1 deletion README.markdown
Expand Up @@ -13,4 +13,10 @@ now send some data down the pipes!
echo "#musicteam,#legal,@alice New album uploaded: ..." | nc somemachine 12345
tail -f /var/log/important.log | nc somemachine 12345

run stuff by typing ?command in the main mini channel or by dmsging mini bot. this will invoke miniminimini.rb with the command as an arg. place miniminimini.rb on your $PATH.
run stuff by typing ?command in the main mini channel or by dmsging mini bot. this will invoke a script called miniminimini with the command as an arg. here's an example miniminimini:

#!/usr/local/bin/ruby

puts "called miniminimini with #{ ARGV.inspect }"

place this on your $PATH and don't forget to chmod +x. check where ruby lives by typing `which ruby`, and replace the bang line above with your ruby path.
2 changes: 0 additions & 2 deletions TODO.textile
@@ -1,5 +1,3 @@
* add buffering to avoid flooding
* add !commands
* only respond to ppl on main chan
* add sinatra
* add datamapper
4 changes: 2 additions & 2 deletions lib/mini/irc.rb
Expand Up @@ -26,8 +26,8 @@ def unwind(nicks)
IRC.moderators = nicks.split.map { |nick| nick.delete("@").delete("+") }

while job = (@queue ||= []).pop
sender, bang = job
say(%x{ #{ ruby -S miniminimini.rb bang[1..-1] } }) if IRC.moderators.include?(sender)
sender, cmd = job
say(%x{ miniminimini #{ cmd } }) if IRC.moderators.include?(sender)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/mini/listener.rb
Expand Up @@ -2,7 +2,7 @@ module Mini
module Listener
mattr_accessor :connection

# echo "#musicteam,#legal,@alice New album uploaded: ..." | nc -q0 somemachine 12345.
# echo "#musicteam,#legal,@alice New album uploaded: ..." | nc somemachine 12345.
def receive_data(data)
all, targets, *payload = *data.match(/^(([\#@]\S+,? ?)*)(.*)$/)
targets = targets.split(",").map { |target| target.strip }.uniq
Expand Down

0 comments on commit 551b79d

Please sign in to comment.