Permalink
Browse files

use the version attribute on robot

  • Loading branch information...
1 parent fb48ead commit baeb865555fb4c1d41ba17293e26ce5d23e95110 @atmos atmos committed Dec 24, 2011
Showing with 8 additions and 18 deletions.
  1. +4 −13 bin/hubot
  2. +4 −5 src/robot.coffee
View
@@ -71,19 +71,6 @@ if Options.create
creator = new Creator.Creator(Options.path)
creator.run()
-else if Options.version
- package_path = __dirname + "/../package.json"
-
- Fs.readFile package_path, (err,data) ->
- if err
- console.error "Could not open package file : %s", err
- process.exit 1
-
- content = JSON.parse(data.toString('ascii'))
- console.log content['version']
-
- process.exit 0
-
else
adapterPath = Path.resolve __dirname, "..", "src", "adapters"
@@ -92,6 +79,10 @@ else
Options.enableHttpd,
Options.name
+ if Options.version
+ console.log robot.version
+ process.exit 0
+
robot.enableSlash = Options.enableSlash
robot.alias = Options.alias
View
@@ -167,7 +167,7 @@ class Robot
#
# Returns nothing.
loadAdapter: (path, adapter) ->
- @logger.info "Loading adapter #{adapter}"
+ @logger.debug "Loading adapter #{adapter}"
try
path = if adapter in HUBOT_DEFAULT_ADAPTERS
@@ -287,11 +287,10 @@ class Robot
parseVersion: ->
package_path = __dirname + "/../package.json"
- console.log package_path
- data = Fs.readFileSync package_path, 'utf8', (err,data) =>
+ data = Fs.readFileSync package_path, 'utf8'
- content = JSON.parse(data)
- @version = content['version']
+ content = JSON.parse data
+ @version = content.version
class Robot.Message
# Represents an incoming message from the chat.

0 comments on commit baeb865

Please sign in to comment.