Commit Graph

50 Commits

Author SHA1 Message Date
Andrew Stewart e9416129ee Move spec globals to spec eslintrc 2015-04-15 12:07:16 -07:00
Andrew Stewart 62cbae7cff Switch to ESLint for linting 2015-04-15 08:59:34 -07:00
Edgar Silva 287b4205dd Offering to the lint godsgit add .! 2015-03-27 15:36:24 -06:00
Edgar Silva ec4dde7448 Adds error handling to basetar#respond. 2015-03-27 15:18:45 -06:00
Andrew Stewart 82ef3d31a2 Add exploding interface functions for Driver/Adaptor
Explicit is better than implicit, and this causes errors to be more
specific
2015-03-19 17:47:15 -07:00
Andrew Stewart c0a3a9439e Add #respond method to work with events/callbacks 2015-03-19 10:48:45 -07:00
Andrew Stewart a17c70a18b Bind passed function to Robot by default 2015-03-17 14:22:14 -07:00
Andrew Stewart 28415f0b74 Add basic #includes helper for arrays 2015-03-11 12:31:45 -07:00
Andrew Stewart 6c5208577a Correct bug in Registry#findBy, add spec 2015-03-09 21:26:45 -07:00
Andrew Stewart cb492c0747 Remove deprecated Connection / Device syntaxes
Removes deprecation warnings + support for single-object + array
syntaxes.

The array syntax will likely continue to work due to the `_.each`
abstraction, but since we don't use it anywhere, the requisite specs
have been removed.
2015-03-04 09:27:33 -08:00
Adrian Zankich 3e65e2027e Merge pull request #271 from hybridgroup/feature/replace-lodash
Replace Lodash
2015-02-24 10:08:06 -08:00
Andrew Stewart 4e363e7930 Add a basic reduce implementation 2015-02-23 15:22:45 -08:00
Andrew Stewart 2eaea42a72 Add helpers for partial application 2015-02-23 14:31:52 -08:00
Andrew Stewart 6e3d7c6667 Add helpers to replace some lodash functionality
Not a 1:1, and probably much slower than Lodash's ultra-optimised
implementations, but we do enough I/O that it's not really relevant,
is it?
2015-02-23 08:38:12 -08:00
Daniel Lamb ccebab4cc2 The register method should return existing modules 2015-02-20 11:25:31 -08:00
Andrew Stewart 618aa8212d Remove lodash 2015-02-20 11:15:34 -08:00
edgarsilva cd23d989cf Fix broken test. 2015-01-30 15:04:14 -06:00
Andrew Stewart 147816b366 First crack at removing seperate Device/Connection initialization 2015-01-22 14:41:58 -08:00
Andrew Stewart d56f9bc53f Add better error checking for Robot#halt 2015-01-21 08:56:13 -08:00
Andrew Stewart 754af3b4db Add test for Robot#log 2015-01-20 19:38:48 -08:00
Andrew Stewart 9165ab36b4 Extract API from core 2015-01-08 10:02:14 -08:00
Andrew Stewart 8065644b4e Add support for nested device details inside conn
e.g.
    connections: {
      loopback: {
        adaptor: "loopback",
        devices: {
          ping: { driver: "ping", pin: 1 }
        }
      }
    }

In the event of a name collision between the `devices` hash and a nested
device, the nested device will 'win'.
2015-01-07 10:21:51 -08:00
Andrew Stewart cf0d24f785 Add API event publication
This update gives Cylon support for the latest changes to the CPPP-IO
spec.
2015-01-05 12:20:53 -08:00
Loren West 1030a50ca3 Added async command tests 2014-12-31 14:25:15 -08:00
Loren West b124e24363 API command discovery and execution tests 2014-12-29 14:26:50 -08:00
Andrew Stewart c9e16fe8c2 Use _.result to get commands from options. 2014-12-17 15:07:03 -08:00
Andrew Stewart 36d1505c2f Add specs for new #connections/#devices behaviour 2014-12-15 13:17:04 -08:00
Andrew Stewart e2bec78de7 Clean up specs for JSHint 2014-12-15 09:37:52 -08:00
Andrew Stewart 7f761c7268 WIP on cleaning up specs 2014-12-14 15:24:49 -08:00
Andrew Stewart 4f850d5e9e Support passing config to Logger#setup again 2014-11-28 09:37:44 -08:00
Andrew Stewart 83153664f5 Remove deprecated syntax from robot spec 2014-11-26 09:42:09 -08:00
Andrew Stewart ca8e22f1e2 Fluent #device/#connection update
Now pass name, then object of details

    #device({ name: 'ping', driver: 'ping' });
    // vs
    #device('ping', { driver: 'ping' });
2014-11-26 09:33:19 -08:00
Andrew Stewart 15c9b96333 Extract out Connection/Device initialization
Simple extraction out of Connection/Device initialization code inside
Robot.

This yields an interesting boon, however - this is now a valid Cylon
program:

    var Cylon = require('cylon');

    Cylon
      .robot()
      .connection({ name: 'loopback', adaptor: 'loopback' })
      .device({ name: 'ping', driver: 'ping' })
      .on('ready', function(bot) {
        console.log("Bot working!");

        every(1000, function() {
          console.log(bot.ping.ping());
        })
      });

    Cylon.start();

For those that prefer imperative programs with Cylon, this is a nice
syntax addition.
2014-11-20 08:43:08 -08:00
Andrew Stewart 8da2a17929 Fix broken test 2014-11-14 11:01:57 -08:00
Andrew Stewart 38bf5fdfed Refer to Adaptor instances as 'Connection' 2014-11-14 10:56:45 -08:00
Andrew Stewart ce87a355f0 Modifications, fix test suite 2014-11-11 11:41:23 -08:00
Andrew Stewart f1b982fedd Support providing connections/devices as an object
Before:

  connections: [
    { name: 'loopback', adaptor: 'loopback', port: 13 }
  ],

Now:

  connections: {
    loopback: { adaptor: 'loopback', port: 13 }
  }

Array syntax still works, but has been marked as deprecated.
2014-11-10 10:52:55 -08:00
Andrew Stewart 4c539ab9d1 Better configuration for TDR test mode 2014-11-06 09:48:21 -08:00
Andrew Stewart c43978bea2 Add logging for module registration 2014-11-05 14:26:18 -08:00
Andrew Stewart 966f8aa530 s/Repository/Registry/g 2014-10-31 14:14:02 -07:00
Andrew Stewart d62673bc8a Stop using extraParams 2014-10-31 13:50:22 -07:00
Andrew Stewart 1c922f02c1 Address bugs w/ connections 2014-10-31 13:48:05 -07:00
Andrew Stewart 44075a1a30 Hook Repository class up, change-up module loading
Cylon modules were previously styled something like this:

    module.exports = {
      adaptor: function(args) {
        return new Adaptor(args);
      },

      register: function(robot) {
        Cylon.Logger.debug("Registering Firmata adaptor for " + robot.name);
        robot.registerAdaptor('cylon-firmata', 'firmata');

        GPIO.register(robot);
        I2C.register(robot);
      }
    };

Now, they should be something more like this:

    module.exports = {
      adaptors: ['firmata'],
      dependencies: ['cylon-gpio', 'cylon-i2c'],

      adaptor: function(args) {
        return new Adaptor(args);
      },
    };
2014-10-30 13:29:06 -07:00
Andrew Stewart 63e43cc553 Repository module added, not integrated yet 2014-10-29 15:25:35 -07:00
Andrew Stewart 0f59645fd7 Move Logger configuration into Cylon#config 2014-10-28 15:53:03 -07:00
Ron Evans 903f8a9518 Merge pull request #235 from hybridgroup/add/log-levels
Add log levels
2014-10-28 17:38:00 +00:00
Andrew Stewart a8b16a3469 Proxy all opts that aren't already used internally 2014-10-27 13:40:38 -07:00
Andrew Stewart 2cb2fc232d Basic log level implementation 2014-10-27 08:59:36 -07:00
Andrew Stewart f5de644af7 Not sure why these were classes to begin with 2014-10-24 14:02:03 -07:00
Andrew Stewart bd95f9eb3c Reorganize tests, under 'spec' directory now 2014-10-20 14:55:25 -07:00