<commit_before>'use strict';

import Promise from 'es6-promises';

const TAG = '[BLEIo]'
const SERVICE_UUID = 'feed0001594246d5ade581c064d03a03';
const CHR_INTERVAL_UUID = 'feedaa02594246d5ade581c064d03a03';  // R/W
const CHR_DOUT_UUID = 'feedaa03594246d5ade581c064d03a03';      // R/W
const CHR_DIN_UUID = 'feedaa04594246d5ade581c064d03a03';       // R/N
const CHR_AIN_UUID = 'feedaa05594246d5ade581c064d03a03';       // R/N
const CHR_LCD_UUID = 'feedaa06594246d5ade581c064d03a03';       // R/W
const CHR_PWM_UUID = 'feedaa07594246d5ade581c064d03a03';       // R/W
const TYPE_INTERVAL = 'INTERVAL';
const TYPE_DOUT = 'DOUT';
const TYPE_DIN = 'DIN';
const TYPE_AIN = 'AIN';
const TYPE_LCD = 'LCD';
const TYPE_PWM = 'PWM';
const UUID_TO_TYPE = {};
UUID_TO_TYPE[CHR_INTERVAL_UUID] = TYPE_INTERVAL;
UUID_TO_TYPE[CHR_DOUT_UUID] = TYPE_DOUT;
UUID_TO_TYPE[CHR_DIN_UUID] = TYPE_DIN;
UUID_TO_TYPE[CHR_AIN_UUID] = TYPE_AIN;
UUID_TO_TYPE[CHR_LCD_UUID] = TYPE_LCD;
UUID_TO_TYPE[CHR_PWM_UUID] = TYPE_PWM;
const TYPE_TO_UUID = {};
TYPE_TO_UUID[TYPE_INTERVAL] = CHR_INTERVAL_UUID;
TYPE_TO_UUID[TYPE_DOUT] = CHR_DOUT_UUID;
TYPE_TO_UUID[TYPE_DIN] = CHR_DIN_UUID;
TYPE_TO_UUID[TYPE_AIN] = CHR_AIN_UUID;
TYPE_TO_UUID[TYPE_LCD] = CHR_LCD_UUID;
TYPE_TO_UUID[TYPE_PWM] = CHR_PWM_UUID;

/*
 * {
 *   "local name(BLEIo_0 to BLEIo_F)": {
 *     "MAC address or *(wildcard)" : {
 *       "node id": {visual node object},
 *     }
 *   }, ...
 * }
 */
const bleioNodes = {};

/*
 * {
 *   "local name(BLEIo_0 to BLEIo_F)": [{peripheral object},...], ...
 * }
 */
const bleioPeripherals = {};

let associationTask = null;

export function acceptFunc(localName) {
  return !!(localName &&
    (localName.indexOf('BLEIo_') === 0 && localName.length === 7));
}

export function discoverFunc(localName, peripheral, RED) {
  if (!bleioPeripherals[localName]) {
    bleioPeripherals[localName] = [];
  }
  let periphs = bleioPeripherals[localName];
  if (periphs.indexOf(peripheral) < 0) {
    if (!peripheral.nodes) {
      peripheral.nodes = [];
    }
    periphs.push(peripheral);
    RED.log.info(`local name[${localName}] has been detected => ${peripheral}`);
  }
}

function findChr(uuid, characteristics) {
  for (let i in characteristics) {
    if (characteristics[i].uuid === uuid) {
      return characteristics[i];
    }
  }
  return null;
}

function valToBuffer(hexOrIntArray) {
  if (Buffer.isBuffer(hexOrIntArray)) {
    return hexOrIntArray;
  }
  if (typeof hexOrIntArray === 'number') {
    return new Buffer(parseInt(hexOrIntArray).toString(16), 'hex');
  }
  if (typeof hexOrIntArray === 'string') {
    return new Buffer(hexOrIntArray, 'hex');
  }
  if (Array.isArray(hexOrIntArray)) {
    return new Buffer(hexOrIntArray);
  }
  return new Buffer();
}

function setupPeripheral(peripheral, RED) {
  if (peripheral.instrumented) {
    return;
  }
  let connectHandler = (err) => {
    if (err) {
      RED.log.error(`[BLEIo:connect] err=${err}`);
      return;
    }
    peripheral.discoverSomeServicesAndCharacteristics(
      [
        SERVICE_UUID
      ],
      [
        CHR_INTERVAL_UUID,
        CHR_DOUT_UUID,
        CHR_DIN_UUID,
        CHR_AIN_UUID,
        CHR_LCD_UUID,
        CHR_PWM_UUID
      ], (err, _, characteristics) => {
        if (err) {
          RED.log.error(RED._('asakusa_giken.errors.unexpected-peripheral'));
          peripheral.disconnect();
          return;
        }
        // write init params
        if (peripheral.nodes && peripheral.nodes.length > 0) {
          let config = peripheral.nodes[0].bleioNode;
          let val = parseInt(config.initInterval);
          if (val > 0) {
            findChr(CHR_INTERVAL_UUID, characteristics).write(valToBuffer(val), true);
          }
          // TODO initLcd
          val = parseInt(config.initDout) & 0xFF;
          if (val) {
            findChr(CHR_DOUT_UUID, characteristics).write(valToBuffer(val), true);
          }
          val = parseInt(config.initPwm) & 0xFFFFFF;
          if (val) {
            findChr(CHR_PWM_UUID, characteristics).write(valToBuffer(val), true);
          }
        }
        // in nodes
        characteristics.forEach((c) => {
          let uuid = c.uuid.toLowerCase();
          if (!c.subscribed &&
              ((uuid === CHR_DIN_UUID) || (uuid === CHR_AIN_UUID))) {
            c.subscribe((err) => {
              if (err) {
                RED.log.error(err);
                RED.log.error(RED._('asakusa_giken.errors.unexpected-peripheral'));
                peripheral.disconnect();
                return;
              }
              c.on('data', (data, isNotification) => {
                if (isNotification && peripheral.nodes) {
                  peripheral.nodes.forEach((node) => {
                    if (node.in) {
                      node.send({
                        payload: {
                          type: UUID_TO_TYPE[uuid],
                          val: data
                        }
                      });
                    }
                  });
                }
              });
              c.notify(true);
              c.subscribed = true;
              RED.log.info(`[BLEIo] Subscribed to ${UUID_TO_TYPE[uuid]}`);
            });
          }
        });
        // out nodes
        if (peripheral.nodes) {
          peripheral.nodes.forEach((node) => {
            if (!node.in) {
              node.on('input', (msg) => {
                let values = msg.payload;
                if (!values) {
                  return;
                }
                if (!Array.isArray(values)) {
                  values = [values];
                }
                values.forEach((v) => {
                  if (!v.type) {
                    return;
                  }
                  let uuid = TYPE_TO_UUID[v.type];
                  if (!uuid) {
                    return;
                  }
                  let data = valToBuffer(v.val);
                  findChr(uuid, characteristics).write(data, true);
                });
              });
            }
          });
        }
      }
    );
  };
  let disconnectHandler = (err) => {
    if (err) {
      RED.log.info(`[BLEIo:disconnect] err=${err}`);
      return;
    }
    Object.keys(bleioPeripherals).forEach((key) => {
      let ary = bleioPeripherals[key];
      let i = ary.indexOf(peripheral);
      if (i >= 0) {
        ary.splice(i, 1);
      }
    });
    if (!peripheral.terminated) {
      peripheral.connect();
    }
  };
  peripheral.on('connect', connectHandler);
  peripheral.on('disconnect', disconnectHandler);
  peripheral.terminate = () => {
    peripheral.terminated = true;
    peripheral.removeListener('connect', connectHandler);
    peripheral.removeListener('disconnect', disconnectHandler);
    peripheral.disconnect((err) => {
      disconnectHandler(err);
    });
  };
  peripheral.instrumented = true;
  if (peripheral.state !== 'connected') {
    peripheral.connect();
  }
}

function startAssociationTask(RED) {
  let retry = false;
  let unassociated = [];
  let associated = [];
  Object.keys(bleioNodes).forEach(localName => {
    let periphs = bleioPeripherals[localName];
    let nodes = bleioNodes[localName];
    if (!periphs || periphs.length === 0) {
      if (nodes && Object.keys(nodes).length > 0) {
        retry = true;
      }
      return;
    }
    if (!nodes || Object.keys(nodes).length === 0) {
      return;
    }
    periphs.forEach(peripheral => {
      Object.keys(nodes).forEach(address => {
        Object.keys(nodes[address]).forEach(id => {
          if (peripheral.nodes.indexOf(nodes[address][id]) < 0) {
            unassociated.push(nodes[address][id]);
          }
        });
      });
    });
    periphs.filter(peripheral => {
      for (let i in unassociated) {
        let address = unassociated[i].bleioNode.address || '*';
        if (('*' === address) ||
            (peripheral.address &&
            peripheral.address.toLowerCase() === address.toLowerCase())) {
          // mutual references
          peripheral.nodes.push(unassociated[i]);
          unassociated[i].peripheral = peripheral;
          // mark the node associated
          associated.push(unassociated[i]);
          return true;
        }
      }
      return false;
    }).forEach(peripheral => {
      setupPeripheral(peripheral, RED);
    });
  });
  if (unassociated.length > 0 && (associated.length !== unassociated.length)) {
    retry = true;
  }
  if (associationTask) {
    clearTimeout(associationTask);
    associationTask = null;
  }
  if (retry) {
    associationTask = setTimeout(() => {
      startAssociationTask(RED);
    }, 1000);
  }
}

export function register(node, RED) {
  if (!node || !node.bleioNode) {
    throw new Error('invalid node');
  }
  let localName = node.bleioNode.localName;
  if (!localName) {
    RED.log.error(RED._('asakusa_giken.errors.missing-localName', {id: node.bleioNode.id}));
    return;
  }
  if (!bleioNodes[localName]) {
    bleioNodes[localName] = {};
  }
  let periphNodes = bleioNodes[localName];
  let address = node.bleioNode.address || '*';
  if (!periphNodes[address]) {
    periphNodes[address] = {};
  }
  periphNodes[address][node.id] = node;
  if (!associationTask) {
    startAssociationTask(RED);
  }
}

export function remove(node, RED) {
  if (!node || !node.bleioNode) {
    throw new Error('invalid node');
  }
  let localName = node.bleioNode.localName;
  if (!localName) {
    return false;
  }
  let address = node.bleioNode.address || '*';
  if (!bleioNodes[localName]) {
    return false;
  }
  let periphNodes = bleioNodes[localName];
  if (!periphNodes[address] || !periphNodes[address][node.id]) {
    return false;
  }
  let peripheral = periphNodes[address][node.id].peripheral;
  let periphHoldingNodes = peripheral.nodes;
  let i = periphHoldingNodes.indexOf(node);
  if (i >= 0) {
    periphHoldingNodes.splice(i, 1);
  }
  delete periphNodes[address][node.id].peripheral;
  delete periphNodes[address][node.id];
  if (Object.keys(periphNodes[address]).length === 0) {
    peripheral.terminate();
  }
  return true;
}

export function clear() {
  // do nothing
}
<commit_msg>Show detection message on browser as well as console<commit_after>'use strict';

import Promise from 'es6-promises';

const TAG = '[BLEIo]'
const SERVICE_UUID = 'feed0001594246d5ade581c064d03a03';
const CHR_INTERVAL_UUID = 'feedaa02594246d5ade581c064d03a03';  // R/W
const CHR_DOUT_UUID = 'feedaa03594246d5ade581c064d03a03';      // R/W
const CHR_DIN_UUID = 'feedaa04594246d5ade581c064d03a03';       // R/N
const CHR_AIN_UUID = 'feedaa05594246d5ade581c064d03a03';       // R/N
const CHR_LCD_UUID = 'feedaa06594246d5ade581c064d03a03';       // R/W
const CHR_PWM_UUID = 'feedaa07594246d5ade581c064d03a03';       // R/W
const TYPE_INTERVAL = 'INTERVAL';
const TYPE_DOUT = 'DOUT';
const TYPE_DIN = 'DIN';
const TYPE_AIN = 'AIN';
const TYPE_LCD = 'LCD';
const TYPE_PWM = 'PWM';
const UUID_TO_TYPE = {};
UUID_TO_TYPE[CHR_INTERVAL_UUID] = TYPE_INTERVAL;
UUID_TO_TYPE[CHR_DOUT_UUID] = TYPE_DOUT;
UUID_TO_TYPE[CHR_DIN_UUID] = TYPE_DIN;
UUID_TO_TYPE[CHR_AIN_UUID] = TYPE_AIN;
UUID_TO_TYPE[CHR_LCD_UUID] = TYPE_LCD;
UUID_TO_TYPE[CHR_PWM_UUID] = TYPE_PWM;
const TYPE_TO_UUID = {};
TYPE_TO_UUID[TYPE_INTERVAL] = CHR_INTERVAL_UUID;
TYPE_TO_UUID[TYPE_DOUT] = CHR_DOUT_UUID;
TYPE_TO_UUID[TYPE_DIN] = CHR_DIN_UUID;
TYPE_TO_UUID[TYPE_AIN] = CHR_AIN_UUID;
TYPE_TO_UUID[TYPE_LCD] = CHR_LCD_UUID;
TYPE_TO_UUID[TYPE_PWM] = CHR_PWM_UUID;

/*
 * {
 *   "local name(BLEIo_0 to BLEIo_F)": {
 *     "MAC address or *(wildcard)" : {
 *       "node id": {visual node object},
 *     }
 *   }, ...
 * }
 */
const bleioNodes = {};

/*
 * {
 *   "local name(BLEIo_0 to BLEIo_F)": [{peripheral object},...], ...
 * }
 */
const bleioPeripherals = {};

let associationTask = null;

export function acceptFunc(localName) {
  return !!(localName &&
    (localName.indexOf('BLEIo_') === 0 && localName.length === 7));
}

export function discoverFunc(localName, peripheral, RED) {
  if (!bleioPeripherals[localName]) {
    bleioPeripherals[localName] = [];
  }
  let periphs = bleioPeripherals[localName];
  if (periphs.indexOf(peripheral) < 0) {
    if (!peripheral.nodes) {
      peripheral.nodes = [];
    }
    periphs.push(peripheral);
    RED.log.warn(`local name[${localName}] has been detected (address:${peripheral.address})`);
  }
}

function findChr(uuid, characteristics) {
  for (let i in characteristics) {
    if (characteristics[i].uuid === uuid) {
      return characteristics[i];
    }
  }
  return null;
}

function valToBuffer(hexOrIntArray) {
  if (Buffer.isBuffer(hexOrIntArray)) {
    return hexOrIntArray;
  }
  if (typeof hexOrIntArray === 'number') {
    return new Buffer(parseInt(hexOrIntArray).toString(16), 'hex');
  }
  if (typeof hexOrIntArray === 'string') {
    return new Buffer(hexOrIntArray, 'hex');
  }
  if (Array.isArray(hexOrIntArray)) {
    return new Buffer(hexOrIntArray);
  }
  return new Buffer();
}

function setupPeripheral(peripheral, RED) {
  if (peripheral.instrumented) {
    return;
  }
  let connectHandler = (err) => {
    if (err) {
      RED.log.error(`[BLEIo:connect] err=${err}`);
      return;
    }
    peripheral.discoverSomeServicesAndCharacteristics(
      [
        SERVICE_UUID
      ],
      [
        CHR_INTERVAL_UUID,
        CHR_DOUT_UUID,
        CHR_DIN_UUID,
        CHR_AIN_UUID,
        CHR_LCD_UUID,
        CHR_PWM_UUID
      ], (err, _, characteristics) => {
        if (err) {
          RED.log.error(RED._('asakusa_giken.errors.unexpected-peripheral'));
          peripheral.disconnect();
          return;
        }
        // write init params
        if (peripheral.nodes && peripheral.nodes.length > 0) {
          let config = peripheral.nodes[0].bleioNode;
          let val = parseInt(config.initInterval);
          if (val > 0) {
            findChr(CHR_INTERVAL_UUID, characteristics).write(valToBuffer(val), true);
          }
          // TODO initLcd
          val = parseInt(config.initDout) & 0xFF;
          if (val) {
            findChr(CHR_DOUT_UUID, characteristics).write(valToBuffer(val), true);
          }
          val = parseInt(config.initPwm) & 0xFFFFFF;
          if (val) {
            findChr(CHR_PWM_UUID, characteristics).write(valToBuffer(val), true);
          }
        }
        // in nodes
        characteristics.forEach((c) => {
          let uuid = c.uuid.toLowerCase();
          if (!c.subscribed &&
              ((uuid === CHR_DIN_UUID) || (uuid === CHR_AIN_UUID))) {
            c.subscribe((err) => {
              if (err) {
                RED.log.error(err);
                RED.log.error(RED._('asakusa_giken.errors.unexpected-peripheral'));
                peripheral.disconnect();
                return;
              }
              c.on('data', (data, isNotification) => {
                if (isNotification && peripheral.nodes) {
                  peripheral.nodes.forEach((node) => {
                    if (node.in) {
                      node.send({
                        payload: {
                          type: UUID_TO_TYPE[uuid],
                          val: data
                        }
                      });
                    }
                  });
                }
              });
              c.notify(true);
              c.subscribed = true;
              RED.log.info(`[BLEIo] Subscribed to ${UUID_TO_TYPE[uuid]}`);
            });
          }
        });
        // out nodes
        if (peripheral.nodes) {
          peripheral.nodes.forEach((node) => {
            if (!node.in) {
              node.on('input', (msg) => {
                let values = msg.payload;
                if (!values) {
                  return;
                }
                if (!Array.isArray(values)) {
                  values = [values];
                }
                values.forEach((v) => {
                  if (!v.type) {
                    return;
                  }
                  let uuid = TYPE_TO_UUID[v.type];
                  if (!uuid) {
                    return;
                  }
                  let data = valToBuffer(v.val);
                  findChr(uuid, characteristics).write(data, true);
                });
              });
            }
          });
        }
      }
    );
  };
  let disconnectHandler = (err) => {
    if (err) {
      RED.log.info(`[BLEIo:disconnect] err=${err}`);
      return;
    }
    Object.keys(bleioPeripherals).forEach((key) => {
      let ary = bleioPeripherals[key];
      let i = ary.indexOf(peripheral);
      if (i >= 0) {
        ary.splice(i, 1);
      }
    });
    if (!peripheral.terminated) {
      peripheral.connect();
    }
  };
  peripheral.on('connect', connectHandler);
  peripheral.on('disconnect', disconnectHandler);
  peripheral.terminate = () => {
    peripheral.terminated = true;
    peripheral.removeListener('connect', connectHandler);
    peripheral.removeListener('disconnect', disconnectHandler);
    peripheral.disconnect((err) => {
      disconnectHandler(err);
    });
  };
  peripheral.instrumented = true;
  if (peripheral.state !== 'connected') {
    peripheral.connect();
  }
}

function startAssociationTask(RED) {
  let retry = false;
  let unassociated = [];
  let associated = [];
  Object.keys(bleioNodes).forEach(localName => {
    let periphs = bleioPeripherals[localName];
    let nodes = bleioNodes[localName];
    if (!periphs || periphs.length === 0) {
      if (nodes && Object.keys(nodes).length > 0) {
        retry = true;
      }
      return;
    }
    if (!nodes || Object.keys(nodes).length === 0) {
      return;
    }
    periphs.forEach(peripheral => {
      Object.keys(nodes).forEach(address => {
        Object.keys(nodes[address]).forEach(id => {
          if (peripheral.nodes.indexOf(nodes[address][id]) < 0) {
            unassociated.push(nodes[address][id]);
          }
        });
      });
    });
    periphs.filter(peripheral => {
      for (let i in unassociated) {
        let address = unassociated[i].bleioNode.address || '*';
        if (('*' === address) ||
            (peripheral.address &&
            peripheral.address.toLowerCase() === address.toLowerCase())) {
          // mutual references
          peripheral.nodes.push(unassociated[i]);
          unassociated[i].peripheral = peripheral;
          // mark the node associated
          associated.push(unassociated[i]);
          return true;
        }
      }
      return false;
    }).forEach(peripheral => {
      setupPeripheral(peripheral, RED);
    });
  });
  if (unassociated.length > 0 && (associated.length !== unassociated.length)) {
    retry = true;
  }
  if (associationTask) {
    clearTimeout(associationTask);
    associationTask = null;
  }
  if (retry) {
    associationTask = setTimeout(() => {
      startAssociationTask(RED);
    }, 1000);
  }
}

export function register(node, RED) {
  if (!node || !node.bleioNode) {
    throw new Error('invalid node');
  }
  let localName = node.bleioNode.localName;
  if (!localName) {
    RED.log.error(RED._('asakusa_giken.errors.missing-localName', {id: node.bleioNode.id}));
    return;
  }
  if (!bleioNodes[localName]) {
    bleioNodes[localName] = {};
  }
  let periphNodes = bleioNodes[localName];
  let address = node.bleioNode.address || '*';
  if (!periphNodes[address]) {
    periphNodes[address] = {};
  }
  periphNodes[address][node.id] = node;
  if (!associationTask) {
    startAssociationTask(RED);
  }
}

export function remove(node, RED) {
  if (!node || !node.bleioNode) {
    throw new Error('invalid node');
  }
  let localName = node.bleioNode.localName;
  if (!localName) {
    return false;
  }
  let address = node.bleioNode.address || '*';
  if (!bleioNodes[localName]) {
    return false;
  }
  let periphNodes = bleioNodes[localName];
  if (!periphNodes[address] || !periphNodes[address][node.id]) {
    return false;
  }
  let peripheral = periphNodes[address][node.id].peripheral;
  let periphHoldingNodes = peripheral.nodes;
  let i = periphHoldingNodes.indexOf(node);
  if (i >= 0) {
    periphHoldingNodes.splice(i, 1);
  }
  delete periphNodes[address][node.id].peripheral;
  delete periphNodes[address][node.id];
  if (Object.keys(periphNodes[address]).length === 0) {
    peripheral.terminate();
  }
  return true;
}

export function clear() {
  // do nothing
}
<|endoftext|>


<commit_before>(function() {
  // exposing __configure_redux_store__ to window
  // instead of redux_store to avoid mutation of redux_store
  // using window object
  window.__configure_redux_store__ = () => {
    const { createStore, applyMiddleware, compose } = Redux;

    const initialState = {
      items: [{ name: "one", time: "23, apr, 2017" }, { name: "two", time: "23, apr, 2017" }]
    };

    const middlewares = [];

    // add support for Redux dev tools
    const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

    return createStore(
      window.__redux_reducer__,
      initialState,
      composeEnhancers(applyMiddleware(...middlewares))
    );
  };
})();
<commit_msg>ready to integrate<commit_after>(function() {
  // exposing __configure_redux_store__ to window
  // instead of redux_store to avoid mutation of redux_store
  // using window object
  window.__configure_redux_store__ = () => {
    const { createStore, applyMiddleware, compose } = Redux;

    const initialState = {
      items: [
        { name: "one", time: "23, apr, 2017" },
        { name: "two", time: "23, apr, 2017" },
        { name: "three", time: "23, apr, 2017" }
      ]
    };

    const middlewares = [];

    // add support for Redux dev tools
    const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

    return createStore(
      window.__redux_reducer__,
      initialState,
      composeEnhancers(applyMiddleware(...middlewares))
    );
  };
})();
<|endoftext|>


<commit_before>'use strict';

var td              = require('testdouble');
var Promise         = require('rsvp');
var mockProject     = require('../../../../fixtures/ember-cordova-mock/project');

describe('Ember Build Task', function() {
  beforeEach(function() {
    td.reset();
  });

  xit('runs an ember builder', function() {
  });

  it('stubs .gitkeep after ember build', function() {
    var createKeepDouble = td.replace('../../../../../lib/utils/create-gitkeep');
    var EmberBuildTask  = require('../../../../../lib/frameworks/ember/tasks/build');

    td.replace(EmberBuildTask.prototype, 'initBuilder', function() {
      return {
        build: function() {
          return Promise.resolve();
        }
      }
    });

    var build  = new EmberBuildTask({
      project: mockProject.project
    });

    return build.run().then(function() {
      td.verify(createKeepDouble('ember-cordova/cordova/www/.gitkeep'));
    });
  });
});
<commit_msg>test(ember-build-task)<commit_after>const td             = require('testdouble');
const expect         = require('../../../../helpers/expect')
const Promise        = require('rsvp');
const mockProject    = require('../../../../fixtures/ember-cordova-mock/project');

describe('Ember Build Task', function() {
  afterEach(function() {
    td.reset();
  });

  it('initBuilder constructs an ember builder', function() {
    let EmberBuilder = td.replace('ember-cli/lib/models/builder');

    let Build = require('../../../../../lib/frameworks/ember/tasks/build');
    let build = new Build({project: mockProject.project});

    build.initBuilder();
    td.verify(new EmberBuilder({
      project: mockProject.project,
      environment: undefined,
      outputPath: undefined
    }));
  });

  it('runs tasks in the right order', function() {
    let tasks = [];
    td.replace('../../../../../lib/utils/create-gitkeep', function() {
      tasks.push('create-gitkeep');
    });

    let Build  = require('../../../../../lib/frameworks/ember/tasks/build');
    let build  = new Build({project: mockProject.project});
    td.replace(build, 'initBuilder', function() {
      tasks.push('init-builder');
      return {
        build() { return Promise.resolve(); }
      };
    });

    return build.run().then(function() {
      expect(tasks).to.deep.equal([
        'init-builder',
        'create-gitkeep'
      ]);
    });
  });

  it('calls createGitKeep with the right path', function() {
    let createKeepDouble = td.replace('../../../../../lib/utils/create-gitkeep');
    let Build  = require('../../../../../lib/frameworks/ember/tasks/build');

    td.replace(Build.prototype, 'initBuilder', function() {
      return {
        build() { return Promise.resolve(); }
      };
    });

    let build  = new Build({project: mockProject.project});
    return build.run().then(function() {
      td.verify(createKeepDouble('ember-cordova/cordova/www/.gitkeep'));
    });
  });
});
<|endoftext|>


<commit_before>Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var XPCOMCoreVersion = '0.5.1'; // DO NOT REMOVE THIS COMMENT OR MOVE THIS LINE. THIS LINE IS AUTO-GENERATED FROM A RAKE TASK. @XPCOMCORE_VERSION@
const $Cc = Components.classes;
const $Ci = Components.interfaces;

var ioService = $Cc["@mozilla.org/network/io-service;1"].getService($Ci.nsIIOService);
var libRoot = ioService.newURI("resource://xpcomcore/lib", null, null).QueryInterface($Ci.nsIFileURL).file.path;
var binRoot = ioService.newURI("resource://xpcomcore/bin", null, null).QueryInterface($Ci.nsIFileURL).file.path;

// NOTE - XPCOMCore is a singleton
var XPCOMCore = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };

  // Private method that does the work of loading the XPCOMCore kernel
  // into the given scope.
  var loadKernel = function(importScope) {
    var loader = $Cc["@mozilla.org/moz/jssubscript-loader;1"].getService($Ci.mozIJSSubScriptLoader);
    loader.loadSubScript("resource://xpcomcore/lib/kernel.js", importScope);
  };

  // Private method to actually kick off the importing of kernel into the given
  // import scope.
  var import = function(importScope, importKernel) {
    if (importScope.__XPCOMCoreLoaded__) {
      return false;
    } else {
      loadKernel(importScope);
      // FIXME - defineGetter explodes when it's a 'Window' object for some reason. Fine for
      // ChromeWindow and fine for BackstagePass though. Weird.
      // importScope.__defineGetter__('__XPCOMCoreLoaded__', function() { return true; });
      importScope.__XPCOMCoreLoaded__ = true;
      // Automatically mix Kernel into the scope if importKernel is true
      if (importKernel) { importScope.Kernel(importScope); };
      return true;
    }
  };

  // FIXME - hack. hijacking the nsIWritableVariant interface so we can have a constructor that works
  // FIXME - and to boot, for reasons i dont understand, we wrap the scope in another object, hence the options
  // hash. which might be useful anyway.
  this.setFromVariant = function(options) {
    if (!options.scope) { return false; }
    return import(options.scope, !(options.importKernel === false));
  };

  arguments.callee.__singletonInstance__ = this;
  // HACK HACK HACK - this is so we can get a reference to the real constructor
  // from the bootstrapper.
  this.__specialConstructor__ = arguments.callee;
};

// FIXME - maybe? might not really be a 'bug'
// Bahaha - we rely on http://mxr.mozilla.org/mozilla1.8/source/js/src/xpconnect/src/xpcwrappedjsclass.cpp#528
// (as written about in http://weblogs.mozillazine.org/weirdal/archives/019778.html) to expose a getProperty
// method on this object to allow for getting arbitrary properties.
var XPCOMCoreInterfaces = [$Ci.nsIClassInfo, $Ci.nsIPropertyBag, $Ci.nsIWritableVariant];

XPCOMCore.prototype = {
  classDescription: "XPCOMCore Core Object",
  contractID: "@conflagrationjs.org/xpcomcore/core;1",
  classID: Components.ID("{f562f600-9c25-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCoreConfig"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreInterfaces.length;
    return XPCOMCoreInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON,

  get version() { return new String(XPCOMCoreVersion); },
  get libRoot() { return new String(libRoot); },
  get binRoot() { return new String(binRoot); }

};

var XPCOMCoreConstructorInterfaces = [$Ci.nsIClassInfo, $Ci.nsIXPCConstructor, $Ci.nsIXPCScriptable];

// Singleton
var XPCOMCoreConstructor = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };
  var ctor = Components.Constructor("@conflagrationjs.org/xpcomcore/core;1", Components.interfaces.nsIWritableVariant, "setFromVariant");
  arguments.callee.__singletonInstance__ = ctor;
  return ctor;
};

XPCOMCoreConstructor.prototype = {
  classDescription: "XPCOMCore Core Object Constructor Hack",
  contractID: "@conflagrationjs.org/xpcomcore/core-constructor;1",
  classID: Components.ID("{b5762b40-a0ec-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreConstructorInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCore"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreConstructorInterfaces.length;
    return XPCOMCoreConstructorInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON
}

NSGetModule = function(compMgr, fileSpec) {
  return XPCOMUtils.generateModule([XPCOMCore, XPCOMCoreConstructor]);
};<commit_msg>Updating from build_properties.yml<commit_after>Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var XPCOMCoreVersion = '0.5.2'; // DO NOT REMOVE THIS COMMENT OR MOVE THIS LINE. THIS LINE IS AUTO-GENERATED FROM A RAKE TASK. @XPCOMCORE_VERSION@
const $Cc = Components.classes;
const $Ci = Components.interfaces;

var ioService = $Cc["@mozilla.org/network/io-service;1"].getService($Ci.nsIIOService);
var libRoot = ioService.newURI("resource://xpcomcore/lib", null, null).QueryInterface($Ci.nsIFileURL).file.path;
var binRoot = ioService.newURI("resource://xpcomcore/bin", null, null).QueryInterface($Ci.nsIFileURL).file.path;

// NOTE - XPCOMCore is a singleton
var XPCOMCore = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };

  // Private method that does the work of loading the XPCOMCore kernel
  // into the given scope.
  var loadKernel = function(importScope) {
    var loader = $Cc["@mozilla.org/moz/jssubscript-loader;1"].getService($Ci.mozIJSSubScriptLoader);
    loader.loadSubScript("resource://xpcomcore/lib/kernel.js", importScope);
  };

  // Private method to actually kick off the importing of kernel into the given
  // import scope.
  var import = function(importScope, importKernel) {
    if (importScope.__XPCOMCoreLoaded__) {
      return false;
    } else {
      loadKernel(importScope);
      // FIXME - defineGetter explodes when it's a 'Window' object for some reason. Fine for
      // ChromeWindow and fine for BackstagePass though. Weird.
      // importScope.__defineGetter__('__XPCOMCoreLoaded__', function() { return true; });
      importScope.__XPCOMCoreLoaded__ = true;
      // Automatically mix Kernel into the scope if importKernel is true
      if (importKernel) { importScope.Kernel(importScope); };
      return true;
    }
  };

  // FIXME - hack. hijacking the nsIWritableVariant interface so we can have a constructor that works
  // FIXME - and to boot, for reasons i dont understand, we wrap the scope in another object, hence the options
  // hash. which might be useful anyway.
  this.setFromVariant = function(options) {
    if (!options.scope) { return false; }
    return import(options.scope, !(options.importKernel === false));
  };

  arguments.callee.__singletonInstance__ = this;
  // HACK HACK HACK - this is so we can get a reference to the real constructor
  // from the bootstrapper.
  this.__specialConstructor__ = arguments.callee;
};

// FIXME - maybe? might not really be a 'bug'
// Bahaha - we rely on http://mxr.mozilla.org/mozilla1.8/source/js/src/xpconnect/src/xpcwrappedjsclass.cpp#528
// (as written about in http://weblogs.mozillazine.org/weirdal/archives/019778.html) to expose a getProperty
// method on this object to allow for getting arbitrary properties.
var XPCOMCoreInterfaces = [$Ci.nsIClassInfo, $Ci.nsIPropertyBag, $Ci.nsIWritableVariant];

XPCOMCore.prototype = {
  classDescription: "XPCOMCore Core Object",
  contractID: "@conflagrationjs.org/xpcomcore/core;1",
  classID: Components.ID("{f562f600-9c25-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCoreConfig"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreInterfaces.length;
    return XPCOMCoreInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON,

  get version() { return new String(XPCOMCoreVersion); },
  get libRoot() { return new String(libRoot); },
  get binRoot() { return new String(binRoot); }

};

var XPCOMCoreConstructorInterfaces = [$Ci.nsIClassInfo, $Ci.nsIXPCConstructor, $Ci.nsIXPCScriptable];

// Singleton
var XPCOMCoreConstructor = function() {
  if (arguments.callee.__singletonInstance__) { return arguments.callee.__singletonInstance__; };
  var ctor = Components.Constructor("@conflagrationjs.org/xpcomcore/core;1", Components.interfaces.nsIWritableVariant, "setFromVariant");
  arguments.callee.__singletonInstance__ = ctor;
  return ctor;
};

XPCOMCoreConstructor.prototype = {
  classDescription: "XPCOMCore Core Object Constructor Hack",
  contractID: "@conflagrationjs.org/xpcomcore/core-constructor;1",
  classID: Components.ID("{b5762b40-a0ec-11de-8a39-0800200c9a66}"),
  QueryInterface: XPCOMUtils.generateQI(XPCOMCoreConstructorInterfaces),
  _xpcom_categories: [{category: "JavaScript global property", entry: "XPCOMCore"}],

  // implemented for nsIClassInfo
  getInterfaces: function(aCountRef) {
    aCountRef.value = XPCOMCoreConstructorInterfaces.length;
    return XPCOMCoreConstructorInterfaces;
  },

  // implemented for nsIClassInfo
  getHelperForLanguage: function(aLanguage) { return null; },

  // implemented for nsIClassInfo
  implementationLanguage: $Ci.nsIProgrammingLanguage.JAVASCRIPT,

  // implemented for nsIClassInfo
  flags: $Ci.nsIClassInfo.SINGLETON
}

NSGetModule = function(compMgr, fileSpec) {
  return XPCOMUtils.generateModule([XPCOMCore, XPCOMCoreConstructor]);
};<|endoftext|>


<commit_before>var fs = require("fs");
var path = require("path");
var util = require("util");
var events = require('events');

var mkdirp = require('mkdirp');

var exec = require(__dirname + '/common.js').exec;
var createArchive = require(__dirname + '/common.js').createArchive;
var unlock = require(__dirname + '/common.js').unlock;
var lock = require(__dirname + '/common.js').lock;

var self = this;

/*
var mirrorReverse = function(name, config, defconf, argv, cb) {
	var ignore_dirs = config.production.sync.ignore_dirs.split(',');
	var checkout = path.join(defconf.svn.trunks, name);
	var auth = config.production.sync.ftp.auth;
	var ftp_htdocs = config.production.sync.ftp.htdocs;
	var ftp_server = config.production.sync.ftp.server;
	var now = new Date().getTime().toString();
	var logfile = path.join(defconf.svn.configs, name, 'sync_' + now + '.log');
	var ignore_dirs_str = '';
	var i; for (i=0; i < ignore_dirs.length; i++) {
		ignore_dirs_str = ignore_dirs_str + ' -x ' + ignore_dirs[i];
	}
	var dry_run = '';
	if (argv.dry_run) { dry_run = "--dry-run"; }
	var verbose = '';
	if (argv.verbose) { verbose = '--verbose=3'; }
	var options = "set net:timeout 5; set net:reconnect-interval-base 5; set net:max-retries 2; ";
	var mirror = options + "mirror " + dry_run + " --reverse " + ignore_dirs_str + " --delete " + verbose + " " + checkout + ' ' + ftp_htdocs + '; bye;';
	console.log('Запись в ' + logfile);
	//console.log(mirror);
	exec('lftp', ['-u', auth, '-e', mirror , ftp_server], function(code, stdout, stderr) {
		cb(code);
	}, logfile);
};
*/

var mirror = function(auth, server, htdocs, local_dir, ignore_dirs, logfile, reverse, argv, cb, this2) {
	if (auth && server && htdocs && local_dir && logfile && argv && cb) {
		mkdirp(local_dir, function(err) {
			if (!err) {
				var ignore_dirs_str = '';
				if (ignore_dirs) {
					var i; for (i=0; i < ignore_dirs.length; i++) {
						ignore_dirs_str = ignore_dirs_str + ' -x ' + ignore_dirs[i];
					}
				}
				var dry_run = '';
				if (argv['dry-run']) { dry_run = "--dry-run"; }
				var verbose = '';
				if (argv.verbose) { verbose = '--verbose=3'; }
				var options = "set ftp:list-options -a; set net:timeout 5; set net:reconnect-interval-base 5; set net:max-retries 2; ";
				var mirror;
				if (!reverse) {
					mirror = options + "mirror " + dry_run + " " + ignore_dirs_str + " --delete " + verbose + " " + htdocs + ' ' + local_dir + '; bye;';
				} else {
					mirror = options + "mirror " + dry_run + " --reverse " + ignore_dirs_str + " --delete " + verbose + " " + local_dir + ' ' + htdocs + '; bye;';
				}
				exec('lftp', ['-u', auth, '-e', mirror , server], function(code, stdout, stderr) {
					cb(code);
				}, logfile, false, true, this2);
			} else { cb(err); }
		});
	} else { cb('Ошибка параметров ftp'); }
};

var Backup = function(name, config, defconf, argv, cb) {
	events.EventEmitter.call(this);
	var self = this;
	var now = new Date().getTime().toString();
	var lockfile = path.join(defconf.svn.configs, name, 'backup.lck');
	var lastfile = path.join(defconf.svn.configs, name, 'lastbackup.txt');
	var logfile = path.join(defconf.svn.configs, name, 'backup_' + now + '.log');
	process.nextTick(function() { self.emit("logfile", logfile); });
	var ignore_dirs = config.production.sync.ignore_dirs.split(',');
	var archive_dir = path.resolve(path.join(defconf.backups, name, 'production'));
	var auth = config.production.sync.ftp.auth;
	var htdocs = config.production.sync.ftp.htdocs;
	var server = config.production.sync.ftp.server;
	var archive_file = path.resolve(path.join(defconf.backups, name, name + '_production_' + now + '.tar.gz'));
	this.run = function() {
		lock(lockfile, argv, function(err) {
			if (!err) {
				mirror(auth, server, htdocs, archive_dir, false, logfile, false, argv, function(err) {
					if (!err) {
						if (!argv['dry-run']) {
							createArchive(archive_dir, archive_file, function(err) {
								if (!err) {
									unlock(lockfile, lastfile, argv, function(err) {
										cb(err);
									});
								} else { cb(err); }
							});
						} else {
							unlock(lockfile, lastfile, argv, function(err) {
								cb(err);
							});
						}
					} else { cb(err); }
				}, self);
			} else { cb(err); }
		});
	};
};
util.inherits(Backup, events.EventEmitter);
this.backup = function(name, config, defconf, argv, cb) {
	var backup = new Backup(name, config, defconf, argv, cb);
	backup.run();
	return backup;
};

var Sync = function(name, config, defconf, argv, cb) {
	events.EventEmitter.call(this);
	var self = this;
	var now = new Date().getTime().toString();
	var lockfile = path.join(defconf.svn.configs, name, 'sync.lck');
	var lastfile = path.join(defconf.svn.configs, name, 'lastsync.txt');
	var logfile = path.join(defconf.svn.configs, name, 'sync_' + now + '.log');
	process.nextTick(function() { self.emit("logfile", logfile); });
	var ignore_dirs = config.production.sync.ignore_dirs.split(',');
	var checkout = path.resolve(path.join(defconf.svn.trunks, name));
	var auth = config.production.sync.ftp.auth;
	var htdocs = config.production.sync.ftp.htdocs;
	var server = config.production.sync.ftp.server;
	this.run = function() {
		lock(lockfile, argv, function(err) {
			if (!err) {
				mirror(auth, server, htdocs, checkout, ignore_dirs, logfile, true, argv, function(err) {
					if (!err) {
						unlock(lockfile, lastfile, argv, function(err) {
							cb(err);
						});
					} else { cb(err); }
				}, self);
			} else { cb(err); }
		});
	};
};
util.inherits(Sync, events.EventEmitter);
this.sync = function(name, config, defconf, argv, cb) {
	var sync = new Sync(name, config, defconf, argv, cb);
	sync.run();
	return sync;
};
<commit_msg>disable cache<commit_after>var fs = require("fs");
var path = require("path");
var util = require("util");
var events = require('events');

var mkdirp = require('mkdirp');

var exec = require(__dirname + '/common.js').exec;
var createArchive = require(__dirname + '/common.js').createArchive;
var unlock = require(__dirname + '/common.js').unlock;
var lock = require(__dirname + '/common.js').lock;

var self = this;

/*
var mirrorReverse = function(name, config, defconf, argv, cb) {
	var ignore_dirs = config.production.sync.ignore_dirs.split(',');
	var checkout = path.join(defconf.svn.trunks, name);
	var auth = config.production.sync.ftp.auth;
	var ftp_htdocs = config.production.sync.ftp.htdocs;
	var ftp_server = config.production.sync.ftp.server;
	var now = new Date().getTime().toString();
	var logfile = path.join(defconf.svn.configs, name, 'sync_' + now + '.log');
	var ignore_dirs_str = '';
	var i; for (i=0; i < ignore_dirs.length; i++) {
		ignore_dirs_str = ignore_dirs_str + ' -x ' + ignore_dirs[i];
	}
	var dry_run = '';
	if (argv.dry_run) { dry_run = "--dry-run"; }
	var verbose = '';
	if (argv.verbose) { verbose = '--verbose=3'; }
	var options = "set net:timeout 5; set net:reconnect-interval-base 5; set net:max-retries 2; ";
	var mirror = options + "mirror " + dry_run + " --reverse " + ignore_dirs_str + " --delete " + verbose + " " + checkout + ' ' + ftp_htdocs + '; bye;';
	console.log('Запись в ' + logfile);
	//console.log(mirror);
	exec('lftp', ['-u', auth, '-e', mirror , ftp_server], function(code, stdout, stderr) {
		cb(code);
	}, logfile);
};
*/

var mirror = function(auth, server, htdocs, local_dir, ignore_dirs, logfile, reverse, argv, cb, this2) {
	if (auth && server && htdocs && local_dir && logfile && argv && cb) {
		mkdirp(local_dir, function(err) {
			if (!err) {
				var ignore_dirs_str = '';
				if (ignore_dirs) {
					var i; for (i=0; i < ignore_dirs.length; i++) {
						ignore_dirs_str = ignore_dirs_str + ' -x ' + ignore_dirs[i];
					}
				}
				var dry_run = '';
				if (argv['dry-run']) { dry_run = "--dry-run"; }
				var verbose = '';
				if (argv.verbose) { verbose = '--verbose=3'; }
				var options = "set cache:enable false; set ftp:list-options -a; set net:timeout 5; set net:reconnect-interval-base 5; set net:max-retries 2; ";
				var mirror;
				if (!reverse) {
					mirror = options + "mirror " + dry_run + " " + ignore_dirs_str + " --delete " + verbose + " " + htdocs + ' ' + local_dir + '; bye;';
				} else {
					mirror = options + "mirror " + dry_run + " --reverse " + ignore_dirs_str + " --delete " + verbose + " " + local_dir + ' ' + htdocs + '; bye;';
				}
				exec('lftp', ['-u', auth, '-e', mirror , server], function(code, stdout, stderr) {
					cb(code);
				}, logfile, false, true, this2);
			} else { cb(err); }
		});
	} else { cb('Ошибка параметров ftp'); }
};

var Backup = function(name, config, defconf, argv, cb) {
	events.EventEmitter.call(this);
	var self = this;
	var now = new Date().getTime().toString();
	var lockfile = path.join(defconf.svn.configs, name, 'backup.lck');
	var lastfile = path.join(defconf.svn.configs, name, 'lastbackup.txt');
	var logfile = path.join(defconf.svn.configs, name, 'backup_' + now + '.log');
	process.nextTick(function() { self.emit("logfile", logfile); });
	var ignore_dirs = config.production.sync.ignore_dirs.split(',');
	var archive_dir = path.resolve(path.join(defconf.backups, name, 'production'));
	var auth = config.production.sync.ftp.auth;
	var htdocs = config.production.sync.ftp.htdocs;
	var server = config.production.sync.ftp.server;
	var archive_file = path.resolve(path.join(defconf.backups, name, name + '_production_' + now + '.tar.gz'));
	this.run = function() {
		lock(lockfile, argv, function(err) {
			if (!err) {
				mirror(auth, server, htdocs, archive_dir, false, logfile, false, argv, function(err) {
					if (!err) {
						if (!argv['dry-run']) {
							createArchive(archive_dir, archive_file, function(err) {
								if (!err) {
									unlock(lockfile, lastfile, argv, function(err) {
										cb(err);
									});
								} else { cb(err); }
							});
						} else {
							unlock(lockfile, lastfile, argv, function(err) {
								cb(err);
							});
						}
					} else { cb(err); }
				}, self);
			} else { cb(err); }
		});
	};
};
util.inherits(Backup, events.EventEmitter);
this.backup = function(name, config, defconf, argv, cb) {
	var backup = new Backup(name, config, defconf, argv, cb);
	backup.run();
	return backup;
};

var Sync = function(name, config, defconf, argv, cb) {
	events.EventEmitter.call(this);
	var self = this;
	var now = new Date().getTime().toString();
	var lockfile = path.join(defconf.svn.configs, name, 'sync.lck');
	var lastfile = path.join(defconf.svn.configs, name, 'lastsync.txt');
	var logfile = path.join(defconf.svn.configs, name, 'sync_' + now + '.log');
	process.nextTick(function() { self.emit("logfile", logfile); });
	var ignore_dirs = config.production.sync.ignore_dirs.split(',');
	var checkout = path.resolve(path.join(defconf.svn.trunks, name));
	var auth = config.production.sync.ftp.auth;
	var htdocs = config.production.sync.ftp.htdocs;
	var server = config.production.sync.ftp.server;
	this.run = function() {
		lock(lockfile, argv, function(err) {
			if (!err) {
				mirror(auth, server, htdocs, checkout, ignore_dirs, logfile, true, argv, function(err) {
					if (!err) {
						unlock(lockfile, lastfile, argv, function(err) {
							cb(err);
						});
					} else { cb(err); }
				}, self);
			} else { cb(err); }
		});
	};
};
util.inherits(Sync, events.EventEmitter);
this.sync = function(name, config, defconf, argv, cb) {
	var sync = new Sync(name, config, defconf, argv, cb);
	sync.run();
	return sync;
};
<|endoftext|>


<commit_before>var theProject;
var ui = {};

var Refine = {
    refineHelperService: "http://1.refine-helper.stefanomazzocchi.user.dev.freebaseapps.com/"
};

Refine.reportException = function(e) {
    if (window.console) {
        console.log(e);
    }
};

function resize() {
    var header = $("#header");

    var leftPanelWidth = 300;
    var width = $(window).width();
    var top = $("#header").outerHeight();
    var height = $(window).height() - top;

    ui.leftPanel
        .css("top", top + "px")
        .css("left", "0px")
        .css("height", height + "px")
        .css("width", leftPanelWidth + "px");

    var leftPanelPaddings = ui.leftPanel.outerHeight(true) - ui.leftPanel.height();
    var leftPanelTabsPaddings = ui.leftPanelTabs.outerHeight(true) - ui.leftPanelTabs.height();
    ui.leftPanelTabs.height(ui.leftPanel.height() - leftPanelTabsPaddings - leftPanelPaddings);

    var rightPanelVPaddings = ui.rightPanel.outerHeight(true) - ui.rightPanel.height();
    var rightPanelHPaddings = ui.rightPanel.outerWidth(true) - ui.rightPanel.width();
    ui.rightPanel
        .css("top", top + "px")
        .css("left", leftPanelWidth + "px")
        .css("height", (height - rightPanelVPaddings) + "px")
        .css("width", (width - leftPanelWidth - rightPanelHPaddings) + "px");

    ui.viewPanel.height((height - ui.toolPanel.outerHeight() - rightPanelVPaddings) + "px");

    var processPanelWidth = 400;
    ui.processPanel
        .css("width", processPanelWidth + "px")
        .css("left", Math.floor((width - processPanelWidth) / 2) + "px");
}

function resizeTabs() {
    var totalHeight = ui.leftPanel.height();
    var headerHeight = ui.leftPanelTabs.find(".ui-tabs-nav").outerHeight(true);

    var visibleTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel:not(.ui-tabs-hide)");
    var paddings = visibleTabPanels.outerHeight(true) - visibleTabPanels.height();

    var allTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel");
    allTabPanels.height(totalHeight - headerHeight - paddings - 1);
}

function resizeAll() {
    resize();
    resizeTabs();

    ui.extensionBar.resize();
    ui.browsingEngine.resize();
    ui.processWidget.resize();
    ui.historyWidget.resize();
    ui.dataTableView.resize();
}

function initializeUI(uiState) {
    $("#loading-message").hide();
    $("#header-layout").show();
    $("#body").show();

    $('#project-name-button').click(Refine._renameProject);
    $('#project-permalink-button').mouseenter(function() {
        this.href = Refine.getPermanentLink();
    });

    Refine.setTitle();

    ui = DOM.bind($("#body"));

    ui.extensionBar = new ExtensionBar(ui.extensionBar); // construct the menu first so we can resize everything else
    ui.exporterManager = new ExporterManager($("#export-button"));

    ui.leftPanelTabs.tabs({ selected: 0 });
    resize();
    resizeTabs();

    ui.summaryWidget = new SummaryWidget(ui.summaryBar);
    ui.browsingEngine = new BrowsingEngine(ui.facetPanel, uiState.facets || []);
    ui.processWidget = new ProcessWidget(ui.processPanel);
    ui.historyWidget = new HistoryWidget(ui.historyPanel, ui.historyTabHeader);
    ui.dataTableView = new DataTableView(ui.viewPanel);

    ui.leftPanelTabs.bind('tabsshow', function(event, tabs) {
        if (tabs.index === 0) {
            ui.browsingEngine.resize();
        } else if (tabs.index === 1) {
            ui.historyWidget.resize();
        }
    });

    $(window).bind("resize", resizeAll);

    if (uiState.facets) {
        Refine.update({ engineChanged: true });
    }
}

Refine.setTitle = function(status) {
    var title = theProject.metadata.name + " - Google Refine";
    if (status) {
        title = status + " - " + title;
    }
    document.title = title;

    $("#project-name-button").text(theProject.metadata.name);
};

Refine.reinitializeProjectData = function(f) {
    Ajax.chainGetJSON(
        "/command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
        function(data) {
            theProject.metadata = data;
        },
        "/command/core/get-models?" + $.param({ project: theProject.id }), null,
        function(data) {
            for (var n in data) {
                if (data.hasOwnProperty(n)) {
                    theProject[n] = data[n];
                }
            }
        },
        f
    );
};

Refine._renameProject = function() {
    var name = window.prompt("Rename Project", theProject.metadata.name);
    if (name == null) {
        return;
    }

    name = $.trim(name);
    if (theProject.metadata.name == name || name.length == 0) {
        return;
    }

    $.ajax({
        type: "POST",
        url: "/command/core/rename-project",
        data: { "project" : theProject.id, "name" : name },
        dataType: "json",
        success: function (data) {
            if (data && typeof data.code != 'undefined' && data.code == "ok") {
                theProject.metadata.name = name;
                Refine.setTitle();
            } else {
                alert("Failed to rename project: " + data.message);
            }
        }
    });
};

/*
 *  Utility state functions
 */

Refine.createUpdateFunction = function(options, onFinallyDone) {
    var functions = [];
    var pushFunction = function(f) {
        var index = functions.length;
        functions.push(function() {
            f(functions[index + 1]);
        });
    };

    pushFunction(function(onDone) {
        ui.historyWidget.update(onDone);
    });
    if (options.everythingChanged || options.modelsChanged || options.columnStatsChanged) {
        pushFunction(Refine.reinitializeProjectData);
    }
    if (options.everythingChanged || options.modelsChanged || options.rowsChanged || options.rowMetadataChanged || options.cellsChanged || options.engineChanged) {
        pushFunction(function(onDone) {
            ui.dataTableView.update(onDone);
        });
        pushFunction(function(onDone) {
            ui.browsingEngine.update(onDone);
        });
    }

    functions.push(onFinallyDone || function() {});

    return functions[0];
};

Refine.update = function(options, onFinallyDone) {
    var done = false;
    var dismissBusy = null;

    Refine.setAjaxInProgress();

    Refine.createUpdateFunction(options, function() {
        Refine.clearAjaxInProgress();

        done = true;
        if (dismissBusy) {
            dismissBusy();
        }
        if (onFinallyDone) {
            onFinallyDone();
        }
    })();

    window.setTimeout(function() {
        if (!done) {
            dismissBusy = DialogSystem.showBusy();
        }
    }, 500);
};

Refine.postCoreProcess = function(command, params, body, updateOptions, callbacks) {
    Refine.postProcess("core", command, params, body, updateOptions, callbacks);
};

Refine.postProcess = function(moduleName, command, params, body, updateOptions, callbacks) {
    updateOptions = updateOptions || {};
    callbacks = callbacks || {};

    params = params || {};
    params.project = theProject.id;

    body = body || {};
    if (!("includeEngine" in updateOptions) || updateOptions.includeEngine) {
        body.engine = JSON.stringify(
            "engineConfig" in updateOptions ?
                updateOptions.engineConfig :
                ui.browsingEngine.getJSON()
        );
    }

    var done = false;
    var dismissBusy = null;

    function onDone(o) {
        done = true;
        if (dismissBusy) {
            dismissBusy();
        }

        Refine.clearAjaxInProgress();

        if (o.code == "error") {
            if ("onError" in callbacks) {
                try {
                    callbacks.onError(o);
                } catch (e) {
                    Refine.reportException(e);
                }
            } else {
                alert(o.message);
            }
        } else {
            if ("onDone" in callbacks) {
                try {
                    callbacks.onDone(o);
                } catch (e) {
                    Refine.reportException(e);
                }
            }

            if (o.code == "ok") {
                Refine.update(updateOptions, callbacks.onFinallyDone);

                if ("historyEntry" in o) {
                    ui.processWidget.showUndo(o.historyEntry);
                }
            } else if (o.code == "pending") {
                if ("onPending" in callbacks) {
                    try {
                        callbacks.onPending(o);
                    } catch (e) {
                        Refine.reportException(e);
                    }
                }
                ui.processWidget.update(updateOptions, callbacks.onFinallyDone);
            }
        }
    }

    Refine.setAjaxInProgress();

    $.post(
        "/command/" + moduleName + "/" + command + "?" + $.param(params),
        body,
        onDone,
        "json"
    );

    window.setTimeout(function() {
        if (!done) {
            dismissBusy = DialogSystem.showBusy();
        }
    }, 500);
};

Refine.setAjaxInProgress = function() {
    $(document.body).attr("ajax_in_progress", "true");
};

Refine.clearAjaxInProgress = function() {
    $(document.body).attr("ajax_in_progress", "false");
};

/*
 *  Utility model functions
 */

Refine.cellIndexToColumn = function(cellIndex) {
    var columns = theProject.columnModel.columns;
    for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (column.cellIndex == cellIndex) {
            return column;
        }
    }
    return null;
};
Refine.columnNameToColumn = function(columnName) {
    var columns = theProject.columnModel.columns;
    for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (column.name == columnName) {
            return column;
        }
    }
    return null;
};
Refine.columnNameToColumnIndex = function(columnName) {
    var columns = theProject.columnModel.columns;
    for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (column.name == columnName) {
            return i;
        }
    }
    return -1;
};

Refine.preparePool = function(pool) {
    for (var id in pool.recons) {
        if (pool.recons.hasOwnProperty(id)) {
            var recon = pool.recons[id];
            if (recon.m) {
                recon.m = pool.reconCandidates[recon.m];
            }
            if (recon.c) {
                for (var j = 0; j < recon.c.length; j++) {
                    recon.c[j] = pool.reconCandidates[recon.c[j]];
                }
            }
        }
    }
};

Refine.fetchRows = function(start, limit, onDone, sorting) {
    var body = {
        engine: JSON.stringify(ui.browsingEngine.getJSON())
    };
    if (sorting) {
        body.sorting = JSON.stringify(sorting)
    }

    $.post(
        "/command/core/get-rows?" + $.param({ project: theProject.id, start: start, limit: limit }) + "&callback=?",
        body,
        function(data) {
            theProject.rowModel = data;

            // Un-pool objects
            Refine.preparePool(data.pool);
            for (var r = 0; r < data.rows.length; r++) {
                var row = data.rows[r];
                for (var c = 0; c < row.cells.length; c++) {
                    var cell = row.cells[c];
                    if ((cell) && ("r" in cell)) {
                        cell.r = data.pool.recons[cell.r];
                    }
                }
            }

            if (onDone) {
                onDone();
            }
        },
        "jsonp"
    );
};

Refine.getPermanentLink = function() {
    var params = [
        "project=" + escape(theProject.id),
        "ui=" + escape(JSON.stringify({
            facets: ui.browsingEngine.getFacetUIStates()
        }))
    ];
    return "project?" + params.join("&");
};

/*
 * Loader
 */

function onLoad() {
    var params = URL.getParameters();
    if ("project" in params) {
        var uiState = {};
        if ("ui" in params) {
            try {
                uiState = JSON.parse(params.ui);
            } catch (e) {
            }
        }

        Refine.reinitializeProjectData(function() {
            initializeUI(uiState);
        });
    }
}

$(onLoad);
<commit_msg>trailing slash breaks everything<commit_after>var theProject;
var ui = {};

var Refine = {
    refineHelperService: "http://1.refine-helper.stefanomazzocchi.user.dev.freebaseapps.com"
};

Refine.reportException = function(e) {
    if (window.console) {
        console.log(e);
    }
};

function resize() {
    var header = $("#header");

    var leftPanelWidth = 300;
    var width = $(window).width();
    var top = $("#header").outerHeight();
    var height = $(window).height() - top;

    ui.leftPanel
        .css("top", top + "px")
        .css("left", "0px")
        .css("height", height + "px")
        .css("width", leftPanelWidth + "px");

    var leftPanelPaddings = ui.leftPanel.outerHeight(true) - ui.leftPanel.height();
    var leftPanelTabsPaddings = ui.leftPanelTabs.outerHeight(true) - ui.leftPanelTabs.height();
    ui.leftPanelTabs.height(ui.leftPanel.height() - leftPanelTabsPaddings - leftPanelPaddings);

    var rightPanelVPaddings = ui.rightPanel.outerHeight(true) - ui.rightPanel.height();
    var rightPanelHPaddings = ui.rightPanel.outerWidth(true) - ui.rightPanel.width();
    ui.rightPanel
        .css("top", top + "px")
        .css("left", leftPanelWidth + "px")
        .css("height", (height - rightPanelVPaddings) + "px")
        .css("width", (width - leftPanelWidth - rightPanelHPaddings) + "px");

    ui.viewPanel.height((height - ui.toolPanel.outerHeight() - rightPanelVPaddings) + "px");

    var processPanelWidth = 400;
    ui.processPanel
        .css("width", processPanelWidth + "px")
        .css("left", Math.floor((width - processPanelWidth) / 2) + "px");
}

function resizeTabs() {
    var totalHeight = ui.leftPanel.height();
    var headerHeight = ui.leftPanelTabs.find(".ui-tabs-nav").outerHeight(true);

    var visibleTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel:not(.ui-tabs-hide)");
    var paddings = visibleTabPanels.outerHeight(true) - visibleTabPanels.height();

    var allTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel");
    allTabPanels.height(totalHeight - headerHeight - paddings - 1);
}

function resizeAll() {
    resize();
    resizeTabs();

    ui.extensionBar.resize();
    ui.browsingEngine.resize();
    ui.processWidget.resize();
    ui.historyWidget.resize();
    ui.dataTableView.resize();
}

function initializeUI(uiState) {
    $("#loading-message").hide();
    $("#header-layout").show();
    $("#body").show();

    $('#project-name-button').click(Refine._renameProject);
    $('#project-permalink-button').mouseenter(function() {
        this.href = Refine.getPermanentLink();
    });

    Refine.setTitle();

    ui = DOM.bind($("#body"));

    ui.extensionBar = new ExtensionBar(ui.extensionBar); // construct the menu first so we can resize everything else
    ui.exporterManager = new ExporterManager($("#export-button"));

    ui.leftPanelTabs.tabs({ selected: 0 });
    resize();
    resizeTabs();

    ui.summaryWidget = new SummaryWidget(ui.summaryBar);
    ui.browsingEngine = new BrowsingEngine(ui.facetPanel, uiState.facets || []);
    ui.processWidget = new ProcessWidget(ui.processPanel);
    ui.historyWidget = new HistoryWidget(ui.historyPanel, ui.historyTabHeader);
    ui.dataTableView = new DataTableView(ui.viewPanel);

    ui.leftPanelTabs.bind('tabsshow', function(event, tabs) {
        if (tabs.index === 0) {
            ui.browsingEngine.resize();
        } else if (tabs.index === 1) {
            ui.historyWidget.resize();
        }
    });

    $(window).bind("resize", resizeAll);

    if (uiState.facets) {
        Refine.update({ engineChanged: true });
    }
}

Refine.setTitle = function(status) {
    var title = theProject.metadata.name + " - Google Refine";
    if (status) {
        title = status + " - " + title;
    }
    document.title = title;

    $("#project-name-button").text(theProject.metadata.name);
};

Refine.reinitializeProjectData = function(f) {
    Ajax.chainGetJSON(
        "/command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
        function(data) {
            theProject.metadata = data;
        },
        "/command/core/get-models?" + $.param({ project: theProject.id }), null,
        function(data) {
            for (var n in data) {
                if (data.hasOwnProperty(n)) {
                    theProject[n] = data[n];
                }
            }
        },
        f
    );
};

Refine._renameProject = function() {
    var name = window.prompt("Rename Project", theProject.metadata.name);
    if (name == null) {
        return;
    }

    name = $.trim(name);
    if (theProject.metadata.name == name || name.length == 0) {
        return;
    }

    $.ajax({
        type: "POST",
        url: "/command/core/rename-project",
        data: { "project" : theProject.id, "name" : name },
        dataType: "json",
        success: function (data) {
            if (data && typeof data.code != 'undefined' && data.code == "ok") {
                theProject.metadata.name = name;
                Refine.setTitle();
            } else {
                alert("Failed to rename project: " + data.message);
            }
        }
    });
};

/*
 *  Utility state functions
 */

Refine.createUpdateFunction = function(options, onFinallyDone) {
    var functions = [];
    var pushFunction = function(f) {
        var index = functions.length;
        functions.push(function() {
            f(functions[index + 1]);
        });
    };

    pushFunction(function(onDone) {
        ui.historyWidget.update(onDone);
    });
    if (options.everythingChanged || options.modelsChanged || options.columnStatsChanged) {
        pushFunction(Refine.reinitializeProjectData);
    }
    if (options.everythingChanged || options.modelsChanged || options.rowsChanged || options.rowMetadataChanged || options.cellsChanged || options.engineChanged) {
        pushFunction(function(onDone) {
            ui.dataTableView.update(onDone);
        });
        pushFunction(function(onDone) {
            ui.browsingEngine.update(onDone);
        });
    }

    functions.push(onFinallyDone || function() {});

    return functions[0];
};

Refine.update = function(options, onFinallyDone) {
    var done = false;
    var dismissBusy = null;

    Refine.setAjaxInProgress();

    Refine.createUpdateFunction(options, function() {
        Refine.clearAjaxInProgress();

        done = true;
        if (dismissBusy) {
            dismissBusy();
        }
        if (onFinallyDone) {
            onFinallyDone();
        }
    })();

    window.setTimeout(function() {
        if (!done) {
            dismissBusy = DialogSystem.showBusy();
        }
    }, 500);
};

Refine.postCoreProcess = function(command, params, body, updateOptions, callbacks) {
    Refine.postProcess("core", command, params, body, updateOptions, callbacks);
};

Refine.postProcess = function(moduleName, command, params, body, updateOptions, callbacks) {
    updateOptions = updateOptions || {};
    callbacks = callbacks || {};

    params = params || {};
    params.project = theProject.id;

    body = body || {};
    if (!("includeEngine" in updateOptions) || updateOptions.includeEngine) {
        body.engine = JSON.stringify(
            "engineConfig" in updateOptions ?
                updateOptions.engineConfig :
                ui.browsingEngine.getJSON()
        );
    }

    var done = false;
    var dismissBusy = null;

    function onDone(o) {
        done = true;
        if (dismissBusy) {
            dismissBusy();
        }

        Refine.clearAjaxInProgress();

        if (o.code == "error") {
            if ("onError" in callbacks) {
                try {
                    callbacks.onError(o);
                } catch (e) {
                    Refine.reportException(e);
                }
            } else {
                alert(o.message);
            }
        } else {
            if ("onDone" in callbacks) {
                try {
                    callbacks.onDone(o);
                } catch (e) {
                    Refine.reportException(e);
                }
            }

            if (o.code == "ok") {
                Refine.update(updateOptions, callbacks.onFinallyDone);

                if ("historyEntry" in o) {
                    ui.processWidget.showUndo(o.historyEntry);
                }
            } else if (o.code == "pending") {
                if ("onPending" in callbacks) {
                    try {
                        callbacks.onPending(o);
                    } catch (e) {
                        Refine.reportException(e);
                    }
                }
                ui.processWidget.update(updateOptions, callbacks.onFinallyDone);
            }
        }
    }

    Refine.setAjaxInProgress();

    $.post(
        "/command/" + moduleName + "/" + command + "?" + $.param(params),
        body,
        onDone,
        "json"
    );

    window.setTimeout(function() {
        if (!done) {
            dismissBusy = DialogSystem.showBusy();
        }
    }, 500);
};

Refine.setAjaxInProgress = function() {
    $(document.body).attr("ajax_in_progress", "true");
};

Refine.clearAjaxInProgress = function() {
    $(document.body).attr("ajax_in_progress", "false");
};

/*
 *  Utility model functions
 */

Refine.cellIndexToColumn = function(cellIndex) {
    var columns = theProject.columnModel.columns;
    for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (column.cellIndex == cellIndex) {
            return column;
        }
    }
    return null;
};
Refine.columnNameToColumn = function(columnName) {
    var columns = theProject.columnModel.columns;
    for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (column.name == columnName) {
            return column;
        }
    }
    return null;
};
Refine.columnNameToColumnIndex = function(columnName) {
    var columns = theProject.columnModel.columns;
    for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if (column.name == columnName) {
            return i;
        }
    }
    return -1;
};

Refine.preparePool = function(pool) {
    for (var id in pool.recons) {
        if (pool.recons.hasOwnProperty(id)) {
            var recon = pool.recons[id];
            if (recon.m) {
                recon.m = pool.reconCandidates[recon.m];
            }
            if (recon.c) {
                for (var j = 0; j < recon.c.length; j++) {
                    recon.c[j] = pool.reconCandidates[recon.c[j]];
                }
            }
        }
    }
};

Refine.fetchRows = function(start, limit, onDone, sorting) {
    var body = {
        engine: JSON.stringify(ui.browsingEngine.getJSON())
    };
    if (sorting) {
        body.sorting = JSON.stringify(sorting)
    }

    $.post(
        "/command/core/get-rows?" + $.param({ project: theProject.id, start: start, limit: limit }) + "&callback=?",
        body,
        function(data) {
            theProject.rowModel = data;

            // Un-pool objects
            Refine.preparePool(data.pool);
            for (var r = 0; r < data.rows.length; r++) {
                var row = data.rows[r];
                for (var c = 0; c < row.cells.length; c++) {
                    var cell = row.cells[c];
                    if ((cell) && ("r" in cell)) {
                        cell.r = data.pool.recons[cell.r];
                    }
                }
            }

            if (onDone) {
                onDone();
            }
        },
        "jsonp"
    );
};

Refine.getPermanentLink = function() {
    var params = [
        "project=" + escape(theProject.id),
        "ui=" + escape(JSON.stringify({
            facets: ui.browsingEngine.getFacetUIStates()
        }))
    ];
    return "project?" + params.join("&");
};

/*
 * Loader
 */

function onLoad() {
    var params = URL.getParameters();
    if ("project" in params) {
        var uiState = {};
        if ("ui" in params) {
            try {
                uiState = JSON.parse(params.ui);
            } catch (e) {
            }
        }

        Refine.reinitializeProjectData(function() {
            initializeUI(uiState);
        });
    }
}

$(onLoad);
<|endoftext|>


<commit_before>import expect from 'expect';
import Meter, { Props } from '../../../src/meter';
import { newComponent } from '../helpers';

describe('Meter', function () {
  describe('locals', () => {

    const exampleProps = {
      id: '12345',
      className: 'fancy-class-name',
      style: { margin: 10, position: 'relative' },
      value: 25,
      min: 0,
      max: 50,
      ranges: [
        { startValue: 0, endValue: 50, fillingColor: 'green', labelColor: 'red' },
        { startValue: 50, endValue: 80, fillingColor: 'yellow' },
        { startValue: 80, endValue: 100 }
      ],
      baseLabelColor: '#000000',
      baseFillingColor: '#ccc',
      labelFormatter: () => 'test'
    };

    const componentMeter = new Meter({
      ...exampleProps
    });

    it('should pass props', ()  => {
      const {
        id,
        style,
        value,
        min,
        max,
        ranges,
        baseLabelColor,
        baseFillingColor
      } = componentMeter.getLocals();
      expect(id).toBe(exampleProps.id);
      expect(style).toEqual(exampleProps.style);
      expect(value).toBe(exampleProps.value);
      expect(min).toBe(exampleProps.min);
      expect(max).toBe(exampleProps.max);
      expect(ranges).toEqual(exampleProps.ranges);
      expect(baseLabelColor).toBe(baseLabelColor);
      expect(baseFillingColor).toBe(baseFillingColor);
    });
    it('should compute className', ()  => {
      const { className } = componentMeter.getLocals();
      expect(className).toInclude('meter');
      expect(className).toInclude('fancy-class-name')
    });
    it('should compute labelFormatter', ()  => {
      const { formattedLabel } = componentMeter.getLocals();
      expect(formattedLabel).toBe('test');
    });
    it('should compute fillingStyle', ()  => {
      const { fillingStyle, ranges } = componentMeter.getLocals();
      expect(fillingStyle).toExist();
      expect(fillingStyle).toBeA(Object);
      expect(fillingStyle.backgroundColor).toBe(ranges[0].fillingColor);
    });
    it('should compute labelStyle', ()  => {
      const { labelStyle, ranges } = componentMeter.getLocals();
      expect(labelStyle).toExist();
      expect(labelStyle).toBeA(Object);
      expect(labelStyle.color).toBe(ranges[0].labelColor);
    });
    it('should compute basisSize', ()  => {
      const { basisSize } = componentMeter.getLocals();
      expect(basisSize).toBe('50%');
    });
    it('should compute basisSize for custom min-max', ()  => {
      const meter = newComponent(Meter, {
        value: 150,
        min: 100,
        max: 200
      });
      const { basisSize } = meter.getLocals();
      expect(basisSize).toBe('50%');
    });
    it('should compute basisSize for custom negative min', ()  => {
      const meter = newComponent(Meter, {
        value: 0,
        min: -100,
        max: 100
      });
      const { basisSize } = meter.getLocals();
      expect(basisSize).toBe('50%');
    });
    it('should compute basisSize for decimal value', ()  => {
      const meter = newComponent(Meter, {
        value: 0.5,
        min: 0,
        max: 1
      });
      const { basisSize } = meter.getLocals();
      expect(basisSize).toBe('50%');
    });
    it('should compute basisSize for decimal min-max', ()  => {
      const meter = newComponent(Meter, {
        value: 2.5,
        min: 1.5,
        max: 3.5
      });
      const { basisSize } = meter.getLocals();
      expect(basisSize).toBe('50%');
    });
    it('should compute ranges with holes', ()  => {
      const meter = newComponent(Meter, {
        value: 60,
        ranges: [
          { startValue: 50, endValue: 80, fillingColor: 'yellow' }
        ]
      });
      const { fillingStyle, ranges } = meter.getLocals();
      expect(fillingStyle.backgroundColor).toBe(ranges[0].fillingColor);
    });
    it('should compute ranges with holes and baseFillingColor not defined', ()  => {
      const meter = newComponent(Meter, {
        value: 20,
        ranges: [
          { startValue: 50, endValue: 80, fillingColor: 'yellow' }
        ]
      });
      const { fillingStyle } = meter.getLocals();
      //console.log(meter.logWarnings());
      expect(fillingStyle.backgroundColor).toNotExist();
    });
    it('should compute ranges with holes and setted baseFillingColor', ()  => {
      const meter = newComponent(Meter, {
        value: 20,
        baseFillingColor: '#ccc',
        ranges: [
          { startValue: 50, endValue: 80, fillingColor: 'yellow' }
        ]
      });
      const { fillingStyle, baseFillingColor } = meter.getLocals();
      expect(fillingStyle.backgroundColor).toBe(baseFillingColor);
    });
    it('should compute ranges without holes and setted baseFillingColor', ()  => {
      const meter = newComponent(Meter, {
        value: 20,
        baseFillingColor: '#ccc',
        ranges: [
          { startValue: 0, endValue: 50, fillingColor: 'green', labelColor: 'red' },
          { startValue: 50, endValue: 80, fillingColor: 'yellow' },
          { startValue: 80, endValue: 100 }
        ]
      });
      const { fillingStyle, labelStyle, baseFillingColor, ranges } = meter.getLocals();
      expect(fillingStyle.backgroundColor).toNotBe(baseFillingColor);
      expect(fillingStyle.backgroundColor).toBe(ranges[0].fillingColor);
      expect(labelStyle.color).toBe(ranges[0].labelColor);
    });
    it('should compute ranges without holes using defaults', ()  => {
      const meter = newComponent(Meter, {
        value: 20,
        ranges: [
          { startValue: 0, endValue: 50 },
          { startValue: 50, endValue: 80 },
          { startValue: 80, endValue: 100 }
        ]
      });
      const { fillingStyle, labelStyle, baseFillingColor, ranges } = meter.getLocals();
      expect(fillingStyle.backgroundColor).toNotExist();
      expect(labelStyle.color).toNotExist();
    });
  });
});
<commit_msg>reword and remove some tests<commit_after>import expect from 'expect';
import Meter, { Props } from '../../../src/meter';
import { newComponent } from '../helpers';

describe('Meter', function () {
  describe('locals', () => {

    const exampleProps = {
      id: '12345',
      className: 'fancy-class-name',
      style: { margin: 10, position: 'relative' },
      value: 25,
      min: 0,
      max: 50,
      ranges: [
        { startValue: 0, endValue: 50, fillingColor: 'green', labelColor: 'red' },
        { startValue: 50, endValue: 80, fillingColor: 'yellow' },
        { startValue: 80, endValue: 100 }
      ],
      baseLabelColor: '#000000',
      baseFillingColor: '#ccc',
      labelFormatter: () => 'test'
    };

    const componentMeter = new Meter(exampleProps);

    it('should pass props', ()  => {
      const locals = componentMeter.getLocals();
      expect(locals.id).toBe(exampleProps.id);
      expect(locals.style).toEqual(exampleProps.style);
      expect(locals.value).toBe(exampleProps.value);
      expect(locals.min).toBe(exampleProps.min);
      expect(locals.max).toBe(exampleProps.max);
      expect(locals.ranges).toEqual(exampleProps.ranges);
      expect(locals.baseLabelColor).toBe(exampleProps.baseLabelColor);
      expect(locals.baseFillingColor).toBe(exampleProps.baseFillingColor);
    });

    it('should compute className', ()  => {
      const { className } = componentMeter.getLocals();
      expect(className).toInclude('meter');
      expect(className).toInclude('fancy-class-name')
    });

    it('should use labelFormatter correctly', ()  => {
      const { formattedLabel } = componentMeter.getLocals();
      expect(formattedLabel).toBe('test');
    });

    it('should compute fillingStyle correctly', ()  => {
      const { fillingStyle, ranges } = componentMeter.getLocals();
      expect(fillingStyle).toExist();
      expect(fillingStyle).toBeA(Object);
      expect(fillingStyle.backgroundColor).toBe(ranges[0].fillingColor);
    });

    it('should compute labelStyle correctly', ()  => {
      const { labelStyle, ranges } = componentMeter.getLocals();
      expect(labelStyle).toExist();
      expect(labelStyle).toBeA(Object);
      expect(labelStyle.color).toBe(ranges[0].labelColor);
    });

    it('should compute basisSize correctly', ()  => {
      const { basisSize } = componentMeter.getLocals();
      expect(basisSize).toBe('50%');
    });

    it('should compute basisSize correctly with custom min and max', ()  => {
      const meter = newComponent(Meter, {
        value: 150,
        min: 100,
        max: 200
      });
      const { basisSize } = meter.getLocals();
      expect(basisSize).toBe('50%');
    });

    it('should compute basisSize correctly for custom negative min', ()  => {
      const meter = newComponent(Meter, {
        value: 0,
        min: -100,
        max: 100
      });
      const { basisSize } = meter.getLocals();
      expect(basisSize).toBe('50%');
    });

    it('should use the correct background color for filling', ()  => {
      const meter = newComponent(Meter, {
        value: 60,
        ranges: [
          { startValue: 50, endValue: 80, fillingColor: 'yellow' }
        ]
      });
      const { fillingStyle, ranges } = meter.getLocals();
      expect(fillingStyle.backgroundColor).toBe(ranges[0].fillingColor);
    });

    it(`background color should be the base color if there's no matching range`, ()  => {
      const meter = newComponent(Meter, {
        value: 20,
        baseFillingColor: '#ccc',
        ranges: [
          { startValue: 50, endValue: 80, fillingColor: 'yellow' }
        ]
      });
      const { fillingStyle, baseFillingColor } = meter.getLocals();
      expect(fillingStyle.backgroundColor).toBe(baseFillingColor);
    });

    it(`background color should be not defined if there's no matching range and no default is given`, ()  => {
      const meter = newComponent(Meter, {
        value: 20,
        ranges: [
          { startValue: 50, endValue: 80, fillingColor: 'yellow' }
        ]
      });
      const { fillingStyle } = meter.getLocals();
      expect(fillingStyle.backgroundColor).toNotExist();
    });
  });
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'constellation:tiny',
  version: '0.3.4',
  summary: 'Minification plugin for Constellation',
  git: 'https://github.com/JackAdams/constellation-tiny.git',
  documentation: 'README.md',
  debugOnly: true
});

Package.onUse(function(api) {
  api.versionsFrom('1.0');

  api.use(['templating','reactive-dict','tracker'], 'client');
  api.use('constellation:console@1.3.0', 'client');

  api.addFiles('tiny-client.css','client');
  api.addFiles('tiny-client.html','client');
  api.addFiles('tiny-client.js','client');

  api.imply('constellation:console');
});

Package.onTest(function(api) {
  api.use('tinytest');
});<commit_msg>Updated dependencies<commit_after>Package.describe({
  name: 'constellation:tiny',
  version: '0.3.5',
  summary: 'Minification plugin for Constellation',
  git: 'https://github.com/JackAdams/constellation-tiny.git',
  documentation: 'README.md',
  debugOnly: true
});

Package.onUse(function(api) {
  api.versionsFrom('1.0');

  api.use(['templating','reactive-dict','tracker'], 'client');
  api.use('constellation:console@1.3.1', 'client');

  api.addFiles('tiny-client.css','client');
  api.addFiles('tiny-client.html','client');
  api.addFiles('tiny-client.js','client');

  api.imply('constellation:console');
});

Package.onTest(function(api) {
  api.use('tinytest');
});<|endoftext|>


<commit_before>/* global Blob window URL */
import CompositeClosureHelper from 'paraviewweb/src/Common/Core/CompositeClosureHelper';

function wslinkImageStream(publicAPI, model) {
  if (!model.client) throw Error('Client must be provided');

  model.metadata = null;
  model.activeURL = null;
  model.fps = 0;
  model.lastTime = Date.now();
  model.urlToRevoke = [];

  model.lastImageReadyEvent = null;

  // This functionality is apparently unused.
  publicAPI.enableView = (enabled) => {
    model.client.VtkImageDelivery.enableView(model.view_id, enabled);
  };

  publicAPI.startInteractiveQuality = () =>
    model.client.VtkImageDelivery.viewQuality(
      model.view_id,
      model.interactiveQuality,
      model.interactiveRatio
    );

  publicAPI.stopInteractiveQuality = () =>
    model.client.VtkImageDelivery.viewQuality(
      model.view_id,
      model.stillQuality,
      model.stillRatio
    );

  publicAPI.stillRender = (view = model.view_id, size = model.size) =>
    model.client.VtkImageDelivery.stillRender({ size, view });

  publicAPI.setMaxFrameRate = (maxFPS) =>
    model.client.VtkImageDelivery.setMaxFrameRate(maxFPS);

  publicAPI.setViewSize = (width, height) => {
    model.size = [width, height];
    return model.client.VtkImageDelivery.viewSize(model.view_id, width, height);
  };

  publicAPI.invalidateCache = () =>
    model.client.VtkImageDelivery.invalidateCache(model.view_id);

  publicAPI.updateQuality = (stillQuality = 100, interactiveQuality = 50) => {
    model.stillQuality = stillQuality;
    model.interactiveQuality = interactiveQuality;
  };

  publicAPI.updateResolutionRatio = (sRatio = 1, iRatio = 0.5) => {
    model.stillRatio = sRatio;
    model.interactiveRatio = iRatio;
  };

  publicAPI.unsubscribeRenderTopic = () => {
    model.client.VtkImageDelivery.offRenderChange(
      model.renderTopicSubscription
    ).promise.then(
      (unsubSuccess) => {
        console.log('Unsubscribe resolved ', unsubSuccess);
      },
      (unsubFailure) => {
        console.log('Unsubscribe error ', unsubFailure);
      }
    );
  };

  // subscribeRenderTopic = () => {
  //   model.client.VtkImageDelivery.onRenderChange(publicAPI.viewChanged).then((subscription) => {
  //     model.renderTopicSubscription = subscription;
  //   }, (subError) => {
  //     console.log('Failed to subscribe to topic');
  //     console.log(subError);
  //   });
  // }

  publicAPI.removeRenderObserver = (viewId) => {
    model.client.VtkImageDelivery.removeRenderObserver(viewId).then(
      (successResult) => {
        console.log(`Removed observer from view ${viewId} succeeded`);
        console.log(successResult);
      },
      (failureResult) => {
        console.log(`Failed to remove observer from view ${viewId}`);
        console.log(failureResult);
      }
    );
  };

  // addRenderObserver(viewId) {
  //   model.client.VtkImageDelivery.addRenderObserver(viewId).then((successResult) => {
  //     console.log(`Successfully added observer to view ${viewId}`);
  //     console.log(successResult);
  //   }, (failureResult) => {
  //     console.log(`Failed to add observer to view ${viewId}`);
  //     console.log(failureResult);
  //   });
  // }

  publicAPI.setViewId = (viewId) => {
    if (model.view_id === viewId) {
      return false;
    }
    model.client.VtkImageDelivery.removeRenderObserver(model.view_id);
    model.view_id = viewId;
    model.client.VtkImageDelivery.addRenderObserver(model.view_id);
    return true;
  };

  publicAPI.viewChanged = (data) => {
    const msg = data[0];
    /* eslint-disable eqeqeq */
    if (!msg || !msg.image || msg.id != model.view_id) return;
    /* eslint-enable eqeqeq */
    const imgBlob = new Blob([msg.image], {
      type: model.mimeType,
    });
    if (model.activeURL) {
      model.urlToRevoke.push(model.activeURL);
      model.activeURL = null;
      while (model.urlToRevoke.length > 60) {
        const url = model.urlToRevoke.shift();
        window.URL.revokeObjectURL(url);
      }
    }
    model.activeURL = URL.createObjectURL(imgBlob);
    const time = Date.now();
    model.fps = Math.floor(10000 / (time - model.lastTime)) / 10;
    model.lastTime = time;

    model.lastImageReadyEvent = {
      url: model.activeURL,
      fps: model.fps,
      metadata: {
        size: msg.size,
        id: msg.id,
        memory: msg.memsize,
        workTime: msg.workTime,
      },
    };

    publicAPI.fireImageReady(model.lastImageReadyEvent);
  };

  /* eslint-disable camelcase */
  publicAPI.connect = ({ view_id = -1, size = [500, 500] }) =>
    // Subscribe to pubsub topic and add view observer
    new Promise((resolve, reject) => {
      model.view_id = view_id;
      model.width = size[0];
      model.height = size[1];

      model.client.VtkImageDelivery.onRenderChange(
        publicAPI.viewChanged
      ).promise.then(
        (subscription) => {
          model.renderTopicSubscription = subscription;
          model.client.VtkImageDelivery.addRenderObserver(view_id).then(
            (successResult) => {
              if (successResult.viewId) {
                model.view_id = successResult.viewId;
              }
              console.log(`Successfully added observer to view ${view_id}`);
              console.log(successResult);
              resolve(successResult);
            },
            (failureResult) => {
              console.log(`Failed to add observer to view ${view_id}`);
              console.log(failureResult);
              reject(failureResult);
            }
          );
        },
        (subError) => {
          console.log('Failed to subscribe to topic');
          console.log(subError);
          reject(subError);
        }
      );
    });
  /* eslint-enable camelcase */

  function cleanUp() {
    publicAPI.removeRenderObserver(model.view_id);
    publicAPI.unsubscribeRenderTopic();
    while (model.urlToRevoke.length) {
      window.URL.revokeObjectURL(model.urlToRevoke.pop());
    }
  }

  publicAPI.destroy = CompositeClosureHelper.chain(cleanUp, publicAPI.destroy);

  publicAPI.getLastImageReadyEvent = () => model.lastImageReadyEvent;
}

const DEFAULT_VALUES = {
  stillRatio: 1,
  interactiveRatio: 0.5,
  stillQuality: 100,
  interactiveQuality: 50,
  mimeType: 'image/jpeg',
  view_id: -1,
};

export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);

  CompositeClosureHelper.destroy(publicAPI, model);
  CompositeClosureHelper.event(publicAPI, model, 'ImageReady');
  CompositeClosureHelper.isA(publicAPI, model, 'WslinkImageStream');

  wslinkImageStream(publicAPI, model);
}

// ----------------------------------------------------------------------------
export const newInstance = CompositeClosureHelper.newInstance(extend);

export default { newInstance, extend };
<commit_msg>fix(wslink): Fix wrong api call<commit_after>/* global Blob window URL */
import CompositeClosureHelper from 'paraviewweb/src/Common/Core/CompositeClosureHelper';

function wslinkImageStream(publicAPI, model) {
  if (!model.client) throw Error('Client must be provided');

  model.metadata = null;
  model.activeURL = null;
  model.fps = 0;
  model.lastTime = Date.now();
  model.urlToRevoke = [];

  model.lastImageReadyEvent = null;

  // This functionality is apparently unused.
  publicAPI.enableView = (enabled) => {
    model.client.VtkImageDelivery.enableView(model.view_id, enabled);
  };

  publicAPI.startInteractiveQuality = () =>
    model.client.VtkImageDelivery.viewQuality(
      model.view_id,
      model.interactiveQuality,
      model.interactiveRatio
    );

  publicAPI.stopInteractiveQuality = () =>
    model.client.VtkImageDelivery.viewQuality(
      model.view_id,
      model.stillQuality,
      model.stillRatio
    );

  publicAPI.stillRender = (view = model.view_id, size = model.size) =>
    model.client.VtkImageDelivery.stillRender({ size, view });

  publicAPI.setMaxFrameRate = (maxFPS) =>
    model.client.VtkImageDelivery.setMaxFrameRate(maxFPS);

  publicAPI.setViewSize = (width, height) => {
    model.size = [width, height];
    return model.client.VtkImageDelivery.viewSize(model.view_id, width, height);
  };

  publicAPI.invalidateCache = () =>
    model.client.VtkImageDelivery.invalidateCache(model.view_id);

  publicAPI.updateQuality = (stillQuality = 100, interactiveQuality = 50) => {
    model.stillQuality = stillQuality;
    model.interactiveQuality = interactiveQuality;
  };

  publicAPI.updateResolutionRatio = (sRatio = 1, iRatio = 0.5) => {
    model.stillRatio = sRatio;
    model.interactiveRatio = iRatio;
  };

  publicAPI.unsubscribeRenderTopic = () => {
    model.client.VtkImageDelivery.offRenderChange(
      model.renderTopicSubscription
    ).then(
      (unsubSuccess) => {
        console.log('Unsubscribe resolved ', unsubSuccess);
      },
      (unsubFailure) => {
        console.log('Unsubscribe error ', unsubFailure);
      }
    );
  };

  // subscribeRenderTopic = () => {
  //   model.client.VtkImageDelivery.onRenderChange(publicAPI.viewChanged).then((subscription) => {
  //     model.renderTopicSubscription = subscription;
  //   }, (subError) => {
  //     console.log('Failed to subscribe to topic');
  //     console.log(subError);
  //   });
  // }

  publicAPI.removeRenderObserver = (viewId) => {
    model.client.VtkImageDelivery.removeRenderObserver(viewId).then(
      (successResult) => {
        console.log(`Removed observer from view ${viewId} succeeded`);
        console.log(successResult);
      },
      (failureResult) => {
        console.log(`Failed to remove observer from view ${viewId}`);
        console.log(failureResult);
      }
    );
  };

  // addRenderObserver(viewId) {
  //   model.client.VtkImageDelivery.addRenderObserver(viewId).then((successResult) => {
  //     console.log(`Successfully added observer to view ${viewId}`);
  //     console.log(successResult);
  //   }, (failureResult) => {
  //     console.log(`Failed to add observer to view ${viewId}`);
  //     console.log(failureResult);
  //   });
  // }

  publicAPI.setViewId = (viewId) => {
    if (model.view_id === viewId) {
      return false;
    }
    model.client.VtkImageDelivery.removeRenderObserver(model.view_id);
    model.view_id = viewId;
    model.client.VtkImageDelivery.addRenderObserver(model.view_id);
    return true;
  };

  publicAPI.viewChanged = (data) => {
    const msg = data[0];
    /* eslint-disable eqeqeq */
    if (!msg || !msg.image || msg.id != model.view_id) return;
    /* eslint-enable eqeqeq */
    const imgBlob = new Blob([msg.image], {
      type: model.mimeType,
    });
    if (model.activeURL) {
      model.urlToRevoke.push(model.activeURL);
      model.activeURL = null;
      while (model.urlToRevoke.length > 60) {
        const url = model.urlToRevoke.shift();
        window.URL.revokeObjectURL(url);
      }
    }
    model.activeURL = URL.createObjectURL(imgBlob);
    const time = Date.now();
    model.fps = Math.floor(10000 / (time - model.lastTime)) / 10;
    model.lastTime = time;

    model.lastImageReadyEvent = {
      url: model.activeURL,
      fps: model.fps,
      metadata: {
        size: msg.size,
        id: msg.id,
        memory: msg.memsize,
        workTime: msg.workTime,
      },
    };

    publicAPI.fireImageReady(model.lastImageReadyEvent);
  };

  /* eslint-disable camelcase */
  publicAPI.connect = ({ view_id = -1, size = [500, 500] }) =>
    // Subscribe to pubsub topic and add view observer
    new Promise((resolve, reject) => {
      model.view_id = view_id;
      model.width = size[0];
      model.height = size[1];

      model.client.VtkImageDelivery.onRenderChange(
        publicAPI.viewChanged
      ).promise.then(
        (subscription) => {
          model.renderTopicSubscription = subscription;
          model.client.VtkImageDelivery.addRenderObserver(view_id).then(
            (successResult) => {
              if (successResult.viewId) {
                model.view_id = successResult.viewId;
              }
              console.log(`Successfully added observer to view ${view_id}`);
              console.log(successResult);
              resolve(successResult);
            },
            (failureResult) => {
              console.log(`Failed to add observer to view ${view_id}`);
              console.log(failureResult);
              reject(failureResult);
            }
          );
        },
        (subError) => {
          console.log('Failed to subscribe to topic');
          console.log(subError);
          reject(subError);
        }
      );
    });
  /* eslint-enable camelcase */

  function cleanUp() {
    publicAPI.removeRenderObserver(model.view_id);
    publicAPI.unsubscribeRenderTopic();
    while (model.urlToRevoke.length) {
      window.URL.revokeObjectURL(model.urlToRevoke.pop());
    }
  }

  publicAPI.destroy = CompositeClosureHelper.chain(cleanUp, publicAPI.destroy);

  publicAPI.getLastImageReadyEvent = () => model.lastImageReadyEvent;
}

const DEFAULT_VALUES = {
  stillRatio: 1,
  interactiveRatio: 0.5,
  stillQuality: 100,
  interactiveQuality: 50,
  mimeType: 'image/jpeg',
  view_id: -1,
};

export function extend(publicAPI, model, initialValues = {}) {
  Object.assign(model, DEFAULT_VALUES, initialValues);

  CompositeClosureHelper.destroy(publicAPI, model);
  CompositeClosureHelper.event(publicAPI, model, 'ImageReady');
  CompositeClosureHelper.isA(publicAPI, model, 'WslinkImageStream');

  wslinkImageStream(publicAPI, model);
}

// ----------------------------------------------------------------------------
export const newInstance = CompositeClosureHelper.newInstance(extend);

export default { newInstance, extend };
<|endoftext|>


<commit_before>module.exports = {
  Colors: {
    PRIMARY: '#359BCF',
    DARK_PRIMARY: '#2E323F',
    INVERSE_PRIMARY: '#FFFFFF',

    SECONDARY: '#F7B148',
    INVERSE_SECONDARY: '#FFFFFF',

    FONT: '#2E323F',
    LIGHT_FONT: '#999999',

    BASE_ARC: '#F5F5F5',
    ORANGE: '#ca3a31',
    YELLOW: '#f6a01e',
    GREEN: '#00a89c',
    BLUE: '#359BCF',
    RED: '#EE4235',

    //Grays
    ASH: '#ACB0B3',       //Base Color 3
    CHARCOAL: '#56595A',  //Base Color 7
    FOG: '#E3E6E7',       //Base Color 1
    PORCELAIN: '#F7F8F8', //Base Color 0
    WHITE: '#FFFFFF',

    //Status Colors
    BANANA: '#FBB600',    //Anything yellow
    LIME: '#2EBE51',      //Anything green
    STRAWBERRY: '#E22727', //Anything red

    //Scrim
    SCRIM: 'rgba(247,248,248,0.9)'
  },

  FontSizes: {
    JUMBO: '30px',
    XXLARGE: '21px',
    XLARGE: '17px',
    MEDIUM: '13px',
    SMALL: '11px',
    TINY: '10px'
  },

  FontFamily: 'Helvetica, Arial, sans-serif',
  BoxShadow: '0 30px 30px 10px rgba(0,0,0,0.1)',
};
<commit_msg>remove comma dangle<commit_after>module.exports = {
  Colors: {
    PRIMARY: '#359BCF',
    DARK_PRIMARY: '#2E323F',
    INVERSE_PRIMARY: '#FFFFFF',

    SECONDARY: '#F7B148',
    INVERSE_SECONDARY: '#FFFFFF',

    FONT: '#2E323F',
    LIGHT_FONT: '#999999',

    BASE_ARC: '#F5F5F5',
    ORANGE: '#ca3a31',
    YELLOW: '#f6a01e',
    GREEN: '#00a89c',
    BLUE: '#359BCF',
    RED: '#EE4235',

    //Grays
    ASH: '#ACB0B3',       //Base Color 3
    CHARCOAL: '#56595A',  //Base Color 7
    FOG: '#E3E6E7',       //Base Color 1
    PORCELAIN: '#F7F8F8', //Base Color 0
    WHITE: '#FFFFFF',

    //Status Colors
    BANANA: '#FBB600',    //Anything yellow
    LIME: '#2EBE51',      //Anything green
    STRAWBERRY: '#E22727', //Anything red

    //Scrim
    SCRIM: 'rgba(247,248,248,0.9)'
  },

  FontSizes: {
    JUMBO: '30px',
    XXLARGE: '21px',
    XLARGE: '17px',
    MEDIUM: '13px',
    SMALL: '11px',
    TINY: '10px'
  },

  FontFamily: 'Helvetica, Arial, sans-serif',
  BoxShadow: '0 30px 30px 10px rgba(0,0,0,0.1)'
};
<|endoftext|>