From bf4d42970e4e5d6e5c140c1f15b2c040b3850d87 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Wed, 23 Oct 2013 11:10:52 -0700 Subject: [PATCH] Proper initialization of adaptors --- src/connection.coffee | 2 +- src/loopback.coffee | 1 + src/robot.coffee | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/connection.coffee b/src/connection.coffee index 84813f7..21bb1c7 100644 --- a/src/connection.coffee +++ b/src/connection.coffee @@ -29,5 +29,5 @@ module.exports = class Connection @adaptor.disconnect requireAdaptor: (adaptorName) -> - console.log "dynamic load adaptor" + Logger.info "dynamic load adaptor" @robot.requireAdaptor(adaptorName, self) diff --git a/src/loopback.coffee b/src/loopback.coffee index 5a77bd3..3d345f0 100644 --- a/src/loopback.coffee +++ b/src/loopback.coffee @@ -20,6 +20,7 @@ class Loopback connect: -> console.log "Connecting to adaptor '#{@name}'..." + self disconnect: -> console.log "Disconnecting from adaptor '#{@name}'..." diff --git a/src/robot.coffee b/src/robot.coffee index 98d2266..06f778b 100644 --- a/src/robot.coffee +++ b/src/robot.coffee @@ -72,6 +72,9 @@ module.exports = class Robot require("cylon-#{adaptorName}").register(self) unless self.adaptors[adaptorName]? require(self.adaptors[adaptorName]).adaptor(name: adaptorName).connect(connection: connection) + requireAdaptor: (adaptorName, connection) -> + self.requireAdaptor(adaptorName, connection) + registerAdaptor: (moduleName, adaptorName) -> return if self.adaptors[adaptorName]? self.adaptors[adaptorName] = moduleName