Update test to keep connections

Update test to keep connections

--- test/integration/connection/test-disconnects.js
+++ test/integration/connection/test-disconnects.js
@@ -5,6 +5,8 @@
 var fields;
 var err;
 var server;
+
+var connections = [];

 function test() {
   var connection = common.createConnection({port: 3307});
@@ -17,6 +19,7 @@
       err = _err;
     });

+    connections.forEach(function(conn) { conn.stream.end(); });
     server._server.close(function() {
       assert.equal(err.code, 'PROTOCOL_CONNECTION_LOST');
     });
@@ -25,6 +28,7 @@
 }

 function serverHandler(conn) {
+  connections.push(conn);
   conn.on('query', function(q) {
     conn.writeTextResult([ { '1': '1' } ], [ { catalog: 'def',
      schema: '',

<|original_code|>
var common     = require('../../common');
var assert     = require('assert');

var rows;
var fields;
var err;
var server;

function test() {
  var connection = common.createConnection({port: 3307});
  connection.query('SELECT 123', function(err, _rows, _fields) {
    if (err) throw err;

    rows = _rows;
    fields = _fields;
    connection.on('error', function(_err) {
      err = _err;
    });

    server._server.close(function() {
      assert.equal(err.code, 'PROTOCOL_CONNECTION_LOST');
    });
  });
  // TODO: test connection.end() etc where we expect disconnect to happen
}

function serverHandler(conn) {
  conn.on('query', function(q) {
    conn.writeTextResult([ { '1': '1' } ], [ { catalog: 'def',
     schema: '',
     table: '',
     orgTable: '',
     name: '1',
     orgName: '',
     characterSet: 63,
     columnLength: 1,
     columnType: 8,
     flags: 129,
     decimals: 0 } ]);
  });
}
server = common.createServer(test, serverHandler);

process.on('exit', function() {
  assert.deepEqual(rows, [{1: 1}]);
  assert.equal(fields[0].name, '1');
});

<|edits_diff|>
--- test/integration/connection/test-disconnects.js
+++ test/integration/connection/test-disconnects.js
@@ -5,6 +5,8 @@
 var fields;
 var err;
 var server;
+
+var connections = [];

 function test() {
   var connection = common.createConnection({port: 3307});
@@ -17,6 +19,7 @@
       err = _err;
     });

+    connections.forEach(function(conn) { conn.stream.end(); });
     server._server.close(function() {
       assert.equal(err.code, 'PROTOCOL_CONNECTION_LOST');
     });
<|current_version|>
var common     = require('../../common');
var assert     = require('assert');

var rows;
var fields;
var err;
var server;

var connections = [];

function test() {
  var connection = common.createConnection({port: 3307});
  connection.query('SELECT 123', function(err, _rows, _fields) {
    if (err) throw err;

    rows = _rows;
    fields = _fields;
    connection.on('error', function(_err) {
      err = _err;
    });

    connections.forEach(function(conn) { conn.stream.end(); });
    server._server.close(function() {
      assert.equal(err.code, 'PROTOCOL_CONNECTION_LOST');
    });
  });
  // TODO: test connection.end() etc where we expect disconnect to happen
}

function serverHandler(conn) {
  conn.on('query', function(q) {
    conn.writeTextResult([ { '1': '1' } ], [ { catalog: 'def',
     schema: '',
     table: '',
     orgTable: '',
     name: '1',
     orgName: '',
     characterSet: 63,
     columnLength: 1,
     columnType: 8,
     flags: 129,
     decimals: 0 } ]);
  });
}
server = common.createServer(test, serverHandler);

process.on('exit', function() {
  assert.deepEqual(rows, [{1: 1}]);
  assert.equal(fields[0].name, '1');
});

<|next_version|>
var common     = require('../../common');
var assert     = require('assert');

var rows;
var fields;
var err;
var server;

var connections = [];

function test() {
  var connection = common.createConnection({port: 3307});
  connection.query('SELECT 123', function(err, _rows, _fields) {
    if (err) throw err;

    rows = _rows;
    fields = _fields;
    connection.on('error', function(_err) {
      err = _err;
    });

    connections.forEach(function(conn) { conn.stream.end(); });
    server._server.close(function() {
      assert.equal(err.code, 'PROTOCOL_CONNECTION_LOST');
    });
  });
  // TODO: test connection.end() etc where we expect disconnect to happen
}

function serverHandler(conn) {
  connections.push(conn);
  conn.on('query', function(q) {
    conn.writeTextResult([ { '1': '1' } ], [ { catalog: 'def',
     schema: '',
     table: '',
     orgTable: '',
     name: '1',
     orgName: '',
     characterSet: 63,
     columnLength: 1,
     columnType: 8,
     flags: 129,
     decimals: 0 } ]);
  });
}
server = common.createServer(test, serverHandler);

process.on('exit', function() {
  assert.deepEqual(rows, [{1: 1}]);
  assert.equal(fields[0].name, '1');
});


:new: Add onDidUpdateMessages to indie registry

--- lib/indie-registry.js
+++ lib/indie-registry.js
@@ -23,6 +23,9 @@
     indieLinter.onDidDestroy(() => {
       this.indieLinters.delete(indieLinter)
     })
+    indieLinter.onDidUpdateMessages(messages => {
+      this.emitter.emit('did-update-messages', {linter: indieLinter, messages})
+    })
     this.emit('observe', indieLinter)

     return indieLinter
@@ -38,6 +41,10 @@
     this.indieLinters.forEach(callback)
     return this.subscriptions.add('observe', callback)
   }
+  // Private method
+  onDidUpdateMessages(callback) {
+    return this.subscriptions.add('did-update-messages', callback)
+  }

   dispose() {
     this.subscriptions.dispose()

<|original_code|>
'use babel'

import {Emitter, CompositeDisposable} from 'atom'
import Validate from './validate'
import Indie from './indie'

export default class IndieRegistry {
  constructor() {
    this.subscriptions = new CompositeDisposable()
    this.emitter = new Emitter()

    this.indieLinters = new Set()
    this.subscriptions.add(this.emitter)
  }

  register(linter) {
    Validate.linter(linter, true)
    const indieLinter = new Indie(linter)

    this.subscriptions.add(indieLinter)
    this.indieLinters.add(indieLinter)

    indieLinter.onDidDestroy(() => {
      this.indieLinters.delete(indieLinter)
    })
    this.emit('observe', indieLinter)

    return indieLinter
  }
  unregister(indieLinter) {
    if (this.indieLinters.has(indieLinter)) {
      indieLinter.dispose()
    }
  }

  // Private method
  observe(callback) {
    this.indieLinters.forEach(callback)
    return this.subscriptions.add('observe', callback)
  }

  dispose() {
    this.subscriptions.dispose()
  }
}

<|edits_diff|>
--- lib/indie-registry.js
+++ lib/indie-registry.js
@@ -23,6 +23,9 @@
     indieLinter.onDidDestroy(() => {
       this.indieLinters.delete(indieLinter)
     })
+    indieLinter.onDidUpdateMessages(messages => {
+      this.emitter.emit('did-update-messages', {linter: indieLinter, messages})
+    })
     this.emit('observe', indieLinter)

     return indieLinter
<|current_version|>
'use babel'

import {Emitter, CompositeDisposable} from 'atom'
import Validate from './validate'
import Indie from './indie'

export default class IndieRegistry {
  constructor() {
    this.subscriptions = new CompositeDisposable()
    this.emitter = new Emitter()

    this.indieLinters = new Set()
    this.subscriptions.add(this.emitter)
  }

  register(linter) {
    Validate.linter(linter, true)
    const indieLinter = new Indie(linter)

    this.subscriptions.add(indieLinter)
    this.indieLinters.add(indieLinter)

    indieLinter.onDidDestroy(() => {
      this.indieLinters.delete(indieLinter)
    })
    indieLinter.onDidUpdateMessages(messages => {
      this.emitter.emit('did-update-messages', {linter: indieLinter, messages})
    })
    this.emit('observe', indieLinter)

    return indieLinter
  }
  unregister(indieLinter) {
    if (this.indieLinters.has(indieLinter)) {
      indieLinter.dispose()
    }
  }

  // Private method
  observe(callback) {
    this.indieLinters.forEach(callback)
    return this.subscriptions.add('observe', callback)
  }

  dispose() {
    this.subscriptions.dispose()
  }
}

<|next_version|>
'use babel'

import {Emitter, CompositeDisposable} from 'atom'
import Validate from './validate'
import Indie from './indie'

export default class IndieRegistry {
  constructor() {
    this.subscriptions = new CompositeDisposable()
    this.emitter = new Emitter()

    this.indieLinters = new Set()
    this.subscriptions.add(this.emitter)
  }

  register(linter) {
    Validate.linter(linter, true)
    const indieLinter = new Indie(linter)

    this.subscriptions.add(indieLinter)
    this.indieLinters.add(indieLinter)

    indieLinter.onDidDestroy(() => {
      this.indieLinters.delete(indieLinter)
    })
    indieLinter.onDidUpdateMessages(messages => {
      this.emitter.emit('did-update-messages', {linter: indieLinter, messages})
    })
    this.emit('observe', indieLinter)

    return indieLinter
  }
  unregister(indieLinter) {
    if (this.indieLinters.has(indieLinter)) {
      indieLinter.dispose()
    }
  }

  // Private method
  observe(callback) {
    this.indieLinters.forEach(callback)
    return this.subscriptions.add('observe', callback)
  }
  // Private method
  onDidUpdateMessages(callback) {
    return this.subscriptions.add('did-update-messages', callback)
  }

  dispose() {
    this.subscriptions.dispose()
  }
}


Update webpack config to use nodeExternals

--- webpack.config.base.js
+++ webpack.config.base.js
@@ -1,4 +1,5 @@
 import path from 'path'
+import nodeExternals from 'webpack-node-externals'

 export default {
   module: {
@@ -29,6 +30,9 @@

   ],
   externals: [
+    nodeExternals({
+      whitelist: ['webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr', 'normalize.css'],
+    }),

     // put your node 3rd party libraries which can't be built with webpack here
     // (mysql, mongodb, and so on..)

<|original_code|>
import path from 'path'

export default {
  module: {
    loaders: [{
      test: /\.jsx?$/,
      loaders: ['babel-loader'],
      exclude: /node_modules/,
    }, {
      test: /\.json$/,
      loader: 'json-loader',
    },
    {
      test: /\.(png|woff|woff2|eot|ttf|svg)$/,
      loader: 'url-loader?limit=100000',
    },
    ],
  },
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    libraryTarget: 'commonjs2',
  },
  resolve: {
    extensions: ['', '.js', '.jsx'],
    packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
  },
  plugins: [

  ],
  externals: [

    // put your node 3rd party libraries which can't be built with webpack here
    // (mysql, mongodb, and so on..)
  ],
}

<|edits_diff|>
--- webpack.config.base.js
+++ webpack.config.base.js
@@ -1,4 +1,5 @@
 import path from 'path'
+import nodeExternals from 'webpack-node-externals'

 export default {
   module: {
<|current_version|>
import path from 'path'
import nodeExternals from 'webpack-node-externals'

export default {
  module: {
    loaders: [{
      test: /\.jsx?$/,
      loaders: ['babel-loader'],
      exclude: /node_modules/,
    }, {
      test: /\.json$/,
      loader: 'json-loader',
    },
    {
      test: /\.(png|woff|woff2|eot|ttf|svg)$/,
      loader: 'url-loader?limit=100000',
    },
    ],
  },
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    libraryTarget: 'commonjs2',
  },
  resolve: {
    extensions: ['', '.js', '.jsx'],
    packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
  },
  plugins: [

  ],
  externals: [

    // put your node 3rd party libraries which can't be built with webpack here
    // (mysql, mongodb, and so on..)
  ],
}

<|next_version|>
import path from 'path'
import nodeExternals from 'webpack-node-externals'

export default {
  module: {
    loaders: [{
      test: /\.jsx?$/,
      loaders: ['babel-loader'],
      exclude: /node_modules/,
    }, {
      test: /\.json$/,
      loader: 'json-loader',
    },
    {
      test: /\.(png|woff|woff2|eot|ttf|svg)$/,
      loader: 'url-loader?limit=100000',
    },
    ],
  },
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    libraryTarget: 'commonjs2',
  },
  resolve: {
    extensions: ['', '.js', '.jsx'],
    packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
  },
  plugins: [

  ],
  externals: [
    nodeExternals({
      whitelist: ['webpack-hot-middleware/client?path=http://localhost:3000/__webpack_hmr', 'normalize.css'],
    }),

    // put your node 3rd party libraries which can't be built with webpack here
    // (mysql, mongodb, and so on..)
  ],
}


Set an id when an account registers

Set an id when an account registers

--- src/passport.js
+++ src/passport.js
@@ -3,6 +3,8 @@

 var passport = require('passport');
 var FacebookStrategy = require('passport-facebook').Strategy;
+
+var uuid = require('uuid');

 passport.use(new FacebookStrategy({
@@ -20,6 +22,7 @@

     }, {

+        id: uuid.v4(),
         displayName: profile.displayName

     }, {

<|original_code|>

var mongo = require('./mongo');

var passport = require('passport');
var FacebookStrategy = require('passport-facebook').Strategy;

passport.use(new FacebookStrategy({

    clientID: process.env.FB_APP_ID,
    clientSecret: process.env.FB_APP_SECRET,
    callbackURL: 'http://localhost:18000/auth/facebook/callback',
    enableProof: false

}, function (accessToken, refreshToken, profile, done) {

    mongo.Account.findOneAndUpdate({

        facebookId: profile.id

    }, {

        displayName: profile.displayName

    }, {

        upsert: true

    }).exec().then(function (account) {

        done(null, account);

    }, function (err) {

        done(err);

    });

}));

module.exports = passport;

<|edits_diff|>
--- src/passport.js
+++ src/passport.js
@@ -3,6 +3,8 @@

 var passport = require('passport');
 var FacebookStrategy = require('passport-facebook').Strategy;
+
+var uuid = require('uuid');

 passport.use(new FacebookStrategy({
<|current_version|>

var mongo = require('./mongo');

var passport = require('passport');
var FacebookStrategy = require('passport-facebook').Strategy;

var uuid = require('uuid');

passport.use(new FacebookStrategy({

    clientID: process.env.FB_APP_ID,
    clientSecret: process.env.FB_APP_SECRET,
    callbackURL: 'http://localhost:18000/auth/facebook/callback',
    enableProof: false

}, function (accessToken, refreshToken, profile, done) {

    mongo.Account.findOneAndUpdate({

        facebookId: profile.id

    }, {

        displayName: profile.displayName

    }, {

        upsert: true

    }).exec().then(function (account) {

        done(null, account);

    }, function (err) {

        done(err);

    });

}));

module.exports = passport;

<|next_version|>

var mongo = require('./mongo');

var passport = require('passport');
var FacebookStrategy = require('passport-facebook').Strategy;

var uuid = require('uuid');

passport.use(new FacebookStrategy({

    clientID: process.env.FB_APP_ID,
    clientSecret: process.env.FB_APP_SECRET,
    callbackURL: 'http://localhost:18000/auth/facebook/callback',
    enableProof: false

}, function (accessToken, refreshToken, profile, done) {

    mongo.Account.findOneAndUpdate({

        facebookId: profile.id

    }, {

        id: uuid.v4(),
        displayName: profile.displayName

    }, {

        upsert: true

    }).exec().then(function (account) {

        done(null, account);

    }, function (err) {

        done(err);

    });

}));

module.exports = passport;


Update default pushTo option of grunt-bump

--- Gruntfile.js
+++ Gruntfile.js
@@ -3,6 +3,7 @@

   // Project configuration.
   grunt.initConfig({
+    pkg: grunt.file.readJSON('package.json'),
     // Task configuration.
     jshint: {
       options: {
@@ -35,6 +36,11 @@
         files: '<%= jshint.lib_test.src %>',
         tasks: ['jshint:lib_test', 'nodeunit']
       }
+    },
+    bump: {
+      options: {
+        pushTo: '<%=pkg.repository.url%>'
+      }
     }
   });

<|original_code|>
/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Task configuration.
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        globals: {}
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test', 'nodeunit']
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-bump');

  // Default task.
  grunt.registerTask('default', ['jshint']);

};

<|edits_diff|>
--- Gruntfile.js
+++ Gruntfile.js
@@ -3,6 +3,7 @@

   // Project configuration.
   grunt.initConfig({
+    pkg: grunt.file.readJSON('package.json'),
     // Task configuration.
     jshint: {
       options: {
<|current_version|>
/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    // Task configuration.
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        globals: {}
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test', 'nodeunit']
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-bump');

  // Default task.
  grunt.registerTask('default', ['jshint']);

};

<|next_version|>
/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    // Task configuration.
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        globals: {}
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
      lib_test: {
        files: '<%= jshint.lib_test.src %>',
        tasks: ['jshint:lib_test', 'nodeunit']
      }
    },
    bump: {
      options: {
        pushTo: '<%=pkg.repository.url%>'
      }
    }
  });

  // These plugins provide necessary tasks.
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-bump');

  // Default task.
  grunt.registerTask('default', ['jshint']);

};


Add source map and live reload

Add source map and live reload

--- Gruntfile.js
+++ Gruntfile.js
@@ -20,6 +20,7 @@
   },
   concat: {
     options: {
+      sourceMap: true,
       separator: ''
     },
     dist: {
@@ -43,6 +44,7 @@
       files: ['src/**/*.js'],
       tasks: ['default'],
       options: {
+        livereload: true,
         spawn: false
       }
     }

<|original_code|>
var grunt = require('grunt');
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.initConfig({
  '6to5': {
    options: {
      sourceMap: true,
      modules: 'ignore'
    },
    dist: {
      files:  [{
        expand: true,
        cwd: 'src',
        src: ['**/*.js', '!intro.js', '!outro.js'],
        dest: '.tmp/es5',
        ext: '.js'
      }]
    }
  },
  concat: {
    options: {
      separator: ''
    },
    dist: {
      src: [
        'src/intro.js',
        '.tmp/es5/**/*.js',
        'src/outro.js'
      ],
      dest: 'dist/lithree.js'
    }
  },
  uglify: {
    my_target: {
      files: {
        'dist/lithree.min.js': ['dist/lithree.js']
      }
    }
  },
  watch: {
    scripts: {
      files: ['src/**/*.js'],
      tasks: ['default'],
      options: {
        spawn: false
      }
    }
  }
});

grunt.registerTask('default', ['6to5', 'concat']);

grunt.registerTask('build', ['default', 'uglify']);
<|edits_diff|>
--- Gruntfile.js
+++ Gruntfile.js
@@ -20,6 +20,7 @@
   },
   concat: {
     options: {
+      sourceMap: true,
       separator: ''
     },
     dist: {
<|current_version|>
var grunt = require('grunt');
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.initConfig({
  '6to5': {
    options: {
      sourceMap: true,
      modules: 'ignore'
    },
    dist: {
      files:  [{
        expand: true,
        cwd: 'src',
        src: ['**/*.js', '!intro.js', '!outro.js'],
        dest: '.tmp/es5',
        ext: '.js'
      }]
    }
  },
  concat: {
    options: {
      sourceMap: true,
      separator: ''
    },
    dist: {
      src: [
        'src/intro.js',
        '.tmp/es5/**/*.js',
        'src/outro.js'
      ],
      dest: 'dist/lithree.js'
    }
  },
  uglify: {
    my_target: {
      files: {
        'dist/lithree.min.js': ['dist/lithree.js']
      }
    }
  },
  watch: {
    scripts: {
      files: ['src/**/*.js'],
      tasks: ['default'],
      options: {
        spawn: false
      }
    }
  }
});

grunt.registerTask('default', ['6to5', 'concat']);

grunt.registerTask('build', ['default', 'uglify']);
<|next_version|>
var grunt = require('grunt');
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.initConfig({
  '6to5': {
    options: {
      sourceMap: true,
      modules: 'ignore'
    },
    dist: {
      files:  [{
        expand: true,
        cwd: 'src',
        src: ['**/*.js', '!intro.js', '!outro.js'],
        dest: '.tmp/es5',
        ext: '.js'
      }]
    }
  },
  concat: {
    options: {
      sourceMap: true,
      separator: ''
    },
    dist: {
      src: [
        'src/intro.js',
        '.tmp/es5/**/*.js',
        'src/outro.js'
      ],
      dest: 'dist/lithree.js'
    }
  },
  uglify: {
    my_target: {
      files: {
        'dist/lithree.min.js': ['dist/lithree.js']
      }
    }
  },
  watch: {
    scripts: {
      files: ['src/**/*.js'],
      tasks: ['default'],
      options: {
        livereload: true,
        spawn: false
      }
    }
  }
});

grunt.registerTask('default', ['6to5', 'concat']);

grunt.registerTask('build', ['default', 'uglify']);


Test if promise is returned

Test if promise is returned

--- test/storage_driver_test.js
+++ test/storage_driver_test.js
@@ -16,12 +16,24 @@
       expect(sut._initStorage).toBeDefined();
     });

+    it('should return Promise when "_initStorage" is called', function () {
+      expect(sut._initStorage().constructor.name).toEqual('Promise');
+    });
+
     it('should have a function called "get"', function () {
       expect(sut.get).toBeDefined();
+    });
+
+    it('should return Promise when "get" is called', function () {
+      expect(sut.get().constructor.name).toEqual('Promise');
     });

     it('should have a function called "set"', function () {
       expect(sut.set).toBeDefined();
     });
+
+    it('should return Promise when "set" is called', function () {
+      expect(sut.set().constructor.name).toEqual('Promise');
+    });
   });
 });

<|original_code|>
var storageDriver = require('../dist/storage_driver.js');

describe('StorageDriver', function () {
  it('should have redis driver', function () {
    expect(storageDriver.redis).toBeDefined();
  });

  describe('Redis', function () {
    var sut;

    beforeEach(function () {
      sut = storageDriver.redis();
    });

    it('should have a function called "_initStorage"', function () {
      expect(sut._initStorage).toBeDefined();
    });

    it('should have a function called "get"', function () {
      expect(sut.get).toBeDefined();
    });

    it('should have a function called "set"', function () {
      expect(sut.set).toBeDefined();
    });
  });
});

<|edits_diff|>
--- test/storage_driver_test.js
+++ test/storage_driver_test.js
@@ -16,8 +16,16 @@
       expect(sut._initStorage).toBeDefined();
     });

+    it('should return Promise when "_initStorage" is called', function () {
+      expect(sut._initStorage().constructor.name).toEqual('Promise');
+    });
+
     it('should have a function called "get"', function () {
       expect(sut.get).toBeDefined();
+    });
+
+    it('should return Promise when "get" is called', function () {
+      expect(sut.get().constructor.name).toEqual('Promise');
     });

     it('should have a function called "set"', function () {
<|current_version|>
var storageDriver = require('../dist/storage_driver.js');

describe('StorageDriver', function () {
  it('should have redis driver', function () {
    expect(storageDriver.redis).toBeDefined();
  });

  describe('Redis', function () {
    var sut;

    beforeEach(function () {
      sut = storageDriver.redis();
    });

    it('should have a function called "_initStorage"', function () {
      expect(sut._initStorage).toBeDefined();
    });

    it('should return Promise when "_initStorage" is called', function () {
      expect(sut._initStorage().constructor.name).toEqual('Promise');
    });

    it('should have a function called "get"', function () {
      expect(sut.get).toBeDefined();
    });

    it('should return Promise when "get" is called', function () {
      expect(sut.get().constructor.name).toEqual('Promise');
    });

    it('should have a function called "set"', function () {
      expect(sut.set).toBeDefined();
    });
  });
});

<|next_version|>
var storageDriver = require('../dist/storage_driver.js');

describe('StorageDriver', function () {
  it('should have redis driver', function () {
    expect(storageDriver.redis).toBeDefined();
  });

  describe('Redis', function () {
    var sut;

    beforeEach(function () {
      sut = storageDriver.redis();
    });

    it('should have a function called "_initStorage"', function () {
      expect(sut._initStorage).toBeDefined();
    });

    it('should return Promise when "_initStorage" is called', function () {
      expect(sut._initStorage().constructor.name).toEqual('Promise');
    });

    it('should have a function called "get"', function () {
      expect(sut.get).toBeDefined();
    });

    it('should return Promise when "get" is called', function () {
      expect(sut.get().constructor.name).toEqual('Promise');
    });

    it('should have a function called "set"', function () {
      expect(sut.set).toBeDefined();
    });

    it('should return Promise when "set" is called', function () {
      expect(sut.set().constructor.name).toEqual('Promise');
    });
  });
});


[test-studio] Add example of using custom icon for list item

--- packages/test-studio/src/deskStructure.js
+++ packages/test-studio/src/deskStructure.js
@@ -1,3 +1,4 @@
+import React from 'react'
 import S from '@sanity/desk-tool/structure-builder'
 import RefreshIcon from 'part:@sanity/base/sync-icon'
 import JsonDocumentDump from './components/JsonDocumentDump'
@@ -13,6 +14,7 @@
       S.listItem()
         .id('docList')
         .title('Anything with a title')
+        .icon(() => T)
         .child(() =>
           delay(
             S.documentList({

<|original_code|>
import S from '@sanity/desk-tool/structure-builder'
import RefreshIcon from 'part:@sanity/base/sync-icon'
import JsonDocumentDump from './components/JsonDocumentDump'

// For testing. Bump the timeout to introduce som lag
const delay = val => new Promise(resolve => setTimeout(resolve, 10, val))

export default () =>
  S.list()
    .id('root')
    .title('Content')
    .items([
      S.listItem()
        .id('docList')
        .title('Anything with a title')
        .child(() =>
          delay(
            S.documentList({
              id: 'title-list',
              title: 'Titles!',
              options: {
                filter: 'defined(title)'
              }
            })
          )
        ),

      S.listItem()
        .id('circular')
        .title('Singleton?')
        .child(delay(S.editor({id: 'editor', options: {id: 'circular', type: 'referenceTest'}}))),

      S.documentListItem()
        .id('grrm')
        .schemaType('author')
        .child(
          S.component()
            .id('dump')
            .component(JsonDocumentDump)
            .menuItems([
              S.menuItem()
                .title('Reload')
                .action('reload')
                .icon(RefreshIcon)
                .showAsAction(true)
            ])
        ),

      ...S.documentTypeListItems()
    ])

<|edits_diff|>
--- packages/test-studio/src/deskStructure.js
+++ packages/test-studio/src/deskStructure.js
@@ -1,3 +1,4 @@
+import React from 'react'
 import S from '@sanity/desk-tool/structure-builder'
 import RefreshIcon from 'part:@sanity/base/sync-icon'
 import JsonDocumentDump from './components/JsonDocumentDump'
<|current_version|>
import React from 'react'
import S from '@sanity/desk-tool/structure-builder'
import RefreshIcon from 'part:@sanity/base/sync-icon'
import JsonDocumentDump from './components/JsonDocumentDump'

// For testing. Bump the timeout to introduce som lag
const delay = val => new Promise(resolve => setTimeout(resolve, 10, val))

export default () =>
  S.list()
    .id('root')
    .title('Content')
    .items([
      S.listItem()
        .id('docList')
        .title('Anything with a title')
        .child(() =>
          delay(
            S.documentList({
              id: 'title-list',
              title: 'Titles!',
              options: {
                filter: 'defined(title)'
              }
            })
          )
        ),

      S.listItem()
        .id('circular')
        .title('Singleton?')
        .child(delay(S.editor({id: 'editor', options: {id: 'circular', type: 'referenceTest'}}))),

      S.documentListItem()
        .id('grrm')
        .schemaType('author')
        .child(
          S.component()
            .id('dump')
            .component(JsonDocumentDump)
            .menuItems([
              S.menuItem()
                .title('Reload')
                .action('reload')
                .icon(RefreshIcon)
                .showAsAction(true)
            ])
        ),

      ...S.documentTypeListItems()
    ])

<|next_version|>
import React from 'react'
import S from '@sanity/desk-tool/structure-builder'
import RefreshIcon from 'part:@sanity/base/sync-icon'
import JsonDocumentDump from './components/JsonDocumentDump'

// For testing. Bump the timeout to introduce som lag
const delay = val => new Promise(resolve => setTimeout(resolve, 10, val))

export default () =>
  S.list()
    .id('root')
    .title('Content')
    .items([
      S.listItem()
        .id('docList')
        .title('Anything with a title')
        .icon(() => T)
        .child(() =>
          delay(
            S.documentList({
              id: 'title-list',
              title: 'Titles!',
              options: {
                filter: 'defined(title)'
              }
            })
          )
        ),

      S.listItem()
        .id('circular')
        .title('Singleton?')
        .child(delay(S.editor({id: 'editor', options: {id: 'circular', type: 'referenceTest'}}))),

      S.documentListItem()
        .id('grrm')
        .schemaType('author')
        .child(
          S.component()
            .id('dump')
            .component(JsonDocumentDump)
            .menuItems([
              S.menuItem()
                .title('Reload')
                .action('reload')
                .icon(RefreshIcon)
                .showAsAction(true)
            ])
        ),

      ...S.documentTypeListItems()
    ])


Initialize touch events in react

Initialize touch events in react

--- public/js/index.js
+++ public/js/index.js
@@ -1,6 +1,10 @@
 var plugins = require('./plugins')
+
+// React init
 var React = require('react')
+React.initializeTouchEvents(true)

+// Initialize the app
 var router = require('../components/router.jsx')
 React.renderComponent(router, document.body);

<|original_code|>
var plugins = require('./plugins')
var React = require('react')

var router = require('../components/router.jsx')
React.renderComponent(router, document.body);

<|edits_diff|>
--- public/js/index.js
+++ public/js/index.js
@@ -1,5 +1,8 @@
 var plugins = require('./plugins')
+
+// React init
 var React = require('react')
+React.initializeTouchEvents(true)

 var router = require('../components/router.jsx')
 React.renderComponent(router, document.body);
<|current_version|>
var plugins = require('./plugins')

// React init
var React = require('react')
React.initializeTouchEvents(true)

var router = require('../components/router.jsx')
React.renderComponent(router, document.body);

<|next_version|>
var plugins = require('./plugins')

// React init
var React = require('react')
React.initializeTouchEvents(true)

// Initialize the app
var router = require('../components/router.jsx')
React.renderComponent(router, document.body);


Set up linear interpolation for position updates

--- client/aframeComponents/socket-controls.js
+++ client/aframeComponents/socket-controls.js
@@ -3,6 +3,7 @@
     previousPos: {default: 0},
     nextPos: {default: 0},
     socket: {default: null},
+    lastUpdateTime: new Date(),
     dur: {default: 100} // set this to update cycle length
   },

@@ -11,6 +12,7 @@
     const socket = window.socket;
     const el = this.el;
     socket.on('enemyPositionUpdate', positionUpdate => {
+      data.lastUpdateTime = Date.now()
       data.previousPos = data.nextPos; // switch this to current position
       data.nextPos = positionUpdate;
       el.setAttribute('position', data.nextPos);
@@ -18,6 +20,7 @@
   },

   tick: function(t, dt) {
+    // linear interp from data.lastPos to data.nextPos
   },

   update: function (previousData) {

<|original_code|>
AFRAME.registerComponent('socket-controls', {
  schema: {
    previousPos: {default: 0},
    nextPos: {default: 0},
    socket: {default: null},
    dur: {default: 100} // set this to update cycle length
  },

  init: function() {
    const data = this.data;
    const socket = window.socket;
    const el = this.el;
    socket.on('enemyPositionUpdate', positionUpdate => {
      data.previousPos = data.nextPos; // switch this to current position
      data.nextPos = positionUpdate;
      el.setAttribute('position', data.nextPos);
    });
  },

  tick: function(t, dt) {
  },

  update: function (previousData) {
  },

});

<|edits_diff|>
--- client/aframeComponents/socket-controls.js
+++ client/aframeComponents/socket-controls.js
@@ -3,6 +3,7 @@
     previousPos: {default: 0},
     nextPos: {default: 0},
     socket: {default: null},
+    lastUpdateTime: new Date(),
     dur: {default: 100} // set this to update cycle length
   },

@@ -11,6 +12,7 @@
     const socket = window.socket;
     const el = this.el;
     socket.on('enemyPositionUpdate', positionUpdate => {
+      data.lastUpdateTime = Date.now()
       data.previousPos = data.nextPos; // switch this to current position
       data.nextPos = positionUpdate;
       el.setAttribute('position', data.nextPos);
<|current_version|>
AFRAME.registerComponent('socket-controls', {
  schema: {
    previousPos: {default: 0},
    nextPos: {default: 0},
    socket: {default: null},
    lastUpdateTime: new Date(),
    dur: {default: 100} // set this to update cycle length
  },

  init: function() {
    const data = this.data;
    const socket = window.socket;
    const el = this.el;
    socket.on('enemyPositionUpdate', positionUpdate => {
      data.lastUpdateTime = Date.now()
      data.previousPos = data.nextPos; // switch this to current position
      data.nextPos = positionUpdate;
      el.setAttribute('position', data.nextPos);
    });
  },

  tick: function(t, dt) {
  },

  update: function (previousData) {
  },

});

<|next_version|>
AFRAME.registerComponent('socket-controls', {
  schema: {
    previousPos: {default: 0},
    nextPos: {default: 0},
    socket: {default: null},
    lastUpdateTime: new Date(),
    dur: {default: 100} // set this to update cycle length
  },

  init: function() {
    const data = this.data;
    const socket = window.socket;
    const el = this.el;
    socket.on('enemyPositionUpdate', positionUpdate => {
      data.lastUpdateTime = Date.now()
      data.previousPos = data.nextPos; // switch this to current position
      data.nextPos = positionUpdate;
      el.setAttribute('position', data.nextPos);
    });
  },

  tick: function(t, dt) {
    // linear interp from data.lastPos to data.nextPos
  },

  update: function (previousData) {
  },

});


Add comments for test launcher

Add comments for test launcher

--- test/index.js
+++ test/index.js
@@ -4,9 +4,11 @@
 RateLimiter = require('../ratelimiter'),
 limits = require('./data');

+// Initialize two different rate limiters with different limits
 fitbit = new RateLimiter("fitbit", limits[0], redisClient);
 jawbone = new RateLimiter("jawbone", limits[1], redisClient);

+// Allowed and blocked requests will be stored in these arrays
 blockedRequests = [],
 allowedRequests = [];

@@ -19,6 +21,7 @@
 	allowedRequests.push(uid);
 };

+// Run all the tests
 var singleLimitTests = require('./lib/singlelimit'),
 	multiLimitTests = require('./lib/multilimit'),
 	expireTests = require('./lib/expire');

<|original_code|>
expect = require('chai').expect,
redis = require('redis'),
redisClient = redis.createClient(),
RateLimiter = require('../ratelimiter'),
limits = require('./data');

fitbit = new RateLimiter("fitbit", limits[0], redisClient);
jawbone = new RateLimiter("jawbone", limits[1], redisClient);

blockedRequests = [],
allowedRequests = [];

// These are the callbacks for block and allow request
block = function(uid, limits) {
	blockedRequests.push(limits);
};

allow = function(uid) {
	allowedRequests.push(uid);
};

var singleLimitTests = require('./lib/singlelimit'),
	multiLimitTests = require('./lib/multilimit'),
	expireTests = require('./lib/expire');

describe("Single limit tests", function() {
	singleLimitTests();
})

describe("Multi limit tests", function() {
	multiLimitTests();
});

describe("Expire tests", function() {
	expireTests();
});
<|edits_diff|>
--- test/index.js
+++ test/index.js
@@ -4,9 +4,11 @@
 RateLimiter = require('../ratelimiter'),
 limits = require('./data');

+// Initialize two different rate limiters with different limits
 fitbit = new RateLimiter("fitbit", limits[0], redisClient);
 jawbone = new RateLimiter("jawbone", limits[1], redisClient);

+// Allowed and blocked requests will be stored in these arrays
 blockedRequests = [],
 allowedRequests = [];

<|current_version|>
expect = require('chai').expect,
redis = require('redis'),
redisClient = redis.createClient(),
RateLimiter = require('../ratelimiter'),
limits = require('./data');

// Initialize two different rate limiters with different limits
fitbit = new RateLimiter("fitbit", limits[0], redisClient);
jawbone = new RateLimiter("jawbone", limits[1], redisClient);

// Allowed and blocked requests will be stored in these arrays
blockedRequests = [],
allowedRequests = [];

// These are the callbacks for block and allow request
block = function(uid, limits) {
	blockedRequests.push(limits);
};

allow = function(uid) {
	allowedRequests.push(uid);
};

var singleLimitTests = require('./lib/singlelimit'),
	multiLimitTests = require('./lib/multilimit'),
	expireTests = require('./lib/expire');

describe("Single limit tests", function() {
	singleLimitTests();
})

describe("Multi limit tests", function() {
	multiLimitTests();
});

describe("Expire tests", function() {
	expireTests();
});

<|next_version|>
expect = require('chai').expect,
redis = require('redis'),
redisClient = redis.createClient(),
RateLimiter = require('../ratelimiter'),
limits = require('./data');

// Initialize two different rate limiters with different limits
fitbit = new RateLimiter("fitbit", limits[0], redisClient);
jawbone = new RateLimiter("jawbone", limits[1], redisClient);

// Allowed and blocked requests will be stored in these arrays
blockedRequests = [],
allowedRequests = [];

// These are the callbacks for block and allow request
block = function(uid, limits) {
	blockedRequests.push(limits);
};

allow = function(uid) {
	allowedRequests.push(uid);
};

// Run all the tests
var singleLimitTests = require('./lib/singlelimit'),
	multiLimitTests = require('./lib/multilimit'),
	expireTests = require('./lib/expire');

describe("Single limit tests", function() {
	singleLimitTests();
})

describe("Multi limit tests", function() {
	multiLimitTests();
});

describe("Expire tests", function() {
	expireTests();
});


Include options and background files in packaging

--- scripts/package.js
+++ scripts/package.js
@@ -23,11 +23,16 @@
     jsonfile.writeFile('dist/' + manifestFile, manifest);

     fileList.push(manifest.options_page);
+    fileList.push('src/options.js');

     manifest.content_scripts.forEach(function (scripts) {
         (scripts.css.concat(scripts.js)).forEach(function (file) {
             fileList.push(file);
         });
+    });
+
+    manifest.background.scripts.forEach(function (file) {
+        fileList.push(file);
     });

     var zipFile = 'dist/' + manifest.short_name + '-' + manifest.version + '.zip';

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

var fs = require('fs');
var exec = require('child_process').exec;
var jsonfile = require('jsonfile');

var manifestFile = 'manifest.json';

fs.readFile(manifestFile, 'UTF-8', function (err, data) {
    if (err) {
        console.log('Error!', err);
    }
    var manifest = JSON.parse(data);
    var fileList = [
        '_locales/**/*',
        'icons/*'
    ];

    if(process.env.CIRCLE_BUILD_NUM) {
        manifest.version = manifest.version + '.' + process.env.CIRCLE_BUILD_NUM;
    }

    jsonfile.writeFile('dist/' + manifestFile, manifest);

    fileList.push(manifest.options_page);

    manifest.content_scripts.forEach(function (scripts) {
        (scripts.css.concat(scripts.js)).forEach(function (file) {
            fileList.push(file);
        });
    });

    var zipFile = 'dist/' + manifest.short_name + '-' + manifest.version + '.zip';
    fileList.unshift(zipFile);
    var cmd = 'zip ' + fileList.join(' ') + ' && zip -j ' + zipFile + ' dist/manifest.json';

    exec(cmd, function(error, stdout, stderr) {
        if (error) {
            console.log('Error!', error, stderr);
        } else {
            console.log('All good! Chrome extension packaged into\n', zipFile);
        }
    });
});
<|edits_diff|>
--- scripts/package.js
+++ scripts/package.js
@@ -23,6 +23,7 @@
     jsonfile.writeFile('dist/' + manifestFile, manifest);

     fileList.push(manifest.options_page);
+    fileList.push('src/options.js');

     manifest.content_scripts.forEach(function (scripts) {
         (scripts.css.concat(scripts.js)).forEach(function (file) {
<|current_version|>
#! /usr/bin/env node

var fs = require('fs');
var exec = require('child_process').exec;
var jsonfile = require('jsonfile');

var manifestFile = 'manifest.json';

fs.readFile(manifestFile, 'UTF-8', function (err, data) {
    if (err) {
        console.log('Error!', err);
    }
    var manifest = JSON.parse(data);
    var fileList = [
        '_locales/**/*',
        'icons/*'
    ];

    if(process.env.CIRCLE_BUILD_NUM) {
        manifest.version = manifest.version + '.' + process.env.CIRCLE_BUILD_NUM;
    }

    jsonfile.writeFile('dist/' + manifestFile, manifest);

    fileList.push(manifest.options_page);
    fileList.push('src/options.js');

    manifest.content_scripts.forEach(function (scripts) {
        (scripts.css.concat(scripts.js)).forEach(function (file) {
            fileList.push(file);
        });
    });

    var zipFile = 'dist/' + manifest.short_name + '-' + manifest.version + '.zip';
    fileList.unshift(zipFile);
    var cmd = 'zip ' + fileList.join(' ') + ' && zip -j ' + zipFile + ' dist/manifest.json';

    exec(cmd, function(error, stdout, stderr) {
        if (error) {
            console.log('Error!', error, stderr);
        } else {
            console.log('All good! Chrome extension packaged into\n', zipFile);
        }
    });
});
<|next_version|>
#! /usr/bin/env node

var fs = require('fs');
var exec = require('child_process').exec;
var jsonfile = require('jsonfile');

var manifestFile = 'manifest.json';

fs.readFile(manifestFile, 'UTF-8', function (err, data) {
    if (err) {
        console.log('Error!', err);
    }
    var manifest = JSON.parse(data);
    var fileList = [
        '_locales/**/*',
        'icons/*'
    ];

    if(process.env.CIRCLE_BUILD_NUM) {
        manifest.version = manifest.version + '.' + process.env.CIRCLE_BUILD_NUM;
    }

    jsonfile.writeFile('dist/' + manifestFile, manifest);

    fileList.push(manifest.options_page);
    fileList.push('src/options.js');

    manifest.content_scripts.forEach(function (scripts) {
        (scripts.css.concat(scripts.js)).forEach(function (file) {
            fileList.push(file);
        });
    });

    manifest.background.scripts.forEach(function (file) {
        fileList.push(file);
    });

    var zipFile = 'dist/' + manifest.short_name + '-' + manifest.version + '.zip';
    fileList.unshift(zipFile);
    var cmd = 'zip ' + fileList.join(' ') + ' && zip -j ' + zipFile + ' dist/manifest.json';

    exec(cmd, function(error, stdout, stderr) {
        if (error) {
            console.log('Error!', error, stderr);
        } else {
            console.log('All good! Chrome extension packaged into\n', zipFile);
        }
    });
});


Add outputting Node version to config dumper rule

--- rules/configuration-dumper.js
+++ rules/configuration-dumper.js
@@ -2,6 +2,7 @@
   const _config = JSON.stringify(configuration, Object.keys(configuration).sort(), 2);
   const _context = JSON.stringify(context, null, 2);
   const _user = JSON.stringify(user, null, 2);
+  const _version = process.version;

   console.log(`
 Configuration Dump:
@@ -13,6 +14,9 @@

 User Dump:
 ${_user}
+
+Node Version:
+${_version}
 `);

   return callback(null, user, context);

<|original_code|>
function (user, context, callback) {
  const _config = JSON.stringify(configuration, Object.keys(configuration).sort(), 2);
  const _context = JSON.stringify(context, null, 2);
  const _user = JSON.stringify(user, null, 2);

  console.log(`
Configuration Dump:
${_config}

Context Dump:

${_context}

User Dump:
${_user}
`);

  return callback(null, user, context);
}

<|edits_diff|>
--- rules/configuration-dumper.js
+++ rules/configuration-dumper.js
@@ -2,6 +2,7 @@
   const _config = JSON.stringify(configuration, Object.keys(configuration).sort(), 2);
   const _context = JSON.stringify(context, null, 2);
   const _user = JSON.stringify(user, null, 2);
+  const _version = process.version;

   console.log(`
 Configuration Dump:
<|current_version|>
function (user, context, callback) {
  const _config = JSON.stringify(configuration, Object.keys(configuration).sort(), 2);
  const _context = JSON.stringify(context, null, 2);
  const _user = JSON.stringify(user, null, 2);
  const _version = process.version;

  console.log(`
Configuration Dump:
${_config}

Context Dump:

${_context}

User Dump:
${_user}
`);

  return callback(null, user, context);
}

<|next_version|>
function (user, context, callback) {
  const _config = JSON.stringify(configuration, Object.keys(configuration).sort(), 2);
  const _context = JSON.stringify(context, null, 2);
  const _user = JSON.stringify(user, null, 2);
  const _version = process.version;

  console.log(`
Configuration Dump:
${_config}

Context Dump:

${_context}

User Dump:
${_user}

Node Version:
${_version}
`);

  return callback(null, user, context);
}


Print error messages to the console as well

--- blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js
+++ blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js
@@ -11,16 +11,19 @@
       Ember.onerror = function (error) {
         Bugsnag.context = container.lookup('router:main').get('location').getURL();
         Bugsnag.notifyException(error);
+        console.error(error.stack);
       };

       Ember.RSVP.on('error', function(error) {
         Bugsnag.context = container.lookup('router:main').get('location').getURL();
         Bugsnag.notifyException(error);
+        console.error(error.stack);
       });

       Ember.Logger.error = function (message, cause, stack) {
         Bugsnag.context = container.lookup('router:main').get('location').getURL();
         Bugsnag.notifyException(new Error(message), null, { cause: cause, stack: stack });
+        console.error(stack);
       };
     }
   }

<|original_code|>
import Ember  from 'ember';
import config from '../config/environment';

var currentEnv = config.environment;

export default {
  name: 'bugsnag-error-service',

  initialize: function(container) {
    if (currentEnv !== 'test' && Bugsnag.notifyReleaseStages.indexOf(currentEnv) !== -1) {
      Ember.onerror = function (error) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(error);
      };

      Ember.RSVP.on('error', function(error) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(error);
      });

      Ember.Logger.error = function (message, cause, stack) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(new Error(message), null, { cause: cause, stack: stack });
      };
    }
  }
};

<|edits_diff|>
--- blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js
+++ blueprints/ember-cli-bugsnag/files/app/initializers/bugsnag.js
@@ -11,11 +11,13 @@
       Ember.onerror = function (error) {
         Bugsnag.context = container.lookup('router:main').get('location').getURL();
         Bugsnag.notifyException(error);
+        console.error(error.stack);
       };

       Ember.RSVP.on('error', function(error) {
         Bugsnag.context = container.lookup('router:main').get('location').getURL();
         Bugsnag.notifyException(error);
+        console.error(error.stack);
       });

       Ember.Logger.error = function (message, cause, stack) {
<|current_version|>
import Ember  from 'ember';
import config from '../config/environment';

var currentEnv = config.environment;

export default {
  name: 'bugsnag-error-service',

  initialize: function(container) {
    if (currentEnv !== 'test' && Bugsnag.notifyReleaseStages.indexOf(currentEnv) !== -1) {
      Ember.onerror = function (error) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(error);
        console.error(error.stack);
      };

      Ember.RSVP.on('error', function(error) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(error);
        console.error(error.stack);
      });

      Ember.Logger.error = function (message, cause, stack) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(new Error(message), null, { cause: cause, stack: stack });
      };
    }
  }
};

<|next_version|>
import Ember  from 'ember';
import config from '../config/environment';

var currentEnv = config.environment;

export default {
  name: 'bugsnag-error-service',

  initialize: function(container) {
    if (currentEnv !== 'test' && Bugsnag.notifyReleaseStages.indexOf(currentEnv) !== -1) {
      Ember.onerror = function (error) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(error);
        console.error(error.stack);
      };

      Ember.RSVP.on('error', function(error) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(error);
        console.error(error.stack);
      });

      Ember.Logger.error = function (message, cause, stack) {
        Bugsnag.context = container.lookup('router:main').get('location').getURL();
        Bugsnag.notifyException(new Error(message), null, { cause: cause, stack: stack });
        console.error(stack);
      };
    }
  }
};


Fix loading of select2 lib

Fix loading of select2 lib

Signed-off-by: Christoph Wurst <7abde52c298496fa169fb750f91f213a282142af@winzerhof-wurst.at>

--- src/weinstein.js
+++ src/weinstein.js
@@ -2,10 +2,14 @@
 import '@babel/polyfill'
 import {init} from '@sentry/browser';
 import 'bootstrap'
+import 'select2/dist/css/select2.css'
+import 'select2/dist/js/select2'
+import 'select2/dist/js/i18n/de'

 import './style/weinstein.less';

 import {addGlobal} from './globals';
+import './entertab'
 import {TastersView} from './views/tasterview';
 import {retastebutton} from './retastebutton';
 import {setUser} from './user';

<|original_code|>
import $ from 'jquery'
import '@babel/polyfill'
import {init} from '@sentry/browser';
import 'bootstrap'

import './style/weinstein.less';

import {addGlobal} from './globals';
import {TastersView} from './views/tasterview';
import {retastebutton} from './retastebutton';
import {setUser} from './user';
import {WineCollection} from './models/wine';
import {WinesView} from './views/wineview';

// TODO: refactor away from these globals
addGlobal('$', $);
addGlobal('TastersView', TastersView);
addGlobal('retastebutton', retastebutton);
addGlobal('WineCollection', WineCollection);
addGlobal('WinesView', WinesView);
addGlobal('setUser', setUser);

console.debug('Weinstein dependencies and scripts loaded');

window.wsinit = ({csrfToken, dsn, release, environment}) => {
    $(function () {
        $.ajaxSetup({
            headers: {'X-CSRF-TOKEN': csrfToken}
        });
    });

    try {
        init({
            dsn,
            release,
            environment
        })
    } catch (e) {
        console.error('Could not initialize Sentry:', e)
    }

    console.info('Weinstein initialized');
}

<|edits_diff|>
--- src/weinstein.js
+++ src/weinstein.js
@@ -2,6 +2,9 @@
 import '@babel/polyfill'
 import {init} from '@sentry/browser';
 import 'bootstrap'
+import 'select2/dist/css/select2.css'
+import 'select2/dist/js/select2'
+import 'select2/dist/js/i18n/de'

 import './style/weinstein.less';

<|current_version|>
import $ from 'jquery'
import '@babel/polyfill'
import {init} from '@sentry/browser';
import 'bootstrap'
import 'select2/dist/css/select2.css'
import 'select2/dist/js/select2'
import 'select2/dist/js/i18n/de'

import './style/weinstein.less';

import {addGlobal} from './globals';
import {TastersView} from './views/tasterview';
import {retastebutton} from './retastebutton';
import {setUser} from './user';
import {WineCollection} from './models/wine';
import {WinesView} from './views/wineview';

// TODO: refactor away from these globals
addGlobal('$', $);
addGlobal('TastersView', TastersView);
addGlobal('retastebutton', retastebutton);
addGlobal('WineCollection', WineCollection);
addGlobal('WinesView', WinesView);
addGlobal('setUser', setUser);

console.debug('Weinstein dependencies and scripts loaded');

window.wsinit = ({csrfToken, dsn, release, environment}) => {
    $(function () {
        $.ajaxSetup({
            headers: {'X-CSRF-TOKEN': csrfToken}
        });
    });

    try {
        init({
            dsn,
            release,
            environment
        })
    } catch (e) {
        console.error('Could not initialize Sentry:', e)
    }

    console.info('Weinstein initialized');
}

<|next_version|>
import $ from 'jquery'
import '@babel/polyfill'
import {init} from '@sentry/browser';
import 'bootstrap'
import 'select2/dist/css/select2.css'
import 'select2/dist/js/select2'
import 'select2/dist/js/i18n/de'

import './style/weinstein.less';

import {addGlobal} from './globals';
import './entertab'
import {TastersView} from './views/tasterview';
import {retastebutton} from './retastebutton';
import {setUser} from './user';
import {WineCollection} from './models/wine';
import {WinesView} from './views/wineview';

// TODO: refactor away from these globals
addGlobal('$', $);
addGlobal('TastersView', TastersView);
addGlobal('retastebutton', retastebutton);
addGlobal('WineCollection', WineCollection);
addGlobal('WinesView', WinesView);
addGlobal('setUser', setUser);

console.debug('Weinstein dependencies and scripts loaded');

window.wsinit = ({csrfToken, dsn, release, environment}) => {
    $(function () {
        $.ajaxSetup({
            headers: {'X-CSRF-TOKEN': csrfToken}
        });
    });

    try {
        init({
            dsn,
            release,
            environment
        })
    } catch (e) {
        console.error('Could not initialize Sentry:', e)
    }

    console.info('Weinstein initialized');
}


Add redirect to /login page.

Add redirect to /login page.

--- index.js
+++ index.js
@@ -25,7 +25,11 @@
     res.render('login');
 });
 app.use('/' + conf.version + '/api', require('./api'));
+
 app.get('/', function (req, res) {
+    if(!req.session.user){
+        return res.redirect('/login');
+    }
     res.render('index');
 });

<|original_code|>
var ejs = require('ejs');
var path = require('path');
var conf = require('./conf');
var express = require('express');
var favicon = require('serve-favicon');
var bodyParser = require('body-parser');
var session = require('express-session');

publicPath = path.join(__dirname, 'pub');
viewsPath = path.join(__dirname, 'views');
faviconPath = path.join(__dirname, '/pub/favicon.ico');

var app = express();
app.use(bodyParser.json());
app.set('views', viewsPath);
app.use(favicon(faviconPath));
app.use(session(conf.session));
app.use(express.static(publicPath));
app.use(bodyParser.urlencoded({ extended: false }));

app.engine('html', ejs.__express);
app.set('view engine', 'html');

app.get('/login', function (req, res) {
    res.render('login');
});
app.use('/' + conf.version + '/api', require('./api'));
app.get('/', function (req, res) {
    res.render('index');
});

// production error handler
app.use(function (err, req, res, next) {
    console.error(err.stack);
    res.status(500).render('error');
});

app.listen(conf.port, function (err) {
    if (err) {
        console.log('Create server fail!');
    } else {
        console.log('%s listening at %s', conf.path, conf.port);
    }
});
<|edits_diff|>
--- index.js
+++ index.js
@@ -25,6 +25,7 @@
     res.render('login');
 });
 app.use('/' + conf.version + '/api', require('./api'));
+
 app.get('/', function (req, res) {
     res.render('index');
 });
<|current_version|>
var ejs = require('ejs');
var path = require('path');
var conf = require('./conf');
var express = require('express');
var favicon = require('serve-favicon');
var bodyParser = require('body-parser');
var session = require('express-session');

publicPath = path.join(__dirname, 'pub');
viewsPath = path.join(__dirname, 'views');
faviconPath = path.join(__dirname, '/pub/favicon.ico');

var app = express();
app.use(bodyParser.json());
app.set('views', viewsPath);
app.use(favicon(faviconPath));
app.use(session(conf.session));
app.use(express.static(publicPath));
app.use(bodyParser.urlencoded({ extended: false }));

app.engine('html', ejs.__express);
app.set('view engine', 'html');

app.get('/login', function (req, res) {
    res.render('login');
});
app.use('/' + conf.version + '/api', require('./api'));

app.get('/', function (req, res) {
    res.render('index');
});

// production error handler
app.use(function (err, req, res, next) {
    console.error(err.stack);
    res.status(500).render('error');
});

app.listen(conf.port, function (err) {
    if (err) {
        console.log('Create server fail!');
    } else {
        console.log('%s listening at %s', conf.path, conf.port);
    }
});
<|next_version|>
var ejs = require('ejs');
var path = require('path');
var conf = require('./conf');
var express = require('express');
var favicon = require('serve-favicon');
var bodyParser = require('body-parser');
var session = require('express-session');

publicPath = path.join(__dirname, 'pub');
viewsPath = path.join(__dirname, 'views');
faviconPath = path.join(__dirname, '/pub/favicon.ico');

var app = express();
app.use(bodyParser.json());
app.set('views', viewsPath);
app.use(favicon(faviconPath));
app.use(session(conf.session));
app.use(express.static(publicPath));
app.use(bodyParser.urlencoded({ extended: false }));

app.engine('html', ejs.__express);
app.set('view engine', 'html');

app.get('/login', function (req, res) {
    res.render('login');
});
app.use('/' + conf.version + '/api', require('./api'));

app.get('/', function (req, res) {
    if(!req.session.user){
        return res.redirect('/login');
    }
    res.render('index');
});

// production error handler
app.use(function (err, req, res, next) {
    console.error(err.stack);
    res.status(500).render('error');
});

app.listen(conf.port, function (err) {
    if (err) {
        console.log('Create server fail!');
    } else {
        console.log('%s listening at %s', conf.path, conf.port);
    }
});


Allow layout and theme opt-out

Allow layout and theme opt-out

--- routes/edit/screens/project/components/toolbar/PreviewTools.js
+++ routes/edit/screens/project/components/toolbar/PreviewTools.js
@@ -7,6 +7,7 @@

       Layout:
       <select value={layout} onChange={onLayoutChanged}>
+        <option value="none">None</option>
         <option value="blog">Blog</option>
         <option value="centered">Centered</option>
       </select>
@@ -14,6 +15,7 @@

       Theme:
       <select value={theme} onChange={onThemeChanged}>
+        <option value="none">None</option>
         <option value="idyll">Idyll</option>
         <option value="github">GitHub</option>
       </select>

<|original_code|>
import React from 'react'

import styles from './PreviewTools.styl'

export default ({ href, layout, theme, onLayoutChanged, onThemeChanged }) =>

      Layout:
      <select value={layout} onChange={onLayoutChanged}>
        <option value="blog">Blog</option>
        <option value="centered">Centered</option>
      </select>

      Theme:
      <select value={theme} onChange={onThemeChanged}>
        <option value="idyll">Idyll</option>
        <option value="github">GitHub</option>
      </select>

      Open in New Window

<|edits_diff|>
--- routes/edit/screens/project/components/toolbar/PreviewTools.js
+++ routes/edit/screens/project/components/toolbar/PreviewTools.js
@@ -7,6 +7,7 @@

       Layout:
       <select value={layout} onChange={onLayoutChanged}>
+        <option value="none">None</option>
         <option value="blog">Blog</option>
         <option value="centered">Centered</option>
       </select>
<|current_version|>
import React from 'react'

import styles from './PreviewTools.styl'

export default ({ href, layout, theme, onLayoutChanged, onThemeChanged }) =>

      Layout:
      <select value={layout} onChange={onLayoutChanged}>
        <option value="none">None</option>
        <option value="blog">Blog</option>
        <option value="centered">Centered</option>
      </select>

      Theme:
      <select value={theme} onChange={onThemeChanged}>
        <option value="idyll">Idyll</option>
        <option value="github">GitHub</option>
      </select>

      Open in New Window

<|next_version|>
import React from 'react'

import styles from './PreviewTools.styl'

export default ({ href, layout, theme, onLayoutChanged, onThemeChanged }) =>

      Layout:
      <select value={layout} onChange={onLayoutChanged}>
        <option value="none">None</option>
        <option value="blog">Blog</option>
        <option value="centered">Centered</option>
      </select>

      Theme:
      <select value={theme} onChange={onThemeChanged}>
        <option value="none">None</option>
        <option value="idyll">Idyll</option>
        <option value="github">GitHub</option>
      </select>

      Open in New Window


Update eslint with babel-eslint parser

Update eslint with babel-eslint parser

--- .eslintrc.js
+++ .eslintrc.js
@@ -18,7 +18,9 @@
     beforeEach: 'readonly',
     it: 'readonly',
     expect: 'readonly',
+    process: 'readonly',
   },
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaFeatures: {
       jsx: true,
@@ -28,6 +30,7 @@
   },
   plugins: [
     'react',
+    'babel',
   ],
   rules: {
     'class-methods-use-this': 'off',

<|original_code|>
module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: [
    'airbnb',
    'plugin:import/errors',
    'plugin:import/warnings'
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
    PRODUCTION: 'readonly',
    SSR: 'readonly',
    jest: 'readonly',
    describe: 'readonly',
    beforeEach: 'readonly',
    it: 'readonly',
    expect: 'readonly',
  },
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2018,
    sourceType: 'module',
  },
  plugins: [
    'react',
  ],
  rules: {
    'class-methods-use-this': 'off',
    'import/namespace': ['on', { allowComputed: true }],
    'import/no-duplicates': 'off',
    'import/prefer-default-export': 'off',
    'eact/jsx-filename-extension': 'off',
    'no-underscore-dangle': 'off',
    'react/jsx-filename-extension': 'off',
    'react/prefer-stateless-function': 'off',
    'no-use-before-define': 'off',
  },
  settings: {
    'import/resolver': {
      webpack: {
        config: './config/webpack/webpack.config.client.babel.js'
      }
    }
  }
};

<|edits_diff|>
--- .eslintrc.js
+++ .eslintrc.js
@@ -18,7 +18,9 @@
     beforeEach: 'readonly',
     it: 'readonly',
     expect: 'readonly',
+    process: 'readonly',
   },
+  parser: 'babel-eslint',
   parserOptions: {
     ecmaFeatures: {
       jsx: true,
<|current_version|>
module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: [
    'airbnb',
    'plugin:import/errors',
    'plugin:import/warnings'
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
    PRODUCTION: 'readonly',
    SSR: 'readonly',
    jest: 'readonly',
    describe: 'readonly',
    beforeEach: 'readonly',
    it: 'readonly',
    expect: 'readonly',
    process: 'readonly',
  },
  parser: 'babel-eslint',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2018,
    sourceType: 'module',
  },
  plugins: [
    'react',
  ],
  rules: {
    'class-methods-use-this': 'off',
    'import/namespace': ['on', { allowComputed: true }],
    'import/no-duplicates': 'off',
    'import/prefer-default-export': 'off',
    'eact/jsx-filename-extension': 'off',
    'no-underscore-dangle': 'off',
    'react/jsx-filename-extension': 'off',
    'react/prefer-stateless-function': 'off',
    'no-use-before-define': 'off',
  },
  settings: {
    'import/resolver': {
      webpack: {
        config: './config/webpack/webpack.config.client.babel.js'
      }
    }
  }
};

<|next_version|>
module.exports = {
  env: {
    browser: true,
    es6: true,
  },
  extends: [
    'airbnb',
    'plugin:import/errors',
    'plugin:import/warnings'
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
    PRODUCTION: 'readonly',
    SSR: 'readonly',
    jest: 'readonly',
    describe: 'readonly',
    beforeEach: 'readonly',
    it: 'readonly',
    expect: 'readonly',
    process: 'readonly',
  },
  parser: 'babel-eslint',
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2018,
    sourceType: 'module',
  },
  plugins: [
    'react',
    'babel',
  ],
  rules: {
    'class-methods-use-this': 'off',
    'import/namespace': ['on', { allowComputed: true }],
    'import/no-duplicates': 'off',
    'import/prefer-default-export': 'off',
    'eact/jsx-filename-extension': 'off',
    'no-underscore-dangle': 'off',
    'react/jsx-filename-extension': 'off',
    'react/prefer-stateless-function': 'off',
    'no-use-before-define': 'off',
  },
  settings: {
    'import/resolver': {
      webpack: {
        config: './config/webpack/webpack.config.client.babel.js'
      }
    }
  }
};


Add some extras to props

Add some extras to props

--- lib/properties.js
+++ lib/properties.js
@@ -1,10 +1,12 @@
 const date = new Date();
+const [major, minor, patch] = process.versions.node.split('.');
 export const defaults = {
   date: {
     day: date.getDate(),
     month: date.getMonth(),
     fullYear: date.getFullYear()
   },
+  node: {major, minor, patch},
   user: {
     name: '',
     github: '',
@@ -13,6 +15,10 @@
   package: {
     name: '',
     description: ''
+  },
+  curly: {
+    left: '{',
+    right: '}'
   }
 };

<|original_code|>
const date = new Date();
export const defaults = {
  date: {
    day: date.getDate(),
    month: date.getMonth(),
    fullYear: date.getFullYear()
  },
  user: {
    name: '',
    github: '',
    email: ''
  },
  package: {
    name: '',
    description: ''
  }
};

export const properties = {
  'user.name': {
    description: 'Your name: ',
    message: 'Required',
    required: true
  },
  'user.email': {
    description: 'Your email (will be publicly available, optional): ',
    pattern: /@/,
    message: 'Should be a valid e-mail'
  },
  'user.github': {
    description: 'Your GitHub public username: ',
    pattern: /^[a-z0-9]+[a-z0-9\-]+[a-z0-9]+$/i,
    message: 'Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen',
    required: true
  },
  'package.name': {
    description: 'Package name: ',
    pattern: /^[a-z0-9]+[a-z0-9\-_]+$/,
    message: 'Package name may only contain alphanumeric characters, hyphens or underscores',
    required: true
  },
  'package.description': {
    description: 'Package description: '
  }
};

<|edits_diff|>
--- lib/properties.js
+++ lib/properties.js
@@ -1,10 +1,12 @@
 const date = new Date();
+const [major, minor, patch] = process.versions.node.split('.');
 export const defaults = {
   date: {
     day: date.getDate(),
     month: date.getMonth(),
     fullYear: date.getFullYear()
   },
+  node: {major, minor, patch},
   user: {
     name: '',
     github: '',
<|current_version|>
const date = new Date();
const [major, minor, patch] = process.versions.node.split('.');
export const defaults = {
  date: {
    day: date.getDate(),
    month: date.getMonth(),
    fullYear: date.getFullYear()
  },
  node: {major, minor, patch},
  user: {
    name: '',
    github: '',
    email: ''
  },
  package: {
    name: '',
    description: ''
  }
};

export const properties = {
  'user.name': {
    description: 'Your name: ',
    message: 'Required',
    required: true
  },
  'user.email': {
    description: 'Your email (will be publicly available, optional): ',
    pattern: /@/,
    message: 'Should be a valid e-mail'
  },
  'user.github': {
    description: 'Your GitHub public username: ',
    pattern: /^[a-z0-9]+[a-z0-9\-]+[a-z0-9]+$/i,
    message: 'Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen',
    required: true
  },
  'package.name': {
    description: 'Package name: ',
    pattern: /^[a-z0-9]+[a-z0-9\-_]+$/,
    message: 'Package name may only contain alphanumeric characters, hyphens or underscores',
    required: true
  },
  'package.description': {
    description: 'Package description: '
  }
};

<|next_version|>
const date = new Date();
const [major, minor, patch] = process.versions.node.split('.');
export const defaults = {
  date: {
    day: date.getDate(),
    month: date.getMonth(),
    fullYear: date.getFullYear()
  },
  node: {major, minor, patch},
  user: {
    name: '',
    github: '',
    email: ''
  },
  package: {
    name: '',
    description: ''
  },
  curly: {
    left: '{',
    right: '}'
  }
};

export const properties = {
  'user.name': {
    description: 'Your name: ',
    message: 'Required',
    required: true
  },
  'user.email': {
    description: 'Your email (will be publicly available, optional): ',
    pattern: /@/,
    message: 'Should be a valid e-mail'
  },
  'user.github': {
    description: 'Your GitHub public username: ',
    pattern: /^[a-z0-9]+[a-z0-9\-]+[a-z0-9]+$/i,
    message: 'Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen',
    required: true
  },
  'package.name': {
    description: 'Package name: ',
    pattern: /^[a-z0-9]+[a-z0-9\-_]+$/,
    message: 'Package name may only contain alphanumeric characters, hyphens or underscores',
    required: true
  },
  'package.description': {
    description: 'Package description: '
  }
};


Clear screen before displaying results

Clear screen before displaying results

--- lib/pf.js
+++ lib/pf.js
@@ -15,6 +15,7 @@
 var gm = require('./green-man-scraper');
 var gog = require('./gog-scraper');
 var steam = require('./steam-scraper');
+var clear = require('clear');

 const chalk = require('chalk');
 var colorLegend = "Prices in " + chalk.green("green") + " are current sale prices, shown next to their normal price in " + chalk.gray("gray") + ".";
@@ -32,6 +33,7 @@
 program.parse(process.argv);

 if (program.title) {
+    clear();
     console.log(colorLegend + "\n" + divider);
     amazon(program);
     gm(program);

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

/*
 * pilot-fish
 * https://github.com/jeffminnear/pilot-fish
 *
 * Copyright (c) 2016 Jeff Minnear
 * Licensed under the MIT license.
 */

'use strict';

var program = require('commander');
var amazon = require('./amazon-scraper');
var gm = require('./green-man-scraper');
var gog = require('./gog-scraper');
var steam = require('./steam-scraper');

const chalk = require('chalk');
var colorLegend = "Prices in " + chalk.green("green") + " are current sale prices, shown next to their normal price in " + chalk.gray("gray") + ".";
var divider =     "==================================================================================";

program
    .version('0.0.1')
    .arguments('<title> [limit]')
    .action(function (title, limit) {
        program.title = title;
        program.limit = limit;
    });

program.parse(process.argv);

if (program.title) {
    console.log(colorLegend + "\n" + divider);
    amazon(program);
    gm(program);
    gog(program);
    steam(program);
} else {
    console.log(chalk.red("Sorry, you must specify a title\nFor example: pf 'dark souls'"));
}

<|edits_diff|>
--- lib/pf.js
+++ lib/pf.js
@@ -15,6 +15,7 @@
 var gm = require('./green-man-scraper');
 var gog = require('./gog-scraper');
 var steam = require('./steam-scraper');
+var clear = require('clear');

 const chalk = require('chalk');
 var colorLegend = "Prices in " + chalk.green("green") + " are current sale prices, shown next to their normal price in " + chalk.gray("gray") + ".";
<|current_version|>
#! /usr/bin/env node

/*
 * pilot-fish
 * https://github.com/jeffminnear/pilot-fish
 *
 * Copyright (c) 2016 Jeff Minnear
 * Licensed under the MIT license.
 */

'use strict';

var program = require('commander');
var amazon = require('./amazon-scraper');
var gm = require('./green-man-scraper');
var gog = require('./gog-scraper');
var steam = require('./steam-scraper');
var clear = require('clear');

const chalk = require('chalk');
var colorLegend = "Prices in " + chalk.green("green") + " are current sale prices, shown next to their normal price in " + chalk.gray("gray") + ".";
var divider =     "==================================================================================";

program
    .version('0.0.1')
    .arguments('<title> [limit]')
    .action(function (title, limit) {
        program.title = title;
        program.limit = limit;
    });

program.parse(process.argv);

if (program.title) {
    console.log(colorLegend + "\n" + divider);
    amazon(program);
    gm(program);
    gog(program);
    steam(program);
} else {
    console.log(chalk.red("Sorry, you must specify a title\nFor example: pf 'dark souls'"));
}

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

/*
 * pilot-fish
 * https://github.com/jeffminnear/pilot-fish
 *
 * Copyright (c) 2016 Jeff Minnear
 * Licensed under the MIT license.
 */

'use strict';

var program = require('commander');
var amazon = require('./amazon-scraper');
var gm = require('./green-man-scraper');
var gog = require('./gog-scraper');
var steam = require('./steam-scraper');
var clear = require('clear');

const chalk = require('chalk');
var colorLegend = "Prices in " + chalk.green("green") + " are current sale prices, shown next to their normal price in " + chalk.gray("gray") + ".";
var divider =     "==================================================================================";

program
    .version('0.0.1')
    .arguments('<title> [limit]')
    .action(function (title, limit) {
        program.title = title;
        program.limit = limit;
    });

program.parse(process.argv);

if (program.title) {
    clear();
    console.log(colorLegend + "\n" + divider);
    amazon(program);
    gm(program);
    gog(program);
    steam(program);
} else {
    console.log(chalk.red("Sorry, you must specify a title\nFor example: pf 'dark souls'"));
}


Handle also .pm and .pl file types

Handle also .pm and .pl file types

--- lib/file-icons.js
+++ lib/file-icons.js
@@ -25,8 +25,10 @@
     } else if (fs.isBinaryExtension(extension)) {
       return 'icon-file-binary'
     } else if (extension == ".pm6" ||
+               extension == ".pm"  ||
                extension == ".pl6" ||
                extension == ".p6"  ||
+               extension == ".pl"  ||
                extension == ".t") {
       return 'icon-file-perl6'
     }

<|original_code|>
"use babel";

fs = require('fs-plus')

/**
 * This class provides the file-icons service API implemented by tree-view
 * Please see https://github.com/atom/tree-view#api
 */
module.exports =
class Perl6FileIconsProvider {

  iconClassForPath(filePath) {
    extension = path.extname(filePath)

    if (fs.isSymbolicLinkSync(filePath)) {
      return 'icon-file-symlink-file'
    } else if (fs.isReadmePath(filePath)) {
      return 'icon-book'
    } else if (fs.isCompressedExtension(extension)) {
      return 'icon-file-zip'
    } else if (fs.isImageExtension(extension)) {
      return 'icon-file-media'
    } else if (fs.isPdfExtension(extension)) {
      return 'icon-file-pdf'
    } else if (fs.isBinaryExtension(extension)) {
      return 'icon-file-binary'
    } else if (extension == ".pm6" ||
               extension == ".pl6" ||
               extension == ".p6"  ||
               extension == ".t") {
      return 'icon-file-perl6'
    }
    else {
      return 'icon-file-text'
    }
  }

  onWillDeactivate(fn) {
    return
  }
}
<|edits_diff|>
--- lib/file-icons.js
+++ lib/file-icons.js
@@ -25,6 +25,7 @@
     } else if (fs.isBinaryExtension(extension)) {
       return 'icon-file-binary'
     } else if (extension == ".pm6" ||
+               extension == ".pm"  ||
                extension == ".pl6" ||
                extension == ".p6"  ||
                extension == ".t") {
<|current_version|>
"use babel";

fs = require('fs-plus')

/**
 * This class provides the file-icons service API implemented by tree-view
 * Please see https://github.com/atom/tree-view#api
 */
module.exports =
class Perl6FileIconsProvider {

  iconClassForPath(filePath) {
    extension = path.extname(filePath)

    if (fs.isSymbolicLinkSync(filePath)) {
      return 'icon-file-symlink-file'
    } else if (fs.isReadmePath(filePath)) {
      return 'icon-book'
    } else if (fs.isCompressedExtension(extension)) {
      return 'icon-file-zip'
    } else if (fs.isImageExtension(extension)) {
      return 'icon-file-media'
    } else if (fs.isPdfExtension(extension)) {
      return 'icon-file-pdf'
    } else if (fs.isBinaryExtension(extension)) {
      return 'icon-file-binary'
    } else if (extension == ".pm6" ||
               extension == ".pm"  ||
               extension == ".pl6" ||
               extension == ".p6"  ||
               extension == ".t") {
      return 'icon-file-perl6'
    }
    else {
      return 'icon-file-text'
    }
  }

  onWillDeactivate(fn) {
    return
  }
}
<|next_version|>
"use babel";

fs = require('fs-plus')

/**
 * This class provides the file-icons service API implemented by tree-view
 * Please see https://github.com/atom/tree-view#api
 */
module.exports =
class Perl6FileIconsProvider {

  iconClassForPath(filePath) {
    extension = path.extname(filePath)

    if (fs.isSymbolicLinkSync(filePath)) {
      return 'icon-file-symlink-file'
    } else if (fs.isReadmePath(filePath)) {
      return 'icon-book'
    } else if (fs.isCompressedExtension(extension)) {
      return 'icon-file-zip'
    } else if (fs.isImageExtension(extension)) {
      return 'icon-file-media'
    } else if (fs.isPdfExtension(extension)) {
      return 'icon-file-pdf'
    } else if (fs.isBinaryExtension(extension)) {
      return 'icon-file-binary'
    } else if (extension == ".pm6" ||
               extension == ".pm"  ||
               extension == ".pl6" ||
               extension == ".p6"  ||
               extension == ".pl"  ||
               extension == ".t") {
      return 'icon-file-perl6'
    }
    else {
      return 'icon-file-text'
    }
  }

  onWillDeactivate(fn) {
    return
  }
}


Add events to tx log

Add events to tx log

--- app/transactor.js
+++ app/transactor.js
@@ -5,11 +5,16 @@
   data: spec.object,
 });

+
+let txLog = [];
+
+
 const validateEvent = function (evt) {
   return valid(EventSpec, evt);
 };

 const novelty = function (evt) {
+  txLog.push(evt);
   console.log(evt);
 };

<|original_code|>
const {spec, valid} = require("js.spec");

const EventSpec = spec.map({
  type: spec.string,
  data: spec.object,
});

const validateEvent = function (evt) {
  return valid(EventSpec, evt);
};

const novelty = function (evt) {
  console.log(evt);
};

module.exports = {
  validateEvent: validateEvent,
  novelty: novelty
};

<|edits_diff|>
--- app/transactor.js
+++ app/transactor.js
@@ -4,6 +4,10 @@
   type: spec.string,
   data: spec.object,
 });
+
+
+let txLog = [];
+

 const validateEvent = function (evt) {
   return valid(EventSpec, evt);
<|current_version|>
const {spec, valid} = require("js.spec");

const EventSpec = spec.map({
  type: spec.string,
  data: spec.object,
});

let txLog = [];

const validateEvent = function (evt) {
  return valid(EventSpec, evt);
};

const novelty = function (evt) {
  console.log(evt);
};

module.exports = {
  validateEvent: validateEvent,
  novelty: novelty
};

<|next_version|>
const {spec, valid} = require("js.spec");

const EventSpec = spec.map({
  type: spec.string,
  data: spec.object,
});

let txLog = [];

const validateEvent = function (evt) {
  return valid(EventSpec, evt);
};

const novelty = function (evt) {
  txLog.push(evt);
  console.log(evt);
};

module.exports = {
  validateEvent: validateEvent,
  novelty: novelty
};


Add fr and it translations

Add fr and it translations

--- src/js/lang.js
+++ src/js/lang.js
@@ -6,6 +6,8 @@
 import 'dayjs/locale/zh-tw';
 import 'dayjs/locale/ru';
 import 'dayjs/locale/uk';
+import 'dayjs/locale/fr';
+import 'dayjs/locale/it';

 export const langText = {
   ca: { wind: 'Vent', humidity: 'Humitat' },
@@ -17,4 +19,6 @@
   zh_tw: { wind: '風速', humidity: '濕度' },
   ru: { wind: 'Ветер', humidity: 'Влажность' },
   uk: { wind: 'Вітер', humidity: 'Вологість' },
+  fr: { wind: 'Vent', humidity: 'Humidité' },
+  it: { wind: 'Vento', humidity: 'Umidità' },
 };

<|original_code|>
import 'dayjs/locale/ca';
import 'dayjs/locale/es';
import 'dayjs/locale/de';
import 'dayjs/locale/sl';
import 'dayjs/locale/ja';
import 'dayjs/locale/zh-tw';
import 'dayjs/locale/ru';
import 'dayjs/locale/uk';

export const langText = {
  ca: { wind: 'Vent', humidity: 'Humitat' },
  en: { wind: 'Wind', humidity: 'Humidity' },
  es: { wind: 'Viento', humidity: 'Humedad' },
  de: { wind: 'Windstärke', humidity: 'Feuchtigkeit' },
  sl: { wind: 'Hitrost vetra', humidity: 'Vlažnost' },
  ja: { wind: '風', humidity: '湿度' },
  zh_tw: { wind: '風速', humidity: '濕度' },
  ru: { wind: 'Ветер', humidity: 'Влажность' },
  uk: { wind: 'Вітер', humidity: 'Вологість' },
};

<|edits_diff|>
--- src/js/lang.js
+++ src/js/lang.js
@@ -6,6 +6,8 @@
 import 'dayjs/locale/zh-tw';
 import 'dayjs/locale/ru';
 import 'dayjs/locale/uk';
+import 'dayjs/locale/fr';
+import 'dayjs/locale/it';

 export const langText = {
   ca: { wind: 'Vent', humidity: 'Humitat' },
<|current_version|>
import 'dayjs/locale/ca';
import 'dayjs/locale/es';
import 'dayjs/locale/de';
import 'dayjs/locale/sl';
import 'dayjs/locale/ja';
import 'dayjs/locale/zh-tw';
import 'dayjs/locale/ru';
import 'dayjs/locale/uk';
import 'dayjs/locale/fr';
import 'dayjs/locale/it';

export const langText = {
  ca: { wind: 'Vent', humidity: 'Humitat' },
  en: { wind: 'Wind', humidity: 'Humidity' },
  es: { wind: 'Viento', humidity: 'Humedad' },
  de: { wind: 'Windstärke', humidity: 'Feuchtigkeit' },
  sl: { wind: 'Hitrost vetra', humidity: 'Vlažnost' },
  ja: { wind: '風', humidity: '湿度' },
  zh_tw: { wind: '風速', humidity: '濕度' },
  ru: { wind: 'Ветер', humidity: 'Влажность' },
  uk: { wind: 'Вітер', humidity: 'Вологість' },
};

<|next_version|>
import 'dayjs/locale/ca';
import 'dayjs/locale/es';
import 'dayjs/locale/de';
import 'dayjs/locale/sl';
import 'dayjs/locale/ja';
import 'dayjs/locale/zh-tw';
import 'dayjs/locale/ru';
import 'dayjs/locale/uk';
import 'dayjs/locale/fr';
import 'dayjs/locale/it';

export const langText = {
  ca: { wind: 'Vent', humidity: 'Humitat' },
  en: { wind: 'Wind', humidity: 'Humidity' },
  es: { wind: 'Viento', humidity: 'Humedad' },
  de: { wind: 'Windstärke', humidity: 'Feuchtigkeit' },
  sl: { wind: 'Hitrost vetra', humidity: 'Vlažnost' },
  ja: { wind: '風', humidity: '湿度' },
  zh_tw: { wind: '風速', humidity: '濕度' },
  ru: { wind: 'Ветер', humidity: 'Влажность' },
  uk: { wind: 'Вітер', humidity: 'Вологість' },
  fr: { wind: 'Vent', humidity: 'Humidité' },
  it: { wind: 'Vento', humidity: 'Umidità' },
};


Use RecipeListEntry for search results and recipe history

--- client/components/RecipeContainer.js
+++ client/components/RecipeContainer.js
@@ -2,11 +2,14 @@
 import '../scss/_recipeContainer.scss';

 import RecipeEntry from '../../client/components/RecipeEntry.js';
+import RecipeListEntry from '../../client/components/RecipeListEntry.js';

 const RecipeContainer = (props) => {
   let childRecipes;
   if (!props.recipes || props.recipes.length === 0) {
     childRecipes =
No recipes to show.
;
+  } else if (props.type === 'Recipe History' || props.type === 'Search Results') {
+    childRecipes = props.recipes.map((recipe) => <RecipeListEntry recipe={recipe} />);
   } else {
     childRecipes = props.recipes.map((recipe) => <RecipeEntry recipe={recipe} />);
   }

<|original_code|>
import React from 'react';
import '../scss/_recipeContainer.scss';

import RecipeEntry from '../../client/components/RecipeEntry.js';

const RecipeContainer = (props) => {
  let childRecipes;
  if (!props.recipes || props.recipes.length === 0) {
    childRecipes =
No recipes to show.
;
  } else {
    childRecipes = props.recipes.map((recipe) => <RecipeEntry recipe={recipe} />);
  }
  return (

{props.type}

        {childRecipes}

  );
};

export default RecipeContainer;

<|edits_diff|>
--- client/components/RecipeContainer.js
+++ client/components/RecipeContainer.js
@@ -2,6 +2,7 @@
 import '../scss/_recipeContainer.scss';

 import RecipeEntry from '../../client/components/RecipeEntry.js';
+import RecipeListEntry from '../../client/components/RecipeListEntry.js';

 const RecipeContainer = (props) => {
   let childRecipes;
<|current_version|>
import React from 'react';
import '../scss/_recipeContainer.scss';

import RecipeEntry from '../../client/components/RecipeEntry.js';
import RecipeListEntry from '../../client/components/RecipeListEntry.js';

const RecipeContainer = (props) => {
  let childRecipes;
  if (!props.recipes || props.recipes.length === 0) {
    childRecipes =
No recipes to show.
;
  } else {
    childRecipes = props.recipes.map((recipe) => <RecipeEntry recipe={recipe} />);
  }
  return (

{props.type}

        {childRecipes}

  );
};

export default RecipeContainer;

<|next_version|>
import React from 'react';
import '../scss/_recipeContainer.scss';

import RecipeEntry from '../../client/components/RecipeEntry.js';
import RecipeListEntry from '../../client/components/RecipeListEntry.js';

const RecipeContainer = (props) => {
  let childRecipes;
  if (!props.recipes || props.recipes.length === 0) {
    childRecipes =
No recipes to show.
;
  } else if (props.type === 'Recipe History' || props.type === 'Search Results') {
    childRecipes = props.recipes.map((recipe) => <RecipeListEntry recipe={recipe} />);
  } else {
    childRecipes = props.recipes.map((recipe) => <RecipeEntry recipe={recipe} />);
  }
  return (

{props.type}

        {childRecipes}

  );
};

export default RecipeContainer;


Add compiler to Peak object.

Add compiler to Peak object.

--- lib/index.js
+++ lib/index.js
@@ -2,6 +2,7 @@
   , Deployer = require('./deployer')
   , Generator = require('./generator')
   , Config = require('./config')
+  , Compiler = require('./compiler')
   , events = require('events')
   , path = require('path')
   , when = require('when')
@@ -46,4 +47,5 @@

 }

+Peak.Compiler = Compiler;
 module.exports = Peak;

<|original_code|>
var Watcher = require('./watcher')
  , Deployer = require('./deployer')
  , Generator = require('./generator')
  , Config = require('./config')
  , events = require('events')
  , path = require('path')
  , when = require('when')
  , fs = require('fs')

  , resolve = path.resolve
  , lstat = fs.lstatSync
  , exists = fs.existsSync;

var Peak = function (path, options) {
  this.path = resolve(path);
  this.config = new Config(this);
  this.options = this.config.load(options);
  this.emitter = new events.EventEmitter;
}

Peak.prototype = {

  generate: function () {
    var generator = new Generator(this);
    return generator.start();
  },

  watch: function () {
    var watcher = new Watcher(this);
    return when.try(this.validate_path.bind(this))
      .then(watcher.start.bind(watcher));
  },

  deploy: function (options) {
    var deployer = new Deployer(this);
    return when.try(this.validate_path.bind(this))
      .then(deployer.start.bind(deployer));
  },

  validate_path: function () {
    if (!exists(this.path)) throw new Error('Path doesn\'t exist.');

    this.lstat = lstat(this.path);
    if (!this.lstat.isDirectory()) throw new Error('Path is not a directory.');
  }

}

module.exports = Peak;

<|edits_diff|>
--- lib/index.js
+++ lib/index.js
@@ -2,6 +2,7 @@
   , Deployer = require('./deployer')
   , Generator = require('./generator')
   , Config = require('./config')
+  , Compiler = require('./compiler')
   , events = require('events')
   , path = require('path')
   , when = require('when')
<|current_version|>
var Watcher = require('./watcher')
  , Deployer = require('./deployer')
  , Generator = require('./generator')
  , Config = require('./config')
  , Compiler = require('./compiler')
  , events = require('events')
  , path = require('path')
  , when = require('when')
  , fs = require('fs')

  , resolve = path.resolve
  , lstat = fs.lstatSync
  , exists = fs.existsSync;

var Peak = function (path, options) {
  this.path = resolve(path);
  this.config = new Config(this);
  this.options = this.config.load(options);
  this.emitter = new events.EventEmitter;
}

Peak.prototype = {

  generate: function () {
    var generator = new Generator(this);
    return generator.start();
  },

  watch: function () {
    var watcher = new Watcher(this);
    return when.try(this.validate_path.bind(this))
      .then(watcher.start.bind(watcher));
  },

  deploy: function (options) {
    var deployer = new Deployer(this);
    return when.try(this.validate_path.bind(this))
      .then(deployer.start.bind(deployer));
  },

  validate_path: function () {
    if (!exists(this.path)) throw new Error('Path doesn\'t exist.');

    this.lstat = lstat(this.path);
    if (!this.lstat.isDirectory()) throw new Error('Path is not a directory.');
  }

}

module.exports = Peak;

<|next_version|>
var Watcher = require('./watcher')
  , Deployer = require('./deployer')
  , Generator = require('./generator')
  , Config = require('./config')
  , Compiler = require('./compiler')
  , events = require('events')
  , path = require('path')
  , when = require('when')
  , fs = require('fs')

  , resolve = path.resolve
  , lstat = fs.lstatSync
  , exists = fs.existsSync;

var Peak = function (path, options) {
  this.path = resolve(path);
  this.config = new Config(this);
  this.options = this.config.load(options);
  this.emitter = new events.EventEmitter;
}

Peak.prototype = {

  generate: function () {
    var generator = new Generator(this);
    return generator.start();
  },

  watch: function () {
    var watcher = new Watcher(this);
    return when.try(this.validate_path.bind(this))
      .then(watcher.start.bind(watcher));
  },

  deploy: function (options) {
    var deployer = new Deployer(this);
    return when.try(this.validate_path.bind(this))
      .then(deployer.start.bind(deployer));
  },

  validate_path: function () {
    if (!exists(this.path)) throw new Error('Path doesn\'t exist.');

    this.lstat = lstat(this.path);
    if (!this.lstat.isDirectory()) throw new Error('Path is not a directory.');
  }

}

Peak.Compiler = Compiler;
module.exports = Peak;


Add a rudimentary test for `bail`

Add a rudimentary test for `bail`

--- test/gulpfile.js
+++ test/gulpfile.js
@@ -9,6 +9,7 @@
 gulp.task('test', function() {
   return gulp.src('fixtures/test/*.js')
     .pipe(tape({
+      bail: true,
       reporter: tapColorize()
     }));
 });
@@ -37,3 +38,7 @@
         }));
     });
 });
+
+gulp.task('watch', function() {
+  gulp.watch('fixtures/test/*.js', ['test']);
+});

<|original_code|>
'use strict';

var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var tapColorize = require('tap-colorize');

var tape = require('../');

gulp.task('test', function() {
  return gulp.src('fixtures/test/*.js')
    .pipe(tape({
      reporter: tapColorize()
    }));
});

gulp.task('istanbul', function(cb) {
  gulp.src('fixtures/*.js')
    .pipe(istanbul())
    .pipe(istanbul.hookRequire())
    .on('finish', function() {
      gulp.src('fixtures/test/*.js')
        .on('error', cb)
        .on('end', cb)
        .pipe(tape())
        .pipe(istanbul.writeReports({
          reporters: ['lcov', 'text']
        }))
        .pipe(istanbul.enforceThresholds({
          thresholds: {
            global: {
              statements: 83,
              functions: 90,
              branches: 75,
              lines: 83,
            },
          },
        }));
    });
});

<|edits_diff|>
--- test/gulpfile.js
+++ test/gulpfile.js
@@ -9,6 +9,7 @@
 gulp.task('test', function() {
   return gulp.src('fixtures/test/*.js')
     .pipe(tape({
+      bail: true,
       reporter: tapColorize()
     }));
 });
<|current_version|>
'use strict';

var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var tapColorize = require('tap-colorize');

var tape = require('../');

gulp.task('test', function() {
  return gulp.src('fixtures/test/*.js')
    .pipe(tape({
      bail: true,
      reporter: tapColorize()
    }));
});

gulp.task('istanbul', function(cb) {
  gulp.src('fixtures/*.js')
    .pipe(istanbul())
    .pipe(istanbul.hookRequire())
    .on('finish', function() {
      gulp.src('fixtures/test/*.js')
        .on('error', cb)
        .on('end', cb)
        .pipe(tape())
        .pipe(istanbul.writeReports({
          reporters: ['lcov', 'text']
        }))
        .pipe(istanbul.enforceThresholds({
          thresholds: {
            global: {
              statements: 83,
              functions: 90,
              branches: 75,
              lines: 83,
            },
          },
        }));
    });
});

<|next_version|>
'use strict';

var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var tapColorize = require('tap-colorize');

var tape = require('../');

gulp.task('test', function() {
  return gulp.src('fixtures/test/*.js')
    .pipe(tape({
      bail: true,
      reporter: tapColorize()
    }));
});

gulp.task('istanbul', function(cb) {
  gulp.src('fixtures/*.js')
    .pipe(istanbul())
    .pipe(istanbul.hookRequire())
    .on('finish', function() {
      gulp.src('fixtures/test/*.js')
        .on('error', cb)
        .on('end', cb)
        .pipe(tape())
        .pipe(istanbul.writeReports({
          reporters: ['lcov', 'text']
        }))
        .pipe(istanbul.enforceThresholds({
          thresholds: {
            global: {
              statements: 83,
              functions: 90,
              branches: 75,
              lines: 83,
            },
          },
        }));
    });
});

gulp.task('watch', function() {
  gulp.watch('fixtures/test/*.js', ['test']);
});