<commit_before>'use strict';
const fs = require('fs');
const Generator = require('yeoman-generator');

const buildPolicy = (serviceName, stage, region) => {
  return {
    Version: '2012-10-17',
    Statement: [
      {
        Effect: 'Allow',
        Action: [
          'cloudformation:List*',
          'cloudformation:Get*',
          'cloudformation:PreviewStackUpdate',
          'cloudformation:ValidateTemplate'
        ],
        Resource: ['*']
      },
      {
        Effect: 'Allow',
        Action: [
          'cloudformation:CreateStack',
          'cloudformation:CreateUploadBucket',
          'cloudformation:DeleteStack',
          'cloudformation:DescribeStackEvents',
          'cloudformation:DescribeStackResource',
          'cloudformation:DescribeStackResources',
          'cloudformation:UpdateStack',
          'cloudformation:DescribeStacks'
        ],
        Resource: [
          `arn:aws:cloudformation:${region}:*:stack/${serviceName}-${stage}/*`
        ]
      },
      {
        Effect: 'Allow',
        Action: ['lambda:Get*', 'lambda:List*', 'lambda:CreateFunction'],
        Resource: ['*']
      },
      {
        Effect: 'Allow',
        Action: ['s3:CreateBucket'],
        Resource: [`arn:aws:s3:::${serviceName}*serverlessdeploymentbucket*`]
      },
      {
        Effect: 'Allow',
        Action: [
          's3:PutObject',
          's3:GetObject',
          's3:ListBucket',
          's3:DeleteObject',
          's3:DeleteBucket',
          's3:ListBucketVersions'
        ],
        Resource: [`arn:aws:s3:::${serviceName}*serverlessdeploymentbucket*`]
      },
      {
        Effect: 'Allow',
        Action: [
          'lambda:AddPermission',
          'lambda:CreateAlias',
          'lambda:DeleteFunction',
          'lambda:InvokeFunction',
          'lambda:PublishVersion',
          'lambda:RemovePermission',
          'lambda:Update*'
        ],
        Resource: [
          `arn:aws:lambda:${region}:*:function:${serviceName}-${stage}-*`
        ]
      },
      {
        Effect: 'Allow',
        Action: [
          'apigateway:GET',
          'apigateway:POST',
          'apigateway:PUT',
          'apigateway:DELETE'
        ],
        Resource: [
          'arn:aws:apigateway:*::/restapis*'
        ]
      },
      {
        Effect: 'Allow',
        Action: ['iam:PassRole'],
        Resource: ['arn:aws:iam::*:role/*']
      },
      {
        Effect: 'Allow',
        Action: 'kinesis:*',
        Resource: [
          `arn:aws:kinesis:*:*:stream/${serviceName}-${stage}-${region}`
        ]
      },
      {
        Effect: 'Allow',
        Action: 'iam:*',
        Resource: [
          `arn:aws:iam::*:role/${serviceName}-${stage}-${region}-lambdaRole`
        ]
      },
      {
        Effect: 'Allow',
        Action: 'sqs:*',
        Resource: [`arn:aws:sqs:*:*:${serviceName}-${stage}-${region}`]
      },
      {
        Effect: 'Allow',
        Action: ['cloudwatch:GetMetricStatistics'],
        Resource: ['*']
      },
      {
        Action: [
          'logs:CreateLogGroup',
          'logs:CreateLogStream',
          'logs:DeleteLogGroup'
        ],
        Resource: [`arn:aws:logs:${region}:*:*`],
        Effect: 'Allow'
      },
      {
        Action: ['logs:PutLogEvents'],
        Resource: [`arn:aws:logs:${region}:*:*`],
        Effect: 'Allow'
      },
      {
        Effect: 'Allow',
        Action: [
          'logs:DescribeLogStreams',
          'logs:DescribeLogGroups',
          'logs:FilterLogEvents'
        ],
        Resource: ['*']
      },
      {
        Effect: 'Allow',
        Action: ['events:Put*', 'events:Remove*', 'events:Delete*'],
        Resource: [`arn:aws:events:*:*:rule/${serviceName}-${stage}-${region}`]
      }
    ]
  };
};

const escapeValFilename = function(val) {
  return val === '*' ? '_star_' : val;
};

module.exports = class extends Generator {
  constructor(args, opts) {
    super(args, opts);

    this.option('project', {
      description: 'The name of the Serverless project',
      type: String
    });
    this.option('stage', {
      description: 'The name of a single stage to target',
      type: String,
      default: '*'
    });
    this.option('region', {
      description: 'The name of a single region to target',
      type: String,
      default: '*'
    });
  }

  prompting() {
    return this.prompt([
      {
        type: 'input',
        name: 'name',
        message: 'Your Serverless service name',
        default: this.appname // Default to current folder name
      },
      {
        type: 'input',
        name: 'stage',
        message: 'You can specify a specific stage, if you like:',
        default: '*'
      },
      {
        type: 'input',
        name: 'region',
        message: 'You can specify a specific region, if you like:',
        default: '*'
      },
      {
        type: 'confirm',
        name: 'dynamodb',
        message: 'Does your service rely on DynamoDB?'
      },
      {
        type: 'confirm',
        name: 's3',
        message: 'Is your service going to be using S3 buckets?'
      }
    ]).then(answers => {
      this.slsSettings = answers;
      this.log('app name', answers.name);
      this.log('app stage', answers.stage);
      this.log('app region', answers.region);
    });
  }

  writing() {
    const done = this.async();

    const project = this.slsSettings.name;
    const stage = this.slsSettings.stage;
    const region = this.slsSettings.region;

    const policy = buildPolicy(project, stage, region);
    if (this.slsSettings.dynamodb) {
      policy.Statement.push({
        Effect: 'Allow',
        Action: ['dynamodb:*'],
        Resource: ['arn:aws:dynamodb:*:*:table/*']
      });
    }

    if (this.slsSettings.s3) {
      policy.Statement.push({
        Effect: 'Allow',
        Action: ['s3:CreateBucket'],
        Resource: [`arn:aws:s3:::*`]
      });
    }

    const policyString = JSON.stringify(policy, null, 2);
    const fileName = `${project}-${escapeValFilename(stage)}-${escapeValFilename(region)}-policy.json`;

    this.log(`Writing to ${fileName}`);
    fs.writeFile(fileName, policyString, done);
  }
};
<commit_msg>policy fixes found on recent deploy<commit_after>'use strict';
const fs = require('fs');
const Generator = require('yeoman-generator');

const buildPolicy = (serviceName, stage, region) => {
  return {
    Version: '2012-10-17',
    Statement: [
      {
        Effect: 'Allow',
        Action: [
          'cloudformation:List*',
          'cloudformation:Get*',
          'cloudformation:PreviewStackUpdate',
          'cloudformation:ValidateTemplate'
        ],
        Resource: ['*']
      },
      {
        Effect: 'Allow',
        Action: [
          "cloudformation:CreateStack",
          "cloudformation:CreateUploadBucket",
          "cloudformation:DeleteStack",
          "cloudformation:Describe*",
          "cloudformation:UpdateStack"
        ],
        Resource: [
          `arn:aws:cloudformation:${region}:*:stack/${serviceName}-${stage}/*`
        ]
      },
      {
        Effect: 'Allow',
        Action: ['lambda:Get*', 'lambda:List*', 'lambda:CreateFunction'],
        Resource: ['*']
      },
      {
        Effect: 'Allow',
        Action: [
          "s3:CreateBucket",
          "s3:DeleteBucket",
          "s3:ListBucket",
          "s3:ListBucketVersions"
        ],
        Resource: [`arn:aws:s3:::${serviceName}*serverlessdeploy*`]
      },
      {
        Effect: 'Allow',
        Action: [
          "s3:PutObject",
          "s3:GetObject",
          "s3:DeleteObject"
        ],
        Resource: [`arn:aws:s3:::${serviceName}*serverlessdeploy*`]
      },
      {
        Effect: 'Allow',
        Action: [
          'lambda:AddPermission',
          'lambda:CreateAlias',
          'lambda:DeleteFunction',
          'lambda:InvokeFunction',
          'lambda:PublishVersion',
          'lambda:RemovePermission',
          'lambda:Update*'
        ],
        Resource: [
          `arn:aws:lambda:${region}:*:function:${serviceName}-${stage}-*`
        ]
      },
      {
        Effect: 'Allow',
        Action: [
          'apigateway:GET',
          'apigateway:POST',
          'apigateway:PUT',
          'apigateway:DELETE'
        ],
        Resource: [
          'arn:aws:apigateway:*::/restapis*'
        ]
      },
      {
        Effect: 'Allow',
        Action: ['iam:PassRole'],
        Resource: ['arn:aws:iam::*:role/*']
      },
      {
        Effect: 'Allow',
        Action: 'kinesis:*',
        Resource: [
          `arn:aws:kinesis:*:*:stream/${serviceName}-${stage}-${region}`
        ]
      },
      {
        Effect: 'Allow',
        Action: 'iam:*',
        Resource: [
          `arn:aws:iam::*:role/${serviceName}-${stage}-${region}-lambdaRole`
        ]
      },
      {
        Effect: 'Allow',
        Action: 'sqs:*',
        Resource: [`arn:aws:sqs:*:*:${serviceName}-${stage}-${region}`]
      },
      {
        Effect: 'Allow',
        Action: ['cloudwatch:GetMetricStatistics'],
        Resource: ['*']
      },
      {
        Action: [
          'logs:CreateLogGroup',
          'logs:CreateLogStream',
          'logs:DeleteLogGroup'
        ],
        Resource: [`arn:aws:logs:${region}:*:*`],
        Effect: 'Allow'
      },
      {
        Action: ['logs:PutLogEvents'],
        Resource: [`arn:aws:logs:${region}:*:*`],
        Effect: 'Allow'
      },
      {
        Effect: 'Allow',
        Action: [
          'logs:DescribeLogStreams',
          'logs:DescribeLogGroups',
          'logs:FilterLogEvents'
        ],
        Resource: ['*']
      },
      {
        Effect: 'Allow',
        Action: ['events:Put*', 'events:Remove*', 'events:Delete*'],
        Resource: [`arn:aws:events:*:*:rule/${serviceName}-${stage}-${region}`]
      }
    ]
  };
};

const escapeValFilename = function(val) {
  return val === '*' ? '_star_' : val;
};

module.exports = class extends Generator {
  constructor(args, opts) {
    super(args, opts);

    this.option('project', {
      description: 'The name of the Serverless project',
      type: String
    });
    this.option('stage', {
      description: 'The name of a single stage to target',
      type: String,
      default: '*'
    });
    this.option('region', {
      description: 'The name of a single region to target',
      type: String,
      default: '*'
    });
  }

  prompting() {
    return this.prompt([
      {
        type: 'input',
        name: 'name',
        message: 'Your Serverless service name',
        default: this.appname // Default to current folder name
      },
      {
        type: 'input',
        name: 'stage',
        message: 'You can specify a specific stage, if you like:',
        default: '*'
      },
      {
        type: 'input',
        name: 'region',
        message: 'You can specify a specific region, if you like:',
        default: '*'
      },
      {
        type: 'confirm',
        name: 'dynamodb',
        message: 'Does your service rely on DynamoDB?'
      },
      {
        type: 'confirm',
        name: 's3',
        message: 'Is your service going to be using S3 buckets?'
      }
    ]).then(answers => {
      this.slsSettings = answers;
      this.log('app name', answers.name);
      this.log('app stage', answers.stage);
      this.log('app region', answers.region);
    });
  }

  writing() {
    const done = this.async();

    const project = this.slsSettings.name;
    const stage = this.slsSettings.stage;
    const region = this.slsSettings.region;

    const policy = buildPolicy(project, stage, region);
    if (this.slsSettings.dynamodb) {
      policy.Statement.push({
        Effect: 'Allow',
        Action: ['dynamodb:*'],
        Resource: ['arn:aws:dynamodb:*:*:table/*']
      });
    }

    if (this.slsSettings.s3) {
      policy.Statement.push({
        Effect: 'Allow',
        Action: ['s3:CreateBucket'],
        Resource: [`arn:aws:s3:::*`]
      });
    }

    const policyString = JSON.stringify(policy, null, 2);
    const fileName = `${project}-${escapeValFilename(stage)}-${escapeValFilename(region)}-policy.json`;

    this.log(`Writing to ${fileName}`);
    fs.writeFile(fileName, policyString, done);
  }
};
<|endoftext|>


<commit_before>var config = {}

// irc config
config.room = '#priyom';
config.server = 'chat.freenode.net';
config.botName = 'IvoSchwarz';
config.userName = 'ivo',
config.realName = 'Ivo Schwarz',
config.password = '';
config.port = 7000;
config.tls = true;

// calendar settings
config.apiKey = '';
config.calendarId = 'ul6joarfkgroeho84vpieeaakk' // this is in your iCal, html, etc. URLs

// announce before ...
config.announceEarly = 1 * 60000; // milliseconds

// calendar limits
config.maxResults = 50; // at least 2

module.exports = config;
<commit_msg>increase number of loaded events<commit_after>var config = {}

// irc config
config.room = '#priyom';
config.server = 'chat.freenode.net';
config.botName = 'IvoSchwarz';
config.userName = 'ivo',
config.realName = 'Ivo Schwarz',
config.password = '';
config.port = 7000;
config.tls = true;

// calendar settings
config.apiKey = '';
config.calendarId = 'ul6joarfkgroeho84vpieeaakk' // this is in your iCal, html, etc. URLs

// announce before ...
config.announceEarly = 1 * 60000; // milliseconds

// calendar limits
config.maxResults = 150; // at least 2

module.exports = config;
<|endoftext|>


<commit_before>const defaultConfig = {
  port: 3000,
  title: 'GOOMMERCE',
  cloudfront: {
    domain: 'd1v1n6p63zq2b9.cloudfront.net',
  },
  bundle: {
    version: '3a7ae09c1963cd31f3c592bc0d570e6d9f8f8352',
  },
  apiRoot: 'http://localhost:8080',
};

const environmentConfig = {
}[process.env.NODE_ENV || 'development'];

module.exports = Object.assign(defaultConfig, environmentConfig);
<commit_msg>deploy<commit_after>const defaultConfig = {
  port: 3000,
  title: 'GOOMMERCE',
  cloudfront: {
    domain: 'd1v1n6p63zq2b9.cloudfront.net',
  },
  bundle: {
    version: '9a6e9d8b0e53194826623a7ed39b2caeb5456cb0',
  },
  apiRoot: 'http://localhost:8080',
};

const environmentConfig = {
}[process.env.NODE_ENV || 'development'];

module.exports = Object.assign(defaultConfig, environmentConfig);
<|endoftext|>


<commit_before>/**
 *
 * Path Edit View
 *
 * pathEditView.js
 * @author Kerri Shotts
 * @version 1.0.0
 *
 * Copyright (c) 2013 PacktPub Publishing
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this
 * software and associated documentation files (the "Software"), to deal in the Software
 * without restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 * The above copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
/*jshint
 asi:true,
 bitwise:true,
 browser:true,
 curly:true,
 eqeqeq:false,
 forin:true,
 noarg:true,
 noempty:true,
 plusplus:false,
 smarttabs:true,
 sub:true,
 trailing:false,
 undef:true,
 white:false,
 onevar:false
 */
/*global define, console*/

define(["yasmf", "app/models/pathStorageSingleton",
        "text!html/pathEditView.html!strip", "app/views/staticView",
        "app/models/place", "gmaps", "hammer"],
       function (_y, pathStorageSingleton, pathEditViewHTML, StaticView,
                 Place, gmaps, Hammer)
       {
         // store our classname for easy overriding later
         var _className = "PathEditView";
         var PathEditView = function ()
         {
           // This time we descend from a simple ViewContainer
           var self = new _y.UI.ViewContainer();
           // always subclass
           self.subclass(_className);

           // our internal pointers to specific elements
           self._navigationBar = null;
           self._nameEditor = null;
           self._scrollContainer = null;
           self._mapContainer = null;
           self._backButton = null;
           self._locateButton = null;
           self._recordButton = null;
           self._saveButton = null;

           // the path we're editing
           self._path = null;

           // the last known position
           self._lastKnownPosition = null;

           // the ID for the geolocation watch
           self._watchID = null;

           // google position marker
           self._currentPositionMarker = null;

           // indicates if the map should be kept centered
           self._keepMapCentered = true;

           // indicates if we are recording a path
           self._isRecording = false;
           self.getIsRecording = function ()
           {
             return self._isRecording;
           }
           Object.defineProperty( self, "isRecording", { get: self.getIsRecording,
                                                         configurable: true });

           // the google map itself
           self._map = null;

           // and the polyline
           self._polyline = null;

           self._updateLastKnownPosition = function ( position )
           {
             // update our last known position
             if (self._lastKnownPosition === null )
             {
               self._lastKnownPosition = new Place();
               self._lastKnownPosition.init ( position );
             }
             else
             {
               self._lastKnownPosition.position = position;
             }

             // get a Google Latitude/Longitude object
             var googleLatLong = self._lastKnownPosition.googleLatitudeLongitude;

             // pan to the center of the map
             if ( self._keepMapCentered )
             {
               self._map.panTo ( googleLatLong );
             }

             // update the current position marker's position
             self._currentPositionMarker.setPosition ( googleLatLong );

             // if we're recording, add the position to the polyline
             // and create a new place and add it to our path
             if ( self._isRecording )
             {
               self._polyline.getPath().push ( googleLatLong );
               var newPlace = new Place();
               newPlace.init ( position );
               self._path.addPlace ( newPlace );
             }
           };

           self.togglePathRecording = function ()
           {
             if (self._isRecording)
             {
               self._isRecording = false;
               navigator.geolocation.clearWatch( self._watchID );
               self._watchID = null;
               self._recordButton.classList.remove ( "ui-glyph-pause-filled" );
               self._recordButton.classList.add ( "ui-glyph-circle-outlined" );
             }
             else
             {
               self._watchID = navigator.geolocation.watchPosition(
                 self._updateLastKnownPosition, self._geolocationError,
                 {
                   enableHighAccuracy: true
                 }
               );
               self._recordButton.classList.remove ( "ui-glyph-circle-outlined" );
               self._recordButton.classList.add ( "ui-glyph-pause-filled" );
               self._isRecording = true;
             }
           }

           self.centerMapAroundLocation = function ()
           {
             self._keepMapCentered = true;
             if (!self._isRecording)
             {
               navigator.geolocation.getCurrentPosition(
                 self._updateLastKnownPosition,
                 self._geolocationError,
                 {
                   enableHighAccuracy: true
                 }
               );
             }
           }

           self._geolocationError = function ( error )
           {
             // handle any errors appropriately in a production app
             var anAlert = new _y.UI.Alert.OK(
               { title:   _y.T("ERROR"),
                 text:    error.message,
                 buttons: [ _y.UI.Alert.button ( _y.T("DELETE" ), { type: "destructive" } ),
                            _y.UI.Alert.button ( _y.T("CANCEL" ), { type: "bold", tag: -1 } )
                 ] } );
             anAlert.show();
           }

           self.getPathUID = function ()
           {
             return self._path.UID;
           }

           /**
            * Save the specific path by copying the name and contents
            * from the DOM
            */
           self.savePath = function ()
           {
             self._path.name = self._nameEditor.innerText;
             pathStorageSingleton.savePath(self._path);
           }

           self.popView = function ()
           {
             // pops the view if we aren't in a split view
             // if we are, replaces it with a static view
             // stop recording first, though.
             if (self._isRecording)
             {
               self.togglePathRecording();
             }
             if (typeof self.navigationController.splitViewController !== "undefined")
             {
               var staticView = new StaticView();
               staticView.initWithOptions();
               self.navigationController.splitViewController.rightView.rootView = staticView;
             }
             else
             {
               self.navigationController.popView();
             }
           }

           self.deletePath = function ()
           {
             var areYouSure = new _y.UI.Alert();

             areYouSure.initWithOptions(
               {
                 title:   _y.T("app.pev.action.DELETE_NOTE"),
                 text:    _y.T("app.pev.action.ARE_YOU_SURE_THIS_ACTION_CANT_BE_UNDONE"),
                 promise: true,
                 buttons: [ _y.UI.Alert.button(_y.T("DELETE"), { type: "destructive" }),
                            _y.UI.Alert.button(_y.T("CANCEL"), { type: "bold", tag: -1 }) ]
               });

             areYouSure.show()
               .then(function (idx)
                     {
                       if (idx > -1)
                       {
                         pathStorageSingleton.removePathByUID(self._path.uid);
                         self.popView();
                       }
                     })
               .catch(function (anError)
                      {
                        return; // happens when a cancel button is pressed
                      })
               .done();
           }

           self.goBack = function ()
           {
             self.savePath();
             self.popView();
           }

           self.overrideSuper(self.class, "render", self.render);
           self.render = function ()
           {
             // no need to call super; it's abstract
             return _y.template(pathEditViewHTML,
                                {
                                  "PATH_NAME":   self._path.name,
                                  "BACK":        _y.T("BACK"),
                                  "DELETE_PATH": _y.T("app.pev.DELETE_PATH"),
                                  "SAVE_PATH":   _y.T("app.pev.SAVE_PATH")
                                });
           }

           self.overrideSuper(self.class, "renderToElement", self.renderToElement);
           self.renderToElement = function ()
           {
             // call super, which will also get our HTML into the element
             self.super(_className, "renderToElement");

             // and now find and link up any elements we want to keep track of
             self._navigationBar = self.element.querySelector(".ui-navigation-bar");
             self._nameEditor = self.element.querySelector(".ui-navigation-bar .ui-title");
             var navigationBarButtons = self.element.querySelectorAll(".ui-navigation-bar .ui-bar-button");

             self._backButton = navigationBarButtons[0];
             self._saveButton = navigationBarButtons[1];
             self._locateButton = navigationBarButtons[2];
             self._recordButton = navigationBarButtons[3];

             self._scrollContainer = self.element.querySelector(".ui-scroll-container");
             self._mapContainer = self.element.querySelector(".ui-map-container");

             // the back and delete buttons should have an event listener
             Hammer(self._backButton).on("tap", self.goBack);
             Hammer(self._saveButton).on("tap", self.savePath);
             Hammer(self._locateButton).on("tap", self.centerMapAroundLocation);
             Hammer(self._recordButton).on("tap", self.togglePathRecording);

             // and make sure we know about the physical back button
             _y.UI.backButton.addListenerForNotification("backButtonPressed", self.goBack);

             setTimeout ( function ()
                          {
                            // create our Google Maps instance
                            self._map = new gmaps.Map (
                              self._mapContainer,
                              {  disableDefaultUI: true,
                                center: new gmaps.LatLng(40,-90),
                                zoom: 15,
                                mapTypeId: gmaps.MapTypeId.ROADMAP
                              }
                            );

                            // intecept a drag gesture and disable map centering
                            gmaps.event.addListener ( self._map, 'dragstart', function ()
                            {
                              self._keepMapCentered = false;
                            });

                            // create the marker for the current position
                            self._currentPositionMarker = new gmaps.Marker(
                              {
                                map: self._map,
                                title: "Current Position"
                              }
                            );

                            // and create a polyline that we can work with
                            self._polyline = new gmaps.Polyline ( {
                                                                    strokeColor: '#80A0C0', strokeOpacity:0.85,
                                                                    strokeWeight:5 } );
                            self._polyline.setMap ( self._map );

                            // add all the places in our path currently to the
                            // polyline
                            self._path.places.map (
                              function ( place )
                              {
                                self._polyline.getPath().push ( place.googleLatitudeLongitude );
                              }
                            )
                          }, 100);

           }

           self.overrideSuper(self.class, "init", self.init);
           self.init = function (theParentElement, thePath)
           {
             self._path = thePath;

             self.super(_className, "init", [undefined, "div", self.class + " pathEditView ui-container", theParentElement]);

             self.addListenerForNotification("viewWasPopped", self.releaseBackButton);
             self.addListenerForNotification("viewWasPopped", self.destroy);
           }

           self.overrideSuper(self.class, "initWithOptions", self.init);
           self.initWithOptions = function (options)
           {
             var theParentElement;
             var thePath;
             if (typeof options !== "undefined")
             {
               if (typeof options.parent !== "undefined")
               {
                 theParentElement = options.parent;
               }
               if (typeof options.path !== "undefined")
               {
                 thePath = options.path;
               }
             }

             self.init(theParentElement, thePath);
           }

           self.releaseBackButton = function ()
           {
             // and make sure we forget about the physical back button
             _y.UI.backButton.removeListenerForNotification("backButtonPressed", self.goBack);
           }

           self.overrideSuper(self.class, "destroy", self.destroy);
           self.destroy = function ()
           {

             self.releaseBackButton();
             // Stop listening for our disappearance
             self.removeListenerForNotification("viewWasPopped", self.releaseBackButton);
             self.removeListenerForNotification("viewWasPopped", self.destroy);

             // release our objects
             self._navigationBar = null;
             self._backButton = null;
             self._recordButton = null;
             self._locateButton = null;
             self._scrollContainer = null;
             self._nameEditor = null;
             self._mapContainer = null;
             self._saveButton = null;

             self._currentPositionMarker = null;
             self._lastKnownPosition = null;
             self._map = null;
             self._polyline = null;

             self.super(_className, "destroy");
           }

           return self;
         };

         /**
          * add translations we need
          */
         _y.addTranslations(
           {
             "app.pev.DELETE_PATH":                                    {
               "EN": "Delete",
               "ES": "Eliminar"
             },
             "app.pev.action.DELETE_PATH":                             {
               "EN": "Delete Path"
             },
             "app.pev.action.ARE_YOU_SURE_THIS_ACTION_CANT_BE_UNDONE": {
               "EN": "Are you sure? This action can't be undone."
             },
             "app.pev.SAVE_PATH":                                      {
               "EN": "Save"
             }
           });

         return PathEditView;

       });<commit_msg>Handle menu button; change stroke color; add prevent_default to hammer events<commit_after>/**
 *
 * Path Edit View
 *
 * pathEditView.js
 * @author Kerri Shotts
 * @version 1.0.0
 *
 * Copyright (c) 2013 PacktPub Publishing
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this
 * software and associated documentation files (the "Software"), to deal in the Software
 * without restriction, including without limitation the rights to use, copy, modify,
 * merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following
 * conditions:
 * The above copyright notice and this permission notice shall be included in all copies
 * or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
 * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */
/*jshint
 asi:true,
 bitwise:true,
 browser:true,
 curly:true,
 eqeqeq:false,
 forin:true,
 noarg:true,
 noempty:true,
 plusplus:false,
 smarttabs:true,
 sub:true,
 trailing:false,
 undef:true,
 white:false,
 onevar:false
 */
/*global define, console*/

define(["yasmf", "app/models/pathStorageSingleton",
        "text!html/pathEditView.html!strip", "app/views/staticView",
        "app/models/place", "gmaps", "hammer"],
       function (_y, pathStorageSingleton, pathEditViewHTML, StaticView,
                 Place, gmaps, Hammer)
       {
         // store our classname for easy overriding later
         var _className = "PathEditView";
         var PathEditView = function ()
         {
           // This time we descend from a simple ViewContainer
           var self = new _y.UI.ViewContainer();
           // always subclass
           self.subclass(_className);

           // our internal pointers to specific elements
           self._navigationBar = null;
           self._nameEditor = null;
           self._mapContainer = null;
           self._backButton = null;
           self._locateButton = null;
           self._recordButton = null;
           self._menuButton = null;

           // the path we're editing
           self._path = null;

           // the last known position
           self._lastKnownPosition = null;

           // the ID for the geolocation watch
           self._watchID = null;

           // google position marker
           self._currentPositionMarker = null;

           // indicates if the map should be kept centered
           self._keepMapCentered = true;

           // indicates if we are recording a path
           self._isRecording = false;
           self.getIsRecording = function ()
           {
             return self._isRecording;
           }
           Object.defineProperty( self, "isRecording", { get: self.getIsRecording,
                                                         configurable: true });

           // the google map itself
           self._map = null;

           // and the polyline
           self._polyline = null;

           self._updateLastKnownPosition = function ( position )
           {
             // update our last known position
             if (self._lastKnownPosition === null )
             {
               self._lastKnownPosition = new Place();
               self._lastKnownPosition.init ( position );
             }
             else
             {
               self._lastKnownPosition.position = position;
             }

             // get a Google Latitude/Longitude object
             var googleLatLong = self._lastKnownPosition.googleLatitudeLongitude;

             // pan to the center of the map
             if ( self._keepMapCentered )
             {
               self._map.panTo ( googleLatLong );
             }

             // update the current position marker's position
             self._currentPositionMarker.setPosition ( googleLatLong );

             // if we're recording, add the position to the polyline
             // and create a new place and add it to our path
             if ( self._isRecording )
             {
               self._polyline.getPath().push ( googleLatLong );
               var newPlace = new Place();
               newPlace.init ( position );
               self._path.addPlace ( newPlace );
             }
           };

           self.togglePathRecording = function ()
           {
             if (self._isRecording)
             {
               self._isRecording = false;
               navigator.geolocation.clearWatch( self._watchID );
               self._watchID = null;
               self._recordButton.classList.remove ( "ui-glyph-pause-filled" );
               self._recordButton.classList.add ( "ui-glyph-circle-outlined" );
             }
             else
             {
               self._watchID = navigator.geolocation.watchPosition(
                 self._updateLastKnownPosition, self._geolocationError,
                 {
                   enableHighAccuracy: true
                 }
               );
               self._recordButton.classList.remove ( "ui-glyph-circle-outlined" );
               self._recordButton.classList.add ( "ui-glyph-pause-filled" );
               self._isRecording = true;
             }
           }

           self.centerMapAroundLocation = function ()
           {
             self._keepMapCentered = true;
             if (!self._isRecording)
             {
               navigator.geolocation.getCurrentPosition(
                 self._updateLastKnownPosition,
                 self._geolocationError,
                 {
                   enableHighAccuracy: true
                 }
               );
             }
           }

           self._geolocationError = function ( error )
           {
             // handle any errors appropriately in a production app
             var anAlert = new _y.UI.Alert.OK(
               { title:   _y.T("ERROR"),
                 text:    error.message,
                 buttons: [ _y.UI.Alert.button ( _y.T("DELETE" ), { type: "destructive" } ),
                            _y.UI.Alert.button ( _y.T("CANCEL" ), { type: "bold", tag: -1 } )
                 ] } );
             anAlert.show();
           }

           self.getPathUID = function ()
           {
             return self._path.UID;
           }

           /**
            * Save the specific path by copying the name and contents
            * from the DOM
            */
           self.savePath = function ()
           {
             self._path.name = self._nameEditor.innerText;
             pathStorageSingleton.savePath(self._path);
           }

           self.popView = function ()
           {
             // pops the view if we aren't in a split view
             // if we are, replaces it with a static view
             // stop recording first, though.
             if (self._isRecording)
             {
               self.togglePathRecording();
             }
             if (typeof self.navigationController.splitViewController !== "undefined")
             {
               var staticView = new StaticView();
               staticView.initWithOptions();
               self.navigationController.splitViewController.rightView.rootView = staticView;
             }
             else
             {
               self.navigationController.popView();
             }
           }

           self.deletePath = function ()
           {
             var areYouSure = new _y.UI.Alert();

             areYouSure.initWithOptions(
               {
                 title:   _y.T("app.pev.action.DELETE_NOTE"),
                 text:    _y.T("app.pev.action.ARE_YOU_SURE_THIS_ACTION_CANT_BE_UNDONE"),
                 promise: true,
                 buttons: [ _y.UI.Alert.button(_y.T("DELETE"), { type: "destructive" }),
                            _y.UI.Alert.button(_y.T("CANCEL"), { type: "bold", tag: -1 }) ]
               });

             areYouSure.show()
               .then(function (idx)
                     {
                       if (idx > -1)
                       {
                         pathStorageSingleton.removePathByUID(self._path.uid);
                         self.popView();
                       }
                     })
               .catch(function (anError)
                      {
                        return; // happens when a cancel button is pressed
                      })
               .done();
           }

           self.goBack = function ()
           {
             self.savePath();
             self.popView();
           }

           self.overrideSuper(self.class, "render", self.render);
           self.render = function ()
           {
             // no need to call super; it's abstract
             return _y.template(pathEditViewHTML,
                                {
                                  "PATH_NAME":   self._path.name,
                                  "BACK":        _y.T("BACK")
                                });
           }

           self.overrideSuper(self.class, "renderToElement", self.renderToElement);
           self.renderToElement = function ()
           {
             // call super, which will also get our HTML into the element
             self.super(_className, "renderToElement");

             // and now find and link up any elements we want to keep track of
             self._navigationBar = self.element.querySelector(".ui-navigation-bar");
             self._nameEditor = self.element.querySelector(".ui-navigation-bar .ui-title");

             self._backButton = self.element.querySelector(".ui-navigation-bar .ui-back-button");
             self._menuButton = self.element.querySelector(".ui-navigation-bar .ui-glyph-menu");
             self._locateButton = self.element.querySelector(".ui-navigation-bar .ui-glyph-gps-locate");
             self._recordButton = self.element.querySelector(".ui-navigation-bar .ui-glyph-circle-outlined");

             self._mapContainer = self.element.querySelector(".map-container");

             // the back and delete buttons should have an event listener
             Hammer(self._backButton).on("tap", self.goBack);
             Hammer(self._menuButton, {prevent_default:true}).on("tap", function () { self.navigationController.splitViewController.toggleLeftView() });
             Hammer(self._locateButton).on("tap", self.centerMapAroundLocation);
             Hammer(self._recordButton).on("tap", self.togglePathRecording);

             // and make sure we know about the physical back button
             _y.UI.backButton.addListenerForNotification("backButtonPressed", self.goBack);

             setTimeout ( function ()
                          {
                            // create our Google Maps instance
                            self._map = new gmaps.Map (
                              self._mapContainer,
                              {  disableDefaultUI: true,
                                center: new gmaps.LatLng(40,-90),
                                zoom: 15,
                                mapTypeId: gmaps.MapTypeId.ROADMAP
                              }
                            );

                            // intecept a drag gesture and disable map centering
                            gmaps.event.addListener ( self._map, 'dragstart', function ()
                            {
                              self._keepMapCentered = false;
                            });

                            // create the marker for the current position
                            self._currentPositionMarker = new gmaps.Marker(
                              {
                                map: self._map,
                                title: "Current Position"
                              }
                            );

                            // and create a polyline that we can work with
                            self._polyline = new gmaps.Polyline ( {
                                                                    strokeColor: '#60E020', strokeOpacity:0.85,
                                                                    strokeWeight:10 } );
                            self._polyline.setMap ( self._map );

                            // add all the places in our path currently to the
                            // polyline
                            self._path.places.forEach (
                              function ( place )
                              {
                                self._polyline.getPath().push ( place.googleLatitudeLongitude );
                              }
                            )
                          }, 100);

           }

           self.overrideSuper(self.class, "init", self.init);
           self.init = function (theParentElement, thePath)
           {
             self._path = thePath;

             self.super(_className, "init", [undefined, "div", self.class + " pathEditView ui-container", theParentElement]);

             self.addListenerForNotification("viewWasPopped", self.releaseBackButton);
             self.addListenerForNotification("viewWasPopped", self.destroy);
           }

           self.overrideSuper(self.class, "initWithOptions", self.init);
           self.initWithOptions = function (options)
           {
             var theParentElement;
             var thePath;
             if (typeof options !== "undefined")
             {
               if (typeof options.parent !== "undefined")
               {
                 theParentElement = options.parent;
               }
               if (typeof options.path !== "undefined")
               {
                 thePath = options.path;
               }
             }

             self.init(theParentElement, thePath);
           }

           self.releaseBackButton = function ()
           {
             // and make sure we forget about the physical back button
             _y.UI.backButton.removeListenerForNotification("backButtonPressed", self.goBack);
           }

           self.overrideSuper(self.class, "destroy", self.destroy);
           self.destroy = function ()
           {

             self.releaseBackButton();
             // Stop listening for our disappearance
             self.removeListenerForNotification("viewWasPopped", self.releaseBackButton);
             self.removeListenerForNotification("viewWasPopped", self.destroy);

             // release our objects
             self._navigationBar = null;
             self._backButton = null;
             self._recordButton = null;
             self._locateButton = null;
             self._nameEditor = null;
             self._mapContainer = null;
             self._menuButton = null;

             self._currentPositionMarker = null;
             self._lastKnownPosition = null;
             self._map = null;
             self._polyline = null;

             self.super(_className, "destroy");
           }

           return self;
         };

         /**
          * add translations we need
          */
         _y.addTranslations(
           {
             "app.pev.DELETE_PATH":                                    {
               "EN": "Delete",
               "ES": "Eliminar"
             },
             "app.pev.action.DELETE_PATH":                             {
               "EN": "Delete Path"
             },
             "app.pev.action.ARE_YOU_SURE_THIS_ACTION_CANT_BE_UNDONE": {
               "EN": "Are you sure? This action can't be undone."
             },
             "app.pev.SAVE_PATH":                                      {
               "EN": "Save"
             }
           });

         return PathEditView;

       });<|endoftext|>


<commit_before>// # Ghost Configuration
// Setup your Ghost install for various environments

var path = require('path'),
    config;

config = {
    // ### Development **(default)**
    development: {
        // The url to use when providing links to the site, E.g. in RSS and email.
        url: 'http://my-ghost-blog.com',

        // Example mail config
        // Visit http://docs.ghost.org/mail for instructions
        // ```
        //  mail: {
        //      transport: 'SMTP',
        //      options: {
        //          service: 'Mailgun',
        //          auth: {
        //              user: '', // mailgun username
        //              pass: ''  // mailgun password
        //          }
        //      }
        //  },
        // ```

        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-dev.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    },

    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://my-ghost-blog.com',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    },

    // **Developers only need to edit below here**

    // ### Testing
    // Used when developing Ghost to run tests and check the health of Ghost
    // Uses a different port number
    testing: {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-test.db')
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        }
    },

    // ### Travis
    // Automated testing run through Github
    travis: {
        url: 'http://127.0.0.1:2368',
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-travis.db')
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2368'
        }
    }
};

// Export config
module.exports = config;
<commit_msg>changed config url<commit_after>// # Ghost Configuration
// Setup your Ghost install for various environments

var path = require('path'),
    config;

config = {
    // ### Development **(default)**
    development: {
        // The url to use when providing links to the site, E.g. in RSS and email.
        url: 'http://blog.listinadforrita.is',

        // Example mail config
        // Visit http://docs.ghost.org/mail for instructions
        // ```
        //  mail: {
        //      transport: 'SMTP',
        //      options: {
        //          service: 'Mailgun',
        //          auth: {
        //              user: '', // mailgun username
        //              pass: ''  // mailgun password
        //          }
        //      }
        //  },
        // ```

        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-dev.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    },

    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://blog.listinadforrita.is',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    },

    // **Developers only need to edit below here**

    // ### Testing
    // Used when developing Ghost to run tests and check the health of Ghost
    // Uses a different port number
    testing: {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-test.db')
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        }
    },

    // ### Travis
    // Automated testing run through Github
    travis: {
        url: 'http://127.0.0.1:2368',
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-travis.db')
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2368'
        }
    }
};

// Export config
module.exports = config;
<|endoftext|>


<commit_before>/**********************************************************
	TSW Roll For Role
	https://github.com/AliceOrwell/TSW-Roll-For-Role/

	Released under the MIT license
 **********************************************************/

var rolePresets = {
  "Custom": [],
  "Eidolon Elite": [
    "Main Tank", "Off Tank", "Healer", "DABS", "DABS", "DPS", "DPS", "DPS", "DPS"
  ],
  "Flappy NM": [
    "Tank (Red)", "Tank (Purple)", "Healer", "DABS (Red)", "DABS (Purple)",
    "Shade 1", "Shade 2", "Shade 2", "Backup"
  ],
  "NYR Elite": [
    "DPS Tank", "Healtank", "DABS", "DABS", "SF", "SF", "DPS", "DPS", "DPS"
  ]
};

var assignment = function( subject, object ) {
  this.subject = "UNASSIGNED";
  this.object = "UNASSIGNED";
  this.isAssigned = false;

  if ( object ) {
    this.object = object;
    this.isAssigned = true;
  }
  if ( subject ) {
    this.subject = subject;
    this.isAssigned = true;
  }

  this.toString = function() {
    var output = this.subject + " := " + this.object;
    return output;
  }

  return this;
};

var tswRollForRole = {
  roleExtracter: function( roles ) {
    if ( roles == "" ) {
      return [];
    }
    return roles.split( '\n' );
  },
  assigner: function ( roles, people ) {
    var assignments = [];

    var subjects = roles;
    var objects = people;
    if ( roles.length < people.length ) {
      subjects = people;
      objects = roles;
    }

    for( var i = 0; i < subjects.length; i++ ) {
      var subject = subjects[i];
      var object = false;
      if ( i < objects.length ) {  // If there are objects left to assign
        object = objects[i];
      }

      var ass = new assignment( subject, object );
      assignments.push( ass );
    }
    return assignments;
  },
  roleData: function( preset ) {
    if ( rolePresets.hasOwnProperty(preset) ) {
      var p = rolePresets[preset];
      p = p.toString()
      p = p.split(',').join('\n');  // Replace all commas for newlines
      return p;
    }
    return "";
  },
  format: function( assignments ) {
    var output = assignments.length + " Assignment(s)";
    if ( assignments.length == 0 ) {
      return output;
    }

    output += " -- " + assignments[0].toString();
    for(var i = 1; i < assignments.length; i++) {
      output +=  " :: " + assignments[i].toString();
    }
    return output;
  }
};
<commit_msg>Fix banner<commit_after>/**********************************************************
	TSW Roll For Role
	https://github.com/AliceOrwell/TSW-Roll-For-Role/

	Copyright (c) 2017 AliceOrwell
	Released under the MIT license
 **********************************************************/

var rolePresets = {
  "Custom": [],
  "Eidolon Elite": [
    "Main Tank", "Off Tank", "Healer", "DABS", "DABS", "DPS", "DPS", "DPS", "DPS"
  ],
  "Flappy NM": [
    "Tank (Red)", "Tank (Purple)", "Healer", "DABS (Red)", "DABS (Purple)",
    "Shade 1", "Shade 2", "Shade 2", "Backup"
  ],
  "NYR Elite": [
    "DPS Tank", "Healtank", "DABS", "DABS", "SF", "SF", "DPS", "DPS", "DPS"
  ]
};

var assignment = function( subject, object ) {
  this.subject = "UNASSIGNED";
  this.object = "UNASSIGNED";
  this.isAssigned = false;

  if ( object ) {
    this.object = object;
    this.isAssigned = true;
  }
  if ( subject ) {
    this.subject = subject;
    this.isAssigned = true;
  }

  this.toString = function() {
    var output = this.subject + " := " + this.object;
    return output;
  }

  return this;
};

var tswRollForRole = {
  roleExtracter: function( roles ) {
    if ( roles == "" ) {
      return [];
    }
    return roles.split( '\n' );
  },
  assigner: function ( roles, people ) {
    var assignments = [];

    var subjects = roles;
    var objects = people;
    if ( roles.length < people.length ) {
      subjects = people;
      objects = roles;
    }

    for( var i = 0; i < subjects.length; i++ ) {
      var subject = subjects[i];
      var object = false;
      if ( i < objects.length ) {  // If there are objects left to assign
        object = objects[i];
      }

      var ass = new assignment( subject, object );
      assignments.push( ass );
    }
    return assignments;
  },
  roleData: function( preset ) {
    if ( rolePresets.hasOwnProperty(preset) ) {
      var p = rolePresets[preset];
      p = p.toString()
      p = p.split(',').join('\n');  // Replace all commas for newlines
      return p;
    }
    return "";
  },
  format: function( assignments ) {
    var output = assignments.length + " Assignment(s)";
    if ( assignments.length == 0 ) {
      return output;
    }

    output += " -- " + assignments[0].toString();
    for(var i = 1; i < assignments.length; i++) {
      output +=  " :: " + assignments[i].toString();
    }
    return output;
  }
};
<|endoftext|>


<commit_before>const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const Insight = require('insight');
const semver = require('semver');
const Generator = require('@ngx-rocket/core');
const asciiLogo = require('@ngx-rocket/ascii-logo');

const pkg = require('../../package.json');
const prompts = require('./prompts');
const options = require('./options');

const packageJsonFile = 'package.json';

class NgxGenerator extends Generator {
  initializing() {
    this.version = pkg.version;
    this.insight = new Insight({trackingCode: 'UA-93069862-1', pkg});
    this.props = {};

    if (semver.lt(process.version, '8.9.0')) {
      this.log(chalk.yellow('Angular CLI v6 needs NodeJS v8.9 or greater.'));
      this.log(chalk.yellow(`You are using ${process.version} which is unsupported, please upgrade.\n`));
      // eslint-disable-next-line unicorn/no-process-exit
      process.exit(-1);
    }

    this.argument('appName', {
      description: 'Name of the app to generate',
      type: String,
      required: false
    });

    this.insight.optOut = !this.options.analytics || process.env.DISABLE_NGX_ANALYTICS;

    if (this.options.raw) {
      this.props.ui = 'raw';
    }

    if (this.options['location-strategy']) {
      this.props.location = this.options['location-strategy'];
    }

    this.props.strict = this.options.strict;
    this.props.skipInstall = this.options['skip-install'];
    this.props.skipQuickstart = this.options['skip-quickstart'];
    this.props.initGit = this.options.git;

    // Updating
    let fromVersion = null;

    if (this.options.update) {
      this.props = this.config.get('props') || this.props;
      fromVersion = this.config.get('version');
    }

    if (fromVersion) {
      if (fromVersion >= this.version) {
        this.log(chalk.green("\nNothing to update, it's all good!\n"));
        // eslint-disable-next-line unicorn/no-process-exit
        process.exit(0);
      }

      this.updating = true;
      this.log(
        `\nUpdating ${chalk.green(this.props.appName)} project (${chalk.yellow(fromVersion)} -> ${chalk.yellow(
          this.version
        )})\n`
      );
      this.log(`${chalk.yellow("Make sure you don't have uncommitted changes before overwriting files!")}`);
      this.insight.track('update', fromVersion, 'to', this.version);
    } else if (!this.options['skip-welcome']) {
      this.log(asciiLogo(pkg.version));
    }

    // Composition
    const addonsOption = this.options.addons;
    this.addons = addonsOption ? addonsOption.split(' ') : [];
    this.addons.forEach(addon => this.composeWith(addon, this.options));

    this.insight.track('version', this.version);
    this.insight.track('node', process.version);
    this.insight.track('platform', process.platform);
    this.insight.track('addons', addonsOption);
  }

  async prompting() {
    // Allow to pre-set any props in an add-on generator
    Object.assign(this.props, this.sharedProps);

    await super.prompting();
    this.props.mobile = this.props.mobile || [];
    this.props.desktop = this.props.desktop || [];
    this.props.utility = this.props.utility || [];
    this.props.tools = this.props.tools || [];
    this.shareProps(this.props);
  }

  configuring() {
    this.insight.track(
      'generator',
      this.props.target,
      this.props.target.includes('web') && this.props.pwa ? 'pwa' : '',
      this.props.target.includes('cordova') ? this.props.mobile : '',
      this.props.ui,
      this.props.auth ? 'auth' : 'no-auth'
    );
    this.insight.track('package-manager', this.packageManager);

    if (this.props.target.includes('cordova') && this.packageManager === 'yarn') {
      this.log(chalk.yellow('\nWarning: Using Yarn with Cordova is NOT recommended!'));
      this.log(chalk.yellow('Cordova still uses NPM to fetch packages, causing issues with Yarn.\n'));
    }
  }

  install() {
    if (this.props.initGit) {
      this.spawnCommandSync('git', ['init', '--quiet']);
    }

    if (!this.props.skipInstall) {
      this.log(`\nRunning ${chalk.yellow(`${this.packageManager} install`)}, please wait...`);

      const install = this.packageManager === 'yarn' ? this.yarnInstall.bind(this) : this.npmInstall.bind(this);

      if (fs.existsSync(this.destinationPath(packageJsonFile))) {
        install();
      }

      if (this.isFullstack) {
        if (fs.existsSync(this.destinationPath(path.join(process.env.NGX_CLIENT_PATH, packageJsonFile)))) {
          install(null, null, {cwd: this.destinationPath(process.env.NGX_CLIENT_PATH)});
        }

        if (fs.existsSync(this.destinationPath(path.join(process.env.NGX_SERVER_PATH, packageJsonFile)))) {
          install(null, null, {cwd: this.destinationPath(process.env.NGX_SERVER_PATH)});
        }
      }
    }
  }

  end() {
    if (this.updating) {
      this.log(`\nUpdated ${chalk.green(this.props.appName)} to ${chalk.yellow(this.version)} successfully!`);
      return;
    }

    if (this.props.skipQuickstart) {
      return;
    }

    this.log('\nAll done! Get started with these tasks:');
    this.log(
      `- $ ${chalk.green(`${this.packageManager} start`)}: start dev server with live reload on http://localhost:4200`
    );

    if (this.props.target.includes('web')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run build`)}: build web app for production`);
    }

    if (this.props.target.includes('cordova')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run cordova:prepare`)}: prepare for building mobile app`);
      this.log(`- $ ${chalk.green(`${this.packageManager} run cordova:run`)}: run app on device or simulator`);
      this.log(`- $ ${chalk.green(`${this.packageManager} run cordova:build`)}: build mobile app for production`);
    }

    if (this.props.target.includes('electron')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run electron:build`)}: build app for electron`);
      this.log(`- $ ${chalk.green(`${this.packageManager} run electron:run`)}: run app in electron`);
      this.log(
        `- $ ${chalk.green(
          `${this.packageManager} run electron:package`
        )}: package executables for all selected platforms`
      );
    }

    this.log(`- $ ${chalk.green(`${this.packageManager} test`)}: run unit tests in watch mode for TDD`);
    this.log(`- $ ${chalk.green(`${this.packageManager} run test:ci`)}: lint code and run units tests with coverage`);
    this.log(`- $ ${chalk.green(`${this.packageManager} run e2e`)}: launch e2e tests`);

    if (this.props.tools.includes('hads')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run docs`)}: show docs and coding guides`);
    }

    if (this.props.tools.includes('compodoc')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run compodoc`)}: generates docs from code`);
    }

    if (this.props.tools.includes('prettier')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run prettier`)}: format your code automatically`);
    }
  }
}

module.exports = Generator.make({
  baseDir: __dirname,
  generator: NgxGenerator,
  options,
  prompts,
  prefixRules: Object.assign(Generator.defaultPrefixRules, {
    'ionic-tabs': props => props.ui === 'ionic' && props.layout === 'tabs',
    'ionic-side-menu': props => props.ui === 'ionic' && props.layout === 'side-menu',
    'material-simple': props => props.ui === 'material' && props.layout === 'simple',
    'material-side-menu': props => props.ui === 'material' && props.layout === 'side-menu',
    raw: props => props.ui === 'raw',
    'electron-windows': props => props.desktop && props.desktop.includes('windows'),
    'electron-mac': props => props.desktop && props.desktop.includes('mac'),
    'electron-linux': props => props.desktop && props.desktop.includes('linux'),
    'tools-hads': props => props.tools && props.tools.includes('hads')
  })
});
<commit_msg>Bump node version check<commit_after>const fs = require('fs');
const path = require('path');
const chalk = require('chalk');
const Insight = require('insight');
const semver = require('semver');
const Generator = require('@ngx-rocket/core');
const asciiLogo = require('@ngx-rocket/ascii-logo');

const pkg = require('../../package.json');
const prompts = require('./prompts');
const options = require('./options');

const packageJsonFile = 'package.json';

class NgxGenerator extends Generator {
  initializing() {
    this.version = pkg.version;
    this.insight = new Insight({trackingCode: 'UA-93069862-1', pkg});
    this.props = {};

    if (semver.lt(process.version, '10.9.0')) {
      this.log(chalk.yellow('Angular CLI v8 needs NodeJS v10.9 or greater.'));
      this.log(chalk.yellow(`You are using ${process.version} which is unsupported, please upgrade.\n`));
      // eslint-disable-next-line unicorn/no-process-exit
      process.exit(-1);
    }

    this.argument('appName', {
      description: 'Name of the app to generate',
      type: String,
      required: false
    });

    this.insight.optOut = !this.options.analytics || process.env.DISABLE_NGX_ANALYTICS;

    if (this.options.raw) {
      this.props.ui = 'raw';
    }

    if (this.options['location-strategy']) {
      this.props.location = this.options['location-strategy'];
    }

    this.props.strict = this.options.strict;
    this.props.skipInstall = this.options['skip-install'];
    this.props.skipQuickstart = this.options['skip-quickstart'];
    this.props.initGit = this.options.git;

    // Updating
    let fromVersion = null;

    if (this.options.update) {
      this.props = this.config.get('props') || this.props;
      fromVersion = this.config.get('version');
    }

    if (fromVersion) {
      if (fromVersion >= this.version) {
        this.log(chalk.green("\nNothing to update, it's all good!\n"));
        // eslint-disable-next-line unicorn/no-process-exit
        process.exit(0);
      }

      this.updating = true;
      this.log(
        `\nUpdating ${chalk.green(this.props.appName)} project (${chalk.yellow(fromVersion)} -> ${chalk.yellow(
          this.version
        )})\n`
      );
      this.log(`${chalk.yellow("Make sure you don't have uncommitted changes before overwriting files!")}`);
      this.insight.track('update', fromVersion, 'to', this.version);
    } else if (!this.options['skip-welcome']) {
      this.log(asciiLogo(pkg.version));
    }

    // Composition
    const addonsOption = this.options.addons;
    this.addons = addonsOption ? addonsOption.split(' ') : [];
    this.addons.forEach(addon => this.composeWith(addon, this.options));

    this.insight.track('version', this.version);
    this.insight.track('node', process.version);
    this.insight.track('platform', process.platform);
    this.insight.track('addons', addonsOption);
  }

  async prompting() {
    // Allow to pre-set any props in an add-on generator
    Object.assign(this.props, this.sharedProps);

    await super.prompting();
    this.props.mobile = this.props.mobile || [];
    this.props.desktop = this.props.desktop || [];
    this.props.utility = this.props.utility || [];
    this.props.tools = this.props.tools || [];
    this.shareProps(this.props);
  }

  configuring() {
    this.insight.track(
      'generator',
      this.props.target,
      this.props.target.includes('web') && this.props.pwa ? 'pwa' : '',
      this.props.target.includes('cordova') ? this.props.mobile : '',
      this.props.ui,
      this.props.auth ? 'auth' : 'no-auth'
    );
    this.insight.track('package-manager', this.packageManager);

    if (this.props.target.includes('cordova') && this.packageManager === 'yarn') {
      this.log(chalk.yellow('\nWarning: Using Yarn with Cordova is NOT recommended!'));
      this.log(chalk.yellow('Cordova still uses NPM to fetch packages, causing issues with Yarn.\n'));
    }
  }

  install() {
    if (this.props.initGit) {
      this.spawnCommandSync('git', ['init', '--quiet']);
    }

    if (!this.props.skipInstall) {
      this.log(`\nRunning ${chalk.yellow(`${this.packageManager} install`)}, please wait...`);

      const install = this.packageManager === 'yarn' ? this.yarnInstall.bind(this) : this.npmInstall.bind(this);

      if (fs.existsSync(this.destinationPath(packageJsonFile))) {
        install();
      }

      if (this.isFullstack) {
        if (fs.existsSync(this.destinationPath(path.join(process.env.NGX_CLIENT_PATH, packageJsonFile)))) {
          install(null, null, {cwd: this.destinationPath(process.env.NGX_CLIENT_PATH)});
        }

        if (fs.existsSync(this.destinationPath(path.join(process.env.NGX_SERVER_PATH, packageJsonFile)))) {
          install(null, null, {cwd: this.destinationPath(process.env.NGX_SERVER_PATH)});
        }
      }
    }
  }

  end() {
    if (this.updating) {
      this.log(`\nUpdated ${chalk.green(this.props.appName)} to ${chalk.yellow(this.version)} successfully!`);
      return;
    }

    if (this.props.skipQuickstart) {
      return;
    }

    this.log('\nAll done! Get started with these tasks:');
    this.log(
      `- $ ${chalk.green(`${this.packageManager} start`)}: start dev server with live reload on http://localhost:4200`
    );

    if (this.props.target.includes('web')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run build`)}: build web app for production`);
    }

    if (this.props.target.includes('cordova')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run cordova:prepare`)}: prepare for building mobile app`);
      this.log(`- $ ${chalk.green(`${this.packageManager} run cordova:run`)}: run app on device or simulator`);
      this.log(`- $ ${chalk.green(`${this.packageManager} run cordova:build`)}: build mobile app for production`);
    }

    if (this.props.target.includes('electron')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run electron:build`)}: build app for electron`);
      this.log(`- $ ${chalk.green(`${this.packageManager} run electron:run`)}: run app in electron`);
      this.log(
        `- $ ${chalk.green(
          `${this.packageManager} run electron:package`
        )}: package executables for all selected platforms`
      );
    }

    this.log(`- $ ${chalk.green(`${this.packageManager} test`)}: run unit tests in watch mode for TDD`);
    this.log(`- $ ${chalk.green(`${this.packageManager} run test:ci`)}: lint code and run units tests with coverage`);
    this.log(`- $ ${chalk.green(`${this.packageManager} run e2e`)}: launch e2e tests`);

    if (this.props.tools.includes('hads')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run docs`)}: show docs and coding guides`);
    }

    if (this.props.tools.includes('compodoc')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run compodoc`)}: generates docs from code`);
    }

    if (this.props.tools.includes('prettier')) {
      this.log(`- $ ${chalk.green(`${this.packageManager} run prettier`)}: format your code automatically`);
    }
  }
}

module.exports = Generator.make({
  baseDir: __dirname,
  generator: NgxGenerator,
  options,
  prompts,
  prefixRules: Object.assign(Generator.defaultPrefixRules, {
    'ionic-tabs': props => props.ui === 'ionic' && props.layout === 'tabs',
    'ionic-side-menu': props => props.ui === 'ionic' && props.layout === 'side-menu',
    'material-simple': props => props.ui === 'material' && props.layout === 'simple',
    'material-side-menu': props => props.ui === 'material' && props.layout === 'side-menu',
    raw: props => props.ui === 'raw',
    'electron-windows': props => props.desktop && props.desktop.includes('windows'),
    'electron-mac': props => props.desktop && props.desktop.includes('mac'),
    'electron-linux': props => props.desktop && props.desktop.includes('linux'),
    'tools-hads': props => props.tools && props.tools.includes('hads')
  })
});
<|endoftext|>


<commit_before>import {app} from 'server';
import {post, get} from 'koa-route';
import Hashes from 'jshashes';
import template from './template.marko';

const md5 = 'MD5';
const sha1 = 'SHA1';
const sha256 = 'SHA256';
const sha512 = 'SHA512';
const ripemd = 'RIPEMD-160';

const MD5 = new Hashes.MD5();
const SHA1 = new Hashes.SHA1();
const SHA256 = new Hashes.SHA256();
const SHA512 = new Hashes.SHA512();
const RMD160 = new Hashes.RMD160();

app.use(get('/hash', async (ctx, next) => {
  ctx.body = template.stream({ });
  ctx.type = 'text/html';
}));

app.use(post('/hash', async (ctx, next) => {
  const input = ctx.request.body.input;
  let output;

  const md5Hex = MD5.hex(input);
  const sha1Hex = SHA1.hex(input);
  const sha256Hex = SHA256.hex(input);
  const sha512Hex = SHA512.hex(input);
  const rmd160Hex = RMD160.hex(input);

  const hexHashes = {
    md5: md5Hex,
    sha1: sha1Hex,
    sha256: sha256Hex,
    sha512: sha512Hex,
    RMD160: rmd160Hex
  };

  const md5B64 = MD5.b64(input);
  const sha1B64 = SHA1.b64(input);
  const sha256B64 = SHA256.b64(input);
  const sha512B64 = SHA512.b64(input);
  const rmd160B64 = RMD160.b64(input);
  const noneB64 = Buffer.from(input).toString('base64');

  const b64Hashes = {
    none: noneB64,
    md5: md5B64,
    sha1: sha1B64,
    sha256: sha256B64,
    sha512: sha512B64,
    RMD160: rmd160B64
  };

  ctx.body = template.stream({hexHashes, b64Hashes, input});
  ctx.type = 'text/html';
}));

<commit_msg>Removes no algoritm base64 output as it now exists in encode feature - cleans up unused code<commit_after>import {app} from 'server';
import {post, get} from 'koa-route';
import Hashes from 'jshashes';
import template from './template.marko';

const MD5 = new Hashes.MD5();
const SHA1 = new Hashes.SHA1();
const SHA256 = new Hashes.SHA256();
const SHA512 = new Hashes.SHA512();
const RMD160 = new Hashes.RMD160();

app.use(get('/hash', async ctx => {
  ctx.body = template.stream({ });
  ctx.type = 'text/html';
}));

app.use(post('/hash', async ctx => {
  const input = ctx.request.body.input;

  const md5Hex = MD5.hex(input);
  const sha1Hex = SHA1.hex(input);
  const sha256Hex = SHA256.hex(input);
  const sha512Hex = SHA512.hex(input);
  const rmd160Hex = RMD160.hex(input);

  const hexHashes = {
    md5: md5Hex,
    sha1: sha1Hex,
    sha256: sha256Hex,
    sha512: sha512Hex,
    RMD160: rmd160Hex
  };

  const md5B64 = MD5.b64(input);
  const sha1B64 = SHA1.b64(input);
  const sha256B64 = SHA256.b64(input);
  const sha512B64 = SHA512.b64(input);
  const rmd160B64 = RMD160.b64(input);

  const b64Hashes = {
    md5: md5B64,
    sha1: sha1B64,
    sha256: sha256B64,
    sha512: sha512B64,
    RMD160: rmd160B64
  };

  ctx.body = template.stream({hexHashes, b64Hashes, input});
  ctx.type = 'text/html';
}));

<|endoftext|>


<commit_before>var airpubConfigs = {
  // blog name
  name: '插屁屁',
  // just a little description
  description: '插屁屁提高班',
  // blog uri
  url: 'http://yourUri.com',
  // blog theme
  // theme: 'my-theme',
  // for images upload
  upyun: {
    bucket: 'mybucket',
    uri: 'http://{{bucketName}}.b0.upaiyun.com',
    endpoint: 'http://v0.api.upyun.com/{{bucketName}}',
    form_api_secret: 'xxxxxx'
  }
}

// for backend service
var duoshuoQuery = {
  short_name: '{{your_duoshuo_short_name}}'
};
<commit_msg>configs<commit_after><|endoftext|>


<commit_before>'use strict';
const Generator = require('yeoman-generator');
const chalk = require('chalk');
const yosay = require('yosay');

module.exports = class extends Generator {
  prompting() {
    // Have Yeoman greet the user.
    this.log(yosay(
      'Welcome to the prime ' + chalk.red('generator-meetch') + ' generator!'
    ));

    const prompts = [{
      type: 'confirm',
      name: 'scoped',
      message: 'Will this project be published under an npm scope?',
      default: false
    },
    {
      when: function (response) {
        return response.scoped;
      },
      type: 'input',
      name: 'scopeName',
      message: 'npm scope name',
      store: true
    },
    {
      type: 'input',
      name: 'packageName',
      message: 'npm package name'
    },
    {
      type: 'input',
      name: 'reactClassName',
      message: 'react component class name (Capitalize, no dashes)'
    },
    {
      type: 'input',
      name: 'bitbucketUser',
      message: 'bitbucket.org user name',
      store: true
    },
    {
      type: 'input',
      name: 'githubUser',
      message: 'github.com user name',
      store: true
    },
    {
      type: 'input',
      name: 'travisUser',
      message: 'travis-ci.org user name',
      store: true
    },
    {
      type: 'input',
      name: 'codecovUser',
      message: 'codecov.io user name',
      store: true
    },
    {
      type: 'input',
      name: 'npmAuthor',
      message: 'npm author name',
      store: true
    }];

    return this.prompt(prompts).then(props => {
      // To access props later use this.props.someAnswer;
      this.props = props;
    }).then(() => {
      this.log('==> scoped: ', this.props.scoped);
      this.log('==> scope: ', this.props.scopeName);
      this.log('==> package name: ', this.props.packageName);
      this.log('==> npm author: ', this.props.npmAuthor);
    });
  }

  writing() {
    // File: package.json
    const pkg = this.props.packageName;

    const data = {
      packageName: pkg,
      fullPackageName:
        this.props.scoped ? '@' + this.props.scopeName + '/' + pkg : pkg,
      reactClassName: this.props.reactClassName,
      npmAuthor: this.props.npmAuthor,
      bitbucketUser: this.props.bitbucketUser,
      githubUser: this.props.githubUser,
      travisUser: this.props.travisUser,
      codecovUser: this.props.codecovUser,
      currentYear: new Date().getFullYear()
    };

    this.fs.copyTpl(
      this.templatePath('_package.json'),
      this.destinationPath('package.json'),
      data
    );

    // File: README.md

    this.fs.copyTpl(
      this.templatePath('_README.md'),
      this.destinationPath('README.md'),
      data
    );

    // File: Gruntfile.js

    this.fs.copy(
      this.templatePath('_Gruntfile.js'),
      this.destinationPath('Gruntfile.js')
    );

    // File: .babelrc

    this.fs.copy(
      this.templatePath('_babelrc'),
      this.destinationPath('.babelrc')
    );

    // File: .npmignore

    this.fs.copy(
      this.templatePath('_npmignore'),
      this.destinationPath('.npmignore')
    );

    // File: .travis.yml

    this.fs.copy(
      this.templatePath('_travis.yml'),
      this.destinationPath('.travis.yml')
    );

    // File: webpack.config.js

    this.fs.copy(
      this.templatePath('_webpack.config.js'),
      this.destinationPath('webpack.config.js')
    );

    // File: LICENSE

    this.fs.copyTpl(
      this.templatePath('_LICENSE'),
      this.destinationPath('LICENSE'),
      data
    );

    // File: index.js

    this.fs.copyTpl(
      this.templatePath('_index.js'),
      this.destinationPath('src/index.js'),
      data
    );

    // File: test/Smoke.spec.js

    this.fs.copyTpl(
      this.templatePath('_test-smoke.spec.js'),
      this.destinationPath('test/Smoke.spec.js'),
      data
    );

     // File: test/dom.js

    this.fs.copy(
      this.templatePath('_test-dom.js'),
      this.destinationPath('test/dom.js')
    );

    // File: test/helpers.js

    this.fs.copy(
      this.templatePath('_test-helpers.js'),
      this.destinationPath('test/helpers.js')
    );
  }

  install() {
    this.installDependencies();
  }
};
<commit_msg>changed display name<commit_after>'use strict';
const Generator = require('yeoman-generator');
const chalk = require('chalk');
const yosay = require('yosay');

module.exports = class extends Generator {
  prompting() {
    // Have Yeoman greet the user.
    this.log(yosay(
      'Welcome to the ' + chalk.red('generator-mitchallen\n-react-component') + ' generator!'
    ));

    const prompts = [{
      type: 'confirm',
      name: 'scoped',
      message: 'Will this project be published under an npm scope?',
      default: false
    },
    {
      when: function (response) {
        return response.scoped;
      },
      type: 'input',
      name: 'scopeName',
      message: 'npm scope name',
      store: true
    },
    {
      type: 'input',
      name: 'packageName',
      message: 'npm package name'
    },
    {
      type: 'input',
      name: 'reactClassName',
      message: 'react component class name (Capitalize, no dashes)'
    },
    {
      type: 'input',
      name: 'bitbucketUser',
      message: 'bitbucket.org user name',
      store: true
    },
    {
      type: 'input',
      name: 'githubUser',
      message: 'github.com user name',
      store: true
    },
    {
      type: 'input',
      name: 'travisUser',
      message: 'travis-ci.org user name',
      store: true
    },
    {
      type: 'input',
      name: 'codecovUser',
      message: 'codecov.io user name',
      store: true
    },
    {
      type: 'input',
      name: 'npmAuthor',
      message: 'npm author name',
      store: true
    }];

    return this.prompt(prompts).then(props => {
      // To access props later use this.props.someAnswer;
      this.props = props;
    }).then(() => {
      this.log('==> scoped: ', this.props.scoped);
      this.log('==> scope: ', this.props.scopeName);
      this.log('==> package name: ', this.props.packageName);
      this.log('==> npm author: ', this.props.npmAuthor);
    });
  }

  writing() {
    // File: package.json
    const pkg = this.props.packageName;

    const data = {
      packageName: pkg,
      fullPackageName:
        this.props.scoped ? '@' + this.props.scopeName + '/' + pkg : pkg,
      reactClassName: this.props.reactClassName,
      npmAuthor: this.props.npmAuthor,
      bitbucketUser: this.props.bitbucketUser,
      githubUser: this.props.githubUser,
      travisUser: this.props.travisUser,
      codecovUser: this.props.codecovUser,
      currentYear: new Date().getFullYear()
    };

    this.fs.copyTpl(
      this.templatePath('_package.json'),
      this.destinationPath('package.json'),
      data
    );

    // File: README.md

    this.fs.copyTpl(
      this.templatePath('_README.md'),
      this.destinationPath('README.md'),
      data
    );

    // File: Gruntfile.js

    this.fs.copy(
      this.templatePath('_Gruntfile.js'),
      this.destinationPath('Gruntfile.js')
    );

    // File: .babelrc

    this.fs.copy(
      this.templatePath('_babelrc'),
      this.destinationPath('.babelrc')
    );

    // File: .npmignore

    this.fs.copy(
      this.templatePath('_npmignore'),
      this.destinationPath('.npmignore')
    );

    // File: .travis.yml

    this.fs.copy(
      this.templatePath('_travis.yml'),
      this.destinationPath('.travis.yml')
    );

    // File: webpack.config.js

    this.fs.copy(
      this.templatePath('_webpack.config.js'),
      this.destinationPath('webpack.config.js')
    );

    // File: LICENSE

    this.fs.copyTpl(
      this.templatePath('_LICENSE'),
      this.destinationPath('LICENSE'),
      data
    );

    // File: index.js

    this.fs.copyTpl(
      this.templatePath('_index.js'),
      this.destinationPath('src/index.js'),
      data
    );

    // File: test/Smoke.spec.js

    this.fs.copyTpl(
      this.templatePath('_test-smoke.spec.js'),
      this.destinationPath('test/Smoke.spec.js'),
      data
    );

     // File: test/dom.js

    this.fs.copy(
      this.templatePath('_test-dom.js'),
      this.destinationPath('test/dom.js')
    );

    // File: test/helpers.js

    this.fs.copy(
      this.templatePath('_test-helpers.js'),
      this.destinationPath('test/helpers.js')
    );
  }

  install() {
    this.installDependencies({
      npm: true,
      bower: false,
      yarn: false
    });
  }
};
<|endoftext|>


<commit_before>import React from "react";
import {qnfetch, apiURL} from "assets/utils/request";
import moment from "moment";
import AppBar from "material-ui/AppBar";
import {List, ListItem} from "material-ui/List";
import ContentDrafts from "material-ui/svg-icons/content/drafts";
import ContentAdd from "material-ui/svg-icons/content/add";
import FloatingActionButton from "material-ui/FloatingActionButton";
import FlatButton from "material-ui/FlatButton";
import Dialog from "material-ui/Dialog";
import TextField from "material-ui/TextField";
import "./home.less";

class Home extends React.Component {
  constructor () {
    super();
    this.state = {
      list: [],
      nextURL: '',
      dialogOpen: false
    }
  }

  componentWillMount () {
    this.fetchData();
  }

  componentDidMount () {
    let that = this;

    document.addEventListener('touchmove', function (e) {
      e.stopPropagation();
      var clientH = document.body.clientHeight
      var scrollTop = document.body.scrollTop
      var scrollH = document.body.scrollHeight

      if (clientH + scrollTop >= scrollH) {
        if (that.state.nextURL) {
          qnfetch(that.state.nextURL)
            .then(res => res.json())
            .then(data => {
              const list = data.results;
              that.setState({
                ...that.state,
                list: that.state.list.push(list),
                nextURL: data.next
              })
            })
            .catch(err => console.log(err))
        }
      }
    }, false)
  }

  fetchData = () => {
    let that = this
    qnfetch(apiURL.Get_Message_list)
      .then(res => res.json())
      .then(data => {
        const list = data.results;
        const nextURL = data.next;
        that.setState({list, nextURL})
      })
      .catch(err => console.log(err))

  }

  handleOpen = () => {
    this.setState({
      ...this.state,
      dialogOpen: true
    })
  }
  handleClose = () => {
    this.setState({
      ...this.state,
      dialogOpen: false
    })
  }

  handleSend = () => {
    const content = document.getElementById('contentText').value;
    const params = {content}

    qnfetch(apiURL.Post_Message, params, 'POST')
      .then(res => res.json())
      .then(data => {
        this.setState({
          ...this.state,
          list: this.state.list.push(data),
          dialogOpen: false
        })
      })
      .catch(err => console.log(err))
  }

  render () {
    const list = this.state.list || [];

    const actions = [
      <FlatButton
        label="取消"
        primary={true}
        onTouchTap={this.handleClose}
      />,
      <FlatButton
        label="发送"
        primary={true}
        keyboardFocused={true}
        onTouchTap={this.handleSend}
      />,
    ];

    return (

          <AppBar
            title="POST MAN"
            iconClassNameRight="muidocs-icon-navigation-expand-more"
          />

          <List>
            {list.length > 0 && list.map((i, index) =>
              <ListItem primaryText={i.content} secondaryText={moment.unix(i.time).fromNow()}
                        leftIcon={<ContentDrafts />} key={index}/>
            )}
          </List>

        <FloatingActionButton secondary={true} className="floating-button" onTouchTap={this.handleOpen}>
          <ContentAdd />
        </FloatingActionButton>

        <Dialog
          actions={actions}
          modal={false}
          open={this.state.dialogOpen}
          onRequestClose={this.handleClose}
        >
          <TextField
            hintText="尽情吐槽吧"
            floatingLabelText="你的留言"
            multiLine={true}
            rows={2}
            id="contentText"
          />
        </Dialog>

    )
  }
}
;

export default Home
<commit_msg>appbar完成<commit_after>import React from "react";
import {qnfetch, apiURL} from "assets/utils/request";
import moment from "moment";
import AppBar from "material-ui/AppBar";
import {List, ListItem} from "material-ui/List";
import ContentDrafts from "material-ui/svg-icons/content/drafts";
import ContentAdd from "material-ui/svg-icons/content/add";
import FloatingActionButton from "material-ui/FloatingActionButton";
import FlatButton from "material-ui/FlatButton";
import Dialog from "material-ui/Dialog";
import TextField from "material-ui/TextField";
import "./home.less";

class Home extends React.Component {
  constructor () {
    super();
    this.state = {
      list: [],
      nextURL: '',
      dialogOpen: false
    }
  }

  componentWillMount () {
    this.fetchData();
  }

  componentDidMount () {
    let that = this;

    document.addEventListener('touchmove', function (e) {
      e.stopPropagation();
      var clientH = document.body.clientHeight
      var scrollTop = document.body.scrollTop
      var scrollH = document.body.scrollHeight

      if (clientH + scrollTop >= scrollH) {
        if (that.state.nextURL) {
          qnfetch(that.state.nextURL)
            .then(res => res.json())
            .then(data => {
              const list = data.results;
              that.setState({
                ...that.state,
                list: that.state.list.push(list),
                nextURL: data.next
              })
            })
            .catch(err => console.log(err))
        }
      }
    }, false)
  }

  fetchData = () => {
    let that = this
    qnfetch(apiURL.Get_Message_list)
      .then(res => res.json())
      .then(data => {
        const list = data.results;
        const nextURL = data.next;
        that.setState({list, nextURL})
      })
      .catch(err => console.log(err))

  }

  handleOpen = () => {
    this.setState({
      ...this.state,
      dialogOpen: true
    })
  }
  handleClose = () => {
    this.setState({
      ...this.state,
      dialogOpen: false
    })
  }

  handleSend = () => {
    const content = document.getElementById('contentText').value;
    const params = {content}

    qnfetch(apiURL.Post_Message, params, 'POST')
      .then(res => res.json())
      .then(data => {
        this.setState({
          ...this.state,
          list: this.state.list.push(data),
          dialogOpen: false
        })
      })
      .catch(err => console.log(err))
  }

  render () {
    const list = this.state.list || [];

    const actions = [
      <FlatButton
        label="取消"
        primary={true}
        onTouchTap={this.handleClose}
      />,
      <FlatButton
        label="发送"
        primary={true}
        keyboardFocused={true}
        onTouchTap={this.handleSend}
      />,
    ];

    return (

          <AppBar
            title="POST MAN"
            iconClassNameRight="muidocs-icon-navigation-expand-more"
          />

          <List>
            {list.length > 0 && list.map((i, index) =>
              <ListItem primaryText={i.content} secondaryText={i.time && moment.unix(i.time).fromNow()}
                        leftIcon={<ContentDrafts />} key={index}/>
            )}
          </List>

        <FloatingActionButton secondary={true} className="floating-button" onTouchTap={this.handleOpen}>
          <ContentAdd />
        </FloatingActionButton>

        <Dialog
          actions={actions}
          modal={false}
          open={this.state.dialogOpen}
          onRequestClose={this.handleClose}
        >
          <TextField
            hintText="尽情吐槽吧"
            floatingLabelText="你的留言"
            multiLine={true}
            rows={2}
            id="contentText"
          />
        </Dialog>

    )
  }
}
;

export default Home
<|endoftext|>


<commit_before>// # Ghost Configuration
// Setup your Ghost install for various environments
// Documentation can be found at http://support.ghost.org/config/

var path = require('path'),
    config;

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://192.241.202.71',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },

        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '192.241.202.71',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        }
    },

    // ### Development **(default)**
    development: {
        // The url to use when providing links to the site, E.g. in RSS and email.
        // Change this to your Ghost blogs published URL.
        url: 'http://localhost:2368',

        // Example mail config
        // Visit http://support.ghost.org/mail for instructions
        // ```
        mail: {
            transport: 'SMTP',
            options: {
                service: 'Mailgun',
                auth: {
                    user: 'postmaster@sandbox6bd16f01bf4b4d27b2d3fc110b2579e7.mailgun.org', // mailgun username
                    pass: '37c5c4d644c6afe24a3d85f0a75b4a1c'  // mailgun password
                }
            }
        },
        // ```

        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-dev.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        },
        paths: {
            contentPath: path.join(__dirname, '/content/')
        }
    },

    // **Developers only need to edit below here**

    // ### Testing
    // Used when developing Ghost to run tests and check the health of Ghost
    // Uses a different port number
    testing: {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-test.db')
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        },
        logging: false
    },

    // ### Testing MySQL
    // Used by Travis - Automated testing run through GitHub
    'testing-mysql': {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'mysql',
            connection: {
                host     : '127.0.0.1',
                user     : 'root',
                password : '',
                database : 'ghost_testing',
                charset  : 'utf8'
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        },
        logging: false
    },

    // ### Testing pg
    // Used by Travis - Automated testing run through GitHub
    'testing-pg': {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'pg',
            connection: {
                host     : '127.0.0.1',
                user     : 'postgres',
                password : '',
                database : 'ghost_testing',
                charset  : 'utf8'
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        },
        logging: false
    }
};

// Export config
module.exports = config;
<commit_msg>Changed to port 80<commit_after>// # Ghost Configuration
// Setup your Ghost install for various environments
// Documentation can be found at http://support.ghost.org/config/

var path = require('path'),
    config;

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment
    // Configure your URL and mail settings here
    production: {
        url: 'http://192.241.202.71',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },

        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '192.241.202.71',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '80'
        }
    },

    // ### Development **(default)**
    development: {
        // The url to use when providing links to the site, E.g. in RSS and email.
        // Change this to your Ghost blogs published URL.
        url: 'http://localhost:2368',

        // Example mail config
        // Visit http://support.ghost.org/mail for instructions
        // ```
        mail: {
            transport: 'SMTP',
            options: {
                service: 'Mailgun',
                auth: {
                    user: 'postmaster@sandbox6bd16f01bf4b4d27b2d3fc110b2579e7.mailgun.org', // mailgun username
                    pass: '37c5c4d644c6afe24a3d85f0a75b4a1c'  // mailgun password
                }
            }
        },
        // ```

        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-dev.db')
            },
            debug: false
        },
        server: {
            // Host to be passed to node's `net.Server#listen()`
            host: '127.0.0.1',
            // Port to be passed to node's `net.Server#listen()`, for iisnode set this to `process.env.PORT`
            port: '2368'
        },
        paths: {
            contentPath: path.join(__dirname, '/content/')
        }
    },

    // **Developers only need to edit below here**

    // ### Testing
    // Used when developing Ghost to run tests and check the health of Ghost
    // Uses a different port number
    testing: {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost-test.db')
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        },
        logging: false
    },

    // ### Testing MySQL
    // Used by Travis - Automated testing run through GitHub
    'testing-mysql': {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'mysql',
            connection: {
                host     : '127.0.0.1',
                user     : 'root',
                password : '',
                database : 'ghost_testing',
                charset  : 'utf8'
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        },
        logging: false
    },

    // ### Testing pg
    // Used by Travis - Automated testing run through GitHub
    'testing-pg': {
        url: 'http://127.0.0.1:2369',
        database: {
            client: 'pg',
            connection: {
                host     : '127.0.0.1',
                user     : 'postgres',
                password : '',
                database : 'ghost_testing',
                charset  : 'utf8'
            }
        },
        server: {
            host: '127.0.0.1',
            port: '2369'
        },
        logging: false
    }
};

// Export config
module.exports = config;
<|endoftext|>