Browse files

Move scripts into src/scripts

  • Loading branch information...
1 parent b53c745 commit 9d1a31fd19f05ec9e493a26aaade7e238c104282 Tom Bell committed Nov 4, 2011
View
37 bin/hubot
@@ -13,15 +13,26 @@ Creator = require '../src/creator'
OptParse = require 'optparse'
PortNumber = parseInt(process.env.PORT) || 8080
-Adapters = ["irc", "campfire", "hipchat", "twilio", "xmpp", "groupme", "talker", "twitter", "flowdock", "gtalk"]
+Adapters = [
+ "irc",
+ "campfire",
+ "hipchat",
+ "twilio",
+ "xmpp",
+ "groupme",
+ "talker",
+ "twitter",
+ "flowdock",
+ "gtalk"
+]
Switches = [
- [ "-h", "--help", "Display the help information"],
- [ "-a", "--adapter ADAPTER", "The Adapter to use"],
- [ "-c", "--create PATH", "Create a deployable hubot"],
- [ "-s", "--enable-slash", "Enable replacing the robot's name with '/'"],
- [ "-n", "--name NAME", "The name of the robot in chat" ],
- [ "-v", "--version", "Displays the version of hubot installed"]
+ [ "-h", "--help", "Display the help information"],
+ [ "-a", "--adapter ADAPTER", "The Adapter to use"],
+ [ "-c", "--create PATH", "Create a deployable hubot"],
+ [ "-s", "--enable-slash", "Enable replacing the robot's name with '/'"],
+ [ "-n", "--name NAME", "The name of the robot in chat" ],
+ [ "-v", "--version", "Displays the version of hubot installed"]
]
Options =
@@ -80,12 +91,14 @@ else
else
'shell'
+ robot = Hubot.loadBot adapter, Options.name
+ robot.enableSlash = Options.enableSlash
+
scriptsPath = Path.resolve "./scripts"
console.log "Loading deploy-local scripts at #{scriptsPath}"
- robot = Hubot.loadBot adapter, scriptsPath, Options.name
- robot.enableSlash = Options.enableSlash
+ robot.load scriptsPath
- scriptsPath = Path.resolve "src", "hubot", "scripts"
+ scriptsPath = Path.resolve "src", "scripts"
console.log "Loading hubot core scripts for relative scripts at #{scriptsPath}"
robot.load scriptsPath
@@ -96,10 +109,6 @@ else
Fs.readFile scriptsFile, (err, data) =>
JSON.parse(data).forEach (plugin) =>
robot.loadFile Path.resolve("node_modules", "hubot-scripts", "src", "scripts"), plugin
- else
- scriptsPath = Path.resolve "src", "scripts"
- console.log "Loading hubot-scripts plugins at #{scriptsPath}"
- robot.load scriptsPath
robot.run()
View
4 index.coffee
@@ -4,9 +4,9 @@
# YourBot = Hubot.robot 'campfire', 'blah', 'yourbot'
# Loads a Hubot robot
-exports.loadBot = (adapterName, path, botName) ->
+exports.loadBot = (adapterName, botName) ->
robot = require "./src/adapters/#{adapterName}"
- new robot path, botName
+ new robot botName
exports.robot = ->
require './src/robot'
View
4 src/robot.coffee
@@ -8,7 +8,7 @@ class Robot
# dispatch them to matching listeners.
#
# path - String directory full of Hubot scripts to load.
- constructor: (path, name = "Hubot") ->
+ constructor: (name = "Hubot") ->
@name = name
@brain = new Robot.Brain
@commands = []
@@ -17,8 +17,6 @@ class Robot
@loadPaths = []
@enableSlash = false
- @load path if path
-
# Public: Adds a Listener that attempts to match incoming messages based on
# a Regex.
#
View
0 src/hubot/scripts/google-images.coffee → src/scripts/google-images.coffee
File renamed without changes.
View
0 src/hubot/scripts/help.coffee → src/scripts/help.coffee
File renamed without changes.
View
0 src/hubot/scripts/maps.coffee → src/scripts/maps.coffee
File renamed without changes.
View
0 src/hubot/scripts/math.coffee → src/scripts/math.coffee
File renamed without changes.
View
0 src/hubot/scripts/ping.coffee → src/scripts/ping.coffee
File renamed without changes.
View
0 src/hubot/scripts/roles.coffee → src/scripts/roles.coffee
File renamed without changes.
View
0 src/hubot/scripts/rules.coffee → src/scripts/rules.coffee
File renamed without changes.
View
0 src/hubot/scripts/storage.coffee → src/scripts/storage.coffee
File renamed without changes.
View
0 src/hubot/scripts/translate.coffee → src/scripts/translate.coffee
File renamed without changes.
View
0 src/hubot/scripts/youtube.coffee → src/scripts/youtube.coffee
File renamed without changes.

0 comments on commit 9d1a31f

Please sign in to comment.