Commit Graph

152 Commits

Author SHA1 Message Date
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
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