From bf7a52c9a0421f31c550464d9761a84d5979f9b1 Mon Sep 17 00:00:00 2001 From: Kate Anishkina Date: Tue, 10 Nov 2015 15:00:31 +0300 Subject: [PATCH] Fix the issue of deploying process --- README.md | 4 ++ package.json | 3 +- slushfile.js | 104 +++++++++++++++++++++++++++++++++++++++++++++++++- slushtasks.js | 94 --------------------------------------------- 4 files changed, 107 insertions(+), 98 deletions(-) delete mode 100644 slushtasks.js diff --git a/README.md b/README.md index 17698c2..d3dcecd 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,10 @@ To find out more about Slush, check out the [documentation](https://github.com/s ## Change log +#### 0.1.2 + +* Remove ES6 from slushfile so it inovoked the problem of deploying process. + #### 0.1.1 * Update dependencies for the slush app. diff --git a/package.json b/package.json index 666910f..154f6c3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "slush-spa", "description": "SPA creation", - "version": "0.1.1", + "version": "0.1.2", "homepage": "https://github.com/KateKate/slush-spa", "author": { "name": "Kate Anishkina", @@ -29,7 +29,6 @@ "test": "echo \"No tests\"" }, "dependencies": { - "babel": "^5.8.29", "gulp": "^3.6.2", "gulp-conflict": "^0.3.0", "gulp-install": "^0.3.0", diff --git a/slushfile.js b/slushfile.js index 72d2461..e060771 100644 --- a/slushfile.js +++ b/slushfile.js @@ -5,5 +5,105 @@ * Copyright (c) 2015, Kate Anishkina * Licensed under the MIT license. */ -require('babel/register'); -require('./slushtasks.js'); + +'use strict'; + +var gulp = require('gulp'), + install = require('gulp-install'), + conflict = require('gulp-conflict'), + template = require('gulp-template'), + rename = require('gulp-rename'), + _ = require('underscore.string'), + inquirer = require('inquirer'), + path = require('path'); + + +function format(string) { + var username = string.toLowerCase(); + return username.replace(/\s/g, ''); +} + + +var defaults = (function () { + var workingDirName = path.basename(process.cwd()); + var homeDir; + var osUserName; + var configFile; + var user = {}; + + if (process.platform === 'win32') { + homeDir = process.env.USERPROFILE; + osUserName = process.env.USERNAME || path.basename(homeDir).toLowerCase(); + } + else { + homeDir = process.env.HOME || process.env.HOMEPATH; + osUserName = homeDir && homeDir.split('/').pop() || 'root'; + } + + configFile = path.join(homeDir, '.gitconfig'); + + if (require('fs').existsSync(configFile)) { + user = require('iniparser').parseSync(configFile).user; + } + + return { + appName: workingDirName, + userName: osUserName || format(user.name || ''), + authorName: user.name || '', + authorEmail: user.email || '' + }; +})(); + + +gulp.task('default', function (done) { + var prompts = [{ + name: 'appName', + message: 'What is the name of your application?', + default: defaults.appName + }, { + name: 'appDescription', + message: 'What is the description?' + }, { + name: 'appVersion', + message: 'What is the version of your application?', + default: '0.1.0' + }, { + name: 'authorName', + message: 'What is the author name?', + default: defaults.authorName + }, { + name: 'authorEmail', + message: 'What is the author email?', + default: defaults.authorEmail + }, { + name: 'userName', + message: 'What is the github username?', + default: defaults.userName + }, { + type: 'confirm', + name: 'moveon', + message: 'Continue?' + }]; + //Ask + inquirer.prompt(prompts, + function (answers) { + if (!answers.moveon) { + return done(); + } + answers.appNameSlug = _.slugify(answers.appName); + gulp.src(__dirname + '/templates/**') + .pipe(template(answers)) + .pipe(rename(function (file) { + if (file.basename[0] === '_') { + file.basename = '.' + file.basename.slice(1); + } + })) + .pipe(conflict('./')) + .pipe(gulp.dest('./')) + .pipe(install()) + .on('end', function () { + done(); + }); + } + ); +}); diff --git a/slushtasks.js b/slushtasks.js deleted file mode 100644 index adadaca..0000000 --- a/slushtasks.js +++ /dev/null @@ -1,94 +0,0 @@ -import gulp from 'gulp'; -import install from 'gulp-install'; -import conflict from 'gulp-conflict'; -import template from 'gulp-template'; -import rename from 'gulp-rename'; -import inquirer from 'inquirer'; -import path from 'path'; - -const _ = require('underscore.string'); - -function format(string) { - const username = string.toLowerCase(); - return username.replace(/\s/g, ''); -} - -const defaults = (() => { - const workingDirName = path.basename(process.cwd()); - - let homeDir, osUserName; - if (process.platform === 'win32') { - homeDir = process.env.USERPROFILE; - osUserName = process.env.USERNAME || path.basename(homeDir).toLowerCase(); - } - else { - homeDir = process.env.HOME || process.env.HOMEPATH; - osUserName = homeDir && homeDir.split('/').pop() || 'root'; - } - - const configFile = path.join(homeDir, '.gitconfig'); - let user = {}; - - if (require('fs').existsSync(configFile)) { - user = require('iniparser').parseSync(configFile).user; - } - - return { - appName: workingDirName, - userName: osUserName || format(user.name || ''), - authorName: user.name || '', - authorEmail: user.email || '' - }; - -})(); - -gulp.task('default', (done) => { - const prompts = [{ - name: 'appName', - message: 'What is the name of your project?', - default: defaults.appName - }, { - name: 'appDescription', - message: 'What is the description?' - }, { - name: 'appVersion', - message: 'What is the version of your project?', - default: '0.1.0' - }, { - name: 'authorName', - message: 'What is the author name?', - default: defaults.authorName - }, { - name: 'authorEmail', - message: 'What is the author email?', - default: defaults.authorEmail - }, { - name: 'userName', - message: 'What is the github username?', - default: defaults.userName - }, { - type: 'confirm', - name: 'moveon', - message: 'Continue?' - }]; - - inquirer.prompt(prompts, (answers) => { - if (!answers.moveon) { - return done(); - } - answers.appNameSlug = _.slugify(answers.appName); - gulp.src(__dirname + '/templates/**') - .pipe(template(answers)) - .pipe(rename( (file) => { - if (file.basename[0] === '_') { - file.basename = '.' + file.basename.slice(1); - } - })) - .pipe(conflict('./')) - .pipe(gulp.dest('./')) - .pipe(install()) - .on('end', () => { - done(); - }); - }); -});