Trim quotes around the CLI argument.

Trim quotes around the CLI argument.

--- src/helpers.js
+++ src/helpers.js
@@ -1,5 +1,6 @@
 const jsonic = require('jsonic');
 const qs = require('qs');
+const trim = require('lodash/trim');

 /**
  * Start a timer.
@@ -26,6 +27,7 @@
 exports.parseData = function(data) {
   let parsedData, headers;

+  data = trim(data, `'"`);
   if (data && typeof data === 'string') {
     if (data.includes(':')) {
       parsedData = jsonic(data);

<|original_code|>
const jsonic = require('jsonic');
const qs = require('qs');

/**
 * Start a timer.
 *
 * @return {Array}
 */
exports.startTimer = function() {
  return process.hrtime();
};

/**
 * Stop the given timer and return elapsed time in milliseconds.
 *
 * @return {Number}
 */
exports.endTimer = function(start) {
  const end = process.hrtime(start);
  return end[0] * 1000 + end[1] / 1000000;
}

/**
 * Parse CLI input into the appropriate request payload.
 */
exports.parseData = function(data) {
  let parsedData, headers;

  if (data && typeof data === 'string') {
    if (data.includes(':')) {
      parsedData = jsonic(data);
    } else if (data.includes('=')) {
      headers = {'Content-Type': 'application/x-www-form-urlencoded'};
      parsedData = qs.stringify(qs.parse(data));
    } else {
      headers = {'Content-Type': 'text/plain'};
      parsedData = data;
    }
  }

  return { parsedData, headers };
}

/**
 * Track verbosity CLI argument.
 */
exports.increaseVerbosity = function(v, total) {
  return total + 1;
}

<|edits_diff|>
--- src/helpers.js
+++ src/helpers.js
@@ -1,5 +1,6 @@
 const jsonic = require('jsonic');
 const qs = require('qs');
+const trim = require('lodash/trim');

 /**
  * Start a timer.
<|current_version|>
const jsonic = require('jsonic');
const qs = require('qs');
const trim = require('lodash/trim');

/**
 * Start a timer.
 *
 * @return {Array}
 */
exports.startTimer = function() {
  return process.hrtime();
};

/**
 * Stop the given timer and return elapsed time in milliseconds.
 *
 * @return {Number}
 */
exports.endTimer = function(start) {
  const end = process.hrtime(start);
  return end[0] * 1000 + end[1] / 1000000;
}

/**
 * Parse CLI input into the appropriate request payload.
 */
exports.parseData = function(data) {
  let parsedData, headers;

  if (data && typeof data === 'string') {
    if (data.includes(':')) {
      parsedData = jsonic(data);
    } else if (data.includes('=')) {
      headers = {'Content-Type': 'application/x-www-form-urlencoded'};
      parsedData = qs.stringify(qs.parse(data));
    } else {
      headers = {'Content-Type': 'text/plain'};
      parsedData = data;
    }
  }

  return { parsedData, headers };
}

/**
 * Track verbosity CLI argument.
 */
exports.increaseVerbosity = function(v, total) {
  return total + 1;
}

<|next_version|>
const jsonic = require('jsonic');
const qs = require('qs');
const trim = require('lodash/trim');

/**
 * Start a timer.
 *
 * @return {Array}
 */
exports.startTimer = function() {
  return process.hrtime();
};

/**
 * Stop the given timer and return elapsed time in milliseconds.
 *
 * @return {Number}
 */
exports.endTimer = function(start) {
  const end = process.hrtime(start);
  return end[0] * 1000 + end[1] / 1000000;
}

/**
 * Parse CLI input into the appropriate request payload.
 */
exports.parseData = function(data) {
  let parsedData, headers;

  data = trim(data, `'"`);
  if (data && typeof data === 'string') {
    if (data.includes(':')) {
      parsedData = jsonic(data);
    } else if (data.includes('=')) {
      headers = {'Content-Type': 'application/x-www-form-urlencoded'};
      parsedData = qs.stringify(qs.parse(data));
    } else {
      headers = {'Content-Type': 'text/plain'};
      parsedData = data;
    }
  }

  return { parsedData, headers };
}

/**
 * Track verbosity CLI argument.
 */
exports.increaseVerbosity = function(v, total) {
  return total + 1;
}


Add MapProperty into the generated file

fix(MapProperty): Add MapProperty into the generated file

--- src/React/Properties/index.js
+++ src/React/Properties/index.js
@@ -1,6 +1,7 @@
 import CellProperty from './CellProperty';
 import CheckboxProperty from './CheckboxProperty';
 import EnumProperty from './EnumProperty';
+import MapProperty from './MapProperty';
 import PropertyFactory from './PropertyFactory';
 import PropertyPanel from './PropertyPanel';
 import SliderProperty from './SliderProperty';
@@ -9,6 +10,7 @@
   CellProperty,
   CheckboxProperty,
   EnumProperty,
+  MapProperty,
   PropertyFactory,
   PropertyPanel,
   SliderProperty,

<|original_code|>
import CellProperty from './CellProperty';
import CheckboxProperty from './CheckboxProperty';
import EnumProperty from './EnumProperty';
import PropertyFactory from './PropertyFactory';
import PropertyPanel from './PropertyPanel';
import SliderProperty from './SliderProperty';

export default {
  CellProperty,
  CheckboxProperty,
  EnumProperty,
  PropertyFactory,
  PropertyPanel,
  SliderProperty,
};

<|edits_diff|>
--- src/React/Properties/index.js
+++ src/React/Properties/index.js
@@ -1,6 +1,7 @@
 import CellProperty from './CellProperty';
 import CheckboxProperty from './CheckboxProperty';
 import EnumProperty from './EnumProperty';
+import MapProperty from './MapProperty';
 import PropertyFactory from './PropertyFactory';
 import PropertyPanel from './PropertyPanel';
 import SliderProperty from './SliderProperty';
<|current_version|>
import CellProperty from './CellProperty';
import CheckboxProperty from './CheckboxProperty';
import EnumProperty from './EnumProperty';
import MapProperty from './MapProperty';
import PropertyFactory from './PropertyFactory';
import PropertyPanel from './PropertyPanel';
import SliderProperty from './SliderProperty';

export default {
  CellProperty,
  CheckboxProperty,
  EnumProperty,
  PropertyFactory,
  PropertyPanel,
  SliderProperty,
};

<|next_version|>
import CellProperty from './CellProperty';
import CheckboxProperty from './CheckboxProperty';
import EnumProperty from './EnumProperty';
import MapProperty from './MapProperty';
import PropertyFactory from './PropertyFactory';
import PropertyPanel from './PropertyPanel';
import SliderProperty from './SliderProperty';

export default {
  CellProperty,
  CheckboxProperty,
  EnumProperty,
  MapProperty,
  PropertyFactory,
  PropertyPanel,
  SliderProperty,
};


Set layout explicitly for the overridden ilios-calendar-component

--- app/components/ilios-calendar-event.js
+++ app/components/ilios-calendar-event.js
@@ -1,8 +1,10 @@
 /* global moment */
 import Ember from 'ember';
+import layout from '../templates/components/ilios-calendar-event';
 import { default as CalendarEvent } from 'el-calendar/components/calendar-event';

 export default CalendarEvent.extend({
+  layout: layout,
   viewType: 'day',
   event: null,
   classNameBindings: [':event', ':event-pos', ':ilios-calendar-event', 'event.eventClass', 'viewType'],

<|original_code|>
/* global moment */
import Ember from 'ember';
import { default as CalendarEvent } from 'el-calendar/components/calendar-event';

export default CalendarEvent.extend({
  viewType: 'day',
  event: null,
  classNameBindings: [':event', ':event-pos', ':ilios-calendar-event', 'event.eventClass', 'viewType'],
  toolTipMessage: Ember.computed('event', function(){
    let str = this.get('event.location') + '
' +
      moment(this.get('event.startDate')).format('h:mma') + ' - ' +
      moment(this.get('event.endDate')).format('h:mma') + '
' +
      this.get('event.name');

    return str;
  }),
  style: Ember.computed(function() {
    if(this.get('viewType') === 'month-event'){
      return '';
    }
    let escape = Ember.Handlebars.Utils.escapeExpression;

    return Ember.String.htmlSafe(
      `top: ${escape(this.calculateTop())}%;
       height: ${escape(this.calculateHeight())}%;
       left: ${escape(this.calculateLeft())}%;
       width: ${escape(this.calculateWidth())}%;`
    );
  }),
  click(){
    this.sendAction('action', this.get('event'));
  }
});

<|edits_diff|>
--- app/components/ilios-calendar-event.js
+++ app/components/ilios-calendar-event.js
@@ -1,5 +1,6 @@
 /* global moment */
 import Ember from 'ember';
+import layout from '../templates/components/ilios-calendar-event';
 import { default as CalendarEvent } from 'el-calendar/components/calendar-event';

 export default CalendarEvent.extend({
<|current_version|>
/* global moment */
import Ember from 'ember';
import layout from '../templates/components/ilios-calendar-event';
import { default as CalendarEvent } from 'el-calendar/components/calendar-event';

export default CalendarEvent.extend({
  viewType: 'day',
  event: null,
  classNameBindings: [':event', ':event-pos', ':ilios-calendar-event', 'event.eventClass', 'viewType'],
  toolTipMessage: Ember.computed('event', function(){
    let str = this.get('event.location') + '
' +
      moment(this.get('event.startDate')).format('h:mma') + ' - ' +
      moment(this.get('event.endDate')).format('h:mma') + '
' +
      this.get('event.name');

    return str;
  }),
  style: Ember.computed(function() {
    if(this.get('viewType') === 'month-event'){
      return '';
    }
    let escape = Ember.Handlebars.Utils.escapeExpression;

    return Ember.String.htmlSafe(
      `top: ${escape(this.calculateTop())}%;
       height: ${escape(this.calculateHeight())}%;
       left: ${escape(this.calculateLeft())}%;
       width: ${escape(this.calculateWidth())}%;`
    );
  }),
  click(){
    this.sendAction('action', this.get('event'));
  }
});

<|next_version|>
/* global moment */
import Ember from 'ember';
import layout from '../templates/components/ilios-calendar-event';
import { default as CalendarEvent } from 'el-calendar/components/calendar-event';

export default CalendarEvent.extend({
  layout: layout,
  viewType: 'day',
  event: null,
  classNameBindings: [':event', ':event-pos', ':ilios-calendar-event', 'event.eventClass', 'viewType'],
  toolTipMessage: Ember.computed('event', function(){
    let str = this.get('event.location') + '
' +
      moment(this.get('event.startDate')).format('h:mma') + ' - ' +
      moment(this.get('event.endDate')).format('h:mma') + '
' +
      this.get('event.name');

    return str;
  }),
  style: Ember.computed(function() {
    if(this.get('viewType') === 'month-event'){
      return '';
    }
    let escape = Ember.Handlebars.Utils.escapeExpression;

    return Ember.String.htmlSafe(
      `top: ${escape(this.calculateTop())}%;
       height: ${escape(this.calculateHeight())}%;
       left: ${escape(this.calculateLeft())}%;
       width: ${escape(this.calculateWidth())}%;`
    );
  }),
  click(){
    this.sendAction('action', this.get('event'));
  }
});


Return true if there are no filters to validate.

--- client/js/app/validations/SharedValidations.js
+++ client/js/app/validations/SharedValidations.js
@@ -1,3 +1,4 @@
+var _ = require('lodash');
 var RunValidations = require('../utils/RunValidations').run;
 var FilterValidations = require('../validations/FilterValidations');
 var TimeframeUtils = require('../utils/TimeframeUtils');
@@ -20,6 +21,7 @@
     msg: 'One of your filters is invalid.',

     validate: function(filters) {
+      if (!filters || (_.isArray(filters) && !filters.length)) return true;
       for (var i=0; i<filters.length; i++) {
         var complete = FilterUtils.isComplete(filters[i]);
         var valid = RunValidations(FilterValidations, filters[i]).length === 0;

<|original_code|>
var RunValidations = require('../utils/RunValidations').run;
var FilterValidations = require('../validations/FilterValidations');
var TimeframeUtils = require('../utils/TimeframeUtils');
var FilterUtils = require('../utils/FilterUtils');

module.exports = {

  event_collection: {

    msg: 'Choose an Event Collection.',

    validate: function(value) {
      return value ? true : false;
    }

  },

  filters: {

    msg: 'One of your filters is invalid.',

    validate: function(filters) {
      for (var i=0; i<filters.length; i++) {
        var complete = FilterUtils.isComplete(filters[i]);
        var valid = RunValidations(FilterValidations, filters[i]).length === 0;
        if (complete && !valid) return false;
      }
      return true;
    }

  },

  time: {

    validate: function(time) {
      var time = time || {};
      if (TimeframeUtils.timeframeType(time) === 'relative') {
        if (time.relativity && time.amount && time.sub_timeframe) {
          return true;
        } else {
          return "You must choose all 3 options for relative timeframes.";
        }
      } else if (TimeframeUtils.timeframeType(time) === 'absolute') {
        if (time.start && time.end) {
          return true;
        } else {
          return "You must provide a start and end time for absolute timeframes.";
        }
      } else {
        return "You must provide a timeframe.";
      }
      return true;
    }

  }

};
<|edits_diff|>
--- client/js/app/validations/SharedValidations.js
+++ client/js/app/validations/SharedValidations.js
@@ -1,3 +1,4 @@
+var _ = require('lodash');
 var RunValidations = require('../utils/RunValidations').run;
 var FilterValidations = require('../validations/FilterValidations');
 var TimeframeUtils = require('../utils/TimeframeUtils');
<|current_version|>
var _ = require('lodash');
var RunValidations = require('../utils/RunValidations').run;
var FilterValidations = require('../validations/FilterValidations');
var TimeframeUtils = require('../utils/TimeframeUtils');
var FilterUtils = require('../utils/FilterUtils');

module.exports = {

  event_collection: {

    msg: 'Choose an Event Collection.',

    validate: function(value) {
      return value ? true : false;
    }

  },

  filters: {

    msg: 'One of your filters is invalid.',

    validate: function(filters) {
      for (var i=0; i<filters.length; i++) {
        var complete = FilterUtils.isComplete(filters[i]);
        var valid = RunValidations(FilterValidations, filters[i]).length === 0;
        if (complete && !valid) return false;
      }
      return true;
    }

  },

  time: {

    validate: function(time) {
      var time = time || {};
      if (TimeframeUtils.timeframeType(time) === 'relative') {
        if (time.relativity && time.amount && time.sub_timeframe) {
          return true;
        } else {
          return "You must choose all 3 options for relative timeframes.";
        }
      } else if (TimeframeUtils.timeframeType(time) === 'absolute') {
        if (time.start && time.end) {
          return true;
        } else {
          return "You must provide a start and end time for absolute timeframes.";
        }
      } else {
        return "You must provide a timeframe.";
      }
      return true;
    }

  }

};
<|next_version|>
var _ = require('lodash');
var RunValidations = require('../utils/RunValidations').run;
var FilterValidations = require('../validations/FilterValidations');
var TimeframeUtils = require('../utils/TimeframeUtils');
var FilterUtils = require('../utils/FilterUtils');

module.exports = {

  event_collection: {

    msg: 'Choose an Event Collection.',

    validate: function(value) {
      return value ? true : false;
    }

  },

  filters: {

    msg: 'One of your filters is invalid.',

    validate: function(filters) {
      if (!filters || (_.isArray(filters) && !filters.length)) return true;
      for (var i=0; i<filters.length; i++) {
        var complete = FilterUtils.isComplete(filters[i]);
        var valid = RunValidations(FilterValidations, filters[i]).length === 0;
        if (complete && !valid) return false;
      }
      return true;
    }

  },

  time: {

    validate: function(time) {
      var time = time || {};
      if (TimeframeUtils.timeframeType(time) === 'relative') {
        if (time.relativity && time.amount && time.sub_timeframe) {
          return true;
        } else {
          return "You must choose all 3 options for relative timeframes.";
        }
      } else if (TimeframeUtils.timeframeType(time) === 'absolute') {
        if (time.start && time.end) {
          return true;
        } else {
          return "You must provide a start and end time for absolute timeframes.";
        }
      } else {
        return "You must provide a timeframe.";
      }
      return true;
    }

  }

};


Add Twitter data source to factory

Add Twitter data source to factory

--- lib/data-source/data-source-factory.js
+++ lib/data-source/data-source-factory.js
@@ -2,6 +2,7 @@
 const yamlConfig = require('node-yaml-config');
 const Todoist = require(path.resolve(__dirname, 'todoist.js'));
 const Poloniex = require(path.resolve(__dirname, 'poloniex.js'));
+const Twitter = require(path.resolve(__dirname, 'twitter.js'));

 class DataSourceFactory {

@@ -21,6 +22,9 @@
       case 'poloniex':
         dataSource = new Poloniex(config);
         break;
+      case 'twitter':
+        dataSource = new Twitter(config);
+        break;
       default:
         throw new TypeError('Invalid Data Source name');
     }

<|original_code|>
const path = require('path');
const yamlConfig = require('node-yaml-config');
const Todoist = require(path.resolve(__dirname, 'todoist.js'));
const Poloniex = require(path.resolve(__dirname, 'poloniex.js'));

class DataSourceFactory {

  /**
   *
   * @param {string} dataSourceName
   */
  static create(dataSourceName) {
    let dataSource;

    const config = yamlConfig.load(path.resolve(__dirname, '../../config/config.yaml'));

    switch (dataSourceName) {
      case 'todoist':
        dataSource = new Todoist(config);
        break;
      case 'poloniex':
        dataSource = new Poloniex(config);
        break;
      default:
        throw new TypeError('Invalid Data Source name');
    }

    return dataSource;
  }
}

module.exports = DataSourceFactory;

<|edits_diff|>
--- lib/data-source/data-source-factory.js
+++ lib/data-source/data-source-factory.js
@@ -2,6 +2,7 @@
 const yamlConfig = require('node-yaml-config');
 const Todoist = require(path.resolve(__dirname, 'todoist.js'));
 const Poloniex = require(path.resolve(__dirname, 'poloniex.js'));
+const Twitter = require(path.resolve(__dirname, 'twitter.js'));

 class DataSourceFactory {

<|current_version|>
const path = require('path');
const yamlConfig = require('node-yaml-config');
const Todoist = require(path.resolve(__dirname, 'todoist.js'));
const Poloniex = require(path.resolve(__dirname, 'poloniex.js'));
const Twitter = require(path.resolve(__dirname, 'twitter.js'));

class DataSourceFactory {

  /**
   *
   * @param {string} dataSourceName
   */
  static create(dataSourceName) {
    let dataSource;

    const config = yamlConfig.load(path.resolve(__dirname, '../../config/config.yaml'));

    switch (dataSourceName) {
      case 'todoist':
        dataSource = new Todoist(config);
        break;
      case 'poloniex':
        dataSource = new Poloniex(config);
        break;
      default:
        throw new TypeError('Invalid Data Source name');
    }

    return dataSource;
  }
}

module.exports = DataSourceFactory;

<|next_version|>
const path = require('path');
const yamlConfig = require('node-yaml-config');
const Todoist = require(path.resolve(__dirname, 'todoist.js'));
const Poloniex = require(path.resolve(__dirname, 'poloniex.js'));
const Twitter = require(path.resolve(__dirname, 'twitter.js'));

class DataSourceFactory {

  /**
   *
   * @param {string} dataSourceName
   */
  static create(dataSourceName) {
    let dataSource;

    const config = yamlConfig.load(path.resolve(__dirname, '../../config/config.yaml'));

    switch (dataSourceName) {
      case 'todoist':
        dataSource = new Todoist(config);
        break;
      case 'poloniex':
        dataSource = new Poloniex(config);
        break;
      case 'twitter':
        dataSource = new Twitter(config);
        break;
      default:
        throw new TypeError('Invalid Data Source name');
    }

    return dataSource;
  }
}

module.exports = DataSourceFactory;


Test case to verify creation of api documentation web page

--- spec/mocha-spec.js
+++ spec/mocha-spec.js
@@ -9,6 +9,7 @@

 var assert =        require('assert');
 var es =            require('event-stream');
+var fs =            require('fs');
 var File =          require('vinyl');
 var gulpNodeSlate = require('../index.js');

@@ -42,4 +43,9 @@
         pluginStream.end();
         }).timeout(60000);  //in case node-slate needs to be downloaded

+    it('creates the API documentation web page', () => {
+        var webPage = 'build/index.html';
+        assert(fs.existsSync(webPage));
+        });
+
     });

<|original_code|>
/////////////////////
// gulp-node-slate //
/////////////////////

// Run:
//  $ cd gulp-node-slate
//  $ npm update
//  $ npm run mocha

var assert =        require('assert');
var es =            require('event-stream');
var File =          require('vinyl');
var gulpNodeSlate = require('../index.js');

////////////////////////////////////////////////////////////////////////////////////////////////////
describe('The gulp-node-slate plugin', () => {

    it('is exported as a function', () => {
        var actual =   typeof gulpNodeSlate;
        var expected = 'function';
        assert.equal(actual, expected);
        });

    });

////////////////////////////////////////////////////////////////////////////////////////////////////
describe('Running the gulp-node-slate plugin', () => {

    it('passes through a file in the stream', (done) => {
        var mockFile = new File({ contents: es.readArray(['[A]', '[B]', '[C]']) });
        function handleFileFromStream(file) {
            assert(file.isStream());
            function handleDataFromFile(err, data) {
                assert.equal(data, '[A][B][C]');
                done();
                }
            file.contents.pipe(es.wait(handleDataFromFile));
            }
        var pluginStream = gulpNodeSlate();
        pluginStream.on('data', handleFileFromStream);
        pluginStream.write(mockFile);
        pluginStream.end();
        }).timeout(60000);  //in case node-slate needs to be downloaded

    });

<|edits_diff|>
--- spec/mocha-spec.js
+++ spec/mocha-spec.js
@@ -9,6 +9,7 @@

 var assert =        require('assert');
 var es =            require('event-stream');
+var fs =            require('fs');
 var File =          require('vinyl');
 var gulpNodeSlate = require('../index.js');

<|current_version|>
/////////////////////
// gulp-node-slate //
/////////////////////

// Run:
//  $ cd gulp-node-slate
//  $ npm update
//  $ npm run mocha

var assert =        require('assert');
var es =            require('event-stream');
var fs =            require('fs');
var File =          require('vinyl');
var gulpNodeSlate = require('../index.js');

////////////////////////////////////////////////////////////////////////////////////////////////////
describe('The gulp-node-slate plugin', () => {

    it('is exported as a function', () => {
        var actual =   typeof gulpNodeSlate;
        var expected = 'function';
        assert.equal(actual, expected);
        });

    });

////////////////////////////////////////////////////////////////////////////////////////////////////
describe('Running the gulp-node-slate plugin', () => {

    it('passes through a file in the stream', (done) => {
        var mockFile = new File({ contents: es.readArray(['[A]', '[B]', '[C]']) });
        function handleFileFromStream(file) {
            assert(file.isStream());
            function handleDataFromFile(err, data) {
                assert.equal(data, '[A][B][C]');
                done();
                }
            file.contents.pipe(es.wait(handleDataFromFile));
            }
        var pluginStream = gulpNodeSlate();
        pluginStream.on('data', handleFileFromStream);
        pluginStream.write(mockFile);
        pluginStream.end();
        }).timeout(60000);  //in case node-slate needs to be downloaded

    });

<|next_version|>
/////////////////////
// gulp-node-slate //
/////////////////////

// Run:
//  $ cd gulp-node-slate
//  $ npm update
//  $ npm run mocha

var assert =        require('assert');
var es =            require('event-stream');
var fs =            require('fs');
var File =          require('vinyl');
var gulpNodeSlate = require('../index.js');

////////////////////////////////////////////////////////////////////////////////////////////////////
describe('The gulp-node-slate plugin', () => {

    it('is exported as a function', () => {
        var actual =   typeof gulpNodeSlate;
        var expected = 'function';
        assert.equal(actual, expected);
        });

    });

////////////////////////////////////////////////////////////////////////////////////////////////////
describe('Running the gulp-node-slate plugin', () => {

    it('passes through a file in the stream', (done) => {
        var mockFile = new File({ contents: es.readArray(['[A]', '[B]', '[C]']) });
        function handleFileFromStream(file) {
            assert(file.isStream());
            function handleDataFromFile(err, data) {
                assert.equal(data, '[A][B][C]');
                done();
                }
            file.contents.pipe(es.wait(handleDataFromFile));
            }
        var pluginStream = gulpNodeSlate();
        pluginStream.on('data', handleFileFromStream);
        pluginStream.write(mockFile);
        pluginStream.end();
        }).timeout(60000);  //in case node-slate needs to be downloaded

    it('creates the API documentation web page', () => {
        var webPage = 'build/index.html';
        assert(fs.existsSync(webPage));
        });

    });


Add loading of main process.

Add loading of main process.

--- lib/plugin.js
+++ lib/plugin.js
@@ -1,4 +1,5 @@
 import loadPath from './loadPath';
+import app from 'app';

 export default plugin;

@@ -8,6 +9,9 @@
  * @return {Multi} The package that was requested.
  */
 function plugin(path) {
+  let pack = {};
   path = loadPath('plugin', path);
+  pack = fs.readFileSync(path);
+  app.main.webContents.executeJavaScript(pack, true);
   return require(path);
 }

<|original_code|>
import loadPath from './loadPath';

export default plugin;

/**
 * Fetch a plugin (much like "require")
 * @param {String} path - Path to plugin.
 * @return {Multi} The package that was requested.
 */
function plugin(path) {
  path = loadPath('plugin', path);
  return require(path);
}

<|edits_diff|>
--- lib/plugin.js
+++ lib/plugin.js
@@ -1,4 +1,5 @@
 import loadPath from './loadPath';
+import app from 'app';

 export default plugin;

@@ -8,6 +9,7 @@
  * @return {Multi} The package that was requested.
  */
 function plugin(path) {
+  let pack = {};
   path = loadPath('plugin', path);
   return require(path);
 }
<|current_version|>
import loadPath from './loadPath';
import app from 'app';

export default plugin;

/**
 * Fetch a plugin (much like "require")
 * @param {String} path - Path to plugin.
 * @return {Multi} The package that was requested.
 */
function plugin(path) {
  let pack = {};
  path = loadPath('plugin', path);
  return require(path);
}

<|next_version|>
import loadPath from './loadPath';
import app from 'app';

export default plugin;

/**
 * Fetch a plugin (much like "require")
 * @param {String} path - Path to plugin.
 * @return {Multi} The package that was requested.
 */
function plugin(path) {
  let pack = {};
  path = loadPath('plugin', path);
  pack = fs.readFileSync(path);
  app.main.webContents.executeJavaScript(pack, true);
  return require(path);
}


Add new eslint 1.8.0 options

Add new eslint 1.8.0 options

--- es6.js
+++ es6.js
@@ -5,10 +5,12 @@
     env: { es6: true },
     rules: {
         // ES6
+        'arrow-body-style': [2, 'as-needed'],
         'arrow-parens': 1,
         'arrow-spacing': [1, { before: true, after: true }],
         'constructor-super': 2,
         'generator-star-spacing': [1, { before: true, after: false }],
+        'no-arrow-condition': 2,
         'no-class-assign': 2,
         'no-const-assign': 2,
         'no-dupe-class-members': 2,

<|original_code|>
'use strict';

module.exports = {
    extends: 'rowno',
    env: { es6: true },
    rules: {
        // ES6
        'arrow-parens': 1,
        'arrow-spacing': [1, { before: true, after: true }],
        'constructor-super': 2,
        'generator-star-spacing': [1, { before: true, after: false }],
        'no-class-assign': 2,
        'no-const-assign': 2,
        'no-dupe-class-members': 2,
        'no-this-before-super': 2,
        'no-var': 1,
        'object-shorthand': [1, 'always'],
        'prefer-arrow-callback': 1,
        'prefer-const': 1,
        'prefer-spread': 1,
        'prefer-reflect': 1,
        'prefer-template': 1,
        'require-yield': 1,
    }
};

<|edits_diff|>
--- es6.js
+++ es6.js
@@ -5,6 +5,7 @@
     env: { es6: true },
     rules: {
         // ES6
+        'arrow-body-style': [2, 'as-needed'],
         'arrow-parens': 1,
         'arrow-spacing': [1, { before: true, after: true }],
         'constructor-super': 2,
<|current_version|>
'use strict';

module.exports = {
    extends: 'rowno',
    env: { es6: true },
    rules: {
        // ES6
        'arrow-body-style': [2, 'as-needed'],
        'arrow-parens': 1,
        'arrow-spacing': [1, { before: true, after: true }],
        'constructor-super': 2,
        'generator-star-spacing': [1, { before: true, after: false }],
        'no-class-assign': 2,
        'no-const-assign': 2,
        'no-dupe-class-members': 2,
        'no-this-before-super': 2,
        'no-var': 1,
        'object-shorthand': [1, 'always'],
        'prefer-arrow-callback': 1,
        'prefer-const': 1,
        'prefer-spread': 1,
        'prefer-reflect': 1,
        'prefer-template': 1,
        'require-yield': 1,
    }
};

<|next_version|>
'use strict';

module.exports = {
    extends: 'rowno',
    env: { es6: true },
    rules: {
        // ES6
        'arrow-body-style': [2, 'as-needed'],
        'arrow-parens': 1,
        'arrow-spacing': [1, { before: true, after: true }],
        'constructor-super': 2,
        'generator-star-spacing': [1, { before: true, after: false }],
        'no-arrow-condition': 2,
        'no-class-assign': 2,
        'no-const-assign': 2,
        'no-dupe-class-members': 2,
        'no-this-before-super': 2,
        'no-var': 1,
        'object-shorthand': [1, 'always'],
        'prefer-arrow-callback': 1,
        'prefer-const': 1,
        'prefer-spread': 1,
        'prefer-reflect': 1,
        'prefer-template': 1,
        'require-yield': 1,
    }
};


Set alias id on message, if it exists.

Set alias id on message, if it exists.

--- private/library/data/MessageComposer.js
+++ private/library/data/MessageComposer.js
@@ -2,6 +2,7 @@

 const dataHandler = require('./DataHandler');
 const eventCentral = require('../EventCentral');
+const storageManager = require('../StorageManager');

 class MessageComposer extends DataComposer {
   constructor() {
@@ -40,6 +41,11 @@
     message,
     callback,
   }) {
+    const aliasId = storageManager.getAliasId();
+    const messageToSend = message;
+
+    if (aliasId) { messageToSend.ownerAliasId = aliasId; }
+
     this.handler.createObject({
       callback,
       params: { message },

<|original_code|>
const DataComposer = require('./BaseComposer');

const dataHandler = require('./DataHandler');
const eventCentral = require('../EventCentral');

class MessageComposer extends DataComposer {
  constructor() {
    super({
      handler: dataHandler.messages,
      completionEvent: eventCentral.Events.COMPLETE_MESSAGE,
      dependencies: [
        dataHandler.messages,
        dataHandler.rooms,
        dataHandler.users,
        dataHandler.teams,
      ],
    });

    this.MessageTypes = {
      CHAT: 'chat',
      WHISPER: 'whisper',
      BROADCAST: 'broadcast',
      MESSAGE: 'message',
    };
  }

  getMessage({
    messageId,
  }) {
    const message = this.handler.getObject({ objectId: messageId });

    if (message) {
      message.creatorName = this.createCreatorName({ object: message });
    }

    return message;
  }

  sendMessage({
    message,
    callback,
  }) {
    this.handler.createObject({
      callback,
      params: { message },
    });
  }
}

const messageComposer = new MessageComposer();

module.exports = messageComposer;

<|edits_diff|>
--- private/library/data/MessageComposer.js
+++ private/library/data/MessageComposer.js
@@ -2,6 +2,7 @@

 const dataHandler = require('./DataHandler');
 const eventCentral = require('../EventCentral');
+const storageManager = require('../StorageManager');

 class MessageComposer extends DataComposer {
   constructor() {
<|current_version|>
const DataComposer = require('./BaseComposer');

const dataHandler = require('./DataHandler');
const eventCentral = require('../EventCentral');
const storageManager = require('../StorageManager');

class MessageComposer extends DataComposer {
  constructor() {
    super({
      handler: dataHandler.messages,
      completionEvent: eventCentral.Events.COMPLETE_MESSAGE,
      dependencies: [
        dataHandler.messages,
        dataHandler.rooms,
        dataHandler.users,
        dataHandler.teams,
      ],
    });

    this.MessageTypes = {
      CHAT: 'chat',
      WHISPER: 'whisper',
      BROADCAST: 'broadcast',
      MESSAGE: 'message',
    };
  }

  getMessage({
    messageId,
  }) {
    const message = this.handler.getObject({ objectId: messageId });

    if (message) {
      message.creatorName = this.createCreatorName({ object: message });
    }

    return message;
  }

  sendMessage({
    message,
    callback,
  }) {
    this.handler.createObject({
      callback,
      params: { message },
    });
  }
}

const messageComposer = new MessageComposer();

module.exports = messageComposer;

<|next_version|>
const DataComposer = require('./BaseComposer');

const dataHandler = require('./DataHandler');
const eventCentral = require('../EventCentral');
const storageManager = require('../StorageManager');

class MessageComposer extends DataComposer {
  constructor() {
    super({
      handler: dataHandler.messages,
      completionEvent: eventCentral.Events.COMPLETE_MESSAGE,
      dependencies: [
        dataHandler.messages,
        dataHandler.rooms,
        dataHandler.users,
        dataHandler.teams,
      ],
    });

    this.MessageTypes = {
      CHAT: 'chat',
      WHISPER: 'whisper',
      BROADCAST: 'broadcast',
      MESSAGE: 'message',
    };
  }

  getMessage({
    messageId,
  }) {
    const message = this.handler.getObject({ objectId: messageId });

    if (message) {
      message.creatorName = this.createCreatorName({ object: message });
    }

    return message;
  }

  sendMessage({
    message,
    callback,
  }) {
    const aliasId = storageManager.getAliasId();
    const messageToSend = message;

    if (aliasId) { messageToSend.ownerAliasId = aliasId; }

    this.handler.createObject({
      callback,
      params: { message },
    });
  }
}

const messageComposer = new MessageComposer();

module.exports = messageComposer;


Add pages state to redux store

Add pages state to redux store

--- src/reducers/index.js
+++ src/reducers/index.js
@@ -1,8 +1,10 @@
 import { combineReducers } from 'redux';
 import NavigationReducer from './NavigationReducer';
 import SyncReducer from './SyncReducer';
+import { PagesReducer } from './PagesReducer';

 export default combineReducers({
   nav: NavigationReducer,
   sync: SyncReducer,
+  pages: PagesReducer,
 });

<|original_code|>
import { combineReducers } from 'redux';
import NavigationReducer from './NavigationReducer';
import SyncReducer from './SyncReducer';

export default combineReducers({
  nav: NavigationReducer,
  sync: SyncReducer,
});

<|edits_diff|>
--- src/reducers/index.js
+++ src/reducers/index.js
@@ -1,6 +1,7 @@
 import { combineReducers } from 'redux';
 import NavigationReducer from './NavigationReducer';
 import SyncReducer from './SyncReducer';
+import { PagesReducer } from './PagesReducer';

 export default combineReducers({
   nav: NavigationReducer,
<|current_version|>
import { combineReducers } from 'redux';
import NavigationReducer from './NavigationReducer';
import SyncReducer from './SyncReducer';
import { PagesReducer } from './PagesReducer';

export default combineReducers({
  nav: NavigationReducer,
  sync: SyncReducer,
});

<|next_version|>
import { combineReducers } from 'redux';
import NavigationReducer from './NavigationReducer';
import SyncReducer from './SyncReducer';
import { PagesReducer } from './PagesReducer';

export default combineReducers({
  nav: NavigationReducer,
  sync: SyncReducer,
  pages: PagesReducer,
});


Add new state to old state

Add new state to old state

--- recipe-server/client/control/reducers/index.js
+++ recipe-server/client/control/reducers/index.js
@@ -12,6 +12,8 @@
 import notificationReducer from 'control/reducers/NotificationReducer';
 import userReducer from 'control/reducers/UserReducer';

+import newState from '../state';
+
 export default combineReducers({
   columns: columnReducer,
   controlApp: controlAppReducer,
@@ -21,4 +23,5 @@
   user: userReducer,
   recipes: recipesReducer,
   routing: routerReducer,
+  newState,
 });

<|original_code|>
import { combineReducers } from 'redux';

// routing/lib reducer imports
import { reducer as formReducer } from 'redux-form';
import { routerReducer } from 'react-router-redux';

// app reducer imports
import controlAppReducer from 'control/reducers/ControlAppReducer';
import filtersReducer from 'control/reducers/FiltersReducer';
import columnReducer from 'control/reducers/ColumnReducer';
import recipesReducer from 'control/reducers/RecipesReducer';
import notificationReducer from 'control/reducers/NotificationReducer';
import userReducer from 'control/reducers/UserReducer';

export default combineReducers({
  columns: columnReducer,
  controlApp: controlAppReducer,
  filters: filtersReducer,
  form: formReducer,
  notifications: notificationReducer,
  user: userReducer,
  recipes: recipesReducer,
  routing: routerReducer,
});

<|edits_diff|>
--- recipe-server/client/control/reducers/index.js
+++ recipe-server/client/control/reducers/index.js
@@ -12,6 +12,8 @@
 import notificationReducer from 'control/reducers/NotificationReducer';
 import userReducer from 'control/reducers/UserReducer';

+import newState from '../state';
+
 export default combineReducers({
   columns: columnReducer,
   controlApp: controlAppReducer,
<|current_version|>
import { combineReducers } from 'redux';

// routing/lib reducer imports
import { reducer as formReducer } from 'redux-form';
import { routerReducer } from 'react-router-redux';

// app reducer imports
import controlAppReducer from 'control/reducers/ControlAppReducer';
import filtersReducer from 'control/reducers/FiltersReducer';
import columnReducer from 'control/reducers/ColumnReducer';
import recipesReducer from 'control/reducers/RecipesReducer';
import notificationReducer from 'control/reducers/NotificationReducer';
import userReducer from 'control/reducers/UserReducer';

import newState from '../state';

export default combineReducers({
  columns: columnReducer,
  controlApp: controlAppReducer,
  filters: filtersReducer,
  form: formReducer,
  notifications: notificationReducer,
  user: userReducer,
  recipes: recipesReducer,
  routing: routerReducer,
});

<|next_version|>
import { combineReducers } from 'redux';

// routing/lib reducer imports
import { reducer as formReducer } from 'redux-form';
import { routerReducer } from 'react-router-redux';

// app reducer imports
import controlAppReducer from 'control/reducers/ControlAppReducer';
import filtersReducer from 'control/reducers/FiltersReducer';
import columnReducer from 'control/reducers/ColumnReducer';
import recipesReducer from 'control/reducers/RecipesReducer';
import notificationReducer from 'control/reducers/NotificationReducer';
import userReducer from 'control/reducers/UserReducer';

import newState from '../state';

export default combineReducers({
  columns: columnReducer,
  controlApp: controlAppReducer,
  filters: filtersReducer,
  form: formReducer,
  notifications: notificationReducer,
  user: userReducer,
  recipes: recipesReducer,
  routing: routerReducer,
  newState,
});


Allow WebbitSocket.on{error,close,open} to be hooked up.

--- src/main/java/org/webbitserver/easyremote/magic.js
+++ src/main/java/org/webbitserver/easyremote/magic.js
@@ -3,8 +3,15 @@
     var ws = new WebSocket('ws://' + document.location.host + path);
     ws.onclose = function() {
         target.onclose && target.onclose();
+        self.onclose && self.onclose();
+    };
+    ws.onerror = function() {
+        target.onerror && target.onerror();
+        self.onerror && self.onerror();
     };
     ws.onmessage = function(e) {
+        target.onmessage && target.onmessage(e);
+        self.onmessage && self.onmessage(e);
         var msg = JSON.parse(e.data);
         if (msg.exports) {
             msg.exports.forEach(function(name) {
@@ -17,6 +24,7 @@
                 };
             })
             target.onopen && target.onopen();
+            self.onopen && self.onopen();
         } else {
             var action = target[msg.action];
             if (typeof action === 'function') {

<|original_code|>
function WebbitSocket(path, target) {
    var self = this;
    var ws = new WebSocket('ws://' + document.location.host + path);
    ws.onclose = function() {
        target.onclose && target.onclose();
    };
    ws.onmessage = function(e) {
        var msg = JSON.parse(e.data);
        if (msg.exports) {
            msg.exports.forEach(function(name) {
                self[name] = function() {
                    var outgoing = {
                        action: name,
                        args: Array.prototype.slice.call(arguments)
                    };
                    ws.send(JSON.stringify(outgoing));
                };
            })
            target.onopen && target.onopen();
        } else {
            var action = target[msg.action];
            if (typeof action === 'function') {
                action.apply(target, msg.args);
            } else {
                // TODO: ?
            }
        }
    };
}
<|edits_diff|>
--- src/main/java/org/webbitserver/easyremote/magic.js
+++ src/main/java/org/webbitserver/easyremote/magic.js
@@ -3,8 +3,15 @@
     var ws = new WebSocket('ws://' + document.location.host + path);
     ws.onclose = function() {
         target.onclose && target.onclose();
+        self.onclose && self.onclose();
+    };
+    ws.onerror = function() {
+        target.onerror && target.onerror();
+        self.onerror && self.onerror();
     };
     ws.onmessage = function(e) {
+        target.onmessage && target.onmessage(e);
+        self.onmessage && self.onmessage(e);
         var msg = JSON.parse(e.data);
         if (msg.exports) {
             msg.exports.forEach(function(name) {
<|current_version|>
function WebbitSocket(path, target) {
    var self = this;
    var ws = new WebSocket('ws://' + document.location.host + path);
    ws.onclose = function() {
        target.onclose && target.onclose();
        self.onclose && self.onclose();
    };
    ws.onerror = function() {
        target.onerror && target.onerror();
        self.onerror && self.onerror();
    };
    ws.onmessage = function(e) {
        target.onmessage && target.onmessage(e);
        self.onmessage && self.onmessage(e);
        var msg = JSON.parse(e.data);
        if (msg.exports) {
            msg.exports.forEach(function(name) {
                self[name] = function() {
                    var outgoing = {
                        action: name,
                        args: Array.prototype.slice.call(arguments)
                    };
                    ws.send(JSON.stringify(outgoing));
                };
            })
            target.onopen && target.onopen();
        } else {
            var action = target[msg.action];
            if (typeof action === 'function') {
                action.apply(target, msg.args);
            } else {
                // TODO: ?
            }
        }
    };
}
<|next_version|>
function WebbitSocket(path, target) {
    var self = this;
    var ws = new WebSocket('ws://' + document.location.host + path);
    ws.onclose = function() {
        target.onclose && target.onclose();
        self.onclose && self.onclose();
    };
    ws.onerror = function() {
        target.onerror && target.onerror();
        self.onerror && self.onerror();
    };
    ws.onmessage = function(e) {
        target.onmessage && target.onmessage(e);
        self.onmessage && self.onmessage(e);
        var msg = JSON.parse(e.data);
        if (msg.exports) {
            msg.exports.forEach(function(name) {
                self[name] = function() {
                    var outgoing = {
                        action: name,
                        args: Array.prototype.slice.call(arguments)
                    };
                    ws.send(JSON.stringify(outgoing));
                };
            })
            target.onopen && target.onopen();
            self.onopen && self.onopen();
        } else {
            var action = target[msg.action];
            if (typeof action === 'function') {
                action.apply(target, msg.args);
            } else {
                // TODO: ?
            }
        }
    };
}


Add --enable-logging that enables logging

--- application.js
+++ application.js
@@ -12,6 +12,7 @@
   .option('--port <port>', 'Port number', Number, 13000)
   .option('--droonga-engine-port <port>', 'Port number of Droonga engine',
           Number, 24224)
+  .option('--enable-logging', 'Enable logging to the standard output')
   .parse(process.argv);

 var application = express();
@@ -20,6 +21,9 @@
 var MemoryStore = express.session.MemoryStore;
 var sessionStore = new MemoryStore();
 application.configure(function() {
+  if (options.enableLogging) {
+    application.use(express.logger());
+  }
   application.use(express.cookieParser('secret key'));
   application.use(express.session({
     secret: 'secret key',

<|original_code|>
#!/usr/bin/env node

var express = require('express'),
    droonga = require('./index'),
    http = require('http'),
    options = require('commander');

var version = require('./package.json').version;

options
  .version(version)
  .option('--port <port>', 'Port number', Number, 13000)
  .option('--droonga-engine-port <port>', 'Port number of Droonga engine',
          Number, 24224)
  .parse(process.argv);

var application = express();
var server = http.createServer(application);

var MemoryStore = express.session.MemoryStore;
var sessionStore = new MemoryStore();
application.configure(function() {
  application.use(express.cookieParser('secret key'));
  application.use(express.session({
    secret: 'secret key',
    store:  sessionStore
  }));
});

application.droonga({
  prefix: '',
  defaultDataset: 'Droonga',
  server: server,
  sessionStore: sessionStore, // this is required to share session information by socket.io and HTTP APIs
  port: options.droongaEnginePort,
  plugins: [
    droonga.API_REST,
    droonga.API_SOCKET_IO,
    droonga.API_GROONGA,
    droonga.API_DROONGA
  ]
});

server.listen(options.port);

<|edits_diff|>
--- application.js
+++ application.js
@@ -12,6 +12,7 @@
   .option('--port <port>', 'Port number', Number, 13000)
   .option('--droonga-engine-port <port>', 'Port number of Droonga engine',
           Number, 24224)
+  .option('--enable-logging', 'Enable logging to the standard output')
   .parse(process.argv);

 var application = express();
<|current_version|>
#!/usr/bin/env node

var express = require('express'),
    droonga = require('./index'),
    http = require('http'),
    options = require('commander');

var version = require('./package.json').version;

options
  .version(version)
  .option('--port <port>', 'Port number', Number, 13000)
  .option('--droonga-engine-port <port>', 'Port number of Droonga engine',
          Number, 24224)
  .option('--enable-logging', 'Enable logging to the standard output')
  .parse(process.argv);

var application = express();
var server = http.createServer(application);

var MemoryStore = express.session.MemoryStore;
var sessionStore = new MemoryStore();
application.configure(function() {
  application.use(express.cookieParser('secret key'));
  application.use(express.session({
    secret: 'secret key',
    store:  sessionStore
  }));
});

application.droonga({
  prefix: '',
  defaultDataset: 'Droonga',
  server: server,
  sessionStore: sessionStore, // this is required to share session information by socket.io and HTTP APIs
  port: options.droongaEnginePort,
  plugins: [
    droonga.API_REST,
    droonga.API_SOCKET_IO,
    droonga.API_GROONGA,
    droonga.API_DROONGA
  ]
});

server.listen(options.port);

<|next_version|>
#!/usr/bin/env node

var express = require('express'),
    droonga = require('./index'),
    http = require('http'),
    options = require('commander');

var version = require('./package.json').version;

options
  .version(version)
  .option('--port <port>', 'Port number', Number, 13000)
  .option('--droonga-engine-port <port>', 'Port number of Droonga engine',
          Number, 24224)
  .option('--enable-logging', 'Enable logging to the standard output')
  .parse(process.argv);

var application = express();
var server = http.createServer(application);

var MemoryStore = express.session.MemoryStore;
var sessionStore = new MemoryStore();
application.configure(function() {
  if (options.enableLogging) {
    application.use(express.logger());
  }
  application.use(express.cookieParser('secret key'));
  application.use(express.session({
    secret: 'secret key',
    store:  sessionStore
  }));
});

application.droonga({
  prefix: '',
  defaultDataset: 'Droonga',
  server: server,
  sessionStore: sessionStore, // this is required to share session information by socket.io and HTTP APIs
  port: options.droongaEnginePort,
  plugins: [
    droonga.API_REST,
    droonga.API_SOCKET_IO,
    droonga.API_GROONGA,
    droonga.API_DROONGA
  ]
});

server.listen(options.port);


Bring back PetitionResponse to petition detail page

--- src/components/Petition/index.js
+++ src/components/Petition/index.js
@@ -7,6 +7,7 @@

 import PetitionHeader from 'containers/PetitionHeader';
 import PetitionBody from 'containers/PetitionBody';
+import PetitionResponse from 'containers/PetitionResponse';
 import PetitionSidebar from 'containers/PetitionSidebar';

 const Petition = ({ preview }) => (
@@ -20,6 +21,7 @@
       <LayoutWrap>
         <LayoutContent>
           <PetitionBody />
+          <PetitionResponse />
         </LayoutContent>
         <LayoutSidebar>
           <PetitionSidebar />

<|original_code|>
import React from 'react';
import LayoutWrap from 'components/LayoutWrap';
import LayoutContent from 'components/LayoutContent';
import LayoutSidebar from 'components/LayoutSidebar';
import Container from 'components/Container';
import Section from 'components/Section';

import PetitionHeader from 'containers/PetitionHeader';
import PetitionBody from 'containers/PetitionBody';
import PetitionSidebar from 'containers/PetitionSidebar';

const Petition = ({ preview }) => (

      <Container>
        <PetitionHeader />
      </Container>

    <Container>
      <LayoutWrap>
        <LayoutContent>
          <PetitionBody />
        </LayoutContent>
        <LayoutSidebar>
          <PetitionSidebar />
        </LayoutSidebar>
      </LayoutWrap>
    </Container>

);

export default Petition;

<|edits_diff|>
--- src/components/Petition/index.js
+++ src/components/Petition/index.js
@@ -7,6 +7,7 @@

 import PetitionHeader from 'containers/PetitionHeader';
 import PetitionBody from 'containers/PetitionBody';
+import PetitionResponse from 'containers/PetitionResponse';
 import PetitionSidebar from 'containers/PetitionSidebar';

 const Petition = ({ preview }) => (
<|current_version|>
import React from 'react';
import LayoutWrap from 'components/LayoutWrap';
import LayoutContent from 'components/LayoutContent';
import LayoutSidebar from 'components/LayoutSidebar';
import Container from 'components/Container';
import Section from 'components/Section';

import PetitionHeader from 'containers/PetitionHeader';
import PetitionBody from 'containers/PetitionBody';
import PetitionResponse from 'containers/PetitionResponse';
import PetitionSidebar from 'containers/PetitionSidebar';

const Petition = ({ preview }) => (

      <Container>
        <PetitionHeader />
      </Container>

    <Container>
      <LayoutWrap>
        <LayoutContent>
          <PetitionBody />
        </LayoutContent>
        <LayoutSidebar>
          <PetitionSidebar />
        </LayoutSidebar>
      </LayoutWrap>
    </Container>

);

export default Petition;

<|next_version|>
import React from 'react';
import LayoutWrap from 'components/LayoutWrap';
import LayoutContent from 'components/LayoutContent';
import LayoutSidebar from 'components/LayoutSidebar';
import Container from 'components/Container';
import Section from 'components/Section';

import PetitionHeader from 'containers/PetitionHeader';
import PetitionBody from 'containers/PetitionBody';
import PetitionResponse from 'containers/PetitionResponse';
import PetitionSidebar from 'containers/PetitionSidebar';

const Petition = ({ preview }) => (

      <Container>
        <PetitionHeader />
      </Container>

    <Container>
      <LayoutWrap>
        <LayoutContent>
          <PetitionBody />
          <PetitionResponse />
        </LayoutContent>
        <LayoutSidebar>
          <PetitionSidebar />
        </LayoutSidebar>
      </LayoutWrap>
    </Container>

);

export default Petition;


Fix Boolean field - show notes

Fix Boolean field - show notes

--- fields/types/boolean/BooleanField.js
+++ fields/types/boolean/BooleanField.js
@@ -27,6 +27,7 @@
 						<input type='checkbox' name={this.props.path} id={this.props.path} value='true' checked={this.props.value} onChange={this.valueChanged} />
 						{this.props.label}

+					{this.renderNote()}

 			);
 		} else {
@@ -36,6 +37,7 @@

 					{this.props.label}
+
{this.renderNote()}

 			);
 		}

<|original_code|>
var React = require('react'),
	Field = require('../Field');

module.exports = Field.create({

	displayName: 'BooleanField',

	valueChanged: function(event) {
		this.props.onChange({
			path: this.props.path,
			value: event.target.checked
		});
	},

	renderUI: function() {

		var input, fieldClassName = 'field-ui';

		if (this.props.indent) {
			fieldClassName += ' field-indented';
		}

		if (this.shouldRenderField()) {
			input = (

						<input type='checkbox' name={this.props.path} id={this.props.path} value='true' checked={this.props.value} onChange={this.valueChanged} />
						{this.props.label}

			);
		} else {
			var state = this.props.value ? 'checked' : 'unchecked';
			var imgSrc = '/keystone/images/icons/16/checkbox-' + state + '.png';
			input = (

					{this.props.label}

			);
		}

		return
{input}
;
	}

});

<|edits_diff|>
--- fields/types/boolean/BooleanField.js
+++ fields/types/boolean/BooleanField.js
@@ -27,6 +27,7 @@
 						<input type='checkbox' name={this.props.path} id={this.props.path} value='true' checked={this.props.value} onChange={this.valueChanged} />
 						{this.props.label}

+					{this.renderNote()}

 			);
 		} else {
<|current_version|>
var React = require('react'),
	Field = require('../Field');

module.exports = Field.create({

	displayName: 'BooleanField',

	valueChanged: function(event) {
		this.props.onChange({
			path: this.props.path,
			value: event.target.checked
		});
	},

	renderUI: function() {

		var input, fieldClassName = 'field-ui';

		if (this.props.indent) {
			fieldClassName += ' field-indented';
		}

		if (this.shouldRenderField()) {
			input = (

						<input type='checkbox' name={this.props.path} id={this.props.path} value='true' checked={this.props.value} onChange={this.valueChanged} />
						{this.props.label}

					{this.renderNote()}

			);
		} else {
			var state = this.props.value ? 'checked' : 'unchecked';
			var imgSrc = '/keystone/images/icons/16/checkbox-' + state + '.png';
			input = (

					{this.props.label}

			);
		}

		return
{input}
;
	}

});

<|next_version|>
var React = require('react'),
	Field = require('../Field');

module.exports = Field.create({

	displayName: 'BooleanField',

	valueChanged: function(event) {
		this.props.onChange({
			path: this.props.path,
			value: event.target.checked
		});
	},

	renderUI: function() {

		var input, fieldClassName = 'field-ui';

		if (this.props.indent) {
			fieldClassName += ' field-indented';
		}

		if (this.shouldRenderField()) {
			input = (

						<input type='checkbox' name={this.props.path} id={this.props.path} value='true' checked={this.props.value} onChange={this.valueChanged} />
						{this.props.label}

					{this.renderNote()}

			);
		} else {
			var state = this.props.value ? 'checked' : 'unchecked';
			var imgSrc = '/keystone/images/icons/16/checkbox-' + state + '.png';
			input = (

					{this.props.label}

{this.renderNote()}

			);
		}

		return
{input}
;
	}

});


Set status button in serial no

Set status button in serial no

--- erpnext/stock/doctype/serial_no/serial_no.js
+++ erpnext/stock/doctype/serial_no/serial_no.js
@@ -17,4 +17,12 @@

 frappe.ui.form.on("Serial No", "refresh", function(frm) {
 	frm.toggle_enable("item_code", frm.doc.__islocal);
+
+	if(frm.doc.status == "Sales Returned" && frm.doc.warehouse)
+		cur_frm.add_custom_button(__('Set Status as Available'), cur_frm.cscript.set_status_as_available);
 });
+
+cur_frm.cscript.set_status_as_available = function() {
+	cur_frm.set_value("status", "Available");
+	cur_frm.save()
+}

<|original_code|>
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

cur_frm.add_fetch("customer", "customer_name", "customer_name")
cur_frm.add_fetch("supplier", "supplier_name", "supplier_name")

cur_frm.add_fetch("item_code", "item_name", "item_name")
cur_frm.add_fetch("item_code", "description", "description")
cur_frm.add_fetch("item_code", "item_group", "item_group")
cur_frm.add_fetch("item_code", "brand", "brand")

cur_frm.cscript.onload = function() {
	cur_frm.set_query("item_code", function() {
		return erpnext.queries.item({"is_stock_item": "Yes", "has_serial_no": "Yes"})
	});
};

frappe.ui.form.on("Serial No", "refresh", function(frm) {
	frm.toggle_enable("item_code", frm.doc.__islocal);
});

<|edits_diff|>
--- erpnext/stock/doctype/serial_no/serial_no.js
+++ erpnext/stock/doctype/serial_no/serial_no.js
@@ -17,4 +17,7 @@

 frappe.ui.form.on("Serial No", "refresh", function(frm) {
 	frm.toggle_enable("item_code", frm.doc.__islocal);
+
+	if(frm.doc.status == "Sales Returned" && frm.doc.warehouse)
+		cur_frm.add_custom_button(__('Set Status as Available'), cur_frm.cscript.set_status_as_available);
 });
<|current_version|>
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

cur_frm.add_fetch("customer", "customer_name", "customer_name")
cur_frm.add_fetch("supplier", "supplier_name", "supplier_name")

cur_frm.add_fetch("item_code", "item_name", "item_name")
cur_frm.add_fetch("item_code", "description", "description")
cur_frm.add_fetch("item_code", "item_group", "item_group")
cur_frm.add_fetch("item_code", "brand", "brand")

cur_frm.cscript.onload = function() {
	cur_frm.set_query("item_code", function() {
		return erpnext.queries.item({"is_stock_item": "Yes", "has_serial_no": "Yes"})
	});
};

frappe.ui.form.on("Serial No", "refresh", function(frm) {
	frm.toggle_enable("item_code", frm.doc.__islocal);

	if(frm.doc.status == "Sales Returned" && frm.doc.warehouse)
		cur_frm.add_custom_button(__('Set Status as Available'), cur_frm.cscript.set_status_as_available);
});

<|next_version|>
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

cur_frm.add_fetch("customer", "customer_name", "customer_name")
cur_frm.add_fetch("supplier", "supplier_name", "supplier_name")

cur_frm.add_fetch("item_code", "item_name", "item_name")
cur_frm.add_fetch("item_code", "description", "description")
cur_frm.add_fetch("item_code", "item_group", "item_group")
cur_frm.add_fetch("item_code", "brand", "brand")

cur_frm.cscript.onload = function() {
	cur_frm.set_query("item_code", function() {
		return erpnext.queries.item({"is_stock_item": "Yes", "has_serial_no": "Yes"})
	});
};

frappe.ui.form.on("Serial No", "refresh", function(frm) {
	frm.toggle_enable("item_code", frm.doc.__islocal);

	if(frm.doc.status == "Sales Returned" && frm.doc.warehouse)
		cur_frm.add_custom_button(__('Set Status as Available'), cur_frm.cscript.set_status_as_available);
});

cur_frm.cscript.set_status_as_available = function() {
	cur_frm.set_value("status", "Available");
	cur_frm.save()
}


Add suppliers feature TO SQUASH

Add suppliers feature TO SQUASH

--- src/redux/modules/reducer.js
+++ src/redux/modules/reducer.js
@@ -10,6 +10,7 @@
 import completeInvitationReducer from './invitations/complete';
 import invitationsReducer from './invitations/list';
 import groupsReducer from './groups/groups';
+import suppliersReducer from './suppliers/list';
 import {reducer as form} from 'redux-form';
 import info from './info';
 import widgets from './widgets';
@@ -25,6 +26,7 @@
   membershipsReducer,
   usersReducer,
   groupsReducer,
+  suppliersReducer,
   invitationsReducer,
   bulkInvitationsReducer,
   completeInvitationReducer,

<|original_code|>
/* eslint no-debugger: 0 */
import { combineReducers } from 'redux';

import auth from './auth';
import signupCreateReducer from './signup/create';
import signupCompleteReducer from './signup/complete';
import membershipsReducer from './groups/memberships';
import usersReducer from './users/users';
import bulkInvitationsReducer from './invitations/bulk';
import completeInvitationReducer from './invitations/complete';
import invitationsReducer from './invitations/list';
import groupsReducer from './groups/groups';
import {reducer as form} from 'redux-form';
import info from './info';
import widgets from './widgets';
import { routeReducer } from 'react-router-redux';
import {reducer as reduxAsyncConnect} from 'redux-async-connect';

export default combineReducers({
  routing: routeReducer,
  reduxAsyncConnect,
  auth,
  signupCreateReducer,
  signupCompleteReducer,
  membershipsReducer,
  usersReducer,
  groupsReducer,
  invitationsReducer,
  bulkInvitationsReducer,
  completeInvitationReducer,
  form,
  info,
  widgets
});

<|edits_diff|>
--- src/redux/modules/reducer.js
+++ src/redux/modules/reducer.js
@@ -10,6 +10,7 @@
 import completeInvitationReducer from './invitations/complete';
 import invitationsReducer from './invitations/list';
 import groupsReducer from './groups/groups';
+import suppliersReducer from './suppliers/list';
 import {reducer as form} from 'redux-form';
 import info from './info';
 import widgets from './widgets';
<|current_version|>
/* eslint no-debugger: 0 */
import { combineReducers } from 'redux';

import auth from './auth';
import signupCreateReducer from './signup/create';
import signupCompleteReducer from './signup/complete';
import membershipsReducer from './groups/memberships';
import usersReducer from './users/users';
import bulkInvitationsReducer from './invitations/bulk';
import completeInvitationReducer from './invitations/complete';
import invitationsReducer from './invitations/list';
import groupsReducer from './groups/groups';
import suppliersReducer from './suppliers/list';
import {reducer as form} from 'redux-form';
import info from './info';
import widgets from './widgets';
import { routeReducer } from 'react-router-redux';
import {reducer as reduxAsyncConnect} from 'redux-async-connect';

export default combineReducers({
  routing: routeReducer,
  reduxAsyncConnect,
  auth,
  signupCreateReducer,
  signupCompleteReducer,
  membershipsReducer,
  usersReducer,
  groupsReducer,
  invitationsReducer,
  bulkInvitationsReducer,
  completeInvitationReducer,
  form,
  info,
  widgets
});

<|next_version|>
/* eslint no-debugger: 0 */
import { combineReducers } from 'redux';

import auth from './auth';
import signupCreateReducer from './signup/create';
import signupCompleteReducer from './signup/complete';
import membershipsReducer from './groups/memberships';
import usersReducer from './users/users';
import bulkInvitationsReducer from './invitations/bulk';
import completeInvitationReducer from './invitations/complete';
import invitationsReducer from './invitations/list';
import groupsReducer from './groups/groups';
import suppliersReducer from './suppliers/list';
import {reducer as form} from 'redux-form';
import info from './info';
import widgets from './widgets';
import { routeReducer } from 'react-router-redux';
import {reducer as reduxAsyncConnect} from 'redux-async-connect';

export default combineReducers({
  routing: routeReducer,
  reduxAsyncConnect,
  auth,
  signupCreateReducer,
  signupCompleteReducer,
  membershipsReducer,
  usersReducer,
  groupsReducer,
  suppliersReducer,
  invitationsReducer,
  bulkInvitationsReducer,
  completeInvitationReducer,
  form,
  info,
  widgets
});


Enable domain config only for sqlserver

Enable domain config only for sqlserver

--- src/db/clients/index.js
+++ src/db/clients/index.js
@@ -14,6 +14,7 @@
     defaultPort: 3306,
     disabledFeatures: [
       'server:schema',
+      'server:domain',
     ],
   },
   {
@@ -21,6 +22,9 @@
     name: 'PostgreSQL',
     defaultDatabase: 'postgres',
     defaultPort: 5432,
+    disabledFeatures: [
+      'server:domain',
+    ],
   },
   {
     key: 'sqlserver',
@@ -37,6 +41,7 @@
       'server:user',
       'server:password',
       'server:schema',
+      'server:domain',
       'scriptCreateTable',
       'cancelQuery',
     ],

<|original_code|>
import mysql from './mysql';
import postgresql from './postgresql';
import sqlserver from './sqlserver';
import cassandra from './cassandra';

/**
 * List of supported database clients
 */
export const CLIENTS = [
  {
    key: 'mysql',
    name: 'MySQL',
    defaultPort: 3306,
    disabledFeatures: [
      'server:schema',
    ],
  },
  {
    key: 'postgresql',
    name: 'PostgreSQL',
    defaultDatabase: 'postgres',
    defaultPort: 5432,
  },
  {
    key: 'sqlserver',
    name: 'Microsoft SQL Server',
    defaultPort: 1433,
  },
  {
    key: 'cassandra',
    name: 'Cassandra',
    defaultPort: 9042,
    disabledFeatures: [
      'server:ssl',
      'server:socketPath',
      'server:user',
      'server:password',
      'server:schema',
      'scriptCreateTable',
      'cancelQuery',
    ],
  },
];

export default {
  mysql,
  postgresql,
  sqlserver,
  cassandra,
};

<|edits_diff|>
--- src/db/clients/index.js
+++ src/db/clients/index.js
@@ -14,6 +14,7 @@
     defaultPort: 3306,
     disabledFeatures: [
       'server:schema',
+      'server:domain',
     ],
   },
   {
@@ -21,6 +22,9 @@
     name: 'PostgreSQL',
     defaultDatabase: 'postgres',
     defaultPort: 5432,
+    disabledFeatures: [
+      'server:domain',
+    ],
   },
   {
     key: 'sqlserver',
<|current_version|>
import mysql from './mysql';
import postgresql from './postgresql';
import sqlserver from './sqlserver';
import cassandra from './cassandra';

/**
 * List of supported database clients
 */
export const CLIENTS = [
  {
    key: 'mysql',
    name: 'MySQL',
    defaultPort: 3306,
    disabledFeatures: [
      'server:schema',
      'server:domain',
    ],
  },
  {
    key: 'postgresql',
    name: 'PostgreSQL',
    defaultDatabase: 'postgres',
    defaultPort: 5432,
    disabledFeatures: [
      'server:domain',
    ],
  },
  {
    key: 'sqlserver',
    name: 'Microsoft SQL Server',
    defaultPort: 1433,
  },
  {
    key: 'cassandra',
    name: 'Cassandra',
    defaultPort: 9042,
    disabledFeatures: [
      'server:ssl',
      'server:socketPath',
      'server:user',
      'server:password',
      'server:schema',
      'scriptCreateTable',
      'cancelQuery',
    ],
  },
];

export default {
  mysql,
  postgresql,
  sqlserver,
  cassandra,
};

<|next_version|>
import mysql from './mysql';
import postgresql from './postgresql';
import sqlserver from './sqlserver';
import cassandra from './cassandra';

/**
 * List of supported database clients
 */
export const CLIENTS = [
  {
    key: 'mysql',
    name: 'MySQL',
    defaultPort: 3306,
    disabledFeatures: [
      'server:schema',
      'server:domain',
    ],
  },
  {
    key: 'postgresql',
    name: 'PostgreSQL',
    defaultDatabase: 'postgres',
    defaultPort: 5432,
    disabledFeatures: [
      'server:domain',
    ],
  },
  {
    key: 'sqlserver',
    name: 'Microsoft SQL Server',
    defaultPort: 1433,
  },
  {
    key: 'cassandra',
    name: 'Cassandra',
    defaultPort: 9042,
    disabledFeatures: [
      'server:ssl',
      'server:socketPath',
      'server:user',
      'server:password',
      'server:schema',
      'server:domain',
      'scriptCreateTable',
      'cancelQuery',
    ],
  },
];

export default {
  mysql,
  postgresql,
  sqlserver,
  cassandra,
};


Replace babel promise with bluebird promises

--- index.js
+++ index.js
@@ -13,8 +13,12 @@
     require('./configuration/webpack.dev.js')
 }

+// Ensure we're using the server babel settings
+process.env.BABEL_ENV = 'server';
+
 require('isomorphic-fetch')
 require('babel-register')
+require('babel-runtime/core-js/promise').default = require('bluebird')
 require('./src/shared/polyfills')
 require('./src/server/server')

<|original_code|>
/**
 * Bootstrap our server
 */
const sourceMaps = require('source-map-support')
sourceMaps.install()

require('./src/shared/console')

// Compile files on PROD or launch DEV server
if (process.env.NODE_ENV === 'production') {
    require('./configuration/webpack.prod.js')
} else {
    require('./configuration/webpack.dev.js')
}

require('isomorphic-fetch')
require('babel-register')
require('./src/shared/polyfills')
require('./src/server/server')

process.on('unhandledRejection', console.error.bind(console))

<|edits_diff|>
--- index.js
+++ index.js
@@ -13,6 +13,9 @@
     require('./configuration/webpack.dev.js')
 }

+// Ensure we're using the server babel settings
+process.env.BABEL_ENV = 'server';
+
 require('isomorphic-fetch')
 require('babel-register')
 require('./src/shared/polyfills')
<|current_version|>
/**
 * Bootstrap our server
 */
const sourceMaps = require('source-map-support')
sourceMaps.install()

require('./src/shared/console')

// Compile files on PROD or launch DEV server
if (process.env.NODE_ENV === 'production') {
    require('./configuration/webpack.prod.js')
} else {
    require('./configuration/webpack.dev.js')
}

// Ensure we're using the server babel settings
process.env.BABEL_ENV = 'server';

require('isomorphic-fetch')
require('babel-register')
require('./src/shared/polyfills')
require('./src/server/server')

process.on('unhandledRejection', console.error.bind(console))

<|next_version|>
/**
 * Bootstrap our server
 */
const sourceMaps = require('source-map-support')
sourceMaps.install()

require('./src/shared/console')

// Compile files on PROD or launch DEV server
if (process.env.NODE_ENV === 'production') {
    require('./configuration/webpack.prod.js')
} else {
    require('./configuration/webpack.dev.js')
}

// Ensure we're using the server babel settings
process.env.BABEL_ENV = 'server';

require('isomorphic-fetch')
require('babel-register')
require('babel-runtime/core-js/promise').default = require('bluebird')
require('./src/shared/polyfills')
require('./src/server/server')

process.on('unhandledRejection', console.error.bind(console))


Set an API load every hour as a scheduled job

--- app.js
+++ app.js
@@ -7,6 +7,8 @@
 var methodOverride  = require('method-override');
 var compress        = require('compression');
 var multipart       = require('connect-multiparty');
+var schedule        = require('node-schedule');
+var feed            = require('./app/controllers/feed');
 var app             = express();

 // Configuration
@@ -23,4 +25,9 @@
 // Routes
 require('./app/routes')(app);

+// Schedule
+schedule.scheduleJob('0 * * * *', function(){
+  feed.API.load( { verbose: true } );
+});
+
 module.exports = app;

<|original_code|>
'use strict';

// Dependencies
var config          = require('./config');
var express         = require('express');
var bodyParser      = require('body-parser');
var methodOverride  = require('method-override');
var compress        = require('compression');
var multipart       = require('connect-multiparty');
var app             = express();

// Configuration
app.enable('trust proxy');
app.set('port', config.app.settings.port);
app.set('views', __dirname + '/app/views');
app.set('view engine', 'jade');
app.use(compress());
app.use(bodyParser.json({ limit: '128kb'}));
app.use(multipart());
app.use(express.static('public'));
app.use(methodOverride());

// Routes
require('./app/routes')(app);

module.exports = app;
<|edits_diff|>
--- app.js
+++ app.js
@@ -7,6 +7,8 @@
 var methodOverride  = require('method-override');
 var compress        = require('compression');
 var multipart       = require('connect-multiparty');
+var schedule        = require('node-schedule');
+var feed            = require('./app/controllers/feed');
 var app             = express();

 // Configuration
<|current_version|>
'use strict';

// Dependencies
var config          = require('./config');
var express         = require('express');
var bodyParser      = require('body-parser');
var methodOverride  = require('method-override');
var compress        = require('compression');
var multipart       = require('connect-multiparty');
var schedule        = require('node-schedule');
var feed            = require('./app/controllers/feed');
var app             = express();

// Configuration
app.enable('trust proxy');
app.set('port', config.app.settings.port);
app.set('views', __dirname + '/app/views');
app.set('view engine', 'jade');
app.use(compress());
app.use(bodyParser.json({ limit: '128kb'}));
app.use(multipart());
app.use(express.static('public'));
app.use(methodOverride());

// Routes
require('./app/routes')(app);

module.exports = app;
<|next_version|>
'use strict';

// Dependencies
var config          = require('./config');
var express         = require('express');
var bodyParser      = require('body-parser');
var methodOverride  = require('method-override');
var compress        = require('compression');
var multipart       = require('connect-multiparty');
var schedule        = require('node-schedule');
var feed            = require('./app/controllers/feed');
var app             = express();

// Configuration
app.enable('trust proxy');
app.set('port', config.app.settings.port);
app.set('views', __dirname + '/app/views');
app.set('view engine', 'jade');
app.use(compress());
app.use(bodyParser.json({ limit: '128kb'}));
app.use(multipart());
app.use(express.static('public'));
app.use(methodOverride());

// Routes
require('./app/routes')(app);

// Schedule
schedule.scheduleJob('0 * * * *', function(){
  feed.API.load( { verbose: true } );
});

module.exports = app;


Add some logging to the phantom skipper

Add some logging to the phantom skipper

--- tests/phantom-runner.js
+++ tests/phantom-runner.js
@@ -13,7 +13,9 @@
 };
 // The magic!
 page.onResourceRequested = function(requestData, networkRequest) {
+  console.log("a request!");
   if (requestData.url.match('fonts.googleapis.com')) {
+    console.log("skipping " + requestData);
     networkRequest.abort();
   }
 };

<|original_code|>
/*eslint-env node*/
// Borrowed from https://github.com/ember-cli/ember-cli/issues/3894#issuecomment-212946925
// Custom version of the Testem PhantomJS runner.
//   This exists to block requests to fonts.googleapis.com because this can cause
//     Phantom to incompletely load JS files causing bizarre syntax errors.
//   See https://github.com/ariya/phantomjs/issues/14173.
var system = require('system');
var page = require('webpage').create();
var url = system.args[1];
page.viewportSize = {
  width: 1024,
  height: 768
};
// The magic!
page.onResourceRequested = function(requestData, networkRequest) {
  if (requestData.url.match('fonts.googleapis.com')) {
    networkRequest.abort();
  }
};
page.open(url);

<|edits_diff|>
--- tests/phantom-runner.js
+++ tests/phantom-runner.js
@@ -13,6 +13,7 @@
 };
 // The magic!
 page.onResourceRequested = function(requestData, networkRequest) {
+  console.log("a request!");
   if (requestData.url.match('fonts.googleapis.com')) {
     networkRequest.abort();
   }
<|current_version|>
/*eslint-env node*/
// Borrowed from https://github.com/ember-cli/ember-cli/issues/3894#issuecomment-212946925
// Custom version of the Testem PhantomJS runner.
//   This exists to block requests to fonts.googleapis.com because this can cause
//     Phantom to incompletely load JS files causing bizarre syntax errors.
//   See https://github.com/ariya/phantomjs/issues/14173.
var system = require('system');
var page = require('webpage').create();
var url = system.args[1];
page.viewportSize = {
  width: 1024,
  height: 768
};
// The magic!
page.onResourceRequested = function(requestData, networkRequest) {
  console.log("a request!");
  if (requestData.url.match('fonts.googleapis.com')) {
    networkRequest.abort();
  }
};
page.open(url);

<|next_version|>
/*eslint-env node*/
// Borrowed from https://github.com/ember-cli/ember-cli/issues/3894#issuecomment-212946925
// Custom version of the Testem PhantomJS runner.
//   This exists to block requests to fonts.googleapis.com because this can cause
//     Phantom to incompletely load JS files causing bizarre syntax errors.
//   See https://github.com/ariya/phantomjs/issues/14173.
var system = require('system');
var page = require('webpage').create();
var url = system.args[1];
page.viewportSize = {
  width: 1024,
  height: 768
};
// The magic!
page.onResourceRequested = function(requestData, networkRequest) {
  console.log("a request!");
  if (requestData.url.match('fonts.googleapis.com')) {
    console.log("skipping " + requestData);
    networkRequest.abort();
  }
};
page.open(url);


Load conda tab at startup if url points there

--- nb_conda/nbextension/static/tree.js
+++ nb_conda/nbextension/static/tree.js
@@ -23,6 +23,7 @@
                     $('<li>')
                     .append(
                         $('<a>')
+                        .attr('id', 'conda_tab')
                         .attr('href', '#conda')
                         .attr('data-toggle', 'tab')
                         .text('Conda')
@@ -42,6 +43,10 @@
                 models.environments.view = views.EnvView;
                 models.available.view = views.AvailView;
                 models.installed.view = views.InstalledView;
+
+                if(window.location.hash === '#conda') {
+                    $('#conda_tab').click();
+                }
             }
         });
     }

<|original_code|>
define(function(require) {
    var $ = require('jquery');
    var IPython = require('base/js/namespace');
    var models = require('./models');
    var views = require('./views');

    function load() {
        if (!IPython.notebook_list) return;
        var base_url = IPython.notebook_list.base_url;
        $('head').append(
            $('<link>')
            .attr('rel', 'stylesheet')
            .attr('type', 'text/css')
            .attr('href', base_url + 'nbextensions/nb_conda/conda.css')
        );

        $.ajax(base_url + 'nbextensions/nb_conda/tab.html', {
            dataType: 'html',
            success: function(env_html, status, xhr) {
                // Configure Conda tab
                $(".tab-content").append($(env_html));
                $("#tabs").append(
                    $('<li>')
                    .append(
                        $('<a>')
                        .attr('href', '#conda')
                        .attr('data-toggle', 'tab')
                        .text('Conda')
                        .click(function (e) {
                            window.history.pushState(null, null, '#conda');

                            models.environments.load();
                            models.available.load();
                        })
                    )
                );

                views.EnvView.init();
                views.AvailView.init();
                views.InstalledView.init();

                models.environments.view = views.EnvView;
                models.available.view = views.AvailView;
                models.installed.view = views.InstalledView;
            }
        });
    }
    return {
        load_ipython_extension: load
    };
});

<|edits_diff|>
--- nb_conda/nbextension/static/tree.js
+++ nb_conda/nbextension/static/tree.js
@@ -23,6 +23,7 @@
                     $('<li>')
                     .append(
                         $('<a>')
+                        .attr('id', 'conda_tab')
                         .attr('href', '#conda')
                         .attr('data-toggle', 'tab')
                         .text('Conda')
<|current_version|>
define(function(require) {
    var $ = require('jquery');
    var IPython = require('base/js/namespace');
    var models = require('./models');
    var views = require('./views');

    function load() {
        if (!IPython.notebook_list) return;
        var base_url = IPython.notebook_list.base_url;
        $('head').append(
            $('<link>')
            .attr('rel', 'stylesheet')
            .attr('type', 'text/css')
            .attr('href', base_url + 'nbextensions/nb_conda/conda.css')
        );

        $.ajax(base_url + 'nbextensions/nb_conda/tab.html', {
            dataType: 'html',
            success: function(env_html, status, xhr) {
                // Configure Conda tab
                $(".tab-content").append($(env_html));
                $("#tabs").append(
                    $('<li>')
                    .append(
                        $('<a>')
                        .attr('id', 'conda_tab')
                        .attr('href', '#conda')
                        .attr('data-toggle', 'tab')
                        .text('Conda')
                        .click(function (e) {
                            window.history.pushState(null, null, '#conda');

                            models.environments.load();
                            models.available.load();
                        })
                    )
                );

                views.EnvView.init();
                views.AvailView.init();
                views.InstalledView.init();

                models.environments.view = views.EnvView;
                models.available.view = views.AvailView;
                models.installed.view = views.InstalledView;
            }
        });
    }
    return {
        load_ipython_extension: load
    };
});

<|next_version|>
define(function(require) {
    var $ = require('jquery');
    var IPython = require('base/js/namespace');
    var models = require('./models');
    var views = require('./views');

    function load() {
        if (!IPython.notebook_list) return;
        var base_url = IPython.notebook_list.base_url;
        $('head').append(
            $('<link>')
            .attr('rel', 'stylesheet')
            .attr('type', 'text/css')
            .attr('href', base_url + 'nbextensions/nb_conda/conda.css')
        );

        $.ajax(base_url + 'nbextensions/nb_conda/tab.html', {
            dataType: 'html',
            success: function(env_html, status, xhr) {
                // Configure Conda tab
                $(".tab-content").append($(env_html));
                $("#tabs").append(
                    $('<li>')
                    .append(
                        $('<a>')
                        .attr('id', 'conda_tab')
                        .attr('href', '#conda')
                        .attr('data-toggle', 'tab')
                        .text('Conda')
                        .click(function (e) {
                            window.history.pushState(null, null, '#conda');

                            models.environments.load();
                            models.available.load();
                        })
                    )
                );

                views.EnvView.init();
                views.AvailView.init();
                views.InstalledView.init();

                models.environments.view = views.EnvView;
                models.available.view = views.AvailView;
                models.installed.view = views.InstalledView;

                if(window.location.hash === '#conda') {
                    $('#conda_tab').click();
                }
            }
        });
    }
    return {
        load_ipython_extension: load
    };
});


Add call file update in file core test.

Add call file update in file core test.

--- test/file/file_core_test.js
+++ test/file/file_core_test.js
@@ -1,4 +1,5 @@
 var fileTests = require('./file_old').fileTests;
+var fileUpdate = require('./update');
 var helpers = require('../helpers');

 describe('File', function () {
@@ -16,4 +17,5 @@
     });

     fileTests();
+    fileUpdate();
 });

<|original_code|>
var fileTests = require('./file_old').fileTests;
var helpers = require('../helpers');

describe('File', function () {
    before(function(done) { helpers.create_user(done); });
    after(function(done) { helpers.delete_user(done); });

    before(function(done) {
        helpers.create_file(function (err) {
            return done(err);
        });
    });

    after(function(done) {
        helpers.delete_file(done);
    });

    fileTests();
});

<|edits_diff|>
--- test/file/file_core_test.js
+++ test/file/file_core_test.js
@@ -1,4 +1,5 @@
 var fileTests = require('./file_old').fileTests;
+var fileUpdate = require('./update');
 var helpers = require('../helpers');

 describe('File', function () {
<|current_version|>
var fileTests = require('./file_old').fileTests;
var fileUpdate = require('./update');
var helpers = require('../helpers');

describe('File', function () {
    before(function(done) { helpers.create_user(done); });
    after(function(done) { helpers.delete_user(done); });

    before(function(done) {
        helpers.create_file(function (err) {
            return done(err);
        });
    });

    after(function(done) {
        helpers.delete_file(done);
    });

    fileTests();
});

<|next_version|>
var fileTests = require('./file_old').fileTests;
var fileUpdate = require('./update');
var helpers = require('../helpers');

describe('File', function () {
    before(function(done) { helpers.create_user(done); });
    after(function(done) { helpers.delete_user(done); });

    before(function(done) {
        helpers.create_file(function (err) {
            return done(err);
        });
    });

    after(function(done) {
        helpers.delete_file(done);
    });

    fileTests();
    fileUpdate();
});


Use clean paths for SPA serving

Use clean paths for SPA serving

--- index.js
+++ index.js
@@ -1,4 +1,6 @@
 "use strict";
+
+const path = require("path");

 const colors = require("colors");

@@ -14,6 +16,11 @@

 const socket = new Socket(server);

+app.use(express.static("public"));
+
+app.get("*", function (req, res) {
+  res.sendFile(path.join(__dirname, "public", "index.html"));
+});

 const port = 8080;

<|original_code|>
"use strict";

const colors = require("colors");

console.log("Starting ReDash".cyan);

const express = require("express");
const app = express();

const http = require("http");
const server = http.Server(app);

const Socket = require("./lib/socket");

const socket = new Socket(server);

const port = 8080;

server.listen(port);
console.log(("Listening on port " + port).green);

<|edits_diff|>
--- index.js
+++ index.js
@@ -1,4 +1,6 @@
 "use strict";
+
+const path = require("path");

 const colors = require("colors");

<|current_version|>
"use strict";

const path = require("path");

const colors = require("colors");

console.log("Starting ReDash".cyan);

const express = require("express");
const app = express();

const http = require("http");
const server = http.Server(app);

const Socket = require("./lib/socket");

const socket = new Socket(server);

const port = 8080;

server.listen(port);
console.log(("Listening on port " + port).green);

<|next_version|>
"use strict";

const path = require("path");

const colors = require("colors");

console.log("Starting ReDash".cyan);

const express = require("express");
const app = express();

const http = require("http");
const server = http.Server(app);

const Socket = require("./lib/socket");

const socket = new Socket(server);

app.use(express.static("public"));

app.get("*", function (req, res) {
  res.sendFile(path.join(__dirname, "public", "index.html"));
});

const port = 8080;

server.listen(port);
console.log(("Listening on port " + port).green);


Make sure buttons don't overlap

Make sure buttons don't overlap

--- Resources/view/handheld/CreateIssueView.js
+++ Resources/view/handheld/CreateIssueView.js
@@ -1,6 +1,9 @@
 rhok.view.createIssue = function() {
 	var createButton = Ti.UI.createButton({
 		systemButton : Ti.UI.iPhone.SystemButton.ADD,
+		left: 100,
+		width : 80,
+		height: 30,
 		title : 'Add issue'
 	});

@@ -11,6 +14,9 @@

 	var cancelButton = Ti.UI.createButton({
 		systemButton : Ti.UI.iPhone.SystemButton.CANCEL,
+		left : 10,
+		width : 80,
+		height: 30,
 		title : 'Cancel'
 	});

<|original_code|>
rhok.view.createIssue = function() {
	var createButton = Ti.UI.createButton({
		systemButton : Ti.UI.iPhone.SystemButton.ADD,
		title : 'Add issue'
	});

	createButton.addEventListener('click', function() {
		rhok.controller.issueController.createIssue();
		view.close();
	});

	var cancelButton = Ti.UI.createButton({
		systemButton : Ti.UI.iPhone.SystemButton.CANCEL,
		title : 'Cancel'
	});

	cancelButton.addEventListener('click', function() {
		view.close();
	});

	var view = Titanium.UI.createWindow({
		backgroundColor : 'green'
	});
	view.add(createButton);
	view.add(cancelButton);
	return view;
}();

<|edits_diff|>
--- Resources/view/handheld/CreateIssueView.js
+++ Resources/view/handheld/CreateIssueView.js
@@ -1,6 +1,9 @@
 rhok.view.createIssue = function() {
 	var createButton = Ti.UI.createButton({
 		systemButton : Ti.UI.iPhone.SystemButton.ADD,
+		left: 100,
+		width : 80,
+		height: 30,
 		title : 'Add issue'
 	});

<|current_version|>
rhok.view.createIssue = function() {
	var createButton = Ti.UI.createButton({
		systemButton : Ti.UI.iPhone.SystemButton.ADD,
		left: 100,
		width : 80,
		height: 30,
		title : 'Add issue'
	});

	createButton.addEventListener('click', function() {
		rhok.controller.issueController.createIssue();
		view.close();
	});

	var cancelButton = Ti.UI.createButton({
		systemButton : Ti.UI.iPhone.SystemButton.CANCEL,
		title : 'Cancel'
	});

	cancelButton.addEventListener('click', function() {
		view.close();
	});

	var view = Titanium.UI.createWindow({
		backgroundColor : 'green'
	});
	view.add(createButton);
	view.add(cancelButton);
	return view;
}();

<|next_version|>
rhok.view.createIssue = function() {
	var createButton = Ti.UI.createButton({
		systemButton : Ti.UI.iPhone.SystemButton.ADD,
		left: 100,
		width : 80,
		height: 30,
		title : 'Add issue'
	});

	createButton.addEventListener('click', function() {
		rhok.controller.issueController.createIssue();
		view.close();
	});

	var cancelButton = Ti.UI.createButton({
		systemButton : Ti.UI.iPhone.SystemButton.CANCEL,
		left : 10,
		width : 80,
		height: 30,
		title : 'Cancel'
	});

	cancelButton.addEventListener('click', function() {
		view.close();
	});

	var view = Titanium.UI.createWindow({
		backgroundColor : 'green'
	});
	view.add(createButton);
	view.add(cancelButton);
	return view;
}();


Add .matches() as default choice for browserUtils.matchSelector

Formerly known as matchesSelector(), with many vendor prefixes as seen in this function.
I'm using ADT in a jsdom environment, which doesn't support any vendor-prefixed variations
of this function.

http://caniuse.com/#feat=matchesselector

--- src/js/BrowserUtils.js
+++ src/js/BrowserUtils.js
@@ -15,6 +15,7 @@
 goog.provide('axs.browserUtils');

 /**
+ * Use Webkit matcher when matches() is not supported.
  * Use Firefox matcher when Webkit is not supported.
  * Use IE matcher when neither webkit nor Firefox supported.
  * @param {Element} element
@@ -22,6 +23,8 @@
  * @return {boolean} true if the element matches the selector
  */
 axs.browserUtils.matchSelector = function(element, selector) {
+    if (element.matches)
+        return element.matches(selector);
     if (element.webkitMatchesSelector)
         return element.webkitMatchesSelector(selector);
     if (element.mozMatchesSelector)

<|original_code|>
// Copyright 2013 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

goog.provide('axs.browserUtils');

/**
 * Use Firefox matcher when Webkit is not supported.
 * Use IE matcher when neither webkit nor Firefox supported.
 * @param {Element} element
 * @param {string} selector
 * @return {boolean} true if the element matches the selector
 */
axs.browserUtils.matchSelector = function(element, selector) {
    if (element.webkitMatchesSelector)
        return element.webkitMatchesSelector(selector);
    if (element.mozMatchesSelector)
        return element.mozMatchesSelector(selector);
    if (element.msMatchesSelector)
        return element.msMatchesSelector(selector);
    return false;
};

<|edits_diff|>
--- src/js/BrowserUtils.js
+++ src/js/BrowserUtils.js
@@ -15,6 +15,7 @@
 goog.provide('axs.browserUtils');

 /**
+ * Use Webkit matcher when matches() is not supported.
  * Use Firefox matcher when Webkit is not supported.
  * Use IE matcher when neither webkit nor Firefox supported.
  * @param {Element} element
<|current_version|>
// Copyright 2013 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

goog.provide('axs.browserUtils');

/**
 * Use Webkit matcher when matches() is not supported.
 * Use Firefox matcher when Webkit is not supported.
 * Use IE matcher when neither webkit nor Firefox supported.
 * @param {Element} element
 * @param {string} selector
 * @return {boolean} true if the element matches the selector
 */
axs.browserUtils.matchSelector = function(element, selector) {
    if (element.webkitMatchesSelector)
        return element.webkitMatchesSelector(selector);
    if (element.mozMatchesSelector)
        return element.mozMatchesSelector(selector);
    if (element.msMatchesSelector)
        return element.msMatchesSelector(selector);
    return false;
};

<|next_version|>
// Copyright 2013 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

goog.provide('axs.browserUtils');

/**
 * Use Webkit matcher when matches() is not supported.
 * Use Firefox matcher when Webkit is not supported.
 * Use IE matcher when neither webkit nor Firefox supported.
 * @param {Element} element
 * @param {string} selector
 * @return {boolean} true if the element matches the selector
 */
axs.browserUtils.matchSelector = function(element, selector) {
    if (element.matches)
        return element.matches(selector);
    if (element.webkitMatchesSelector)
        return element.webkitMatchesSelector(selector);
    if (element.mozMatchesSelector)
        return element.mozMatchesSelector(selector);
    if (element.msMatchesSelector)
        return element.msMatchesSelector(selector);
    return false;
};