Permalink
Browse files

Update for rackup style stuff

  • Loading branch information...
1 parent 664b27c commit c6e32c0421fc8ffcecbd830d9431506d196f764e @raggi committed Nov 13, 2009
Showing with 17 additions and 28 deletions.
  1. +4 −4 bin/talker_bot
  2. +0 −24 bin/talker_inspector
  3. +13 −0 examples/config.bot
View
@@ -1,6 +1,8 @@
#!/usr/bin/env ruby
-unless ARGV.first && File.exists?(ARGV[1])
+config = ARGV[1] || 'config.bot'
+
+unless ARGV.first && File.exists?(config)
abort <<-TEXT
Usage: talker_bot room [config.bot]
config.bot is a ruby file of the form:
@@ -10,11 +12,9 @@ unless ARGV.first && File.exists?(ARGV[1])
TEXT
end
-config = ARGV[1] || 'config.bot'
-
require 'talker_bot'
-bot = TalkerBot.new
+bot = TalkerBot.new :room => ARGV.first
bot.instance_eval(File.read(config), config, 0)
bot.connect
bot.run
View
@@ -1,24 +0,0 @@
-#!/usr/bin/env ruby
-require 'talker_bot'
-
-class Inspector
- NAME = "Inspector Jones"
-
- attr_accessor :client
-
- def respond_to?(name)
- true if name.to_s =~ /^on_/
- end
-
- def method_missing(name, *args)
- p [name, args]
- end
-
- def to_s
- NAME
- end
-end
-
-TalkerBot.start(:room => ARGV.first || abort('supply a room number')) do
- use Inspector.new
-end
View
@@ -0,0 +1,13 @@
+#!/usr/bin/env talker_bot
+
+class Inspector
+ def respond_to?(name)
+ true if name.to_s =~ /^on_/
+ end
+
+ def method_missing(name, *args)
+ p [name, args]
+ end
+end
+
+use Inspector.new

0 comments on commit c6e32c0

Please sign in to comment.