Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make stdio hubot the default.

  • Loading branch information...
commit 15cd8a18adb0ab56f1b70ec45fd4e5cde9c9b025 1 parent 53d76c3
@technoweenie technoweenie authored
Showing with 17 additions and 15 deletions.
  1. +15 −15 bin/hubot
  2. +2 −0  src/hubot/shell.coffee
View
30 bin/hubot
@@ -18,7 +18,7 @@ Switches = [
]
Options =
- adapter: "campfire"
+ adapter: "stdio"
Parser = new OptParse.OptionParser(Switches)
Parser.banner = "Usage hubot [options]"
@@ -31,27 +31,27 @@ Parser.parse process.ARGV
Options.adapter
switch Options.adapter
- when "stdio"
- Hubot = require("hubot/shell").Shell
when "campfire"
Hubot = require("hubot/campfire").Campfire
+ else
+ Hubot = require("hubot/shell").Shell
robot = new Hubot Path.resolve(__dirname, "..", "src", "hubot", "scripts")
robot.run()
-server = HTTP.createServer( (req, res) ->
- res.writeHead 200, {'Content-Type': 'text/plain'}
- res.end 'Hello from Hubot\n'
-).listen PortNumber
+if webHost = process.env.HUBOT_WEB_HOST
+ server = HTTP.createServer( (req, res) ->
+ res.writeHead 200, {'Content-Type': 'text/plain'}
+ res.end 'Hello from Hubot\n'
+ ).listen PortNumber
-setInterval ->
- httpOpts =
- host: process.env.HUBOT_WEB_HOST
+ setInterval ->
+ httpOpts = host: webHost
- HTTP.get( httpOpts, (res) ->
- console.log "Got response: #{res}" unless res.statusCode == 200
- ).on 'error', (e) ->
- console.log "Got error: #{e.message}"
-, 60000
+ HTTP.get( httpOpts, (res) ->
+ console.log "Got response: #{res}" unless res.statusCode == 200
+ ).on 'error', (e) ->
+ console.log "Got error: #{e.message}"
+ , 60000
# vim:ft=coffee
View
2  src/hubot/shell.coffee
@@ -10,6 +10,8 @@ class Shell extends Robot
@send user, "#{user.name}: #{str}"
run: ->
+ console.log "Hubot: the Shell."
+
user = new Robot.User 1, 'shell'
process.stdin.resume()
process.stdin.on 'data', (txt) =>
Please sign in to comment.
Something went wrong with that request. Please try again.