From 3d3a3fbfde31fbcdb2a984814dee85b5914aa628 Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 17 Oct 2014 18:17:56 -0400 Subject: [PATCH] Proceed with questions for site variables --- gulpfile.js | 6 +- tasks/questions.js | 379 +++++++++++++++++++++++++++++++++++++-------- 2 files changed, 322 insertions(+), 63 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index a125dfbeb..a94958b32 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -305,7 +305,7 @@ gulp.task('version', 'Displays current version of Semantic', function(callback) ---------------*/ gulp.task('check install', false, function () { - if(0) { + if(1) { setTimeout(function() { gulp.start('install'); }, 100); @@ -322,11 +322,13 @@ gulp.task('install', 'Set-up project for first time', function () { gulp .src(defaults.paths.source.config) .pipe(prompt.prompt(questions.setup, function( answers ) { - console.log(answers); console.info('Creating site folder'); console.info('Creating theme config file (semantic.config)'); console.info('Creating build config file (semantic.json)'); })) + .pipe(prompt.prompt(questions.site, function( answers ) { + console.info('Creating site variables file'); + })) ; } diff --git a/tasks/questions.js b/tasks/questions.js index c66ee6cdd..f477dd537 100644 --- a/tasks/questions.js +++ b/tasks/questions.js @@ -2,7 +2,31 @@ Set-up Questions *******************************/ -var defaults = require('./defaults'); +var defaults, when; + +defaults = require('./defaults'); + +when = { + notAuto: function(questions) { + console.log(questions.install); + return (questions.install !== 'auto'); + }, + custom: function(questions) { + return (questions.install === 'custom'); + }, + express: function(questions) { + return (questions.install === 'express'); + }, + customize: function(questions) { + return (questions.customize === true); + }, + primaryColor: function(questions) { + return (questions.primaryColor); + }, + secondaryColor: function(questions) { + return (questions.secondaryColor); + } +}; module.exports = { @@ -10,92 +34,325 @@ module.exports = { { type: 'list', name: 'install', - message: 'First run: Set-up Semantic UI', + message: 'Set-up Semantic UI', choices: [ - 'Automatic (Use defaults locations and all packages)', - 'Express (Set components and output folder)', - 'Custom (Customize all config values)' + { + name: 'Automatic (Use defaults locations and all packages)', + value: 'auto' + }, + { + name: 'Express (Set components and output folder)', + value: 'express' + }, + { + name: 'Custom (Customize all config values)', + value: 'custom' + } ] }, + { + type: 'checkbox', + name: 'components', + message: 'What components should we include in the package? (Toggle with spacebar)', + choices: [ + { name: "Button", checked: true }, + { name: "Divider", checked: true }, + { name: "Flag", checked: true }, + { name: "Header", checked: true }, + { name: "Icon", checked: true }, + { name: "Image", checked: true }, + { name: "Input", checked: true }, + { name: "Label", checked: true }, + { name: "List", checked: true }, + { name: "Loader", checked: true }, + { name: "Rail", checked: true }, + { name: "Reveal", checked: true }, + { name: "Segment", checked: true }, + { name: "Step", checked: true }, + { name: "Breadcrumb", checked: true }, + { name: "Form", checked: true }, + { name: "Grid", checked: true }, + { name: "Menu", checked: true }, + { name: "Message", checked: true }, + { name: "Table", checked: true }, + { name: "Card", checked: true }, + { name: "Comment", checked: true }, + { name: "Feed", checked: true }, + { name: "Item", checked: true }, + { name: "Statistic", checked: true }, + { name: "Accordion", checked: true }, + { name: "Checkbox", checked: true }, + { name: "Dimmer", checked: true }, + { name: "Dropdown", checked: true }, + { name: "Modal", checked: true }, + { name: "Nag", checked: true }, + { name: "Popup", checked: true }, + { name: "Progress", checked: true }, + { name: "Rating", checked: true }, + { name: "Search", checked: true }, + { name: "Shape", checked: true }, + { name: "Sidebar", checked: true }, + { name: "Sticky", checked: true }, + { name: "Tab", checked: true }, + { name: "Transition", checked: true }, + { name: "Video", checked: true }, + { name: "Api", checked: true }, + { name: "Form ", checked: true } + ], + when: when.notAuto + }, + { + type: 'input', + name: 'dist', + message: 'Where should we output Semantic UI?', + default: defaults.paths.output.packaged, + when: when.express + }, { type: 'input', name: 'site', message: 'Where should we put your site folder?', - default: defaults.paths.source.site + default: defaults.paths.source.site, + when: when.custom }, { type: 'input', name: 'config', message: 'Where should we put your semantic.config file?', - default: defaults.paths.source.config + default: defaults.paths.source.config, + when: when.custom }, { type: 'input', - name: 'dest', - message: 'Where should we compile semantic to?', - default: defaults.paths.output.packaged + name: 'packaged', + message: 'Where should we output a packaged version?', + default: defaults.paths.output.packaged, + when: when.custom }, { type: 'input', - name: 'dest', + name: 'compressed', message: 'Where should we output compressed components?', - default: defaults.paths.output.compressed + default: defaults.paths.output.compressed, + when: when.custom }, { type: 'input', - name: 'dest', + name: 'uncompressed', message: 'Where should we output uncompressed components?', - default: defaults.paths.output.uncompressed - }, + default: defaults.paths.output.uncompressed, + when: when.custom + } + ], + + site: [ { - type: 'checkbox', - name: 'components', - message: 'What components should we include in the package? (Toggle with spacebar)', + type: 'list', + name: 'customize', + message: 'You have not yet customized your site, can we help you do that?', choices: [ - {name: "Button", checked: true }, - {name: "Divider", checked: true }, - {name: "Flag", checked: true }, - {name: "Header", checked: true }, - {name: "Icon", checked: true }, - {name: "Image", checked: true }, - {name: "Input", checked: true }, - {name: "Label", checked: true }, - {name: "List", checked: true }, - {name: "Loader", checked: true }, - {name: "Rail", checked: true }, - {name: "Reveal", checked: true }, - {name: "Segment", checked: true }, - {name: "Step", checked: true }, - {name: "Breadcrumb", checked: true }, - {name: "Form", checked: true }, - {name: "Grid", checked: true }, - {name: "Menu", checked: true }, - {name: "Message", checked: true }, - {name: "Table", checked: true }, - {name: "Card", checked: true }, - {name: "Comment", checked: true }, - {name: "Feed", checked: true }, - {name: "Item", checked: true }, - {name: "Statistic", checked: true }, - {name: "Accordion", checked: true }, - {name: "Checkbox", checked: true }, - {name: "Dimmer", checked: true }, - {name: "Dropdown", checked: true }, - {name: "Modal", checked: true }, - {name: "Nag", checked: true }, - {name: "Popup", checked: true }, - {name: "Progress", checked: true }, - {name: "Rating", checked: true }, - {name: "Search", checked: true }, - {name: "Shape", checked: true }, - {name: "Sidebar", checked: true }, - {name: "Sticky", checked: true }, - {name: "Tab", checked: true }, - {name: "Transition", checked: true }, - {name: "Video", checked: true }, - {name: "Api", checked: true }, - {name: "Form ", checked: true } + { + name: 'Yes, ask me a few questions', + value: true + }, + { + name: 'No I\'ll do it myself', + value: false + } ] + }, + { + type: 'list', + name: 'headerFont', + message: 'Select your header font', + choices: [ + { + name: 'Helvetica Neue, Arial, sans-serif', + value: 'Helvetica Neue, Arial, sans-serif;' + }, + { + name: 'Lato (Google Fonts)', + value: 'Lato' + }, + { + name: 'Open Sans (Google Fonts)', + value: 'Open Sans' + }, + { + name: 'Source Sans Pro (Google Fonts)', + value: 'Source Sans Pro' + }, + { + name: 'Droid (Google Fonts)', + value: 'Droid' + }, + { + name: 'I\'ll choose on my own', + value: false + } + ], + when: when.customize + }, + { + type: 'list', + name: 'pageFont', + message: 'Select your page font', + choices: [ + { + name: 'Helvetica Neue, Arial, sans-serif', + value: 'Helvetica Neue, Arial, sans-serif;' + }, + { + name: 'Lato (Import from Google Fonts)', + value: 'Lato' + }, + { + name: 'Open Sans (Import from Google Fonts)', + value: 'Open Sans' + }, + { + name: 'Source Sans Pro (Import from Google Fonts)', + value: 'Source Sans Pro' + }, + { + name: 'Droid (Google Fonts)', + value: 'Droid' + }, + { + name: 'I\'ll choose on my own', + value: false + } + ], + when: when.customize + }, + { + type: 'list', + name: 'fontSize', + message: 'Select your base font size', + default: '14px', + choices: [ + { + name: '12px', + }, + { + name: '13px', + }, + { + name: '14px (Recommended)', + value: '14px' + }, + { + name: '15px', + }, + { + name: '16px', + }, + { + name: 'I\'ll choose on my own', + value: false + } + ], + when: when.customize + }, + { + type: 'list', + name: 'primaryColor', + message: 'Select the closest name for your primary brand color', + default: '14px', + choices: [ + { + name: 'Blue' + }, + { + name: 'Green' + }, + { + name: 'Orange' + }, + { + name: 'Pink' + }, + { + name: 'Purple' + }, + { + name: 'Red' + }, + { + name: 'Teal' + }, + { + name: 'Yellow' + }, + { + name: 'Black' + }, + { + name: 'None really fit', + value: 'custom' + }, + { + name: 'I\'ll choose on my own', + value: false + } + ], + when: when.customize + }, + { + type: 'input', + name: 'PrimaryHex', + message: 'Enter a hexcode for your primary brand color', + when: when.primaryColor + }, + { + type: 'list', + name: 'secondaryColor', + message: 'Select the closest name for your secondary brand color', + default: '14px', + choices: [ + { + name: 'Blue' + }, + { + name: 'Green' + }, + { + name: 'Orange' + }, + { + name: 'Pink' + }, + { + name: 'Purple' + }, + { + name: 'Red' + }, + { + name: 'Teal' + }, + { + name: 'Yellow' + }, + { + name: 'Black' + }, + { + name: 'None really fit', + value: 'custom' + }, + { + name: 'I\'ll choose on my own', + value: false + } + ], + when: when.customize + }, + { + type: 'input', + name: 'secondaryHex', + message: 'Enter a hexcode for your secondary brand color', + when: when.secondaryColor } ]