/* eslint-env node */
'use strict';
var BasePlugin = require('ember-cli-deploy-plugin');
var fbTools = require('firebase-tools');

module.exports = {
  name: 'ember-cli-deploy-firebase',

  createDeployPlugin: function(options) {
    var DeployPlugin = BasePlugin.extend({
      name: options.name,

      upload: function(context) {
        var outer = this;
        var project = context.config.firebase.appName || context.config.fireBaseAppName;
        var options = {
          project: project,
          public: context.config.build.outputPath,
          message: (context.revisionData || {}).revisionKey,
          verbose: context.ui.verbose
        };
        if (context.config.firebase.deployToken || process.env.FIREBASE_TOKEN) {
          options.token = context.config.firebase.deployToken || process.env.FIREBASE_TOKEN;
        }
        return fbTools.deploy(options).then(function() {
          // outer.log('it worked yay');
        }).catch(function(err) {
          // handle error
          outer.log('something bad happened oh no', { color: 'red' });
          outer.log(err, { color: 'red' });
          outer.log(err.stack, { color: 'red' });
        });
      }
    });

    return new DeployPlugin();
  }
};

@@ -331,34 +331,8 @@
 ) %7B%0A
-        var outer = this;%0A
     
@@ -861,18 +861,13 @@
 hen(
-function()
+() =%3E
  %7B%0A 
@@ -878,21 +878,20 @@
      // 
-outer
+this
 .log('it
@@ -926,21 +926,16 @@
 tch(
-function
 (err)
+ =%3E
  %7B%0A 
@@ -965,29 +965,28 @@
 r%0A          
-outer
+this
 .log('someth
@@ -1031,37 +1031,36 @@
 ' %7D);%0A          
-outer
+this
 .log(err, %7B colo
@@ -1086,13 +1086,12 @@
     
-outer
+this
 .log

use arrow functions to eliminate `this` storage