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
3672a1b712
General cleanup of single-line statements
2014-06-09 14:02:06 -07:00
Andrew Stewart
dd553a55f2
Clean up #start to use Async.series
2014-06-09 13:55:44 -07:00
Andrew Stewart
4e43483e9d
Slightly refactor constructor
2014-06-09 13:41:46 -07:00
Andrew Stewart
dbde3d5b7d
Remove circular reference from Robot
2014-06-09 13:24:42 -07:00
edgarsilva
8c46aea525
Fix typo in IO utils.
2014-06-09 13:34:49 -05:00
Andrew Stewart
b1d7dd8186
Generate BasicLogger methods, rather than duplicating code
2014-06-06 17:09:22 -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
af4bbd963b
Clean up API implementation using middleware
2014-06-06 13:52:55 -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
2b5e991ef3
Clean up some of the utility functions
2014-06-05 16:30:05 -07:00
Edgar Silva
a60f16b8ea
Fix typo in utils param name.
2014-06-05 14:47:48 -05: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
789347f6f8
Improve inline docs for Utils functions
2014-06-05 09:32:20 -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
9b352feeae
Move API command param parsing to middleware
2014-06-04 15:54:23 -07:00
Andrew Stewart
ac0a69e63f
Move API routes to their own file
2014-06-04 13:39:30 -07:00
Andrew Stewart
789ce02ad0
Organize server creation into new function
2014-06-04 13:21:15 -07:00
Andrew Stewart
a4cfc4b8ec
Improve authentication middleware mounting
2014-06-04 13:17:17 -07:00
Andrew Stewart
5e21c52b95
Add mock request/response classes for testing
2014-06-04 12:51:35 -07:00
Andrew Stewart
014574a545
Move SSL certs to live under api dir
2014-06-04 11:58:54 -07:00
Andrew Stewart
6bc1e9d944
Move configuration to API class
2014-06-04 11:51:07 -07:00
Andrew Stewart
e08a5df88b
Bump Express version to 4.4.1
2014-06-04 11:06:02 -07:00
edgarsilva
62d4ef620e
Fix typos in new sero IO util.
2014-06-02 18:02:02 -05:00
Edgar Silva
293594355c
WIP on sero utils
2014-06-02 15:45:42 -05:00
deadprogram
69cc76b6a6
Ability to pass the name of module to use for an adaptor. Specifically for case where a module contains multiple adaptors
2014-05-23 18:42:29 -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
1e44224660
Refactor Logger
2014-05-13 19:05:01 -07:00
Andrew Stewart
c99ce6571f
Remove node-namespace from DigitalPin
2014-05-13 18:31:25 -07:00
Andrew Stewart
2cca04873d
Remove node-namespace from Utils
2014-05-13 18:25:31 -07:00
Andrew Stewart
17a0a5d08f
Remove node-namespace from Config
2014-05-13 18:14:36 -07:00
Andrew Stewart
f20ae55bf6
Remove node-namespace from Robot
2014-05-08 08:57:20 -07:00
Andrew Stewart
a3974f38b7
Remove node-namespace from API
2014-05-07 15:19:23 -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
Andrew Stewart
a9ae09bdce
Remove Basestar from global scope
2014-04-24 16:31:58 -06:00
Andrew Stewart
dc09be6bcc
Remove class cruft and namespace from Basestar
2014-04-24 13:43:00 -06:00
Javier Cervantes
3caeb47b3a
Removing unused requires
2014-04-24 11:25:56 -05:00
Javier Cervantes
f05025ba68
Removing wrong conditional in api
2014-04-24 11:25:45 -05: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
8f746f1d27
Renaming https to generic node
2014-04-23 17:55: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
938c11872c
Bumped version to 0.13.3
2014-04-21 18:15:30 -05: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
fcd771cadc
Provide more indication where API is listening
2014-04-14 11:27:48 -07:00
Andrew Stewart
c5428d89ab
Allow Content-Type header to be set for CORS
2014-04-11 19:23:13 -07:00
Andrew Stewart
9e781a2ea1
Add basic tests for API server and routes
2014-04-11 12:33:32 -07:00
Andrew Stewart
1c56b5942f
Implement Server-Sent-Events for device events
2014-04-08 13:21:03 -07:00
Andrew Stewart
cf31cfa7b9
Switch from Express-IO to plain Express
2014-04-08 11:52:53 -07:00
Andrew Stewart
4b409f7777
Add CORS param for API config
2014-04-08 10:58:58 -07:00
Andrew Stewart
c81740e339
Add basic auth support to API
2014-04-03 16:04:11 -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
ea022d3880
Implement HTTPS API with self-signed cert
...
Switches API to serve all requests over HTTPS, using a self-signed SSL
certificate.
2014-04-03 14:32:56 -07:00
Andrew Stewart
34324dabd5
Clean up API logic
2014-04-03 12:28:27 -07:00
edgarsilva
de360ba2b3
Add error handler for devices that fail to initialize.
...
Do not start work if devices fail to initialize and throw err insted.
2014-04-01 17:53:34 -06:00
Andrew Stewart
1cffa6067e
Add Utils to global.Cylon namespace, add bootstrap
...
This commit moves Utils to live in the global Cylon namespace, so they can be
accessed in test suites. This is necessary because Mocha, when setting up for
tests, will override our #after method, making TDR not work if any robots
contain a #after call in their work block.
To fix this, in test setup you can call global.Cylon.Utils.bootstrap();
which will re-setup our globals.
2014-04-01 12:31:13 -07:00
Andrew Stewart
2563e62de4
Catch MODULE_NOT_FOUND errors, throw others
2014-04-01 10:30:14 -07:00
Andrew Stewart
2d11e75434
Remove CLI tooling from Cylon
...
It now lives in hybridgroup/cylon-cli.
2014-03-27 14:45:36 -07:00
Andrew Stewart
337074f34f
Add friendlier errors when no adaptor/driver found
2014-03-26 14:32:52 -07:00
Andrew Stewart
2acc07b443
Fix error with /robots route in API
2014-03-25 10:16:11 -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
70dde8148c
Refactor and clean up Cylon.IO.DigitalPin class
2014-03-14 16:06:32 -07:00
Adrian Zankich
1ee0b8b87a
Ensure toScale stays within defined range
2014-03-11 18:33:39 -07:00
Andrew Stewart
f9537d9af8
Rename #stop to #halt to avoid potential conflicts
2014-03-11 10:44:11 -07:00
Andrew Stewart
4c464f0d88
Remove Math.ceil from #toScale, JS has no integers/floats anyways
2014-03-10 15:25:39 -07:00
Andrew Stewart
3c6696a78f
Reorganize Utils for easier testing
2014-03-10 12:00:48 -07:00
Andrew Stewart
56b66bded4
Add/improve specs for Connection class
2014-03-10 09:49:46 -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
Edgar O Silva
dc22164c0f
Prettyfy.
2014-03-07 18:03:44 -06:00
Edgar O Silva
eae946e41f
Remove logging.
2014-03-07 15:58:26 -06:00
Edgar O Silva
7412977d47
Remove logging
2014-03-07 15:57:56 -06:00
Edgar O Silva
541c7402ef
Refactoring cli commands to make them more friendly and pretty.
2014-03-07 15:57:08 -06: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
Ron Evans
d702d1077a
Merge pull request #128 from hybridgroup/add-stop-to-connection
...
Add a stop function to the base connection class.
2014-03-04 08:48:04 -08:00
edgarsilva
d54c9419af
Add a stop function to the base connection class.
2014-03-04 10:45:19 -06:00
Andrew Stewart
4c5937695b
Add Cylon-provided globals to generated .jshintrc files
2014-03-03 14:41:05 -08:00
Andrew Stewart
89f0e43570
Clean up Windows readline-SIGINT support
2014-03-03 14:35:32 -08:00
Andrew Stewart
d8de60a02d
Clean up var declarations in robot.js
2014-03-03 14:33:29 -08:00
Andrew Stewart
d12adc64b1
Clarify license year in generated adaptors
2014-03-03 14:32:01 -08:00
Andrew Stewart
707703cae2
Improve Device specs
2014-03-03 13:54:33 -08:00
Andrew Stewart
79ff3a1233
Clean up Connection and Device classes
2014-03-03 12:43:30 -08:00
deadprogram
182e8c3ee8
Make sure connection's port valid before adaptor init
2014-03-01 00:24:26 -08:00
Andrew Stewart
ef3aaf6591
Clean up initialization methods for adaptors/drivers
2014-02-28 20:50:45 -08:00
Andrew Stewart
5650ce1d60
Clean up starter and #stop functions
2014-02-28 20:37:23 -08:00
Andrew Stewart
862a3702b7
Refactor device/connection initialization methods
2014-02-28 20:30:12 -08:00
Andrew Stewart
89baebd3c1
Refactor #data method
2014-02-28 12:22:32 -08:00
Andrew Stewart
1ee35f1487
Clean up constructor
2014-02-28 12:13:19 -08:00
Andrew Stewart
f307aad0cd
Add global.bind method and tests
2014-02-28 10:31:10 -08:00
Andrew Stewart
3a46ff7848
Minor cleanups in basestar.js
2014-02-27 21:35:12 -08:00
Andrew Stewart
84916f69e3
Add shortcut for defining adaptor/driver events
2014-02-27 21:17:44 -08:00
Andrew Stewart
473e0ab08f
Remove 'source loading:' log messages from tests
...
Not really necessary now that we have actual tracebacks.
2014-02-27 20:59:21 -08:00
Andrew Stewart
520c523971
Refactor Basestar#defineEvent
2014-02-27 18:21:30 -08:00
Andrew Stewart
84f06afa5b
Add specs for event proxying
2014-02-27 18:13:21 -08:00
Andrew Stewart
cdd3f3310a
Remove trailing whitespace
2014-02-27 17:39:02 -08:00
xixebombilla
933c5d2660
210 fix merge files andrew :)
2014-02-27 17:12:29 -06:00
xixebombilla
0067f33505
210 fix merge files
2014-02-27 16:56:11 -06:00
xixebombilla
642c5c8b1e
210 need fix merge
2014-02-27 16:45:14 -06:00
xixebombilla
8644399276
210 comments JS
2014-02-27 16:42:33 -06:00
Andrew Stewart
204bf89685
Remove trailing whitespace
2014-02-27 14:14:51 -08:00
Andrew Stewart
df82352a96
Refactor cylon.js
2014-02-27 13:32:05 -08:00
Andrew Stewart
bbf4e413d8
Refactor utils.js
2014-02-27 13:32:05 -08:00
Andrew Stewart
599a5bb288
Refactor logger.js
2014-02-27 13:32:05 -08:00
Andrew Stewart
82effb6b64
Merge pull request #121 from hybridgroup/pure-js-cli
...
Migrate cylon-cli to pure JS.
2014-02-27 12:56:53 -08:00
edgarsilva
655e7c5613
WIP on migrating cylon-cli to pure js.
2014-02-27 14:39:54 -06:00
deadprogram
3694361eea
Add comments to adaptor functions
2014-02-27 11:45:09 -08:00
deadprogram
0113091f95
Refactor dogotal pin to pure JS style
2014-02-27 11:28:13 -08:00
deadprogram
452f07d4ab
Refactor port & robot to pure JS style
2014-02-27 11:17:02 -08:00
Andrew Stewart
ddc24eeca9
Update generator to create pure-JS adaptors
2014-02-27 11:00:35 -08:00
Andrew Stewart
ce8107d607
Move generators from src to lib
2014-02-27 11:00:34 -08:00
deadprogram
c28baa8eeb
Refactor api, basestar & config to pure JS style
2014-02-27 10:58:50 -08:00
Andrew Stewart
cc5d3e3335
Update generator to create pure-JS adaptors
2014-02-27 10:46:58 -08:00
deadprogram
30228c7f3c
Refactor connection & device to pure JS style
2014-02-27 10:33:43 -08:00
Andrew Stewart
610a6fdf91
Move generators from src to lib
2014-02-27 09:59:41 -08:00
deadprogram
8b88e5dc10
Refactor adaptor & driver to pure JS style
2014-02-27 09:38:38 -08:00
deadprogram
1a63cefd60
Make tests all green, now the real work begins
2014-02-27 06:55:08 -08:00
deadprogram
b27756abfc
WIP on pure JS revamp
2014-02-27 06:44:53 -08:00