Commit Graph

141 Commits

Author SHA1 Message Date
Andrew Stewart 9406fddaad Use same formatting for all log strings 2014-06-10 11:33:52 -07:00
Ron Evans 17c1d4609f Merge pull request #198 from hybridgroup/refactor/robot
Robot Refactors
2014-06-10 13:52:00 -04:00
Andrew Stewart 0517942253 Remove the 'connect' and 'start' events
These events are being removed, as they're essentially useless in most cases, as
the events will already have been emitted before the work block is run to set up
handlers for them.
2014-06-10 09:20:23 -07:00
Andrew Stewart dbde3d5b7d Remove circular reference from Robot 2014-06-09 13:24:42 -07:00
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 ebdeeccd12 Use implicit object conversion with #toJSON
JSON.stringify, if told to convert an object with a #toJSON method, will instead
stringify the result of the #toJSON method.
2014-06-06 14:15:43 -07: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 a5241e57b5 All work and no play makes Jack a dull boy
Robots can now take a break and have #play functions instead of #work.
Internally they're treated the same, but it's a fun easter egg!

Example:

Cylon.robot({
  name: 'Jack',

  connections: [],
  devices: [],

  play: function play(my) {
    every((5).seconds(), function() {
      console.log("All work and no play makes %s a dull boy.", my.name);
    });
  }
});

I sincerely apologize for the repeated reference to The Shining, blame
@deadprogram.

Closes #189.
2014-06-04 16:33:20 -07:00
Andrew Stewart 38ad5eae78 Remove unnecessary/broken tests 2014-06-04 13:41:42 -07:00
Andrew Stewart 5e21c52b95 Add mock request/response classes for testing 2014-06-04 12:51:35 -07:00
Andrew Stewart cae754672e Add mock request/response classes for testing 2014-06-04 12:48:20 -07:00
Andrew Stewart 6bc1e9d944 Move configuration to API class 2014-06-04 11:51:07 -07:00
Andrew Stewart 838fdc7046 Correct references to Logger in tests 2014-05-24 10:34:19 -07:00
Andrew Stewart e27aa46f07 Move test support file into test/support dir 2014-05-24 10:34:09 -07:00
Andrew Stewart 34e562207d Tidy up Cylon specs, add specs for exports 2014-05-13 19:48:50 -07:00
Andrew Stewart c22ef95239 Remove Logger from global namespace 2014-05-13 19:44:40 -07:00
Andrew Stewart c99ce6571f Remove node-namespace from DigitalPin 2014-05-13 18:31:25 -07:00
Andrew Stewart f20ae55bf6 Remove node-namespace from Robot 2014-05-08 08:57:20 -07:00
Andrew Stewart 7bab3ff65f Remove node-namespace from Connection 2014-05-07 08:38:06 -07:00
Andrew Stewart f8e546a6e0 Remove node-namespace from Device 2014-05-06 19:18:13 -07:00
Andrew Stewart d46de63379 Remove node-namespace from Test Drivers/Adaptors 2014-05-06 18:56:13 -07:00
Andrew Stewart c8cb7f0e40 Remove node-namespace from Driver 2014-05-06 18:24:43 -07:00
Andrew Stewart 637bce0e6d Remove node-namespace from Adaptor 2014-05-06 18:19:56 -07:00
Ron Evans 2958f148f3 Merge pull request #176 from hybridgroup/remove-class-cruft-and-namespace
Remove class cruft and namespace from Basestar
2014-05-04 02:34:14 -07:00
Andrew Stewart f9d39151af Simplify testing harness 2014-04-27 15:28:08 -07:00
Andrew Stewart a9ae09bdce Remove Basestar from global scope 2014-04-24 16:31:58 -06:00
Andrew Stewart bcd9cb84ec Clean up spec 2014-04-24 10:55:16 -06:00
Javier Cervantes f05025ba68 Removing wrong conditional in api 2014-04-24 11:25:45 -05:00
Javier Cervantes 224287744a Adding test for ssl disabled 2014-04-24 10:14:16 -05:00
Javier Cervantes 956e757e8e Updating ssl configuration keys and tests 2014-04-24 10:14:02 -05:00
Javier Cervantes e5400341d0 Making tests green 2014-04-24 09:41:51 -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
edgarsilva 801d1a5d49 Fixed tests, change incorrect 4 for '4' 2014-04-21 18:27:07 -05:00
edgarsilva 37af9c8e62 Remove circular reference test for master. 2014-04-21 18:03:33 -05: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 26b92987a8 Improve specs for Logger 2014-03-21 16:15:13 -07:00
Andrew Stewart cb35cf27a5 Improve specs for Driver class 2014-03-21 12:17:39 -07:00
Andrew Stewart 0a631513ee Improve specs for Cylon.Adaptor class 2014-03-21 10:15:53 -07:00
Andrew Stewart e4c43c0cd5 Remove Port class
Ultimately unnecessary with Cylon, as opposed to Artoo where we do some
interesting/tricky stuff with Socket-To-Serial to make everything work.
2014-03-18 13:41:12 -07:00
Andrew Stewart e7f96b8a6c Refactor and improve tests for Cylon.IO.DigitalPin 2014-03-14 13:33:49 -07:00
Andrew Stewart f9537d9af8 Rename #stop to #halt to avoid potential conflicts 2014-03-11 10:44:11 -07:00
Andrew Stewart 0ebd4153d4 Improve/expand test coverage for utils 2014-03-10 15:26:19 -07:00
Andrew Stewart 56b66bded4 Add/improve specs for Connection class 2014-03-10 09:49:46 -07:00
Andrew Stewart cbbaa10c52 Add specs for Cylon#stop 2014-03-09 19:18:45 -07:00
Andrew Stewart a112a5bedc Add specs for Cylon#start 2014-03-09 19:17:40 -07:00
Andrew Stewart a1b230c62d Added specs for Cylon#findRobotConnection 2014-03-09 19:06:06 -07:00