Commit Graph

28 Commits

Author SHA1 Message Date
Ron Evans 3717c4dc31 Merge pull request #195 from hybridgroup/refactor/robots-collection
Refactor Robots collection
2014-06-06 18:36:19 -04:00
Andrew Stewart 81fa260963 Store robots in an dict, rather than array
Also removes the find{Robot,RobotConnection,RobotDevice} methods. Additionally,
stops passing the Master through to the Robot constructor, we can just
require('./cylon') if we need to access anything in there.
2014-06-06 11:36:22 -07:00
Andrew Stewart f91dd7d5c3 Refactor Utils (mostly) out of global namespace
This commit reframes the Utils module to be more self-contained, and now only
the Number prototype methods and the every/after/constantly methods are exposed
globally.

I'm unsure about whether these methods can be more scoped such that people can
turn them off if they want, but that's potentially something to look into in the
future.

This commit also updates most of the other source files in Cylon, requiring the
Utils module rather than assuming the methods are in the global namespace.

A similar batch of commits will need to be made for all other Cylon modules to
make sure they don't explode when they can't find #subclass or something like
that.

To make the previously-global methods available, both in submodules and for
people looking for them, all the utility functions are exported in Cylon.Utils.
2014-06-05 12:17:29 -07:00
Andrew Stewart 6bc1e9d944 Move configuration to API class 2014-06-04 11:51:07 -07:00
Andrew Stewart c22ef95239 Remove Logger from global namespace 2014-05-13 19:44:40 -07:00
Andrew Stewart 43a9351921 Convert Cylon.Master to a plain JS object
Acts exactly the same with much, much less code complexity.

This also introduces a pattern for providing core modules to external libraries.

Whereas previously Cylon modules were able to rely on Cylon.Adaptor or
Cylon.Driver being present in the namespace (due to being required in
./lib/cylon), they will now need to require Cylon first, like this:

    var Cylon = require('cylon');

    var Driver = Cylon.Driver,
        Adaptor = Cylon.Adaptor,
        DigitalPin = Cylon.IO.DigitalPin;
2014-05-13 19:20:54 -07:00
Andrew Stewart a3974f38b7 Remove node-namespace from API 2014-05-07 15:19:23 -07:00
Javier Cervantes 394691a8f2 Refactoring api optional ssl logic 2014-04-24 11:18:20 -05:00
Javier Cervantes 956e757e8e Updating ssl configuration keys and tests 2014-04-24 10:14:02 -05:00
Javier Cervantes 40b3db1dce Changing how ssl is configured
Expected configuration:

{
  ssl: {
    key: "/path/to/key",
    cert: "/path/to/cert"
  }
}

If ssl is false, use plain HTTP. If it's an empty object (the default)
use our self-signed certs. If it's set up like above, use the provided
certs.
2014-04-23 17:56:42 -05:00
Javier Cervantes cc3dac9442 Adding optional ssl param in API
By default http is used for api, but you can pass a param to use ssl.

This is the same behaviour that we have currently in robot.
2014-04-23 17:02:25 -05:00
Andrew Stewart e66c1145d5 Simplify Master#api 2014-04-21 16:36:47 -07:00
edgarsilva 283b05b08a Fixes bug with robot not halting, which caused connections, adaptors and devices to not disconnect. 2014-04-21 17:46:02 -05:00
Andrew Stewart d8152852a0 Correctly kill process 2014-04-14 15:11:07 -07:00
Andrew Stewart 9e781a2ea1 Add basic tests for API server and routes 2014-04-11 12:33:32 -07:00
Andrew Stewart 4b409f7777 Add CORS param for API config 2014-04-08 10:58:58 -07:00
Andrew Stewart 89a5bbae2f Support passing auth hash to API server 2014-04-03 15:49:13 -07:00
Andrew Stewart 29b7db0de8 Add support for manually specifying cert/key files 2014-04-03 15:03:21 -07:00
Andrew Stewart f9537d9af8 Rename #stop to #halt to avoid potential conflicts 2014-03-11 10:44:11 -07:00
Andrew Stewart a1b230c62d Added specs for Cylon#findRobotConnection 2014-03-09 19:06:06 -07:00
Andrew Stewart 691547a97f Add specs for Cylon#findRobotDevice 2014-03-09 18:56:42 -07:00
Andrew Stewart c0c4ce6958 Small changes to appease JSHint 2014-03-07 23:33:59 -08:00
Andrew Stewart 9c5d1c3496 Refactor API configuration method 2014-03-04 16:18:51 -08:00
Andrew Stewart 5120c35f7c Provide backing variables instead of functions 2014-03-04 16:10:49 -08:00
Andrew Stewart 89f0e43570 Clean up Windows readline-SIGINT support 2014-03-03 14:35:32 -08:00
Andrew Stewart f307aad0cd Add global.bind method and tests 2014-02-28 10:31:10 -08:00
Andrew Stewart df82352a96 Refactor cylon.js 2014-02-27 13:32:05 -08:00
deadprogram b27756abfc WIP on pure JS revamp 2014-02-27 06:44:53 -08:00