Permalink
Browse files

adds prompt to install assemble

  • Loading branch information...
1 parent e62da93 commit bf80206aa65510bcd8ab8e8e560fc42202f27fae @jonschlinkert jonschlinkert committed Jul 5, 2016
Showing with 142 additions and 63 deletions.
  1. +2 −1 .gitignore
  2. +78 −52 bower.json
  3. +59 −9 lib/generator.js
  4. +1 −0 lib/utils.js
  5. +2 −1 package.json
View
@@ -14,6 +14,7 @@ vendor
.idea
benchmark
coverage
-examples/_draft
+_draft
+_drafts
examples/*/dist
examples/*/site
View
@@ -1,104 +1,130 @@
{
"name": "assemble",
- "description": "Assemble is a powerful, extendable and easy to use static site generator for node.js. Used by thousands of projects for much more than building websites, Assemble is also used for creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, gh-pages and more! Plugins for gulp and grunt are also supported.",
- "repository": "assemble/assemble",
- "license": "MIT",
+ "description": "Assemble is a powerful, extendable and easy to use static site generator for node.js. Used by thousands of projects for much more than building websites, Assemble is also used for creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, gh-pages and more! Assemble can also be used with gulp and grunt.",
+ "version": "0.15.0",
"homepage": "https://github.com/assemble/assemble",
"authors": [
+ "Brian Woodward (https://github.com/doowb)",
+ "Jon Schlinkert (https://github.com/jonschlinkert)"
+ ],
+ "maintainers": [
+ "Brian Woodward (https://github.com/doowb)",
"Jon Schlinkert (https://github.com/jonschlinkert)"
],
+ "repository": "assemble/assemble",
+ "bugs": {
+ "url": "https://github.com/assemble/assemble/issues"
+ },
+ "license": "MIT",
+ "files": [
+ "bin",
+ "index.js",
+ "lib",
+ "LICENSE",
+ "README.md"
+ ],
"main": [
"index.js"
],
+ "bin": {
+ "assemble": "bin/cli.js"
+ },
"dependencies": {
- "ansi-colors": "^0.1.0",
- "assemble-core": "^0.9.0",
- "assemble-loader": "^0.3.0",
- "base-argv": "^0.3.0",
- "base-cli": "^0.4.0",
- "base-config": "^0.3.4",
- "composer-runtimes": "^0.7.0",
+ "assemble-core": "^0.25.0",
+ "assemble-loader": "^0.6.1",
+ "base-argv": "^0.5.0",
+ "base-cli-process": "^0.1.14",
+ "base-config": "^0.5.2",
+ "base-questions": "^0.6.6",
+ "base-runtimes": "^0.2.0",
"engine-handlebars": "^0.8.0",
- "expand-args": "^0.3.1",
- "export-files": "^2.1.0",
- "find-pkg": "^0.1.1",
- "global-modules": "^0.2.0",
- "gulp-format-md": "^0.1.5",
- "has-value": "^0.3.0",
- "isobject": "^2.0.0",
- "lazy-cache": "^1.0.3",
- "matched": "^0.4.1",
- "minimist": "^1.2.0",
- "mixin-deep": "^1.1.3",
- "opn": "^4.0.0",
+ "fs-exists-sync": "^0.1.0",
+ "global-modules": "^0.2.2",
+ "lazy-cache": "^2.0.1",
+ "log-utils": "^0.1.4",
"parser-front-matter": "^1.3.0",
"resolve-dir": "^0.1.0",
- "success-symbol": "^0.1.0",
- "time-stamp": "^0.1.3",
- "try-open": "^0.1.0",
- "word-wrap": "^1.1.0"
+ "yargs-parser": "^2.4.0"
},
"devDependencies": {
- "async": "^1.5.2",
- "buffer-equal": "^1.0.0",
- "consolidate": "^0.13.1",
- "define-property": "^0.2.5",
- "engine-base": "^0.1.2",
- "event-stream": "^3.3.2",
- "get-value": "^2.0.3",
- "graceful-fs": "^4.1.2",
- "gulp": "^3.9.0",
- "gulp-eslint": "^1.1.1",
- "gulp-extname": "^0.2.2",
- "gulp-istanbul": "^0.10.3",
+ "base-store": "^0.4.4",
+ "base-test-runner": "^0.2.0",
+ "base-test-suite": "^0.1.12",
+ "gulp": "^3.9.1",
+ "gulp-eslint": "^2.0.0",
+ "gulp-format-md": "^0.1.9",
+ "gulp-istanbul": "^1.0.0",
"gulp-mocha": "^2.2.0",
- "gulp-prettify": "^0.4.0",
- "is-buffer": "^1.1.1",
- "kind-of": "^3.0.2",
- "load-pkg": "^3.0.1",
- "mocha": "*",
- "resolve-glob": "^0.1.8",
- "rimraf": "^2.5.0",
- "should": "*",
- "sinon": "^1.17.2",
- "swig": "^1.4.2",
- "through2": "^2.0.0",
- "vinyl": "^1.1.1"
+ "gulp-unused": "^0.1.2",
+ "mocha": "^2.5.3"
},
"keywords": [
"assemble",
+ "async-helper",
+ "base",
"blog",
"boilerplate",
"boilerplates",
"bootstrap",
"build",
"builder",
+ "collection",
+ "compile",
"component",
+ "content",
"docs",
+ "document",
"documentation",
+ "engines",
"generate",
"generator",
"handlebars",
+ "helper",
"helpers",
"html",
+ "inflections",
"jekyll",
+ "layout",
+ "lodash",
"markdown",
"md",
"page",
"partial",
"post",
+ "pug",
+ "render",
"scaffold",
"scaffolder",
"scaffolding",
"site",
+ "smith",
"static",
"static-site",
+ "symlink",
"task",
+ "tasks",
"template",
"templates",
"templating",
+ "view",
+ "views",
"website",
- "yaml",
- "yeoman"
+ "yaml"
+ ],
+ "lintDeps": {
+ "ignore": [
+ "docs",
+ "examples"
+ ]
+ },
+ "ignore": [
+ "actual",
+ "bower_components",
+ "fixtures",
+ "node_modules",
+ "temp",
+ "test",
+ "test.js",
+ "tmp"
]
}
View
@@ -3,39 +3,89 @@
var utils = require('./utils');
module.exports = function(app) {
+
// use `base-questions` plugin for user prompts
app.use(utils.questions());
- var cwd = app.options.dest || app.cwd || process.cwd();
+
+ /**
+ * Listend for `done` event
+ */
+
+ app.on('done', function() {
+ app.log.success('done');
+ process.exit();
+ });
/**
* Generate an `assemblefile.js`
*/
app.task('new', function(cb) {
app.src('templates/assemblefile.js', {cwd: __dirname})
- .pipe(app.dest(cwd))
+ .pipe(app.dest(app.options.dest || app.cwd))
.on('end', function() {
- console.log('created assemblefile.js');
+ app.log.success('created assemblefile.js');
cb();
});
});
/**
+ * Prompt to install assemble
+ */
+
+ app.task('prompt-install', function(cb) {
+ app.confirm('install', 'Want to install assemble to devDependencies now?');
+ app.ask('install', {save: false}, function(err, answers) {
+ if (err) {
+ cb(err);
+ return;
+ }
+ if (!answers.install) {
+ app.log.time('Got it, stopping');
+ app.emit('done');
+ return;
+ }
+ app.log.time('installing assemble');
+ install(['assemble'], cb);
+ });
+ });
+
+ /**
* Asks if you want to generate an `assemblefile.js`
*/
app.task('prompt-new', function(cb) {
app.confirm('file', 'No assemblefile.js found, want to add one?');
app.ask('file', {save: false}, function(err, answers) {
- if (err) return cb(err);
- if (answers.file) {
- app.build('new', cb);
- } else {
- console.log('Got it, stopping');
- process.exit();
+ if (err) {
+ cb(err);
+ return;
}
+ if (!answers.file) {
+ app.log.time('Got it, stopping');
+ app.emit('done');
+ return;
+ }
+ app.build(['new', 'prompt-install'], cb);
});
});
+ /**
+ * Default task
+ */
+
app.task('default', ['prompt-new']);
};
+
+/**
+ * Install devDependencies
+ */
+
+function install(args, cb) {
+ args = ['install', '--save-dev'].concat(args);
+ utils.spawn('npm', args, {stdio: 'inherit'})
+ .on('error', cb)
+ .on('close', function(code, err) {
+ cb(err, code);
+ });
+}
View
@@ -10,6 +10,7 @@ require = utils;
*/
require('base-questions', 'questions');
+require('cross-spawn', 'spawn');
require('fs-exists-sync', 'exists');
require('global-modules', 'gm');
require('log-utils', 'log');
View
@@ -1,6 +1,6 @@
{
"name": "assemble",
- "description": "Assemble is a powerful, extendable and easy to use static site generator for node.js. Used by thousands of projects for much more than building websites, Assemble is also used for creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, gh-pages and more! Assemble can also be used with gulp and grunt.",
+ "description": "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websites / static site generator, alternative to jekyll for gh-pages and more! Assemble can also be used with gulp and grunt.",
"version": "0.15.0",
"homepage": "https://github.com/assemble/assemble",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
@@ -43,6 +43,7 @@
"base-config": "^0.5.2",
"base-questions": "^0.6.6",
"base-runtimes": "^0.2.0",
+ "cross-spawn": "^4.0.0",
"engine-handlebars": "^0.8.0",
"fs-exists-sync": "^0.1.0",
"global-modules": "^0.2.2",

0 comments on commit bf80206

Please sign in to comment.