Commit Graph

174 Commits

Author SHA1 Message Date
Andrew Stewart 55f9445149 Remove #proxyTestStubs in favor of inline solution 2014-08-13 15:04:25 -07:00
Andrew Stewart b312f6bb6b Correctly proxy functions from driver to device 2014-08-12 18:33:20 -07:00
Andrew Stewart d4e34c6f54 Test API routes to ensure they can resolve 2014-08-12 13:15:47 -07:00
Andrew Stewart df60282042 Simplify test 2014-08-11 15:55:47 -07:00
Andrew Stewart 1f0b214c97 Add Driver#setupCommands method 2014-08-11 14:11:06 -07:00
Andrew Stewart 7a481f6767 Correctly execute device commands 2014-08-07 13:56:06 -07:00
Andrew Stewart e6c567a090 Add new command structure 2014-08-07 12:24:29 -07:00
Andrew Stewart 026d3777e6 Simplify coercion of Robot to JSON 2014-07-29 18:49:35 -07:00
Andrew Stewart 029aca2e9e Add 'details' subsection to Device/Connection 2014-07-25 16:11:45 -07:00
Ron Evans 8762820d0c Merge pull request #213 from hybridgroup/refactor/threepio
Threepio Support
2014-07-19 01:08:19 +02:00
Andrew Stewart 7394eefde2 WIP on commands + JSON serialization 2014-07-15 12:27:16 -07:00
Andrew Stewart ace5f15a36 Refer to device connections by name in JSON format 2014-07-15 11:49:29 -07:00
Andrew Stewart b4a68d1a37 Remove connection_id from Connection class 2014-07-15 11:43:43 -07:00
Adrian Zankich 0184efb4cd Merge pull request #211 from hybridgroup/fix/require-connection
Require a connection if a robot has any devices
2014-07-14 07:57:20 -10:00
Andrew Stewart ba295e9642 Slightly clean up Connection 2014-07-12 11:00:22 -07:00
Andrew Stewart 4dd7e013ed Require a connection if a robot has any devices 2014-07-11 10:46:22 -07:00
Andrew Stewart 857a34dc41 Prefer {before,after}Each 2014-07-04 09:49:29 -07:00
Andrew Stewart 070c4a4fb9 Fix test preparation 2014-07-03 11:54:18 -07:00
Andrew Stewart ca2bf7e5a9 Merge branch 'dev' into servo-level-up
* dev:
  Remove `self` references in favor of #bind
  Stop using #fetch here for now, it just breaks tests
  Just use arguments directly instead of array
  Remove Utils#bind in preference of built-in fn
  Consolidate logstring generation into private fn
  Experiment with Utils.fetch in Driver class
  Add #fetch Utility function
  Fix JSHint errors
  Fix an edge case and improve tests for API
2014-07-03 11:52:02 -07:00
Andrew Stewart 8ba5bb0e6a Working tests for Adaptor#_noop 2014-07-03 11:51:51 -07:00
Edgar Silva 1eabab6ec9 WIP: Change noop to use anonymous function and added tests. 2014-07-03 13:42:43 -05:00
Andrew Stewart f0d8b0360b Remove `self` references in favor of #bind 2014-07-03 09:35:24 -07:00
Andrew Stewart 5acfd4aed4 Remove Utils#bind in preference of built-in fn
We were re-implementing Function.prototype.bind, so let's just use that.
2014-06-17 19:35:07 -07:00
Andrew Stewart e8520e3de2 Experiment with Utils.fetch in Driver class 2014-06-17 19:15:38 -07:00
Andrew Stewart 6f42b061b3 Add #fetch Utility function
The #fetch utility acts in (roughly) the same way as Ruby's Hash#fetch function.
This addition should hopefully make constructors more rigorous and help to
prevent a few classes of errors.
2014-06-17 16:02:54 -07:00
Andrew Stewart ca749fd03e Fix an edge case and improve tests for API 2014-06-16 12:22:11 -07:00
Andrew Stewart 587efe2fee Rename API variables for less confusion
api.express => the Express instance
api.server  => the actual server (@express or a https.Server instance)
2014-06-16 08:44:52 -07:00
Andrew Stewart d90c4eef7c Fix broken specs 2014-06-12 15:40:08 -07:00
edgarsilva 0869909521 Updated fromScale util to return top or bottom of scale, updated specs to reflect new fromScale behavior. 2014-06-11 16:32:40 -05:00
Andrew Stewart 9e1ffad6f6 Add more tests for BasicLogger class 2014-06-10 19:05:41 -07:00
Andrew Stewart f797cf4c48 Misc. cleanup in Basestar 2014-06-10 18:44:40 -07:00
Andrew Stewart 3b312def0d Small cleanups in Device 2014-06-10 18:19:04 -07:00
Andrew Stewart 1832e20e17 Expose commands as array, instead of function
For appropriate classes, #commands is now an array, instead of a function that
returns the same array.
2014-06-10 12:29:44 -07:00
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