From 35dfe4712065b6922763c0885975a7585dc9053c Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 3 Feb 2015 21:45:16 +0100 Subject: [PATCH 001/178] Started work on Gulp 4.0 and Jekyll 3.0 --- app/templates/_package.json | 10 ++- app/templates/gulpfile.js | 169 +++++++++++++++++++----------------- app/templates/jshintrc | 2 +- test/test-gulp.js | 72 +++------------ 4 files changed, 107 insertions(+), 146 deletions(-) diff --git a/app/templates/_package.json b/app/templates/_package.json index 06557ae..41dbb17 100755 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -8,7 +8,7 @@ "browser-sync": "^1.5.7",<% if (amazonCloudfrontS3) { %> "concurrent-transform": "^1.0.0",<% } %> "del": "^1.1.1", - "gulp": "^3.8.8", + "gulp": "file:../../../../../var/folders/f1/l2svxmy91tbdk94t9259sq040000gn/T/npm-43577-622ebfd0/git-cache-efb05e57fc27/4dc9eb895b07cd87ea7af0009e2a9197aa21a3a6", "gulp-autoprefixer": "^2.0.0",<% if (amazonCloudfrontS3) { %> "gulp-awspublish": "0.0.23", "gulp-awspublish-router": "0.1.0",<% } %> @@ -18,6 +18,7 @@ "gulp-cloudfront": "0.0.14",<% } %> "gulp-filter": "^2.0.0",<% if (githubPages) { %> "gulp-gh-pages": "^0.4.0",<% } %> + "gulp-group-concat": "^1.1.4", "gulp-gzip": "0.0.8", "gulp-htmlmin": "^0.2.0", "gulp-if": "^1.2.4", @@ -31,11 +32,14 @@ "gulp-sass": "^1.0.0", "gulp-shell": "^0.2.9", "gulp-size": "^1.1.0", - "gulp-uglify": "^1.0.1", + "gulp-sourcemaps": "^1.3.0", + "gulp-uglify": "^1.1.0", "gulp-uncss": "^0.5.0", "gulp-useref": "^1.0.2", "jshint-stylish": "^1.0.0", - "merge-stream": "^0.1.6" + "merge-stream": "^0.1.6", + "shelljs": "^0.3.0", + "trash": "^1.4.0" }, "engines": { "node": ">0.10.0" diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index 8a2a1e5..59b1652 100755 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -5,8 +5,10 @@ var gulp = require("gulp"); // Loads the plugins without having to list all of them, but you need // to call them as $.pluginname var $ = require("gulp-load-plugins")(); -// "del" is used to clean out directories and such -var del = require("del"); +// "trash" is used to clean out directories and such +var trash = require("trash"); +// Used to run shell commands +var shell = require("shelljs"); <% if (amazonCloudfrontS3) { %>// Parallelize the uploads when uploading to Amazon S3 // "fs" is used to read files from the system (used for AWS uploading) var fs = require("fs"); @@ -15,47 +17,52 @@ var parallelize = require("concurrent-transform"); var browserSync = require("browser-sync"); // merge is used to merge the output from two different streams into the same stream var merge = require("merge-stream"); -// Need a command for reloading webpages using BrowserSync -var reload = browserSync.reload; -// And define a variable that BrowserSync uses in it"s function -var bs; - -// Deletes the directory that is used to serve the site during development -gulp.task("clean:dev", del.bind(null, ["serve"])); // Deletes the directory that the optimized site is output to -gulp.task("clean:prod", del.bind(null, ["site"])); +function clean(done) { trash(["site"]); done(); } // Runs the build command for Jekyll to compile the site locally // This will build the site with the production settings -gulp.task("jekyll:dev", $.shell.task("jekyll build")); -gulp.task("jekyll-rebuild", ["jekyll:dev"], function () { - reload; -}); +function jekyllDev(done) { shell.exec("jekyll build"); done(); } +function jekyllRebuild() { gulp.series(jekyllDev, browserSync.reload); } // Almost identical to the above task, but instead we load in the build configuration // that overwrites some of the settings in the regular configuration so that you -// don"t end up publishing your drafts or future posts -gulp.task("jekyll:prod", $.shell.task("jekyll build --config _config.yml,_config.build.yml")); +// don't end up publishing your drafts or future posts +function jekyllProd(done) { shell.exec("jekyll build --config _config.yml,_config.build.yml"); done(); } // Compiles the SASS files and moves them into the "assets/stylesheets" directory -gulp.task("styles", function () { +function styles() { // Looks at the style.scss file for what to include and creates a style.css file return gulp.src("src/assets/scss/style.scss") - .pipe($.sass()) - // AutoPrefix your CSS so it works between browsers - .pipe($.autoprefixer("last 1 version", { cascade: true })) + .pipe($.sourcemaps.init()) + .pipe($.sass()) + // AutoPrefix your CSS so it works between browsers + .pipe($.autoprefixer("last 1 version", { cascade: true })) + .pipe($.sourcemaps.write(".")) // Directory your CSS file goes to .pipe(gulp.dest("src/assets/stylesheets/")) - .pipe(gulp.dest("serve/assets/stylesheets/")) + .pipe(gulp.dest("site/assets/stylesheets/")) // Outputs the size of the CSS file .pipe($.size({title: "styles"})) - // Injects the CSS changes to your browser since Jekyll doesn"t rebuild the CSS - .pipe(reload({stream: true})); -}); + // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS + .pipe(browserSync.reload({stream: true})); +} +function javascript() { + return gulp.src("src/assets/javascript/*.js") + .pipe($.sourcemaps.init()) + .pipe($.uglify({compress: false, preserveComments: "all"})) + .pipe($.groupConcat({ + "index.js": "src/assets/javascript/*.js" + })) + .pipe($.sourcemaps.write(".")) + .pipe(gulp.dest("site/assets/javascript/")) + .pipe($.size({title: "javascript"})) + .pipe(browserSync.reload({stream: true})); +} // Optimizes the images that exists -gulp.task("images", function () { +function images() { return gulp.src("src/assets/images/**") .pipe($.changed("site/assets/images")) .pipe($.imagemin({ @@ -66,34 +73,27 @@ gulp.task("images", function () { })) .pipe(gulp.dest("site/assets/images")) .pipe($.size({title: "images"})); -}); +} // Copy over fonts to the "site" directory -gulp.task("fonts", function () { +function fonts() { return gulp.src("src/assets/fonts/**") .pipe(gulp.dest("site/assets/fonts")) .pipe($.size({ title: "fonts" })); -}); - -// Copy xml and txt files to the "site" directory -gulp.task("copy", function () { - return gulp.src(["serve/*.txt", "serve/*.xml"]) - .pipe(gulp.dest("site")) - .pipe($.size({ title: "xml & txt" })) -}); +} // Optimizes all the CSS, HTML and concats the JS etc -gulp.task("html", ["styles"], function () { - var assets = $.useref.assets({searchPath: "serve"}); +function optimize() { + var assets = $.useref.assets({searchPath: "site"}); - return gulp.src("serve/**/*.html") + return gulp.src("site/**/*.html") .pipe(assets) // Concatenate JavaScript files and preserve important comments .pipe($.if("*.js", $.uglify({preserveComments: "some"}))) // Minify CSS .pipe($.if("*.css", $.minifyCss())) // Start cache busting the files - .pipe($.revAll({ ignore: [".eot", ".svg", ".ttf", ".woff"] })) + .pipe($.revAll({ ignore: [".eot", ".svg", ".ttf", ".woff", ".woff2"] })) .pipe(assets.restore()) // Conctenate your files based on what you specified in _layout/header.html .pipe($.useref()) @@ -112,10 +112,10 @@ gulp.task("html", ["styles"], function () { // Send the output to the correct folder .pipe(gulp.dest("site")) .pipe($.size({title: "optimizations"})); -}); +} <% if (amazonCloudfrontS3) { %>// Task to deploy your site to Amazon S3 and Cloudfront -gulp.task("deploy", function () { +function deploy() { // Generate the needed credentials (bucket, secret key etc) from a "hidden" JSON file var credentials = JSON.parse(fs.readFileSync("aws-credentials.json", "utf8")); var publisher = $.awspublish.create(credentials); @@ -173,10 +173,10 @@ gulp.task("deploy", function () { .pipe($.awspublish.reporter()) // And update the default root object .pipe($.cloudfront(credentials)); -});<% } %><% if (rsync) { %> +}<% } %><% if (rsync) { %> // Task to upload your site via Rsync to your server -gulp.task("deploy", function () { +function deploy() { // Load in the variables needed for our Rsync synchronization var secret = require("./rsync-credentials.json"); @@ -193,9 +193,9 @@ gulp.task("deploy", function () { // Shows the progress on your files while uploading progress: true })); -});<% } %><% if (githubPages) { %> +}<% } %><% if (githubPages) { %> // Task to upload your site to your personal GH Pages repo -gulp.task("deploy", function () { +function deploy() { // Deploys your optimized site, you can change the settings in the html task if you want to return gulp.src("./site/**/*") .pipe($.ghPages({ @@ -203,65 +203,70 @@ gulp.task("deploy", function () { // branch and automatically overwrite anything that is in the directory branch: "master" })); -});<% } %> +}<% } %> // Run JS Lint against your JS -gulp.task("jslint", function () { - gulp.src("./serve/assets/javascript/*.js") +function jslint() { + gulp.src("./site/assets/javascript/*.js") // Checks your JS code quality against your .jshintrc file .pipe($.jshint(".jshintrc")) .pipe($.jshint.reporter()); -}); +} // Runs "jekyll doctor" on your site to check for errors with your configuration // and will check for URL errors a well -gulp.task("doctor", $.shell.task("jekyll doctor")); +function doctor(done) { shell.exec("jekyll doctor"); done(); } // BrowserSync will serve our site on a local server for us and other devices to use // It will also autoreload across all devices as well as keep the viewport synchronized // between them. -gulp.task("serve:dev", ["styles", "jekyll:dev"], function () { - bs = browserSync({ +function serve() { + browserSync({ notify: true, // tunnel: "", server: { - baseDir: "serve" + baseDir: "site" } }); -}); +} // These tasks will look for files that change while serving and will auto-regenerate or // reload the website accordingly. Update or add other files you need to be watched. -gulp.task("watch", function () { - gulp.watch(["src/**/*.md", "src/**/*.html", "src/**/*.xml", "src/**/*.txt", "src/**/*.js"], ["jekyll-rebuild"]); - gulp.watch(["serve/assets/stylesheets/*.css"], reload); - gulp.watch(["src/assets/scss/**/*.scss"], ["styles"]); -}); - -// Serve the site after optimizations to see that everything looks fine -gulp.task("serve:prod", function () { - bs = browserSync({ - notify: false, - // tunnel: true, - server: { - baseDir: "site" - } - }); -}); +function watch() { + gulp.watch(["src/**/*.md", "src/**/*.html", "src/**/*.xml", "src/**/*.txt", "src/**/*.js"], [jekyllRebuild]); + gulp.watch(["site/assets/stylesheets/*.css"], browserSync.reload); + gulp.watch(["src/assets/scss/**/*.scss"], [styles]); +} // Default task, run when just writing "gulp" in the terminal -gulp.task("default", ["serve:dev", "watch"]); - -// Checks your CSS, JS and Jekyll for errors -gulp.task("check", ["jslint", "doctor"], function () { - // Better hope nothing is wrong. -}); - -// Builds the site but doesn"t serve it to you -gulp.task("build", ["jekyll:prod", "styles"], function () {}); +gulp.task("default", gulp.series( + gulp.series(jekyllDev), + gulp.parallel(styles, javascript, fonts, images), + gulp.parallel(serve, watch) +)); // Builds your site with the "build" command and then runs all the optimizations on // it and outputs it to "./site" -gulp.task("publish", ["build"], function () { - gulp.start("html", "copy", "images", "fonts"); -}); +gulp.task("optimize", gulp.series( + gulp.series(jekyllProd), + gulp.parallel(styles, javascript, fonts, images), + gulp.series(optimize) +)); + +// Deploy your site for all to see +gulp.task("deploy", deploy); + +// Serves your site locally +gulp.task("serve", serve); + +// Clean out your site folder +gulp.task("clean", clean); + +// Create your styles and create sourcemaps +gulp.task("styles", styles); + +// Create sourcemaps for your JS files +gulp.task("javascript", javascript); + +// Checks your CSS, JS and Jekyll for errors +gulp.task("check", gulp.series(doctor, jslint)); diff --git a/app/templates/jshintrc b/app/templates/jshintrc index 23ca7ec..a89f882 100644 --- a/app/templates/jshintrc +++ b/app/templates/jshintrc @@ -10,7 +10,7 @@ "latedef": true, "newcap": true, "noarg": true, - "quotmark": "single", + "quotmark": "double", "undef": true, "strict": false, "trailing": true, diff --git a/test/test-gulp.js b/test/test-gulp.js index 998a06b..1f9de6c 100644 --- a/test/test-gulp.js +++ b/test/test-gulp.js @@ -50,80 +50,32 @@ describe("Jekyllized generator test for Gulp tasks without any uploading", funct assert.noFile(unexpected); }); - it("should contain clean:dev task", function (done) { - tasks.assertTaskExists(this.jekyllized, "clean:dev", [], done); + it("should contain default task", function (done) { + tasks.assertTaskExists(this.jekyllized, "default", [], done); }); - it("should contain clean:prod task", function (done) { - tasks.assertTaskExists(this.jekyllized, "clean:prod", [], done); + it("should contain optimize task", function (done) { + tasks.assertTaskExists(this.jekyllized, "optimize", [], done); }); - it("should contain jekyll:dev task", function (done) { - tasks.assertTaskExists(this.jekyllized, "jekyll:dev", [], done); + it("should contain deploy task", function (done) { + tasks.assertTaskExists(this.jekyllized, "deploy", [], done); }); - it("should contain jekyll-rebuild task with jekyll:dev included", function (done) { - tasks.assertTaskExists(this.jekyllized, "jekyll-rebuild", ["jekyll:dev"], done); - }); - - it("should contain jekyll:prod task", function (done) { - tasks.assertTaskExists(this.jekyllized, "jekyll:prod", [], done); + it("should contain serve task", function (done) { + tasks.assertTaskExists(this.jekyllized, "serve", [], done); }); it("should contain styles task", function (done) { tasks.assertTaskExists(this.jekyllized, "styles", [], done); }); - it("should contain images task", function (done) { - tasks.assertTaskExists(this.jekyllized, "images", [], done); - }); - - it("should contain fonts task", function (done) { - tasks.assertTaskExists(this.jekyllized, "fonts", [], done); - }); - - it("should contain copy task", function (done) { - tasks.assertTaskExists(this.jekyllized, "copy", [], done); - }); - - it("should contain html task with styles included", function (done) { - tasks.assertTaskExists(this.jekyllized, "html", ["styles"], done); - }); - - it("should contain jslint task", function (done) { - tasks.assertTaskExists(this.jekyllized, "jslint", [], done); - }); - - it("should contain doctor task", function (done) { - tasks.assertTaskExists(this.jekyllized, "doctor", [], done); - }); - - it("should contain serve:dev task with styles and jekyll:dev included", function (done) { - tasks.assertTaskExists(this.jekyllized, "serve:dev", ["styles", "jekyll:dev"], done); - }); - - it("should contain watch task", function (done) { - tasks.assertTaskExists(this.jekyllized, "watch", [], done); - }); - - it("should contain serve:prod task", function (done) { - tasks.assertTaskExists(this.jekyllized, "serve:prod", [], done); - }); - - it("should contain default task with serve:dev and watch included", function (done) { - tasks.assertTaskExists(this.jekyllized, "default", ["serve:dev", "watch"], done); - }); - - it("should contain check task with jslint and doctor included", function (done) { - tasks.assertTaskExists(this.jekyllized, "check", ["jslint", "doctor"], done); - }); - - it("should contain build task with jekyll:prod and styles included", function (done) { - tasks.assertTaskExists(this.jekyllized, "build", [], done); + it("should contain javascript task", function (done) { + tasks.assertTaskExists(this.jekyllized, "javascript", [], done); }); - it("should contain publish task with build included", function (done) { - tasks.assertTaskExists(this.jekyllized, "publish", ["build"], done); + it("should contain check task", function (done) { + tasks.assertTaskExists(this.jekyllized, "check", [], done); }); }); From ca13446e315cc46041126ab059e7540d04197225 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 4 Feb 2015 00:28:07 +0100 Subject: [PATCH 002/178] More changes for the Gulpfile and moved JS to body The move of the JS file to the bottom of the body fixes #63. --- app/templates/app/_includes/head.html | 6 -- app/templates/app/_layouts/default.html | 5 ++ app/templates/gulpfile.js | 80 ++++++++++++++++--------- 3 files changed, 56 insertions(+), 35 deletions(-) diff --git a/app/templates/app/_includes/head.html b/app/templates/app/_includes/head.html index 4e62d2e..2d4964e 100644 --- a/app/templates/app/_includes/head.html +++ b/app/templates/app/_includes/head.html @@ -19,12 +19,6 @@ - - - - - - diff --git a/app/templates/app/_layouts/default.html b/app/templates/app/_layouts/default.html index ed19ec7..0ebec7e 100644 --- a/app/templates/app/_layouts/default.html +++ b/app/templates/app/_layouts/default.html @@ -26,5 +26,10 @@

+ + + + + diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index 59b1652..da72f54 100755 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -13,42 +13,46 @@ var shell = require("shelljs"); // "fs" is used to read files from the system (used for AWS uploading) var fs = require("fs"); var parallelize = require("concurrent-transform"); -<% } %>// BrowserSync isn"t a gulp package, and needs to be loaded manually +<% } %>// BrowserSync is used to live-reload your website var browserSync = require("browser-sync"); +var reload = browserSync.reload; // merge is used to merge the output from two different streams into the same stream var merge = require("merge-stream"); // Deletes the directory that the optimized site is output to function clean(done) { trash(["site"]); done(); } +function rebuild(done) { trash(["src/.jekyll-metadata"]); done(); } // Runs the build command for Jekyll to compile the site locally // This will build the site with the production settings -function jekyllDev(done) { shell.exec("jekyll build"); done(); } -function jekyllRebuild() { gulp.series(jekyllDev, browserSync.reload); } +function jekyllDev(done) { shell.exec("jekyll build --quiet"); done(); } // Almost identical to the above task, but instead we load in the build configuration // that overwrites some of the settings in the regular configuration so that you // don't end up publishing your drafts or future posts -function jekyllProd(done) { shell.exec("jekyll build --config _config.yml,_config.build.yml"); done(); } +function jekyllProd(done) { shell.exec("jekyll build --quiet --config _config.yml,_config.build.yml"); done(); } // Compiles the SASS files and moves them into the "assets/stylesheets" directory function styles() { // Looks at the style.scss file for what to include and creates a style.css file return gulp.src("src/assets/scss/style.scss") + // Start creation of sourcemaps .pipe($.sourcemaps.init()) - .pipe($.sass()) + .pipe($.sass({errLogToconsole: true})) // AutoPrefix your CSS so it works between browsers .pipe($.autoprefixer("last 1 version", { cascade: true })) + // Write the sourcemaps to the directory of the gulp.src stream .pipe($.sourcemaps.write(".")) // Directory your CSS file goes to .pipe(gulp.dest("src/assets/stylesheets/")) - .pipe(gulp.dest("site/assets/stylesheets/")) + .pipe(gulp.dest(".tmp/assets/stylesheets/")) // Outputs the size of the CSS file .pipe($.size({title: "styles"})) // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS - .pipe(browserSync.reload({stream: true})); + .pipe(reload({stream: true})); } +// Mostly used to create sourcemaps and live-reload JS function javascript() { return gulp.src("src/assets/javascript/*.js") .pipe($.sourcemaps.init()) @@ -57,34 +61,48 @@ function javascript() { "index.js": "src/assets/javascript/*.js" })) .pipe($.sourcemaps.write(".")) - .pipe(gulp.dest("site/assets/javascript/")) + .pipe(gulp.dest(".tmp/assets/javascript/")) .pipe($.size({title: "javascript"})) - .pipe(browserSync.reload({stream: true})); + .pipe(reload({stream: true})); } + // Optimizes the images that exists function images() { - return gulp.src("src/assets/images/**") - .pipe($.changed("site/assets/images")) - .pipe($.imagemin({ + return gulp.src("src/assets/images/**/*") + // Does not run on images that are already optimized + .pipe($.cache($.imagemin({ // Lossless conversion to progressive JPGs progressive: true, // Interlace GIFs for progressive rendering interlaced: true - })) - .pipe(gulp.dest("site/assets/images")) + }))) + .pipe(gulp.dest(".tmp/assets/images")) .pipe($.size({title: "images"})); } -// Copy over fonts to the "site" directory +// Copy over fonts to the ".tmp" directory function fonts() { return gulp.src("src/assets/fonts/**") - .pipe(gulp.dest("site/assets/fonts")) + .pipe(gulp.dest(".tmp/assets/fonts")) .pipe($.size({ title: "fonts" })); } +// Copy optimized images and (not optimized) fonts to the "site" folder +function copy() { + var images = gulp.src(".tmp/assets/images/**/*") + .pipe(gulp.dest("site/assets/images")) + .pipe($.size({title: "copied images"})); + + var fonts = gulp.src(".tmp/assets/fonts/**/*") + .pipe(gulp.dest("site/assets/fonts")) + .pipe($.size({title: "copied fonts"})); + + return merge(images, fonts); +} + // Optimizes all the CSS, HTML and concats the JS etc function optimize() { - var assets = $.useref.assets({searchPath: "site"}); + var assets = $.useref.assets({searchPath: ["site", ".tmp"]}); return gulp.src("site/**/*.html") .pipe(assets) @@ -93,7 +111,7 @@ function optimize() { // Minify CSS .pipe($.if("*.css", $.minifyCss())) // Start cache busting the files - .pipe($.revAll({ ignore: [".eot", ".svg", ".ttf", ".woff", ".woff2"] })) + .pipe($.revAll({quiet: true, ignore: [".eot", ".svg", ".ttf", ".woff", ".woff2"]})) .pipe(assets.restore()) // Conctenate your files based on what you specified in _layout/header.html .pipe($.useref()) @@ -207,7 +225,7 @@ function deploy() { // Run JS Lint against your JS function jslint() { - gulp.src("./site/assets/javascript/*.js") + gulp.src(".tmp/assets/javascript/*.js") // Checks your JS code quality against your .jshintrc file .pipe($.jshint(".jshintrc")) .pipe($.jshint.reporter()); @@ -225,34 +243,37 @@ function serve() { notify: true, // tunnel: "", server: { - baseDir: "site" + baseDir: ["site", ".tmp"] } }); -} -// These tasks will look for files that change while serving and will auto-regenerate or -// reload the website accordingly. Update or add other files you need to be watched. -function watch() { - gulp.watch(["src/**/*.md", "src/**/*.html", "src/**/*.xml", "src/**/*.txt", "src/**/*.js"], [jekyllRebuild]); - gulp.watch(["site/assets/stylesheets/*.css"], browserSync.reload); - gulp.watch(["src/assets/scss/**/*.scss"], [styles]); + // Watch various files for changes and do the needful + gulp.watch(["src/**/*.md", "src/**/*.html", "src/**/*.xml", "src/**/*.txt", "src/**/*.yml"], [jekyllDev, reload]); + gulp.watch(["src/assets/javascript/**/*.js"], javascript); + gulp.watch(["src/assets/scss/**/*.scss"], styles); + gulp.watch(["src/assets/images/**/*"], reload); } // Default task, run when just writing "gulp" in the terminal gulp.task("default", gulp.series( gulp.series(jekyllDev), gulp.parallel(styles, javascript, fonts, images), - gulp.parallel(serve, watch) + gulp.series(serve) )); // Builds your site with the "build" command and then runs all the optimizations on // it and outputs it to "./site" gulp.task("optimize", gulp.series( gulp.series(jekyllProd), - gulp.parallel(styles, javascript, fonts, images), + gulp.parallel(styles, javascript, fonts, images, copy), gulp.series(optimize) )); +gulp.task("build", gulp.series( + gulp.series(jekyllDev), + gulp.parallel(styles, javascript, fonts, images) +)); + // Deploy your site for all to see gulp.task("deploy", deploy); @@ -261,6 +282,7 @@ gulp.task("serve", serve); // Clean out your site folder gulp.task("clean", clean); +gulp.task("rebuild", gulp.series("clean", rebuild)); // Create your styles and create sourcemaps gulp.task("styles", styles); From 464733e70046c4f1b9b044cd4d98d66c1b96f8b1 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 4 Feb 2015 01:42:58 +0100 Subject: [PATCH 003/178] Updated documentation, directories and tests Updated the README to reflect the most recent changes and reword the introduction, updated the CHANGELOG with all the updates. Moved the output for Jekyllized into a dist folder instead of a site folder to be more in line with other tools and updated the test for gulp tasks to include the new tasks. --- CHANGELOG.md | 23 +++++ README.md | 145 ++++++++++++++++++-------------- app/index.js | 12 +-- app/templates/_config.build.yml | 2 +- app/templates/_config.yml | 2 +- app/templates/gulpfile.js | 27 +++--- test/test-gulp.js | 12 +++ 7 files changed, 138 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 717ab3b..b68b92f 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ + +## HEAD + +#### Changes +* **Gulp:** Updated to Gulp 4.0 and changed the majority of the Gulpfile and + most of the tasks there as well, this should be considered a breaking + change. +* **Jekyll:** Updated to Jekyll 3.0-beta since both Jekyll and Gulp is currently + moving towards a new major version, the biggest change is the inclusion of + incremental regeneration. Also included a plugin for generating archives for + Jekyll. +* **Jekyll directory:** Everything is now output to a `dist` folder instead of a + `site` folder to be more in line with most other tools. +* **Asset directories:** Moved most of the assets to live in a .tmp while working on + them because Jekyll would regenrate itself and not include the assets folder + when you changed something while BrowserSync was active. + +#### Fixes +* **Gulp:** In general the gulpfile has seen most of it changes or added upon, both the SCSS + and JS files will now have sourcemaps generated, both Jekyll and the + asset-revitalizer now runs quietly to not clog the command line. All the JS + files are concated into a `index.js` file as well. + ## 0.7.1 - Bugfix diff --git a/README.md b/README.md index 28f33d1..8380a22 100755 --- a/README.md +++ b/README.md @@ -2,108 +2,122 @@ [![NPM version](https://badge.fury.io/js/generator-jekyllized.png)](http://badge.fury.io/js/generator-jekyllized) [![Coverage Status](https://coveralls.io/repos/sondr3/generator-jekyllized/badge.png)](https://coveralls.io/r/sondr3/generator-jekyllized) [![Code Climate](https://codeclimate.com/github/sondr3/generator-jekyllized/badges/gpa.svg)](https://codeclimate.com/github/sondr3/generator-jekyllized) -### Work in progress! Still unfinished. +### Work in progress! Things may or may not work. **Stylized and opinionated Jekyll development** -Jekyllized is an opinionated [Yeoman][yeoman] generator for building -[Jekyll][jekyll] based websites. Easy scaffolding via [Yo][yo] to get started -quickly, [Bower][bower] for managing frontend packages and [Gulp][gulp] to -automate and optimize developing your site. +Jekyllized is a small and opinionated [Yeoman][yeoman] generator for +[Jekyll][jekyll]-based sites. Quick and painless scaffolding with [Yo][yo] to +kickstart development, easy frontend package managment with [Bower][bower] and +supercharged with [Gulp][gulp] to automate common development tasks like +concating your CSS and JS, minify your assets, optimze images and upload to +[Amazon S3][aws], [Github Pages][ghpages] or just plain ol' Rsync. -Based on [Jekyll][jekyll], Jekyllized is ideal for building highly optimized -static sites and prototyping sites. Quickly review changes with LiveReload, -optimize your stylesheets and images automatically and detect errors and unused -code in your project. +Built on [Jekyll][jekyll] you get a modern and mature base to build upon; either +it is your personal blog or quickly prototyping sites Jekyllized is there to +help you. Quickly review changes with [BrowserSync][browsersync], automagically +optimize your CSS, JS, HTML and images, automatic vendor prefixing with +[AutoPrefixer][autoprefixer] and much more. ## Features ### Tools -- SASS using [libsass][libsass] -- [AutoPrefixer][autoprefixer] for automatic vendor prefixing -- Upload your site to either Amazon S3 or to your server with Rsync -- [Lanyon][lanyon] theme based on [Poole][poole] from [mdo][mdo] -- Jekyll with sane configurations and lots of extras +* [libsass][libsass] for lightning fast generation of Sass files +* [AutoPrefixer][autoprefixer] for automatic vendor prefixing +* Support for either Amazon S3, GitHub Pages or Rsync for deployment +* [Lanyon][lanyon] theme based on [Poole][poole] from [mdo][mdo] +* Jekyll with sane configurations and a proper Atom feed and sitemap.xml -### Developing +### When developing -- Have your sites automatically refreshed across multiple devices with +* Have your sites automatically refreshed across multiple devices with [BrowserSync](browsersync) -- Detect errors and potential issues with your code using `jekyll doctor` and +* Detect errors and potential issues with your code using `jekyll doctor` and [JShint][jshint] -- Optimize your assets and site: your CSS and JS is automatically concatenated, - both your CSS, JS and HTMl is minifiyed and all your text files are gzipped - for optimal performance. Your images are run through imagemin to optimize - them as well -- Cachebusting for your assets +* Automagical optimization of your assets when you are ready to deploy your + site. Your CSS and JS is concatenated and is minified together with your HTML + and gzipped for maximal performance. +* Your images is run through imagemin to minify them as well. +* Support for sourcemaps for ease of debugging for both your JS and CSS +* Cachebusting for your assets that is automatically updated in your HTML ## Getting started ## Installation -To install you need [Node.js][nodejs] (`>0.10.0`) and [Ruby][rubylang] (`> 1.9`) -for Jekyll. Install Jekyllized via NPM: `npm install -g generator-jekyllized` -and finally run `yo jekyllized` in the directory you want to install in. +To install you need [Node.js][nodejs] (`>0.10.0`), the latest version of `yo` +(`npm install -g yo`) and [Ruby][rubylang] (`> 1.9`) for Jekyll. Install +Jekyllized via NPM: `npm install -g generator-jekyllized` and finally run `yo +jekyllized` in the directory you want to install in. ## Usage #### `gulp` -The default task, this will automatically compile and open the site in your -browser. A watch task runs in the background and detects when any files change, -recompiles them if nessecary and updates your browser with BrowserSync. +The default task, you will probably use this most of the time short of deploying +your site. This will regenerate your Jekyll site, update your CSS and JS, +optimize your images and start a [BrowserSync][browsersync] session and open +your browser. While editing your files it will either inject the changes +(CSS/JS) or reload the site (changes to Jekyll documents). All this happens +automatically so you can keep working. -#### `gulp check` - -Check the health of your JavaScript, CSS and Jekyll. You can change the settings -for what it looks for in `.jshintrc`. +BrowserSync can also tunnel your +development via [localtunnel][localtunnel] so you can view it on your tablet, +phone or let other people view it as well. By default clicks and scrolling is +also broadcast so when you go to the `About` page all other browsers listening +in on the session will as well. #### `gulp build` -Almost the same as the default `gulp` task, but this won't start up a -preview/LiveReload server and open the browser, it will only build your site. +Identical to the default `gulp` task but won't start a BrowserSync session. -#### `gulp publish` +#### `gulp optimize` -This will first run `gulp build` to make sure the changes you've made to your -site are included and then optimize all your assets (images, HTML, CSS, JS++). -If you want to display your optimized site to make sure everything is working -run `gulp serve:prod` to see the changes. +Use this when you are done with developing and you're ready to deploy your site. +This command will first clean out the `dist` directory and then rebuild your +site using the build settings. Once the site is generated all your assets are +optimized (concatinated/minified/gzipped etc) and cachebust them and inject them +to your HTML. #### `gulp deploy` -This will either upload your site to Amazon S3, Rsync your files to your server -or push them to GitHub Pages. +Use this command when you are ready to deploy your site. It'll upload to either +Amazon S3, Rsync or GitHub Pages depending on what you chose when first running +Jekyllized. + +#### `gulp check` + +Check the health of your JavaScript files and Jekyll. -### Individual tasks +#### Various tasks -A lot of the tasks are built up of smaller tasks that can be run individually. -For example, the `gulp publish` task first runs `gulp build` (that also runs -`jekyll:prod`, `styles` and `images`) and `clean:prod` and then runs the `html` -and `copy` commands (`html` to optimize your site and `copy` to copy over some -files that `html` misses). If you want to you can run any of these tasks without -invoking their "parent" task. If you only wanted to optimize your assets and -such, run `gulp html` and it won't run any of the tasks used with `gulp -publish`. +###### `gulp rebuild`/`gulp clean` +`gulp rebuild` runs `gulp clean` to delete your `dist` directory and then +deletes `.jekyll-metadata` so it forces Jekyll to fully rebuild your site. If +you only want to delete the `dist` folder you can run `gulp clean` but this will +mess up Jekyll's incremental regeneration. -For all the different tasks that can be run, see the [gulpfile][gulpfile] and -look through the code. Everything is commented and you can edit, change or -remove what you want/need. +###### `gulp styles`/`gulp javascript` +Regenerates your CSS/JS files. ## Deploying +For either Amazon S3 or Rsync you either fill in the deployment details during +the initial scaffolding when running the generator or you can just edit their +corresponding files (`aws/rsync-credentials.json`) later. #### Amazon AWS -If you are using Amazon S3 make sure you change the region you want to use in -the aws-credentials.json and have created a bucket already. If you don't want to -use Cloudfront you'll have to uncommend the last line in the `gulp deploy` task. -For Rsync it should be automatic as long as your details are correct. +This will upload your changed files to Amazon S3, so you don't have to worry +about wasting bandwidth. It'll also gzip your files and upload them with the +proper headers so it will show the gzipped files properly and tell the browser +it'll be cached forever. It'll also update CloudFront so if this isn't needed +you can comment out the last line in the `deploy` function. #### Rsync -If you are using Rsync make sure the credentials are filled out in the -rsync-credentials.json file, otherwise all you have to do is to run `gulp -deploy` and your site will be synced to your server. NOTE: For the moment your -site is not gzipped while uploading, this is going to be fixed in the future. +Upload your files to your server with Rsync. As with uploading to Amazon S3 this +will also only upload the changed files and have them gzipped. However it can't +add the proper headers for your files so make sure you do it on Apache/Nginx +yourself. #### GitHub Pages If you are using GitHub Pages note that currently only personal repositories are @@ -121,9 +135,9 @@ repositories there are some things you need to do: ## Roadmap -- Write more documentation -- Implement Bower functionality -- And more things +* Write more documentation +* Implement Bower functionality +* And more things ### [Changelog][changelog] @@ -132,6 +146,8 @@ repositories there are some things you need to do: [yo]: https://github.com/yeoman/yo [bower]: http://bower.io/ [gulp]: http://gulpjs.com/ +[aws]: http://aws.amazon.com/s3/ +[ghpages]: https://pages.github.com/ [libsass]: https://github.com/hcatlin/libsass [autoprefixer]: https://github.com/ai/autoprefixer [poole]: https://github.com/poole @@ -140,6 +156,7 @@ repositories there are some things you need to do: [jshint]: http://www.jshint.com/ [nodejs]: http://nodejs.org/ [rubylang]: http://www.ruby-lang.org/ +[localtunnel]: http://localtunnel.me/ [gulpfile]: https://github.com/sondr3/generator-jekyllized/blob/master/app/templates/gulpfile.js [changelog]: https://github.com/sondr3/generator-jekyllized/blob/master/CHANGELOG.md [browsersync]: https://github.com/shakyShane/browser-sync diff --git a/app/index.js b/app/index.js index 44d7456..98888a7 100644 --- a/app/index.js +++ b/app/index.js @@ -54,7 +54,7 @@ module.exports = yeoman.generators.Base.extend({ ); this.log(chalk.magenta("\nIt\"s time to get Jekyllized!")); - this.log(chalk.yellow("\nTell me a little about your project »")); + this.log(chalk.yellow("\nTell me a little about your project >>")); var prompts = [{ name: "projectName", @@ -83,7 +83,7 @@ module.exports = yeoman.generators.Base.extend({ authorPrompting: function () { var cb = this.async(); - this.log(chalk.yellow("\nNow it\"s time to tell me about you. »")); + this.log(chalk.yellow("\nNow it\"s time to tell me about you. >>")); var prompts = [{ name: "authorName", @@ -112,7 +112,7 @@ module.exports = yeoman.generators.Base.extend({ jekyllPrompting: function () { var cb = this.async(); - this.log(chalk.yellow("\nNow on to set some Jekyll settings: »") + + this.log(chalk.yellow("\nNow on to set some Jekyll settings: >>") + chalk.red("\nYou can change all of this later in the _config.yml file")); var prompts = [{ @@ -149,7 +149,7 @@ module.exports = yeoman.generators.Base.extend({ uploadPrompting: function () { var cb = this.async(); - this.log(chalk.yellow("\nNow we only need some details about how to upload your site: »") + + this.log(chalk.yellow("\nNow we only need some details about how to upload your site: >>") + chalk.red("\nNOTE: Take whatever time you need to get these right/fill them in later in eithers credentials file.")); var prompts = [{ @@ -171,7 +171,7 @@ module.exports = yeoman.generators.Base.extend({ }] }, { name: "amazonKey", - message: chalk.yellow("\n\nNow we just need to fill out the detailes needed to configure your site for Amazon S3 and Cloudfront: »") + + message: chalk.yellow("\n\nNow we just need to fill out the detailes needed to configure your site for Amazon S3 and Cloudfront: >>") + chalk.red("\nNOTE: Take your time and get the correct settings from Amazon, or alternatively") + chalk.red("\njust fill them in blankly and fill out the aws-credentials.json later.") + "\nWhat is your key to AWS?", @@ -198,7 +198,7 @@ module.exports = yeoman.generators.Base.extend({ } }, { name: "rsyncUsername", - message: chalk.yellow("\n\nNow we just need to fill out the detailes needed to upload your site via Rsync: »") + + message: chalk.yellow("\n\nNow we just need to fill out the detailes needed to upload your site via Rsync: >>") + chalk.red("\nNOTE: Take your time and get the correct settings for your server, or alternatively") + chalk.red("\njust fill them in blankly and fill out the rsync-credentials.json later.") + "\nWhat is the username of the user you will be uploading with?", diff --git a/app/templates/_config.build.yml b/app/templates/_config.build.yml index f2e0177..01a1732 100644 --- a/app/templates/_config.build.yml +++ b/app/templates/_config.build.yml @@ -13,4 +13,4 @@ lsi: true limit_posts: 0 source: 'src' -destination: 'serve' +destination: 'dist' diff --git a/app/templates/_config.yml b/app/templates/_config.yml index 5664e5c..38df4b5 100755 --- a/app/templates/_config.yml +++ b/app/templates/_config.yml @@ -7,7 +7,7 @@ url: localhost:4000 # Used so Jekyll outputs the site correctly so Gulp can do what it wants source: src -destination: serve +destination: dist # Same as the title etc for your site but can instead be # called by using 'site.author.name' and so on diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index da72f54..1395dc4 100755 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -20,7 +20,7 @@ var reload = browserSync.reload; var merge = require("merge-stream"); // Deletes the directory that the optimized site is output to -function clean(done) { trash(["site"]); done(); } +function clean(done) { trash(["dist"]); done(); } function rebuild(done) { trash(["src/.jekyll-metadata"]); done(); } // Runs the build command for Jekyll to compile the site locally @@ -90,11 +90,11 @@ function fonts() { // Copy optimized images and (not optimized) fonts to the "site" folder function copy() { var images = gulp.src(".tmp/assets/images/**/*") - .pipe(gulp.dest("site/assets/images")) + .pipe(gulp.dest("dist/assets/images")) .pipe($.size({title: "copied images"})); var fonts = gulp.src(".tmp/assets/fonts/**/*") - .pipe(gulp.dest("site/assets/fonts")) + .pipe(gulp.dest("dist/assets/fonts")) .pipe($.size({title: "copied fonts"})); return merge(images, fonts); @@ -102,9 +102,9 @@ function copy() { // Optimizes all the CSS, HTML and concats the JS etc function optimize() { - var assets = $.useref.assets({searchPath: ["site", ".tmp"]}); + var assets = $.useref.assets({searchPath: ["dist", ".tmp"]}); - return gulp.src("site/**/*.html") + return gulp.src("dist/**/*.html") .pipe(assets) // Concatenate JavaScript files and preserve important comments .pipe($.if("*.js", $.uglify({preserveComments: "some"}))) @@ -128,7 +128,7 @@ function optimize() { removeRedundantAttributes: true }))) // Send the output to the correct folder - .pipe(gulp.dest("site")) + .pipe(gulp.dest("dist")) .pipe($.size({title: "optimizations"})); } @@ -143,7 +143,7 @@ function deploy() { "Content-Encoding": "gzip" }; - gulp.src("site/**/*") + gulp.src("dist/**/*") .pipe($.awspublishRouter({ routes: { "^assets/(?:.+)\\.(?:js|css)$": { @@ -198,10 +198,10 @@ function deploy() { // Load in the variables needed for our Rsync synchronization var secret = require("./rsync-credentials.json"); - return gulp.src("site/**") + return gulp.src("dist/**") .pipe($.rsync({ // This uploads the contenst of "root", instead of the folder - root: "site", + root: "dist", // Find your username, hostname and destination from your rsync-credentials.json hostname: secret.hostname, username: secret.username, @@ -215,7 +215,7 @@ function deploy() { // Task to upload your site to your personal GH Pages repo function deploy() { // Deploys your optimized site, you can change the settings in the html task if you want to - return gulp.src("./site/**/*") + return gulp.src("dist/**/*") .pipe($.ghPages({ // Currently only personal GitHub Pages are supported so it will upload to the master // branch and automatically overwrite anything that is in the directory @@ -243,7 +243,7 @@ function serve() { notify: true, // tunnel: "", server: { - baseDir: ["site", ".tmp"] + baseDir: ["dist", ".tmp"] } }); @@ -262,8 +262,9 @@ gulp.task("default", gulp.series( )); // Builds your site with the "build" command and then runs all the optimizations on -// it and outputs it to "./site" +// it and outputs it to "./dist" gulp.task("optimize", gulp.series( + gulp.series(rebuild), gulp.series(jekyllProd), gulp.parallel(styles, javascript, fonts, images, copy), gulp.series(optimize) @@ -280,7 +281,7 @@ gulp.task("deploy", deploy); // Serves your site locally gulp.task("serve", serve); -// Clean out your site folder +// Clean out your dist folder gulp.task("clean", clean); gulp.task("rebuild", gulp.series("clean", rebuild)); diff --git a/test/test-gulp.js b/test/test-gulp.js index 1f9de6c..d4feb22 100644 --- a/test/test-gulp.js +++ b/test/test-gulp.js @@ -58,6 +58,10 @@ describe("Jekyllized generator test for Gulp tasks without any uploading", funct tasks.assertTaskExists(this.jekyllized, "optimize", [], done); }); + it("should contain build task", function (done) { + tasks.assertTaskExists(this.jekyllized, "build", [], done); + }); + it("should contain deploy task", function (done) { tasks.assertTaskExists(this.jekyllized, "deploy", [], done); }); @@ -66,6 +70,14 @@ describe("Jekyllized generator test for Gulp tasks without any uploading", funct tasks.assertTaskExists(this.jekyllized, "serve", [], done); }); + it("should contain clean task", function (done) { + tasks.assertTaskExists(this.jekyllized, "clean", [], done); + }); + + it("should contain rebuild task", function (done) { + tasks.assertTaskExists(this.jekyllized, "rebuild", [], done); + }); + it("should contain styles task", function (done) { tasks.assertTaskExists(this.jekyllized, "styles", [], done); }); From caf91fc0b249ec691d4ab9720036724b91b78207 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 4 Feb 2015 19:29:49 +0100 Subject: [PATCH 004/178] Archives, improved generation and more Updated the _config files to help with incremental regeneration so you don't have to fully rebuild the site all the time. Also added the jekyll-archives gem to Jekyll with proper settings and some small beginnings for the layouts. Updated the atom.xml file to be more up to par and validate correctly and added a small "Hello world!" log to one of the JS files so you can see that it is included properly in the JS console. --- CHANGELOG.md | 19 +++++++++-- README.md | 8 +++++ app/templates/Gemfile | 3 +- app/templates/_config.build.yml | 7 ++-- app/templates/_config.yml | 25 +++++++++++++- app/templates/_package.json | 12 +++---- .../app/_layouts/category-archive.html | 13 +++++++ app/templates/app/_layouts/month-archive.html | 14 ++++++++ app/templates/app/_layouts/tag-archive.html | 13 +++++++ app/templates/app/_layouts/year-archive.html | 14 ++++++++ .../_posts/2014-03-02-introducing-poole.md | 2 +- .../_posts/2014-03-03-welcome-to-jekyll.md | 6 ++-- .../app/assets/javascript/javascript.js | 1 + app/templates/app/assets/scss/style.scss | 2 +- app/templates/app/atom.xml | 34 ++++++++++++------- app/templates/gulpfile.js | 2 +- test/test-jekyll.js | 30 +++++++++++++--- 17 files changed, 165 insertions(+), 40 deletions(-) create mode 100644 app/templates/app/_layouts/category-archive.html create mode 100644 app/templates/app/_layouts/month-archive.html create mode 100644 app/templates/app/_layouts/tag-archive.html create mode 100644 app/templates/app/_layouts/year-archive.html diff --git a/CHANGELOG.md b/CHANGELOG.md index b68b92f..bd96c36 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,22 @@ ## HEAD +## BREAKING CHANGES +Gulp was updated to version 4.0 and much of the Gulpfile was updated +accordingly, hence a lot of old tasks were removed and a few new ones +introduced. This is breaking in the sense that people who have previously +installed Jekyllized have to learn some new commands, but for those who have +previously installed nothing will change, this is just an informal update. + #### Changes * **Gulp:** Updated to Gulp 4.0 and changed the majority of the Gulpfile and most of the tasks there as well, this should be considered a breaking change. * **Jekyll:** Updated to Jekyll 3.0-beta since both Jekyll and Gulp is currently moving towards a new major version, the biggest change is the inclusion of - incremental regeneration. Also included a plugin for generating archives for - Jekyll. + incremental regeneration. +* **Archives:** Added yearly and monthly archives and archives for tags and + categories. * **Jekyll directory:** Everything is now output to a `dist` folder instead of a `site` folder to be more in line with most other tools. * **Asset directories:** Moved most of the assets to live in a .tmp while working on @@ -20,12 +28,17 @@ and JS files will now have sourcemaps generated, both Jekyll and the asset-revitalizer now runs quietly to not clog the command line. All the JS files are concated into a `index.js` file as well. +* **Jekyll:** Removed the URL setting from the `_config.build.yml` file into the + `_config.yml` file so getting the site ready for production doesn't involve + a full rebuild to better support incremental regeneration. +* **Feed:** Updated the feed to be more up to par and completely valid +* **Packages:** Updated the packages to be more up to date on NPM ## 0.7.1 - Bugfix #### Fixes -* **LiveReload:** Fix from @thiago-om for generating and reloading JavaScript +* **LiveReload:** Fix from @[thiago-om](https://github.com/thiago-om) for generating and reloading JavaScript files with BrowserSync. diff --git a/README.md b/README.md index 8380a22..278f164 100755 --- a/README.md +++ b/README.md @@ -42,6 +42,13 @@ optimize your CSS, JS, HTML and images, automatic vendor prefixing with * Support for sourcemaps for ease of debugging for both your JS and CSS * Cachebusting for your assets that is automatically updated in your HTML +### Jekyll + +* Jekyll is configured with [Redcarpet][redcarpet] that adds a ton of extra functionality to + writing Markdown (footnotes etc) and lots of sane settings +* Automatic generation of year/month/category/tags archives +* Fully valid Atom 1.0 feed and sitemap + ## Getting started ## Installation @@ -149,6 +156,7 @@ repositories there are some things you need to do: [aws]: http://aws.amazon.com/s3/ [ghpages]: https://pages.github.com/ [libsass]: https://github.com/hcatlin/libsass +[redcarpet]: https://github.com/vmg/redcarpet [autoprefixer]: https://github.com/ai/autoprefixer [poole]: https://github.com/poole [lanyon]: https://github.com/poole/lanyon diff --git a/app/templates/Gemfile b/app/templates/Gemfile index 80d0344..0cba631 100755 --- a/app/templates/Gemfile +++ b/app/templates/Gemfile @@ -2,5 +2,4 @@ source "http://rubygems.org" gem 'jekyll' gem 'redcarpet' -gem 'classifier-reborn' -gem 'fast-stemmer' +gem 'jekyll-archives' diff --git a/app/templates/_config.build.yml b/app/templates/_config.build.yml index 01a1732..f2ccf67 100644 --- a/app/templates/_config.build.yml +++ b/app/templates/_config.build.yml @@ -1,9 +1,6 @@ # Run during the 'gulp build' command # Overrides these options in _config.yml -# Overrides the default URL, needed for your atom feed and sitemap -url: <%= projectURL %> - # Hides your drafts and future posts future: false show_drafts: false @@ -12,5 +9,5 @@ lsi: true # Removes the upper limit for posts generated limit_posts: 0 -source: 'src' -destination: 'dist' +source: src +destination: dist diff --git a/app/templates/_config.yml b/app/templates/_config.yml index 38df4b5..3f0d6e4 100755 --- a/app/templates/_config.yml +++ b/app/templates/_config.yml @@ -3,11 +3,12 @@ title: <%= projectName %> description: <%= projectDescription %> tagline: <%= projectTagline %> -url: localhost:4000 +url: <%= projectURL %> # Used so Jekyll outputs the site correctly so Gulp can do what it wants source: src destination: dist +exclude: ['assets'] # Same as the title etc for your site but can instead be # called by using 'site.author.name' and so on @@ -36,6 +37,10 @@ paginate: <%= jekyllPaginate%> paginate_path: 'page:num' excerpt_separator: '' +# Extras for Jekyll +gems: + - jekyll-archives + # Markdown library markdown: redcarpet # Markdown library options @@ -43,3 +48,21 @@ redcarpet: extensions: ['no_intra_emphasis', 'tables', 'fenced_code_blocks', 'autolink', 'smart', 'strikethrough', 'superscript', 'underline', 'highlight', 'footnotes'] highlighter: true + +# Settings for archives +jekyll-archives: + enabled: + - year + - month + - categories + - tags + layouts: + year: 'year-archive' + month: 'month-archive' + category: 'category-archive' + tag: 'tag-archive' + permalinks: + year: '/:year/' + month: '/:year/:month/' + category: '/category/:name/' + tags: '/tag/:name/' diff --git a/app/templates/_package.json b/app/templates/_package.json index 41dbb17..441eba9 100755 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -10,9 +10,9 @@ "del": "^1.1.1", "gulp": "file:../../../../../var/folders/f1/l2svxmy91tbdk94t9259sq040000gn/T/npm-43577-622ebfd0/git-cache-efb05e57fc27/4dc9eb895b07cd87ea7af0009e2a9197aa21a3a6", "gulp-autoprefixer": "^2.0.0",<% if (amazonCloudfrontS3) { %> - "gulp-awspublish": "0.0.23", - "gulp-awspublish-router": "0.1.0",<% } %> - "gulp-cache": "~0.2.2", + "gulp-awspublish": "1.0.0", + "gulp-awspublish-router": "0.1.1",<% } %> + "gulp-cache": "~0.2.4", "gulp-cached": "^1.0.1", "gulp-changed": "^1.0.0",<% if (amazonCloudfrontS3) { %> "gulp-cloudfront": "0.0.14",<% } %> @@ -20,12 +20,12 @@ "gulp-gh-pages": "^0.4.0",<% } %> "gulp-group-concat": "^1.1.4", "gulp-gzip": "0.0.8", - "gulp-htmlmin": "^0.2.0", + "gulp-htmlmin": "^1.0.0", "gulp-if": "^1.2.4", "gulp-imagemin": "^2.1.0", "gulp-jshint": "^1.8.5", "gulp-load-plugins": "^0.8.0", - "gulp-minify-css": "^0.3.10", + "gulp-minify-css": "^0.4.4", "gulp-rev-all": "^0.7.5", "gulp-rev-replace": "^0.3.1",<% if (rsync) { %> "gulp-rsync": "0.0.2",<% } %> @@ -34,7 +34,7 @@ "gulp-size": "^1.1.0", "gulp-sourcemaps": "^1.3.0", "gulp-uglify": "^1.1.0", - "gulp-uncss": "^0.5.0", + "gulp-uncss": "^1.0.0", "gulp-useref": "^1.0.2", "jshint-stylish": "^1.0.0", "merge-stream": "^0.1.6", diff --git a/app/templates/app/_layouts/category-archive.html b/app/templates/app/_layouts/category-archive.html new file mode 100644 index 0000000..5875994 --- /dev/null +++ b/app/templates/app/_layouts/category-archive.html @@ -0,0 +1,13 @@ +--- +layout: default +--- + +

Archive of posts with {{ page.type }} '{{ page.title }}'

+
    + {% for post in page.posts %} +
  • + + {{ post.title }} +
  • + {% endfor %} +
diff --git a/app/templates/app/_layouts/month-archive.html b/app/templates/app/_layouts/month-archive.html new file mode 100644 index 0000000..a42bd21 --- /dev/null +++ b/app/templates/app/_layouts/month-archive.html @@ -0,0 +1,14 @@ +--- +layout: default +--- + +

Archive of posts from {{ page.date | date: "%B %Y" }}

+ +
    +{% for post in page.posts %} +
  • + + {{ post.title }} +
  • +{% endfor %} +
diff --git a/app/templates/app/_layouts/tag-archive.html b/app/templates/app/_layouts/tag-archive.html new file mode 100644 index 0000000..5875994 --- /dev/null +++ b/app/templates/app/_layouts/tag-archive.html @@ -0,0 +1,13 @@ +--- +layout: default +--- + +

Archive of posts with {{ page.type }} '{{ page.title }}'

+
    + {% for post in page.posts %} +
  • + + {{ post.title }} +
  • + {% endfor %} +
diff --git a/app/templates/app/_layouts/year-archive.html b/app/templates/app/_layouts/year-archive.html new file mode 100644 index 0000000..1884340 --- /dev/null +++ b/app/templates/app/_layouts/year-archive.html @@ -0,0 +1,14 @@ +--- +layout: default +--- + +

Archive of posts from {{ page.date | date: "%Y" }}

+ +
    +{% for post in page.posts %} +
  • + + {{ post.title }} +
  • +{% endfor %} +
diff --git a/app/templates/app/_posts/2014-03-02-introducing-poole.md b/app/templates/app/_posts/2014-03-02-introducing-poole.md index 5504435..f2ece37 100644 --- a/app/templates/app/_posts/2014-03-02-introducing-poole.md +++ b/app/templates/app/_posts/2014-03-02-introducing-poole.md @@ -10,7 +10,7 @@ investigating the connection of two persons, Dr. Henry Jekyll and Mr. Edward Hyde. Chief among the novel's supporting cast is a man by the name of Mr. Poole, Dr. Jekyll's loyal butler. ------ + Poole is the butler for [Jekyll](http://jekyllrb.com), the static site generator. It's designed and developed by [@mdo](https://twitter.com/mdo) to diff --git a/app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md b/app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md index f861ee6..b4aa00e 100644 --- a/app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md +++ b/app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md @@ -1,6 +1,6 @@ --- layout: post -date: 2014-03-03 +date: 2015-02-03 title: Welcome to Jekyll! categories: jekyll --- @@ -34,6 +34,6 @@ Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh]. [redcarpet]: https://github.com/vmg/redcarpet -[jekyll-gh]: https://github.com/mojombo/jekyll -[jekyll]: http://jekyllrb.com +[jekyll-gh]: https://github.com/jekyll/jekyll +[jekyll]: http://jekyllrb.com/docs/home/ [^1]: Who are quite handy diff --git a/app/templates/app/assets/javascript/javascript.js b/app/templates/app/assets/javascript/javascript.js index e69de29..940a3ff 100644 --- a/app/templates/app/assets/javascript/javascript.js +++ b/app/templates/app/assets/javascript/javascript.js @@ -0,0 +1 @@ +console.log("Hello world!"); diff --git a/app/templates/app/assets/scss/style.scss b/app/templates/app/assets/scss/style.scss index 93e94eb..c8acbdd 100644 --- a/app/templates/app/assets/scss/style.scss +++ b/app/templates/app/assets/scss/style.scss @@ -1,4 +1,4 @@ -/* +/* The main SCSS file for everything, yep */ diff --git a/app/templates/app/atom.xml b/app/templates/app/atom.xml index 96c9681..4cd9256 100644 --- a/app/templates/app/atom.xml +++ b/app/templates/app/atom.xml @@ -5,23 +5,33 @@ layout: null - {{ site.title }} - - - {{ site.time | date_to_xmlschema }} - {{ site.url }} - - {{ site.author.name }} - {{ site.author.email }} - + {{ site.title }} + {{ site.tagline }} + + + {{ site.time | date_to_xmlschema }} + {{ site.url }}/ + + {{ site.author.name }} + {{ site.author.email }} + - {% for post in site.posts %} + {% for post in site.posts limit:10 %} - {{ post.title }} + {{ post.title | xml_escape }} {{ post.date | date_to_xmlschema }} + {{ post.date | date_to_xmlschema }} {{ site.url }}{{ post.id }} - {{ post.content | xml_escape }} + + {% if post.excerpt %}{{ post.excerpt | xml_escape }}{% endif %} + + {{ post.content | xml_escape }} + + + {{ site.author.name }} + {{ site.author.email }} + {% endfor %} diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index 1395dc4..b8855f6 100755 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -87,7 +87,7 @@ function fonts() { .pipe($.size({ title: "fonts" })); } -// Copy optimized images and (not optimized) fonts to the "site" folder +// Copy optimized images and (not optimized) fonts to the "dist" folder function copy() { var images = gulp.src(".tmp/assets/images/**/*") .pipe(gulp.dest("dist/assets/images")) diff --git a/test/test-jekyll.js b/test/test-jekyll.js index 5d2a65e..761c2a4 100644 --- a/test/test-jekyll.js +++ b/test/test-jekyll.js @@ -75,13 +75,33 @@ describe("Jekyllized generator", function () { tasks.assertJekyllSettings(this.jekyllized, "twitter", "olanordmann123123", done); }); - it("_config.build.yml contains the correct URL", function (done) { - tasks.assertJekyllBuildSettings(this.jekyllized, "url", "testing.com", done); + it("_config.build.yml contains the corrent setting for future posts", function (done) { + tasks.assertJekyllBuildSettings(this.jekyllized, "future", "false", done); + }); + + it("_config.build.yml contains the corrent setting for drafts", function (done) { + tasks.assertJekyllBuildSettings(this.jekyllized, "show_drafts", "false", done); + }); + + it("_config.build.yml contains the corrent setting for LSI", function (done) { + tasks.assertJekyllBuildSettings(this.jekyllized, "lsi", "true", done); + }); + + it("_config.build.yml contains the corrent setting for limiting posts", function (done) { + tasks.assertJekyllBuildSettings(this.jekyllized, "limit_posts", "0", done); + }); + + it("_config.build.yml contains the corrent setting for source dir", function (done) { + tasks.assertJekyllBuildSettings(this.jekyllized, "source", "src", done); + }); + + it("_config.build.yml contains the corrent setting for destination dir", function (done) { + tasks.assertJekyllBuildSettings(this.jekyllized, "destination", "dist", done); }); }); - describe("test for permalinks and pagination", function () { + describe("test pretty permalinks and 10 pages", function () { before(function (done) { helpers.run(path.join(__dirname, "../app")) .inDir(path.join(__dirname, "./temp/test-jekyll-pagination")) @@ -104,7 +124,7 @@ describe("Jekyllized generator", function () { }); - describe("", function () { + describe("test date permalinks and all pages", function () { before(function (done) { helpers.run(path.join(__dirname, "../app")) .inDir(path.join(__dirname, "./temp/test-jekyll-pagination-1")) @@ -127,7 +147,7 @@ describe("Jekyllized generator", function () { }); - describe("", function () { + describe("test no permalinks and 1 page", function () { before(function (done) { helpers.run(path.join(__dirname, "../app")) .inDir(path.join(__dirname, "./temp/test-jekyll-pagination-2")) From d577a8b3bb510bdc5550deb064c5cb4bd63ab8a0 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 4 Feb 2015 20:47:19 +0100 Subject: [PATCH 005/178] Updated all the tests and fixed the deploy task Added a bunch more tests that checks for the gulpfile tasks, that the correct packages are installed in the package.json file and removed the test-util.js file as it's no longer needed. Also fixed the gulpfile always containing a deploy task even when you selected that you didn't use it and added tests that checks for it. --- CHANGELOG.md | 4 ++ app/index.js | 1 + app/templates/gulpfile.js | 4 +- test-util.js | 37 ------------- test/test-creation-aws.js | 25 ++++++++- test/test-creation-ghpages.js | 18 +++++- test/test-creation-rsync.js | 18 +++++- test/test-gulp.js | 51 +++++------------ test/test-jekyll.js | 100 +++++++++++++--------------------- test/test-load.js | 2 +- test/test-package.js | 38 +++++++++++++ 11 files changed, 150 insertions(+), 148 deletions(-) delete mode 100644 test-util.js create mode 100644 test/test-package.js diff --git a/CHANGELOG.md b/CHANGELOG.md index bd96c36..3fa7528 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,10 @@ previously installed nothing will change, this is just an informal update. * **Feed:** Updated the feed to be more up to par and completely valid * **Packages:** Updated the packages to be more up to date on NPM +#### Behind the scenes +* **Tests:** Continued working on tests to make errors even less likely. Yay + tests. + ## 0.7.1 - Bugfix diff --git a/app/index.js b/app/index.js index 98888a7..1465a35 100644 --- a/app/index.js +++ b/app/index.js @@ -231,6 +231,7 @@ module.exports = yeoman.generators.Base.extend({ this.amazonCloudfrontS3 = hasFeature("amazonCloudfrontS3"); this.rsync = hasFeature("rsync"); this.githubPages = hasFeature("githubPages"); + this.noUpload = hasFeature("noUpload"); this.amazonKey = props.amazonKey; this.amazonSecret = props.amazonSecret; diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index b8855f6..c7983a7 100755 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -273,10 +273,10 @@ gulp.task("optimize", gulp.series( gulp.task("build", gulp.series( gulp.series(jekyllDev), gulp.parallel(styles, javascript, fonts, images) -)); +));<% if (!noUpload) { %> // Deploy your site for all to see -gulp.task("deploy", deploy); +gulp.task("deploy", deploy);<% } %> // Serves your site locally gulp.task("serve", serve); diff --git a/test-util.js b/test-util.js deleted file mode 100644 index 41b04b6..0000000 --- a/test-util.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -var fs = require("fs"); -var assert = require("assert"); - -exports.assertTaskExists = function (generator, taskName, features, done) { - var gulpFile = fs.readFileSync("./gulpfile.js", "utf8"); - var regExpGulp = new RegExp("gulp.task\\(\"" + taskName + "\""); - - assert.ok( - regExpGulp.test(gulpFile), - "gulpfile.js does not contain " + taskName + " task" - ); - done(); -}; - -exports.assertJekyllSettings = function (generator, settingName, settingValue, done) { - var configFile = fs.readFileSync("./_config.yml", "utf8"); - var settingRegExp = new RegExp(settingName + ": " + settingValue); - - assert.ok( - settingRegExp.test(configFile), - "_config.yml setting " + settingName + " does not contain the right value" - ); - done(); -}; - -exports.assertJekyllBuildSettings = function (generator, settingName, settingValue, done) { - var configBuildFile = fs.readFileSync("./_config.build.yml", "utf8"); - var settingRegExp = new RegExp(settingName + ": " + settingValue); - - assert.ok( - settingRegExp.test(configBuildFile), - "_config.build.yml setting " + settingName + " does not contain the right value" - ); - done(); -}; diff --git a/test/test-creation-aws.js b/test/test-creation-aws.js index 81577c9..3d9f48c 100755 --- a/test/test-creation-aws.js +++ b/test/test-creation-aws.js @@ -4,7 +4,6 @@ var path = require("path"); var helpers = require("yeoman-generator").test; var assert = require("yeoman-generator").assert; -var tasks = require("../test-util.js"); describe("Jekyllized generator test when using Amazon AWS", function () { before(function (done) { @@ -36,8 +35,28 @@ describe("Jekyllized generator test when using Amazon AWS", function () { assert.file(expected); }); - it("should contain deploy tasks", function (done) { - tasks.assertTaskExists(this.jekyllized, "deploy", [], done); + it("should contain the correct deploy function", function () { + assert.fileContent("gulpfile.js", /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + }); + + it("should NOT contain either the GH Pages or Rsync function", function () { + assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site via Rsync to your server/); + assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site to your personal GH Pages repo/); + }); + + it("should contain deploy tasks", function () { + assert.fileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + }); + + it("should contain the correct packages", function () { + var expected = [ + ["package.json", /\"concurrent-transform\"/], + ["package.json", /\"gulp-awspublish\"/], + ["package.json", /\"gulp-awspublish-router\"/], + ["package.json", /\"gulp-cloudfront\"/] + ]; + + assert.fileContent(expected); }); }); diff --git a/test/test-creation-ghpages.js b/test/test-creation-ghpages.js index 15d56bb..d4d5fb6 100644 --- a/test/test-creation-ghpages.js +++ b/test/test-creation-ghpages.js @@ -4,7 +4,6 @@ var path = require("path"); var helpers = require("yeoman-generator").test; var assert = require("yeoman-generator").assert; -var tasks = require("../test-util.js"); describe("Jekyllized generator test when using GitHub Pages", function () { before(function (done) { @@ -31,8 +30,21 @@ describe("Jekyllized generator test when using GitHub Pages", function () { assert.file(expected); }); - it("should contain deploy task", function (done) { - tasks.assertTaskExists(this.jekyllized, "deploy", [], done); + it("should contain the correct deploy function", function () { + assert.fileContent("gulpfile.js", /\/\/ Task to upload your site to your personal GH Pages repo/); + }); + + it("should NOT contain either the Amazon or Rsync function", function () { + assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site via Rsync to your server/); + assert.noFileContent("gulpfile.js", /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + }); + + it("should contain deploy tasks", function () { + assert.fileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + }); + + it("should contain the correct packages", function () { + assert.fileContent("package.json", /\"gulp-gh-pages\"/); }); }); diff --git a/test/test-creation-rsync.js b/test/test-creation-rsync.js index 7a333c3..a801dfd 100755 --- a/test/test-creation-rsync.js +++ b/test/test-creation-rsync.js @@ -4,7 +4,6 @@ var path = require("path"); var helpers = require("yeoman-generator").test; var assert = require("yeoman-generator").assert; -var tasks = require("../test-util.js"); describe("Jekyllized generator test when using Rsync", function () { before(function (done) { @@ -35,8 +34,21 @@ describe("Jekyllized generator test when using Rsync", function () { assert.file(expected); }); - it("should contain deploy task", function (done) { - tasks.assertTaskExists(this.jekyllized, "deploy", [], done); + it("should contain the correct deploy function", function () { + assert.fileContent("gulpfile.js", /\/\/ Task to upload your site via Rsync to your server/); + }); + + it("should NOT contain either the GH Pages or Amazon function", function () { + assert.noFileContent("gulpfile.js", /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site to your personal GH Pages repo/); + }); + + it("should contain deploy tasks", function () { + assert.fileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + }); + + it("should contain the correct packages", function () { + assert.fileContent("package.json", /\"gulp-rsync\"/); }); }); diff --git a/test/test-gulp.js b/test/test-gulp.js index d4feb22..7fa53e2 100644 --- a/test/test-gulp.js +++ b/test/test-gulp.js @@ -4,7 +4,6 @@ var path = require("path"); var assert = require("assert"); var helpers = require("yeoman-generator").test; -var tasks = require("../test-util.js"); describe("Jekyllized generator test for Gulp tasks without any uploading", function () { before(function (done) { @@ -50,44 +49,24 @@ describe("Jekyllized generator test for Gulp tasks without any uploading", funct assert.noFile(unexpected); }); - it("should contain default task", function (done) { - tasks.assertTaskExists(this.jekyllized, "default", [], done); - }); - - it("should contain optimize task", function (done) { - tasks.assertTaskExists(this.jekyllized, "optimize", [], done); - }); - - it("should contain build task", function (done) { - tasks.assertTaskExists(this.jekyllized, "build", [], done); - }); - - it("should contain deploy task", function (done) { - tasks.assertTaskExists(this.jekyllized, "deploy", [], done); - }); - - it("should contain serve task", function (done) { - tasks.assertTaskExists(this.jekyllized, "serve", [], done); - }); - - it("should contain clean task", function (done) { - tasks.assertTaskExists(this.jekyllized, "clean", [], done); - }); - - it("should contain rebuild task", function (done) { - tasks.assertTaskExists(this.jekyllized, "rebuild", [], done); - }); - - it("should contain styles task", function (done) { - tasks.assertTaskExists(this.jekyllized, "styles", [], done); - }); + it ("should contain the standard tasks", function () { + var expected = [ + ["gulpfile.js", /gulp.task\(\"default\"/], + ["gulpfile.js", /gulp.task\(\"optimize\"/], + ["gulpfile.js", /gulp.task\(\"build\"/], + ["gulpfile.js", /gulp.task\(\"serve\"/], + ["gulpfile.js", /gulp.task\(\"clean\"/], + ["gulpfile.js", /gulp.task\(\"rebuild\"/], + ["gulpfile.js", /gulp.task\(\"styles\"/], + ["gulpfile.js", /gulp.task\(\"javascript\"/], + ["gulpfile.js", /gulp.task\(\"check\"/] + ]; - it("should contain javascript task", function (done) { - tasks.assertTaskExists(this.jekyllized, "javascript", [], done); + assert.fileContent(expected); }); - it("should contain check task", function (done) { - tasks.assertTaskExists(this.jekyllized, "check", [], done); + it("should NOT contain a deploy task", function () { + assert.noFileContent("gulpfile.js", /gulp.task\(\"deploy\"/); }); }); diff --git a/test/test-jekyll.js b/test/test-jekyll.js index 761c2a4..6041234 100644 --- a/test/test-jekyll.js +++ b/test/test-jekyll.js @@ -4,7 +4,6 @@ var path = require("path"); var helpers = require("yeoman-generator").test; var assert = require("yeoman-generator").assert; -var tasks = require("../test-util.js"); describe("Jekyllized generator", function () { describe("test for Jekyll settings", function () { @@ -44,64 +43,39 @@ describe("Jekyllized generator", function () { }); it("gulpfile.js does NOT contain a deploy task", function () { - assert.noFileContent("gulpfile.js", /gulp.task \("deploy"\)/); + assert.noFileContent("gulpfile.js", /gulp.task\(\"deploy\"/); }); - it("_config.yml contains the correct title", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "title", "Mocha Test", done); - }); - - it("_config.yml contains the correct description", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "description", "Mocha tests for Jekyllized", done); - }); - - it("_config.yml contains the correct tagline", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "tagline", "Better hope this doesn\"t blow up", done); - }); - - it("_config.yml contains the correct author name", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "name", "Ola Nordmann", done); - }); - - it("_config.yml contains the correct author email", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "email", "ola.nordmann@email.com", done); - }); - - it("_config.yml contains the correct author bio", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "bio", "Just your average Norwegian", done); - }); - - it("_config.yml contains the correct author Twitter", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "twitter", "olanordmann123123", done); - }); - - it("_config.build.yml contains the corrent setting for future posts", function (done) { - tasks.assertJekyllBuildSettings(this.jekyllized, "future", "false", done); - }); - - it("_config.build.yml contains the corrent setting for drafts", function (done) { - tasks.assertJekyllBuildSettings(this.jekyllized, "show_drafts", "false", done); - }); - - it("_config.build.yml contains the corrent setting for LSI", function (done) { - tasks.assertJekyllBuildSettings(this.jekyllized, "lsi", "true", done); - }); + it("_config.yml contains the correct settings", function () { + var expected = [ + ["_config.yml", /title\: Mocha Test/], + ["_config.yml", /description\: Mocha tests for Jekyllized/], + ["_config.yml", /tagline\: Better hope this doesn\"t blow up/], + ["_config.yml", /name\: Ola Nordmann/], + ["_config.yml", /email\: ola\.nordmann\@email\.com/], + ["_config.yml", /bio\: Just your average Norwegian/], + ["_config.yml", /twitter\: olanordmann123123/] + ]; - it("_config.build.yml contains the corrent setting for limiting posts", function (done) { - tasks.assertJekyllBuildSettings(this.jekyllized, "limit_posts", "0", done); + assert.fileContent(expected); }); - it("_config.build.yml contains the corrent setting for source dir", function (done) { - tasks.assertJekyllBuildSettings(this.jekyllized, "source", "src", done); - }); + it("_config.build.yml contains the correct settings", function () { + var expected = [ + ["_config.build.yml", /future\: false/], + ["_config.build.yml", /show_drafts\: false/], + ["_config.build.yml", /lsi\: true/], + ["_config.build.yml", /limit_posts\: 0/], + ["_config.build.yml", /source\: src/], + ["_config.build.yml", /destination\: dist/] + ]; - it("_config.build.yml contains the corrent setting for destination dir", function (done) { - tasks.assertJekyllBuildSettings(this.jekyllized, "destination", "dist", done); + assert.fileContent(expected); }); }); - describe("test pretty permalinks and 10 pages", function () { + describe("test with setting pretty permalinks and 10 posts per page", function () { before(function (done) { helpers.run(path.join(__dirname, "../app")) .inDir(path.join(__dirname, "./temp/test-jekyll-pagination")) @@ -114,17 +88,17 @@ describe("Jekyllized generator", function () { .on("end", done); }); - it("_config.yml permalink setting is 'pretty'", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "permalink", "pretty", done); + it("_config.yml permalink setting is 'pretty'", function () { + assert.fileContent("_config.yml", /permalink\: pretty/); }); - it("_config.yml pagination setting is '10'", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "paginate", "10", done); + it("_config.yml pagination is '10' posts per page", function () { + assert.fileContent("_config.yml", /paginate\: 10/); }); }); - describe("test date permalinks and all pages", function () { + describe("test with setting date permalinks and all posts on the same page", function () { before(function (done) { helpers.run(path.join(__dirname, "../app")) .inDir(path.join(__dirname, "./temp/test-jekyll-pagination-1")) @@ -137,17 +111,17 @@ describe("Jekyllized generator", function () { .on("end", done); }); - it("_config.yml permalink setting is 'date'", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "permalink", "date", done); + it("_config.yml permalink setting is 'date'", function () { + assert.fileContent("_config.yml", /permalink\: date/); }); - it("_config.yml pagination setting is 'all'", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "paginate", "all", done); + it("_config.yml pagination is 'all' posts per page", function () { + assert.fileContent("_config.yml", /paginate\: all/); }); }); - describe("test no permalinks and 1 page", function () { + describe("test with no permalinks setting and 1 post per page", function () { before(function (done) { helpers.run(path.join(__dirname, "../app")) .inDir(path.join(__dirname, "./temp/test-jekyll-pagination-2")) @@ -160,12 +134,12 @@ describe("Jekyllized generator", function () { .on("end", done); }); - it("_config.yml permalink setting is 'none'", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "permalink", "none", done); + it("_config.yml permalink setting is 'none'", function () { + assert.fileContent("_config.yml", /permalink\: none/); }); - it("_config.yml pagination setting is '1'", function (done) { - tasks.assertJekyllSettings(this.jekyllized, "paginate", "1", done); + it("_config.yml pagination is '1' posts per page", function () { + assert.fileContent("_config.yml", /paginate\: 1/); }); }); diff --git a/test/test-load.js b/test/test-load.js index 8ac30f6..8b49714 100644 --- a/test/test-load.js +++ b/test/test-load.js @@ -3,7 +3,7 @@ var assert = require("assert"); -describe("jekyll generator", function () { +describe("Jekyllized generator", function () { it("can be imported without blowing up", function () { var app = require("../app"); assert(app !== undefined); diff --git a/test/test-package.js b/test/test-package.js new file mode 100644 index 0000000..45f6ccd --- /dev/null +++ b/test/test-package.js @@ -0,0 +1,38 @@ +/*global describe, before, it*/ +"use strict"; + +var path = require("path"); +var assert = require("assert"); +var helpers = require("yeoman-generator").test; + +describe("Jekyllized generator test for package.json", function () { + before(function (done) { + helpers.run(path.join(__dirname, "../app")) + .inDir(path.join(__dirname, "./temp/test-package")) + .withArguments(["--skip-install"]) + .withPrompt({ + projectName: ["Package Test"], + projectDescription: ["Package tests for Jekyllized"], + projectTagline: ["Better hope this doesn\"t blow up"], + projectURL: ["testing.com"], + authorName: ["Ola Nordmann"], + authorEmail: ["ola.nordmann@email.com"], + authorBio: ["Just your average Norwegian"], + authorTwitter: ["olanordmann123123"], + jekyllPermalinks: ["pretty"], + jekyllPaginate: ["10"], + uploadChoices: ["noUpload"] + }) + .on("end", done); + }); + + it("should contain the proper names and version", function () { + var expected = [ + ["package.json", /\"name\"\: \"test-package\"/], + ["package.json", /\"description\"\: \"Yeoman workflow for test package\"/] + ]; + + assert.fileContent(expected); + }); + +}); From 67eaa12b67ba89f6513fed8b31602149afa7c26a Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 10 Feb 2015 18:47:14 +0100 Subject: [PATCH 006/178] Moved back to the default Jekyll theme --- CHANGELOG.md | 14 +- app/templates/app/404.html | 4 +- app/templates/app/_includes/footer.html | 44 ++ app/templates/app/_includes/head.html | 19 +- app/templates/app/_includes/header.html | 24 + app/templates/app/_includes/sidebar.html | 38 -- app/templates/app/_layouts/default.html | 19 +- app/templates/app/_layouts/page.html | 13 +- app/templates/app/_layouts/post.html | 30 +- .../_posts/2014-03-02-introducing-poole.md | 57 -- app/templates/app/about.md | 31 +- app/templates/app/assets/scss/base.scss | 204 +++++++ app/templates/app/assets/scss/lanyon.scss | 542 ------------------ app/templates/app/assets/scss/layout.scss | 236 ++++++++ app/templates/app/assets/scss/main.scss | 38 ++ app/templates/app/assets/scss/poole.scss | 425 -------------- app/templates/app/assets/scss/style.scss | 7 +- .../app/assets/scss/syntax-highlighting.scss | 67 +++ app/templates/app/assets/scss/syntax.scss | 66 --- app/templates/app/index.html | 46 +- 20 files changed, 680 insertions(+), 1244 deletions(-) create mode 100644 app/templates/app/_includes/footer.html create mode 100644 app/templates/app/_includes/header.html delete mode 100644 app/templates/app/_includes/sidebar.html delete mode 100644 app/templates/app/_posts/2014-03-02-introducing-poole.md create mode 100644 app/templates/app/assets/scss/base.scss delete mode 100644 app/templates/app/assets/scss/lanyon.scss create mode 100644 app/templates/app/assets/scss/layout.scss create mode 100644 app/templates/app/assets/scss/main.scss delete mode 100644 app/templates/app/assets/scss/poole.scss create mode 100644 app/templates/app/assets/scss/syntax-highlighting.scss delete mode 100644 app/templates/app/assets/scss/syntax.scss diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fa7528..baa2747 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,17 +4,21 @@ ## BREAKING CHANGES Gulp was updated to version 4.0 and much of the Gulpfile was updated accordingly, hence a lot of old tasks were removed and a few new ones -introduced. This is breaking in the sense that people who have previously -installed Jekyllized have to learn some new commands, but for those who have -previously installed nothing will change, this is just an informal update. +introduced. + +This isn't strictly breaking as it won't affect people who have installed and +are running a site with Jekyllized nor will it change for people who are new but +if you are updating or coming from a previous install some things might not be +as it was. #### Changes * **Gulp:** Updated to Gulp 4.0 and changed the majority of the Gulpfile and most of the tasks there as well, this should be considered a breaking change. * **Jekyll:** Updated to Jekyll 3.0-beta since both Jekyll and Gulp is currently - moving towards a new major version, the biggest change is the inclusion of - incremental regeneration. + moving towards a new major version, with one of the biggest changes being + incremental regeneration. Also moved back to the default theme for Jekyll with + some minor tweaks to suit this project better. * **Archives:** Added yearly and monthly archives and archives for tags and categories. * **Jekyll directory:** Everything is now output to a `dist` folder instead of a diff --git a/app/templates/app/404.html b/app/templates/app/404.html index 5f5b9bf..46f2d7b 100644 --- a/app/templates/app/404.html +++ b/app/templates/app/404.html @@ -5,5 +5,7 @@

404: Page not found

-

Sorry, we've misplaced that URL or it's pointing to something that doesn't exist. Head back home to try finding it again.

+

Sorry, we've misplaced that URL or it's pointing to something + that doesn't exist. Head back home to try finding it + again.

diff --git a/app/templates/app/_includes/footer.html b/app/templates/app/_includes/footer.html new file mode 100644 index 0000000..7b7c565 --- /dev/null +++ b/app/templates/app/_includes/footer.html @@ -0,0 +1,44 @@ + diff --git a/app/templates/app/_includes/head.html b/app/templates/app/_includes/head.html index 2d4964e..6cf97ca 100644 --- a/app/templates/app/_includes/head.html +++ b/app/templates/app/_includes/head.html @@ -1,23 +1,16 @@ - - + + + - - - - - {% if page.title == "Home" %} - {{ site.title }} · {{ site.tagline }} - {% else %} - {{ page.title }} · {{ site.title }} - {% endif %} - + {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} + + - diff --git a/app/templates/app/_includes/header.html b/app/templates/app/_includes/header.html new file mode 100644 index 0000000..e2395a1 --- /dev/null +++ b/app/templates/app/_includes/header.html @@ -0,0 +1,24 @@ + diff --git a/app/templates/app/_includes/sidebar.html b/app/templates/app/_includes/sidebar.html deleted file mode 100644 index 0bf959c..0000000 --- a/app/templates/app/_includes/sidebar.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - diff --git a/app/templates/app/_layouts/default.html b/app/templates/app/_layouts/default.html index 0ebec7e..7ba65a5 100644 --- a/app/templates/app/_layouts/default.html +++ b/app/templates/app/_layouts/default.html @@ -5,26 +5,15 @@ - {% include sidebar.html %} + {% include header.html %} - -
-
-
-

- {{ site.title }} - {{ site.tagline }} -

-
-
- -
+
+
{{ content }}
- + {% include footer.html %} diff --git a/app/templates/app/_layouts/page.html b/app/templates/app/_layouts/page.html index 4e0d4eb..f375cc4 100644 --- a/app/templates/app/_layouts/page.html +++ b/app/templates/app/_layouts/page.html @@ -1,8 +1,13 @@ --- layout: default --- +
-
-

{{ page.title }}

- {{ content }} -
+
+

{{ page.title }}

+
+ +
+ {{ content }} +
+
diff --git a/app/templates/app/_layouts/post.html b/app/templates/app/_layouts/post.html index 2a6c7c1..d4f8be3 100644 --- a/app/templates/app/_layouts/post.html +++ b/app/templates/app/_layouts/post.html @@ -1,25 +1,15 @@ --- layout: default --- +
-
-

{{ page.title }}

- - {{ content }} -
+
+

{{ page.title }}

+ +
- +
+ {{ content }} +
+ +
diff --git a/app/templates/app/_posts/2014-03-02-introducing-poole.md b/app/templates/app/_posts/2014-03-02-introducing-poole.md deleted file mode 100644 index f2ece37..0000000 --- a/app/templates/app/_posts/2014-03-02-introducing-poole.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: post -date: 2014-03-02 -title: Introducing Poole -categories: jekyll poole ---- - -*The Strange Case of Dr. Jeykll and Mr. Hyde* tells the story of a lawyer -investigating the connection of two persons, Dr. Henry Jekyll and Mr. Edward -Hyde. Chief among the novel's supporting cast is a man by the name of Mr. Poole, -Dr. Jekyll's loyal butler. - - - -Poole is the butler for [Jekyll](http://jekyllrb.com), the static site -generator. It's designed and developed by [@mdo](https://twitter.com/mdo) to -provide a clear and concise foundational setup for any Jekyll site. It does so -by furnishing a full vanilla Jekyll install with example templates, pages, -posts, and styles. - -There are currently two themes built on Poole: - -* [Hyde](http://hyde.getpoole.com) -* [Lanyon](http://lanyon.getpoole.com) - -Learn more and contribute on [GitHub](https://github.com/poole). - -### What's included - -Poole is a streamlined Jekyll site designed and built as a foundation for -building more meaningful themes. Poole, and every theme built on it, includes -the following: - -* Complete Jekyll setup included (layouts, config, [404](/404), [RSS - feed](/atom.xml), posts, and [example page](/about)) -* Mobile friendly design and development -* Easily scalable text and component sizing with `rem` units in the CSS -* Support for a wide gamut of HTML elements -* Related posts (time-based, because Jekyll) below each post -* Syntax highlighting, courtesy Pygments (the Python-based code snippet - highlighter) - -Additional features are available in individual themes. - -### Browser support - -Poole and it's themes are by preference a forward-thinking project. In addition -to the latest versions of Chrome, Safari (mobile and desktop), and Firefox, it -is only compatible with Internet Explorer 9 and above. - -### Download - -Poole is developed on and hosted with GitHub. Head to the GitHub repository for downloads, bug -reports, and features requests. - -Thanks! diff --git a/app/templates/app/about.md b/app/templates/app/about.md index 9b2605b..0b8de1d 100644 --- a/app/templates/app/about.md +++ b/app/templates/app/about.md @@ -1,30 +1,15 @@ --- layout: page title: About +permalink: /about/ --- -

- Hey there! This page is included as an example. Feel free to customize it for your own use upon downloading. Carry on! -

+This is the base Jekyll theme. You can find out more info about customizing your +Jekyll theme, as well as basic Jekyll usage documentation at +[jekyllrb.com](http://jekyllrb.com/) -In the novel, *The Strange Case of Dr. Jeykll and Mr. Hyde*, Mr. Poole is Dr. Jekyll's virtuous and loyal butler. Similarly, Poole is an upstanding and effective butler that helps you build Jekyll themes. It's made by [@mdo](https://twitter.com/mdo). +You can find the source code for the Jekyll new theme at: +[github.com/jglovier/jekyll-new](https://github.com/jglovier/jekyll-new) -There are currently two themes built on Poole: - -* [Hyde](http://hyde.getpoole.com) -* [Lanyon](http://lanyon.getpoole.com) - -Learn more and contribute on [GitHub](https://github.com/poole). - -## Setup - -Some fun facts about the setup of this project include: - -* Built for [Jekyll](http://jekyllrb.com) -* Developed on GitHub and hosted for free on [GitHub Pages](https://pages.github.com) -* Coded with [Sublime Text 2](http://sublimetext.com), an amazing code editor -* Designed and developed while listening to music like [Blood Bros Trilogy](https://soundcloud.com/maddecent/sets/blood-bros-series) - -Have questions or suggestions? Feel free to [open an issue on GitHub](https://github.com/poole/issues/new) or [ask me on Twitter](https://twitter.com/mdo). - -Thanks for reading! +You can find the source code for Jekyll at +[github.com/jekyll/jekyll](https://github.com/jekyll/jekyll) diff --git a/app/templates/app/assets/scss/base.scss b/app/templates/app/assets/scss/base.scss new file mode 100644 index 0000000..e5fd0fd --- /dev/null +++ b/app/templates/app/assets/scss/base.scss @@ -0,0 +1,204 @@ +/** + * Reset some basic elements + */ +body, h1, h2, h3, h4, h5, h6, +p, blockquote, pre, hr, +dl, dd, ol, ul, figure { + margin: 0; + padding: 0; +} + + + +/** + * Basic styling + */ +body { + font-family: $base-font-family; + font-size: $base-font-size; + line-height: $base-line-height; + font-weight: 300; + color: $text-color; + background-color: $background-color; + -webkit-text-size-adjust: 100%; +} + + + +/** + * Set `margin-bottom` to maintain vertical rhythm + */ +h1, h2, h3, h4, h5, h6, +p, blockquote, pre, +ul, ol, dl, figure, +%vertical-rhythm { + margin-bottom: $spacing-unit / 2; +} + + + +/** + * Images + */ +img { + max-width: 100%; + vertical-align: middle; +} + + + +/** + * Figures + */ +figure > img { + display: block; +} + +figcaption { + font-size: $small-font-size; +} + + + +/** + * Lists + */ +ul, ol { + margin-left: $spacing-unit; +} + +li { + > ul, + > ol { + margin-bottom: 0; + } +} + + + +/** + * Headings + */ +h1, h2, h3, h4, h5, h6 { + font-weight: 300; +} + + + +/** + * Links + */ +a { + color: $brand-color; + text-decoration: none; + + &:visited { + color: darken($brand-color, 15%); + } + + &:hover { + color: $text-color; + text-decoration: underline; + } +} + + + +/** + * Blockquotes + */ +blockquote { + color: $grey-color; + border-left: 4px solid $grey-color-light; + padding-left: $spacing-unit / 2; + font-size: 18px; + letter-spacing: -1px; + font-style: italic; + + > :last-child { + margin-bottom: 0; + } +} + + + +/** + * Code formatting + */ +pre, +code { + font-size: 15px; + border: 1px solid $grey-color-light; + border-radius: 3px; + background-color: #eef; +} + +code { + padding: 1px 5px; +} + +pre { + padding: 8px 12px; + overflow-x: scroll; + + > code { + border: 0; + padding-right: 0; + padding-left: 0; + } +} + + + +/** + * Wrapper + */ +.wrapper { + max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2)); + max-width: calc(#{$content-width} - (#{$spacing-unit} * 2)); + margin-right: auto; + margin-left: auto; + padding-right: $spacing-unit; + padding-left: $spacing-unit; + @extend %clearfix; + + @include media-query($on-laptop) { + max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit})); + max-width: calc(#{$content-width} - (#{$spacing-unit})); + padding-right: $spacing-unit / 2; + padding-left: $spacing-unit / 2; + } +} + + + +/** + * Clearfix + */ +%clearfix { + + &:after { + content: ""; + display: table; + clear: both; + } +} + + + +/** + * Icons + */ +.icon { + + > svg { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: middle; + + path { + fill: $grey-color; + } + } +} diff --git a/app/templates/app/assets/scss/lanyon.scss b/app/templates/app/assets/scss/lanyon.scss deleted file mode 100644 index 5fcad21..0000000 --- a/app/templates/app/assets/scss/lanyon.scss +++ /dev/null @@ -1,542 +0,0 @@ -/* - * ___ - * /\_ \ - * \//\ \ __ ___ __ __ ___ ___ - * \ \ \ /'__`\ /' _ `\/\ \/\ \ / __`\ /' _ `\ - * \_\ \_/\ \_\.\_/\ \/\ \ \ \_\ \/\ \_\ \/\ \/\ \ - * /\____\ \__/.\_\ \_\ \_\/`____ \ \____/\ \_\ \_\ - * \/____/\/__/\/_/\/_/\/_/`/___/> \/___/ \/_/\/_/ - * /\___/ - * \/__/ - * - * Designed, built, and released under MIT license by @mdo. Learn more at - * https://github.com/poole/lanyon. - */ - -/* - * Contents - * - * Global resets - * Masthead - * Sidebar - * Slide effect - * Posts and pages - * Pagination - * Reverse layout - * Themes - */ - -/* - * Global resets - * - * Update the foundational and global aspects of the page. - */ - -/* Prevent scroll on narrow devices */ - -html, body { - overflow-x: hidden; -} - -html { - font-family: "PT Serif", Georgia, "Times New Roman", serif; -} - -h1, h2, h3, h4, h5, h6 { - font-family: "PT Sans", Helvetica, Arial, sans-serif; - font-weight: 400; - color: #313131; - letter-spacing: -.025rem; -} - -/* - * Wrapper - * - * The wrapper is used to position site content when the sidebar is toggled. We - * use an outter wrap to position the sidebar without interferring with the - * regular page content. - */ - -.wrap { - position: relative; - width: 100%; -} - -/* - * Container - * - * Center the page content. - */ - -.container { - max-width: 28rem; -} - -@media (min-width: 38rem) { - .container { - max-width: 32rem; - } -} - -@media (min-width: 56rem) { - .container { - max-width: 38rem; - } -} - -/* - * Masthead - * - * Super small header above the content for site name and short description. - */ - -.masthead { - padding-top: 1rem; - padding-bottom: 1rem; - margin-bottom: 3rem; - border-bottom: 1px solid #eee; -} - -.masthead-title { - margin-top: 0; - margin-bottom: 0; - color: #505050; - a { - color: #505050; - } - small { - font-size: 75%; - font-weight: 400; - color: #c0c0c0; - letter-spacing: 0; - } -} - -@media (max-width: 48rem) { - .masthead-title { - text-align: center; - small { - display: none; - } - } -} - -/* - * Sidebar - * - * The sidebar is the drawer, the item we are toggling with our handy hamburger - * button in the corner of the page. - * - * This particular sidebar implementation was inspired by Chris Coyier's - * "Offcanvas Menu with CSS Target" article, and the checkbox variation from the - * comments by a reader. It modifies both implementations to continue using the - * checkbox (no change in URL means no polluted browser history), but this uses - * `position` for the menu to avoid some potential content reflow issues. - * - * Source: http://css-tricks.com/off-canvas-menu-with-css-target/#comment-207504 - */ - -/* Style and "hide" the sidebar */ - -.sidebar { - position: fixed; - top: 0; - bottom: 0; - left: -14rem; - width: 14rem; - visibility: hidden; - overflow-y: auto; - font-family: "PT Sans", Helvetica, Arial, sans-serif; - font-size: .875rem; - /* 15px */ - color: rgba(255, 255, 255, 0.6); - background-color: #202020; - -webkit-transition: all .3s ease-in-out; - transition: all .3s ease-in-out; - a { - font-weight: normal; - color: #fff; - } -} - -@media (min-width: 30rem) { - .sidebar { - font-size: .75rem; - /* 14px */ - } -} - -/* Sidebar content */ - -.sidebar-item { - padding: 1rem; - p:last-child { - margin-bottom: 0; - } -} - -/* Sidebar nav */ - -.sidebar-nav { - border-bottom: 1px solid rgba(255, 255, 255, 0.1); -} - -.sidebar-nav-item { - display: block; - padding: .5rem 1rem; - border-top: 1px solid rgba(255, 255, 255, 0.1); - &.active { - text-decoration: none; - background-color: rgba(255, 255, 255, 0.1); - border-color: transparent; - } -} - -a.sidebar-nav-item { - &:hover, &:focus { - text-decoration: none; - background-color: rgba(255, 255, 255, 0.1); - border-color: transparent; - } -} - -@media (min-width: 48rem) { - .sidebar-item { - padding: 1.5rem; - } - .sidebar-nav-item { - padding-left: 1.5rem; - padding-right: 1.5rem; - } -} - -/* Hide the sidebar checkbox that we toggle with `.sidebar-toggle` */ - -.sidebar-checkbox { - display: none; -} - -/* Style the `label` that we use to target the `.sidebar-checkbox` */ - -.sidebar-toggle { - position: absolute; - top: 1rem; - left: 1rem; - display: block; - width: 2.2rem; - padding: .5rem .65rem; - color: #505050; - background-color: #fff; - border-radius: 4px; - cursor: pointer; - &:before { - display: block; - content: ""; - width: 100%; - padding-bottom: .125rem; - border-top: .375rem double; - border-bottom: .125rem solid; - /* Make the border inside the box */ - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - } - &:active { - color: #fff; - background-color: #505050; - } -} - -#sidebar-checkbox:checked ~ .sidebar-toggle { - color: #fff; - background-color: #505050; -} - -@media (min-width: 30.1rem) { - .sidebar-toggle { - position: fixed; - width: 2.25rem; - &:before { - padding-bottom: .15rem; - border-top-width: .45rem; - border-bottom-width: .15rem; - } - } -} - -/* Slide effect - * - * Handle the sliding effects of the sidebar and content in one spot, seperate - * from the default styles. - * - * As an a heads up, we don't use `transform: translate3d()` here because when - * mixed with `position: fixed;` for the sidebar toggle, it creates a new - * containing block. Put simply, the fixed sidebar toggle behaves like - * `position: absolute;` when transformed. - * - * Read more about it at http://meyerweb.com/eric/thoughts/2011/09/12/. - */ - -.wrap, .sidebar, .sidebar-toggle { - -webkit-backface-visibility: hidden; - -ms-backface-visibility: hidden; - backface-visibility: hidden; -} - -.wrap, .sidebar-toggle { - -webkit-transition: -webkit-transform .3s ease-in-out; - transition: transform .3s ease-in-out; -} - -#sidebar-checkbox:checked { - + .sidebar { - visibility: visible; - } - ~ { - .sidebar, .wrap, .sidebar-toggle { - -webkit-transform: translateX(14rem); - -ms-transform: translateX(14rem); - transform: translateX(14rem); - } - } -} - -/* - * Posts and pages - * - * Each post is wrapped in `.post` and is used on default and post layouts. Each - * page is wrapped in `.page` and is only used on the page layout. - */ - -.page, .post { - margin-bottom: 4em; -} - -/* Blog post or page title */ - -.page-title { - color: #303030; -} - -.post-title { - color: #303030; - a { - color: #303030; - } -} - -.page-title, .post-title { - margin-top: 0; -} - -/* Meta data line below post title */ - -.post-date { - display: block; - margin-top: -.5rem; - margin-bottom: 1rem; - color: #9a9a9a; -} - -/* Related posts */ - -.related { - padding-top: 2rem; - padding-bottom: 2rem; - border-top: 1px solid #eee; -} - -.related-posts { - padding-left: 0; - list-style: none; - h3 { - margin-top: 0; - } - li { - small { - font-size: 75%; - color: #999; - } - a:hover { - color: #268bd2; - text-decoration: none; - small { - color: inherit; - } - } - } -} - -/* - * Pagination - * - * Super lightweight (HTML-wise) blog pagination. `span`s are provide for when - * there are no more previous or next posts to show. - */ - -.pagination { - overflow: hidden; - /* clearfix */ - margin-left: -1rem; - margin-right: -1rem; - font-family: "PT Sans", Helvetica, Arial, sans-serif; - color: #ccc; - text-align: center; -} - -/* Pagination items can be `span`s or `a`s */ - -.pagination-item { - display: block; - padding: 1rem; - border: 1px solid #eee; - &:first-child { - margin-bottom: -1px; - } -} - -/* Only provide a hover state for linked pagination items */ - -a.pagination-item:hover { - background-color: #f5f5f5; -} - -@media (min-width: 30rem) { - .pagination { - margin: 3rem 0; - } - .pagination-item { - float: left; - width: 50%; - &:first-child { - margin-bottom: 0; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; - } - &:last-child { - margin-left: -1px; - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; - } - } -} - -/* - * Reverse layout - * - * Flip the orientation of the page by placing the `.sidebar` and sidebar toggle - * on the right side. - */ - -.layout-reverse { - .sidebar { - left: auto; - right: -14rem; - } - .sidebar-toggle { - left: auto; - right: 1rem; - } - #sidebar-checkbox:checked ~ { - .sidebar, .wrap, .sidebar-toggle { - -webkit-transform: translateX(-14rem); - -ms-transform: translateX(-14rem); - transform: translateX(-14rem); - } - } -} - -/* - * Themes - * - * Apply custom color schemes by adding the appropriate class to the `body`. - * Based on colors from Base16: http://chriskempson.github.io/base16/#default. - */ - -/* Red */ - -.theme-base-08 { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #ac4142; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #ac4142; - } -} - -/* Orange */ - -.theme-base-09 { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #d28445; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #d28445; - } -} - -/* Yellow */ - -.theme-base-0a { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #f4bf75; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #f4bf75; - } -} - -/* Green */ - -.theme-base-0b { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #90a959; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #90a959; - } -} - -/* Cyan */ - -.theme-base-0c { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #75b5aa; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #75b5aa; - } -} - -/* Blue */ - -.theme-base-0d { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #6a9fb5; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #6a9fb5; - } -} - -/* Magenta */ - -.theme-base-0e { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #aa759f; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #aa759f; - } -} - -/* Brown */ - -.theme-base-0f { - .sidebar, .sidebar-toggle:active, #sidebar-checkbox:checked ~ .sidebar-toggle { - background-color: #8f5536; - } - .container a, .sidebar-toggle, .related-posts li a:hover { - color: #8f5536; - } -} diff --git a/app/templates/app/assets/scss/layout.scss b/app/templates/app/assets/scss/layout.scss new file mode 100644 index 0000000..3f9ff42 --- /dev/null +++ b/app/templates/app/assets/scss/layout.scss @@ -0,0 +1,236 @@ +/** + * Site header + */ +.site-header { + border-top: 5px solid $grey-color-dark; + border-bottom: 1px solid $grey-color-light; + min-height: 56px; + + // Positioning context for the mobile navigation icon + position: relative; +} + +.site-title { + font-size: 26px; + line-height: 56px; + letter-spacing: -1px; + margin-bottom: 0; + float: left; + + &, + &:visited { + color: $grey-color-dark; + } +} + +.site-nav { + float: right; + line-height: 56px; + + .menu-icon { + display: none; + } + + .page-link { + color: $text-color; + line-height: $base-line-height; + + // Gaps between nav items, but not on the last one + &:not(:last-child) { + margin-right: 20px; + } + } + + @include media-query($on-palm) { + position: absolute; + top: 9px; + right: $spacing-unit / 2; + background-color: $background-color; + border: 1px solid $grey-color-light; + border-radius: 5px; + text-align: right; + + .menu-icon { + display: block; + float: right; + width: 36px; + height: 26px; + line-height: 0; + padding-top: 10px; + text-align: center; + + > svg { + width: 18px; + height: 15px; + + path { + fill: $grey-color-dark; + } + } + } + + .trigger { + clear: both; + display: none; + } + + &:hover .trigger { + display: block; + padding-bottom: 5px; + } + + .page-link { + display: block; + padding: 5px 10px; + } + } +} + + + +/** + * Site footer + */ +.site-footer { + border-top: 1px solid $grey-color-light; + padding: $spacing-unit 0; +} + +.footer-heading { + font-size: 18px; + margin-bottom: $spacing-unit / 2; +} + +.contact-list, +.social-media-list { + list-style: none; + margin-left: 0; +} + +.footer-col-wrapper { + font-size: 15px; + color: $grey-color; + margin-left: -$spacing-unit / 2; + @extend %clearfix; +} + +.footer-col { + float: left; + margin-bottom: $spacing-unit / 2; + padding-left: $spacing-unit / 2; +} + +.footer-col-1 { + width: -webkit-calc(35% - (#{$spacing-unit} / 2)); + width: calc(35% - (#{$spacing-unit} / 2)); +} + +.footer-col-2 { + width: -webkit-calc(20% - (#{$spacing-unit} / 2)); + width: calc(20% - (#{$spacing-unit} / 2)); +} + +.footer-col-3 { + width: -webkit-calc(45% - (#{$spacing-unit} / 2)); + width: calc(45% - (#{$spacing-unit} / 2)); +} + +@include media-query($on-laptop) { + .footer-col-1, + .footer-col-2 { + width: -webkit-calc(50% - (#{$spacing-unit} / 2)); + width: calc(50% - (#{$spacing-unit} / 2)); + } + + .footer-col-3 { + width: -webkit-calc(100% - (#{$spacing-unit} / 2)); + width: calc(100% - (#{$spacing-unit} / 2)); + } +} + +@include media-query($on-palm) { + .footer-col { + float: none; + width: -webkit-calc(100% - (#{$spacing-unit} / 2)); + width: calc(100% - (#{$spacing-unit} / 2)); + } +} + + + +/** + * Page content + */ +.page-content { + padding: $spacing-unit 0; +} + +.page-heading { + font-size: 20px; +} + +.post-list { + margin-left: 0; + list-style: none; + + > li { + margin-bottom: $spacing-unit; + } +} + +.post-meta { + font-size: $small-font-size; + color: $grey-color; +} + +.post-link { + display: block; + font-size: 24px; +} + + + +/** + * Posts + */ +.post-header { + margin-bottom: $spacing-unit; +} + +.post-title { + font-size: 42px; + letter-spacing: -1px; + line-height: 1; + + @include media-query($on-laptop) { + font-size: 36px; + } +} + +.post-content { + margin-bottom: $spacing-unit; + + h2 { + font-size: 32px; + + @include media-query($on-laptop) { + font-size: 28px; + } + } + + h3 { + font-size: 26px; + + @include media-query($on-laptop) { + font-size: 22px; + } + } + + h4 { + font-size: 20px; + + @include media-query($on-laptop) { + font-size: 18px; + } + } +} diff --git a/app/templates/app/assets/scss/main.scss b/app/templates/app/assets/scss/main.scss new file mode 100644 index 0000000..0e4f004 --- /dev/null +++ b/app/templates/app/assets/scss/main.scss @@ -0,0 +1,38 @@ +@charset "utf-8"; + +// Our variables + +$base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +$base-font-size: 16px; +$base-font-weight: 300; +$small-font-size: $base-font-size * 0.875; +$base-line-height: 1.5; + +$spacing-unit: 30px; + +$text-color: #111; +$background-color: #fdfdfd; +$brand-color: #2a7ae2; + +$grey-color: #828282; +$grey-color-light: lighten($grey-color, 40%); +$grey-color-dark: darken($grey-color, 25%); + +// Width of the content area +$content-width: 800px; + +$on-palm: 600px; +$on-laptop: 800px; + +// Using media queries with like this: +// @include media-query($on-palm) { +// .wrapper { +// padding-right: $spacing-unit / 2; +// padding-left: $spacing-unit / 2; +// } +// } +@mixin media-query($device) { + @media screen and (max-width: $device) { + @content; + } +} diff --git a/app/templates/app/assets/scss/poole.scss b/app/templates/app/assets/scss/poole.scss deleted file mode 100644 index 69e6dd1..0000000 --- a/app/templates/app/assets/scss/poole.scss +++ /dev/null @@ -1,425 +0,0 @@ -/* - * ___ - * /\_ \ - * _____ ___ ___\//\ \ __ - * /\ '__`\ / __`\ / __`\\ \ \ /'__`\ - * \ \ \_\ \/\ \_\ \/\ \_\ \\_\ \_/\ __/ - * \ \ ,__/\ \____/\ \____//\____\ \____\ - * \ \ \/ \/___/ \/___/ \/____/\/____/ - * \ \_\ - * \/_/ - * - * Designed, built, and released under MIT license by @mdo. Learn more at - * https://github.com/poole/poole. - */ - -/* - * Contents - * - * Body resets - * Custom type - * Messages - * Container - * Masthead - * Posts and pages - * Pagination - * Reverse layout - * Themes - */ - -/* - * Body resets - * - * Update the foundational and global aspects of the page. - */ - -* { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -html, body { - margin: 0; - padding: 0; -} - -html { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 1.5; -} - -@media (min-width: 38rem) { - html { - font-size: 20px; - } -} - -body { - color: #515151; - background-color: #fff; - -webkit-text-size-adjust: 100%; - -ms-text-size-adjust: 100%; -} - -/* No `:visited` state is required by default (browsers will use `a`) */ - -a { - color: #268bd2; - text-decoration: none; - &:hover, &:focus { - text-decoration: underline; - } -} - -/* `:focus` is linked to `:hover` for basic accessibility */ - -/* Headings */ - -h1, h2, h3, h4, h5, h6 { - margin-bottom: .5rem; - font-weight: bold; - line-height: 1.25; - color: #313131; - text-rendering: optimizeLegibility; -} - -h1 { - font-size: 2rem; -} - -h2 { - margin-top: 1rem; - font-size: 1.5rem; -} - -h3 { - margin-top: 1.5rem; - font-size: 1.25rem; -} - -h4, h5, h6 { - margin-top: 1rem; - font-size: 1rem; -} - -/* Body text */ - -p { - margin-top: 0; - margin-bottom: 1rem; -} - -strong { - color: #303030; -} - -/* Lists */ - -ul, ol, dl { - margin-top: 0; - margin-bottom: 1rem; -} - -dt { - font-weight: bold; -} - -dd { - margin-bottom: .5rem; -} - -/* Misc */ - -hr { - position: relative; - margin: 1.5rem 0; - border: 0; - border-top: 1px solid #eee; - border-bottom: 1px solid #fff; -} - -abbr { - font-size: 85%; - font-weight: bold; - color: #555; - text-transform: uppercase; - &[title] { - cursor: help; - border-bottom: 1px dotted #e5e5e5; - } -} - -/* Code */ - -code, pre { - font-family: Menlo, Monaco, "Courier New", monospace; -} - -code { - padding: .25em .5em; - font-size: 85%; - color: #bf616a; - background-color: #f9f9f9; - border-radius: 3px; -} - -pre { - display: block; - margin-top: 0; - margin-bottom: 1rem; - padding: 1rem; - font-size: .8rem; - line-height: 1.4; - white-space: pre; - white-space: pre-wrap; - word-break: break-all; - word-wrap: break-word; - background-color: #f9f9f9; - code { - padding: 0; - font-size: 100%; - color: inherit; - background-color: transparent; - } -} - -.highlight { - margin-bottom: 1rem; - border-radius: 4px; - pre { - margin-bottom: 0; - } -} - -/* Quotes */ - -blockquote { - padding: .5rem 1rem; - margin: .8rem 0; - color: #7a7a7a; - border-left: .25rem solid #e5e5e5; - p:last-child { - margin-bottom: 0; - } -} - -@media (min-width: 30rem) { - blockquote { - padding-right: 5rem; - padding-left: 1.25rem; - } -} - -img { - display: block; - margin: 0 0 1rem; - border-radius: 5px; -} - -/* Tables */ - -table { - margin-bottom: 1rem; - width: 100%; - border: 1px solid #e5e5e5; - border-collapse: collapse; -} - -td, th { - padding: .25rem .5rem; - border: 1px solid #e5e5e5; -} - -tbody tr:nth-child(odd) { - td, th { - background-color: #f9f9f9; - } -} - -/* - * Custom type - * - * Extend paragraphs with `.lead` for larger introductory text. - */ - -.lead { - font-size: 1.25rem; - font-weight: 300; -} - -/* - * Messages - * - * Show alert messages to users. You may add it to single elements like a `

`, - * or to a parent if there are multiple elements to show. - */ - -.message { - margin-bottom: 1rem; - padding: 1rem; - color: #717171; - background-color: #f9f9f9; -} - -/* - * Container - * - * Center the page content. - */ - -.container { - max-width: 38rem; - padding-left: 1rem; - padding-right: 1rem; - margin-left: auto; - margin-right: auto; -} - -/* - * Masthead - * - * Super small header above the content for site name and short description. - */ - -.masthead { - padding-top: 1rem; - padding-bottom: 1rem; - margin-bottom: 3rem; -} - -.masthead-title { - margin-top: 0; - margin-bottom: 0; - color: #505050; - a { - color: #505050; - } - small { - font-size: 75%; - font-weight: 400; - color: #c0c0c0; - letter-spacing: 0; - } -} - -/* - * Posts and pages - * - * Each post is wrapped in `.post` and is used on default and post layouts. Each - * page is wrapped in `.page` and is only used on the page layout. - */ - -.page, .post { - margin-bottom: 4em; -} - -/* Blog post or page title */ - -.page-title { - color: #303030; -} - -.post-title { - color: #303030; - a { - color: #303030; - } -} - -.page-title, .post-title { - margin-top: 0; -} - -/* Meta data line below post title */ - -.post-date { - display: block; - margin-top: -.5rem; - margin-bottom: 1rem; - color: #9a9a9a; -} - -/* Related posts */ - -.related { - padding-top: 2rem; - padding-bottom: 2rem; - border-top: 1px solid #eee; -} - -.related-posts { - padding-left: 0; - list-style: none; - h3 { - margin-top: 0; - } - li { - small { - font-size: 75%; - color: #999; - } - a:hover { - color: #268bd2; - text-decoration: none; - small { - color: inherit; - } - } - } -} - -/* - * Pagination - * - * Super lightweight (HTML-wise) blog pagination. `span`s are provide for when - * there are no more previous or next posts to show. - */ - -.pagination { - overflow: hidden; - /* clearfix */ - margin-left: -1rem; - margin-right: -1rem; - font-family: "PT Sans", Helvetica, Arial, sans-serif; - color: #ccc; - text-align: center; -} - -/* Pagination items can be `span`s or `a`s */ - -.pagination-item { - display: block; - padding: 1rem; - border: 1px solid #eee; - &:first-child { - margin-bottom: -1px; - } -} - -/* Only provide a hover state for linked pagination items */ - -a.pagination-item:hover { - background-color: #f5f5f5; -} - -@media (min-width: 30rem) { - .pagination { - margin: 3rem 0; - } - .pagination-item { - float: left; - width: 50%; - &:first-child { - margin-bottom: 0; - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; - } - &:last-child { - margin-left: -1px; - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; - } - } -} diff --git a/app/templates/app/assets/scss/style.scss b/app/templates/app/assets/scss/style.scss index c8acbdd..f265500 100644 --- a/app/templates/app/assets/scss/style.scss +++ b/app/templates/app/assets/scss/style.scss @@ -2,6 +2,7 @@ The main SCSS file for everything, yep */ -@import "poole"; -@import "syntax"; -@import "lanyon"; +@import "main"; +@import "base"; +@import "layout"; +@import "syntax-highlighting"; diff --git a/app/templates/app/assets/scss/syntax-highlighting.scss b/app/templates/app/assets/scss/syntax-highlighting.scss new file mode 100644 index 0000000..e36627d --- /dev/null +++ b/app/templates/app/assets/scss/syntax-highlighting.scss @@ -0,0 +1,67 @@ +/** + * Syntax highlighting styles + */ +.highlight { + background: #fff; + @extend %vertical-rhythm; + + .c { color: #998; font-style: italic } // Comment + .err { color: #a61717; background-color: #e3d2d2 } // Error + .k { font-weight: bold } // Keyword + .o { font-weight: bold } // Operator + .cm { color: #998; font-style: italic } // Comment.Multiline + .cp { color: #999; font-weight: bold } // Comment.Preproc + .c1 { color: #998; font-style: italic } // Comment.Single + .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special + .gd { color: #000; background-color: #fdd } // Generic.Deleted + .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific + .ge { font-style: italic } // Generic.Emph + .gr { color: #a00 } // Generic.Error + .gh { color: #999 } // Generic.Heading + .gi { color: #000; background-color: #dfd } // Generic.Inserted + .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific + .go { color: #888 } // Generic.Output + .gp { color: #555 } // Generic.Prompt + .gs { font-weight: bold } // Generic.Strong + .gu { color: #aaa } // Generic.Subheading + .gt { color: #a00 } // Generic.Traceback + .kc { font-weight: bold } // Keyword.Constant + .kd { font-weight: bold } // Keyword.Declaration + .kp { font-weight: bold } // Keyword.Pseudo + .kr { font-weight: bold } // Keyword.Reserved + .kt { color: #458; font-weight: bold } // Keyword.Type + .m { color: #099 } // Literal.Number + .s { color: #d14 } // Literal.String + .na { color: #008080 } // Name.Attribute + .nb { color: #0086B3 } // Name.Builtin + .nc { color: #458; font-weight: bold } // Name.Class + .no { color: #008080 } // Name.Constant + .ni { color: #800080 } // Name.Entity + .ne { color: #900; font-weight: bold } // Name.Exception + .nf { color: #900; font-weight: bold } // Name.Function + .nn { color: #555 } // Name.Namespace + .nt { color: #000080 } // Name.Tag + .nv { color: #008080 } // Name.Variable + .ow { font-weight: bold } // Operator.Word + .w { color: #bbb } // Text.Whitespace + .mf { color: #099 } // Literal.Number.Float + .mh { color: #099 } // Literal.Number.Hex + .mi { color: #099 } // Literal.Number.Integer + .mo { color: #099 } // Literal.Number.Oct + .sb { color: #d14 } // Literal.String.Backtick + .sc { color: #d14 } // Literal.String.Char + .sd { color: #d14 } // Literal.String.Doc + .s2 { color: #d14 } // Literal.String.Double + .se { color: #d14 } // Literal.String.Escape + .sh { color: #d14 } // Literal.String.Heredoc + .si { color: #d14 } // Literal.String.Interpol + .sx { color: #d14 } // Literal.String.Other + .sr { color: #009926 } // Literal.String.Regex + .s1 { color: #d14 } // Literal.String.Single + .ss { color: #990073 } // Literal.String.Symbol + .bp { color: #999 } // Name.Builtin.Pseudo + .vc { color: #008080 } // Name.Variable.Class + .vg { color: #008080 } // Name.Variable.Global + .vi { color: #008080 } // Name.Variable.Instance + .il { color: #099 } // Literal.Number.Integer.Long +} diff --git a/app/templates/app/assets/scss/syntax.scss b/app/templates/app/assets/scss/syntax.scss deleted file mode 100644 index 5aa1e8a..0000000 --- a/app/templates/app/assets/scss/syntax.scss +++ /dev/null @@ -1,66 +0,0 @@ -.hll { background-color: #ffffcc } - //{ background: #f0f3f3; } -.c { color: #999; } // Comment -.err { color: #AA0000; background-color: #FFAAAA } // Error -.k { color: #006699; } // Keyword -.o { color: #555555 } // Operator -.cm { color: #0099FF; font-style: italic } // Comment.Multiline -.cp { color: #009999 } // Comment.Preproc -.c1 { color: #999; } // Comment.Single -.cs { color: #999; } // Comment.Special -.gd { background-color: #FFCCCC; border: 1px solid #CC0000 } // Generic.Deleted -.ge { font-style: italic } // Generic.Emph -.gr { color: #FF0000 } // Generic.Error -.gh { color: #003300; } // Generic.Heading -.gi { background-color: #CCFFCC; border: 1px solid #00CC00 } // Generic.Inserted -.go { color: #AAAAAA } // Generic.Output -.gp { color: #000099; } // Generic.Prompt -.gs { } // Generic.Strong -.gu { color: #003300; } // Generic.Subheading -.gt { color: #99CC66 } // Generic.Traceback -.kc { color: #006699; } // Keyword.Constant -.kd { color: #006699; } // Keyword.Declaration -.kn { color: #006699; } // Keyword.Namespace -.kp { color: #006699 } // Keyword.Pseudo -.kr { color: #006699; } // Keyword.Reserved -.kt { color: #007788; } // Keyword.Type -.m { color: #FF6600 } // Literal.Number -.s { color: #d44950 } // Literal.String -.na { color: #4f9fcf } // Name.Attribute -.nb { color: #336666 } // Name.Builtin -.nc { color: #00AA88; } // Name.Class -.no { color: #336600 } // Name.Constant -.nd { color: #9999FF } // Name.Decorator -.ni { color: #999999; } // Name.Entity -.ne { color: #CC0000; } // Name.Exception -.nf { color: #CC00FF } // Name.Function -.nl { color: #9999FF } // Name.Label -.nn { color: #00CCFF; } // Name.Namespace -.nt { color: #2f6f9f; } // Name.Tag -.nv { color: #003333 } // Name.Variable -.ow { color: #000000; } // Operator.Word -.w { color: #bbbbbb } // Text.Whitespace -.mf { color: #FF6600 } // Literal.Number.Float -.mh { color: #FF6600 } // Literal.Number.Hex -.mi { color: #FF6600 } // Literal.Number.Integer -.mo { color: #FF6600 } // Literal.Number.Oct -.sb { color: #CC3300 } // Literal.String.Backtick -.sc { color: #CC3300 } // Literal.String.Char -.sd { color: #CC3300; font-style: italic } // Literal.String.Doc -.s2 { color: #CC3300 } // Literal.String.Double -.se { color: #CC3300; } // Literal.String.Escape -.sh { color: #CC3300 } // Literal.String.Heredoc -.si { color: #AA0000 } // Literal.String.Interpol -.sx { color: #CC3300 } // Literal.String.Other -.sr { color: #33AAAA } // Literal.String.Regex -.s1 { color: #CC3300 } // Literal.String.Single -.ss { color: #FFCC33 } // Literal.String.Symbol -.bp { color: #336666 } // Name.Builtin.Pseudo -.vc { color: #003333 } // Name.Variable.Class -.vg { color: #003333 } // Name.Variable.Global -.vi { color: #003333 } // Name.Variable.Instance -.il { color: #FF6600 } // Literal.Number.Integer.Long - -.css .o, -.css .o + .nt, -.css .nt + .nt { color: #999; } diff --git a/app/templates/app/index.html b/app/templates/app/index.html index bc173f9..8f44053 100644 --- a/app/templates/app/index.html +++ b/app/templates/app/index.html @@ -1,39 +1,21 @@ --- layout: default -title: Home +regenerate: true --- +

+

Posts

-
- {% for post in paginator.posts %} -
-

- - {{ post.title }} - -

+
    + {% for post in site.posts %} +
  • + - +

    + {{ post.title }} +

    +
  • + {% endfor %} +
- {{ post.excerpt }} - - Read more » -
- {% endfor %} -
- - From f69533d3f2520795b5aa5d8c6f4d4e524ef90682 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 10 Feb 2015 19:22:28 +0100 Subject: [PATCH 007/178] Moved to jekyll-sitemaps and tweaks to the theme Removed the sitemap.xml file and moved to the jekyll-sitemap gem, added the gems to the Gemfile and _config.yml file and tweaked the theme. --- CHANGELOG.md | 2 + app/templates/Gemfile | 5 +- app/templates/_config.yml | 5 +- .../app/_drafts/2014-03-01-example-content.md | 81 ++++++++++++------- app/templates/app/_includes/head.html | 2 +- app/templates/app/_includes/header.html | 2 +- app/templates/app/atom.xml | 2 + app/templates/app/index.html | 2 +- app/templates/app/sitemap.xml | 56 ------------- 9 files changed, 67 insertions(+), 90 deletions(-) delete mode 100644 app/templates/app/sitemap.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index baa2747..7abb7ba 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ as it was. some minor tweaks to suit this project better. * **Archives:** Added yearly and monthly archives and archives for tags and categories. +* **Sitemap:** Removed the `sitemap.xml` file and now use the `jekyll-sitemap` + gem instead. * **Jekyll directory:** Everything is now output to a `dist` folder instead of a `site` folder to be more in line with most other tools. * **Asset directories:** Moved most of the assets to live in a .tmp while working on diff --git a/app/templates/Gemfile b/app/templates/Gemfile index 0cba631..91437eb 100755 --- a/app/templates/Gemfile +++ b/app/templates/Gemfile @@ -2,4 +2,7 @@ source "http://rubygems.org" gem 'jekyll' gem 'redcarpet' -gem 'jekyll-archives' + +# jekyll plugins +gem 'jekyll-archives', :git => 'https://github.com/jekyll/jekyll-archives' +gem 'jekyll-sitemap' diff --git a/app/templates/_config.yml b/app/templates/_config.yml index 3f0d6e4..bc4e4ff 100755 --- a/app/templates/_config.yml +++ b/app/templates/_config.yml @@ -40,6 +40,7 @@ excerpt_separator: '' # Extras for Jekyll gems: - jekyll-archives + - jekyll-sitemap # Markdown library markdown: redcarpet @@ -62,7 +63,7 @@ jekyll-archives: category: 'category-archive' tag: 'tag-archive' permalinks: - year: '/:year/' - month: '/:year/:month/' + year: '/archive/:year/' + month: '/archive/:year/:month/' category: '/category/:name/' tags: '/tag/:name/' diff --git a/app/templates/app/_drafts/2014-03-01-example-content.md b/app/templates/app/_drafts/2014-03-01-example-content.md index e6e5462..fb41e06 100644 --- a/app/templates/app/_drafts/2014-03-01-example-content.md +++ b/app/templates/app/_drafts/2014-03-01-example-content.md @@ -5,74 +5,99 @@ title: Example content categories: jekyll example --- +
Howdy! This is an example blog post that shows several +types of HTML content supported in this theme.
-
- Howdy! This is an example blog post that shows several types of HTML content supported in this theme. -
+Cum sociis natoque penatibus et magnis dis parturient montes, +nascetur ridiculus mus. *Aenean eu leo quam.* Pellentesque ornare sem lacinia +quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis +consectetur purus sit amet fermentum. -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. *Aenean eu leo quam.* Pellentesque ornare sem lacinia quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum. +> Curabitur blandit tempus porttitor. Nullam quis risus eget urna mollis ornare +> vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit. -> Curabitur blandit tempus porttitor. Nullam quis risus eget urna mollis ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit. +Etiam porta **sem malesuada magna** mollis euismod. Cras mattis consectetur +purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur. -Etiam porta **sem malesuada magna** mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur. + ## Inline HTML elements -HTML defines a long list of available inline tags, a complete list of which can be found on the [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/HTML/Element). +HTML defines a long list of available inline tags, a complete list of which can +be found on the [Mozilla Developer +Network](https://developer.mozilla.org/en-US/docs/Web/HTML/Element). - **To bold text**, use ``. - *To italicize text*, use ``. -- Abbreviations, like HTML should use ``, with an optional `title` attribute for the full phrase. +- Abbreviations, like HTML should + use ``, with an optional `title` attribute for the full phrase. - Citations, like — Mark otto, should use ``. -- Deleted text should use `` and inserted text should use ``. -- Superscript text uses `` and subscript text uses ``. +- Deleted text should use `` and inserted text should + use ``. +- Superscript text uses `` and subscript text uses + ``. Most of these elements are styled by browsers with few modifications on our part. ## Heading -Vivamus sagittis lacus vel augue rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. +Vivamus sagittis lacus vel augue rutrum faucibus dolor auctor. Duis mollis, est +non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. +Morbi leo risus, porta ac consectetur ac, vestibulum at eros. ### Code -Cum sociis natoque penatibus et magnis dis `code element` montes, nascetur ridiculus mus. +Cum sociis natoque penatibus et magnis dis `code element` montes, nascetur +ridiculus mus. {% highlight js %} // Example can be run directly in your JavaScript console -// Create a function that takes two arguments and returns the sum of those arguments -var adder = new Function("a", "b", "return a + b"); +// Create a function that takes two arguments and returns the sum of those +arguments var adder = new Function("a", "b", "return a + b"); // Call the function adder(2, 6); // > 8 {% endhighlight %} -Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa. +Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna +mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris +condimentum nibh, ut fermentum massa. ### Gists via GitHub Pages -Vestibulum id ligula porta felis euismod semper. Nullam quis risus eget urna mollis ornare vel eu leo. Donec sed odio dui. +Vestibulum id ligula porta felis euismod semper. Nullam quis risus eget urna +mollis ornare vel eu leo. Donec sed odio dui. {% gist 5555251 gist.md %} -Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec sed odio dui. Vestibulum id ligula porta felis euismod semper. +Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. +Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque +penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec sed +odio dui. Vestibulum id ligula porta felis euismod semper. ### Lists -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. +Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada +magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris +condimentum nibh, ut fermentum massa justo sit amet risus. * Praesent commodo cursus magna, vel scelerisque nisl consectetur et. * Donec id elit non mi porta gravida at eget metus. * Nulla vitae elit libero, a pharetra augue. -Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue. +Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a +pharetra augue. 1. Vestibulum id ligula porta felis euismod semper. -2. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. +2. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur + ridiculus mus. 3. Maecenas sed diam eget risus varius blandit sit amet non magna. -Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis. +Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at +lobortis.
HyperText Markup Language (HTML)
@@ -85,11 +110,14 @@ Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at
The programming language used to build advanced Web sites and applications
-Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna mollis ornare vel eu leo. +Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Morbi leo +risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna +mollis ornare vel eu leo. ### Tables -Aenean lacinia bibendum nulla sed consectetur. Lorem ipsum dolor sit amet, consectetur adipiscing elit. +Aenean lacinia bibendum nulla sed consectetur. Lorem ipsum dolor sit amet, +consectetur adipiscing elit. @@ -125,8 +153,5 @@ Aenean lacinia bibendum nulla sed consectetur. Lorem ipsum dolor sit amet, conse
-Nullam id dolor id nibh ultricies vehicula ut id elit. Sed posuere consectetur est at lobortis. Nullam quis risus eget urna mollis ornare vel eu leo. - ------ - -Want to see something else added? Open an issue. +Nullam id dolor id nibh ultricies vehicula ut id elit. Sed posuere consectetur +est at lobortis. Nullam quis risus eget urna mollis ornare vel eu leo. diff --git a/app/templates/app/_includes/head.html b/app/templates/app/_includes/head.html index 6cf97ca..e51f1a0 100644 --- a/app/templates/app/_includes/head.html +++ b/app/templates/app/_includes/head.html @@ -17,5 +17,5 @@ - + diff --git a/app/templates/app/_includes/header.html b/app/templates/app/_includes/header.html index e2395a1..cedae2c 100644 --- a/app/templates/app/_includes/header.html +++ b/app/templates/app/_includes/header.html @@ -2,7 +2,7 @@ diff --git a/app/templates/app/sitemap.xml b/app/templates/app/sitemap.xml deleted file mode 100644 index 72f9372..0000000 --- a/app/templates/app/sitemap.xml +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: null ---- - - - - {{ site.url }}/ - {{ site.time | date_to_xmlschema }} - weekly - 1.0 - - {% for post in site.posts %} - - {{ site.url }}{{ post.url }} - {% if post.sitemap.lastmod %} - {{ post.sitemap.lastmod | date: "%Y-%m-%d" }} - {% elsif post.date %} - {{ post.date | date_to_xmlschema }} - {% else %} - {{ site.time | date_to_xmlschema }} - {% endif %} - {% if post.sitemap.changefreq %} - {{ post.sitemap.changefreq }} - {% else %} - monthly - {% endif %} - {% if post.sitemap.priority %} - {{ post.sitemap.priority }} - {% else %} - 0.5 - {% endif %} - - {% endfor %} - {% for page in site.pages %} - - {{ site.url }}{{ page.url }} - {% if page.sitemap.lastmod %} - {{ page.sitemap.lastmod | date: "%Y-%m-%d" }} - {% elsif page.date %} - {{ page.date | date_to_xmlschema }} - {% else %} - {{ site.time | date_to_xmlschema }} - {% endif %} - {% if page.sitemap.changefreq %} - {{ page.sitemap.changefreq }} - {% else %} - monthly - {% endif %} - {% if page.sitemap.priority %} - {{ page.sitemap.priority }} - {% else %} - 0.3 - {% endif %} - - {% endfor %} - From 953a8be7bdd5bbb2b453deab40a3bfc8a82e7dca Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 10 Feb 2015 19:31:55 +0100 Subject: [PATCH 008/178] Removed the welcome message, updated gulp-istanbul --- app/index.js | 22 +++------------------- package.json | 5 +++-- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/app/index.js b/app/index.js index 1465a35..7128f82 100644 --- a/app/index.js +++ b/app/index.js @@ -2,6 +2,7 @@ var path = require("path"); var chalk = require("chalk"); var yeoman = require("yeoman-generator"); +var yosay = require("yosay"); var shelljs = require("shelljs"); module.exports = yeoman.generators.Base.extend({ @@ -35,25 +36,8 @@ module.exports = yeoman.generators.Base.extend({ projectPrompting: function () { var cb = this.async(); - this.log(this.yeoman); - this.log("\n" + - chalk.blue(" ____ ___ ___ ___") + chalk.yellow(" ___\n") + - chalk.blue(" `MM `MM `MM `MM") + chalk.yellow(" 68b `MM\n") + - chalk.blue(" MM MM MM MM") + chalk.yellow(" Y89 MM\n") + - chalk.blue(" MM ____ MM __ ____ ___ MM MM") + chalk.yellow(" ___ _________ ____ ____MM\n") + - chalk.blue(" MM 6MMMMb MM d` `MM( )M` MM MM") + chalk.yellow(" `MM MMMMMMMMP 6MMMMb 6MMMMMM\n") + - chalk.blue(" MM 6M` `Mb MM d` `Mb d` MM MM") + chalk.yellow(" MM / dMP 6M` `Mb 6M` `MM\n") + - chalk.blue(" MM MM MM MM d` YM. ,P MM MM") + chalk.yellow(" MM dMP MM MM MM MM\n") + - chalk.blue(" MM MMMMMMMM MMdM. MM M MM MM") + chalk.yellow(" MM dMP MMMMMMMM MM MM\n") + - chalk.blue("(8) MM MM MMPYM. `Mbd` MM MM") + chalk.yellow(" MM dMP MM MM MM\n") + - chalk.blue("(( ,M9 YM d9 MM YM. YMP MM MM") + chalk.yellow(" MM dMP /YM d9 YM. ,MM\n") + - chalk.blue(" YMMMM9 YMMMM9 _MM_ YM._ M _MM__MM") + chalk.yellow("__MM_dMMMMMMMM YMMMM9 YMMMMMM_\n") + - chalk.blue(" d` ") + chalk.yellow("\n") + - chalk.blue(" (8),P ") + chalk.yellow("\n") + - chalk.blue(" YMM ") + chalk.yellow("\n") - ); - - this.log(chalk.magenta("\nIt\"s time to get Jekyllized!")); + this.log(yosay("Time to supercharge your Jekyll development, time to get Jekyllized!")); + this.log(chalk.yellow("\nTell me a little about your project >>")); var prompts = [{ diff --git a/package.json b/package.json index 3445dbe..e2aaa88 100644 --- a/package.json +++ b/package.json @@ -33,14 +33,15 @@ "chalk": "^0.5.1", "globule": "~0.2.0", "shelljs": "~0.3.0", - "yeoman-generator": "^0.18.6" + "yeoman-generator": "^0.18.6", + "yosay": "^1.0.2" }, "devDependencies": { "codeclimate-test-reporter": "0.0.4", "coveralls": "^2.11.2", "gulp": "^3.8.10", "gulp-coveralls": "^0.1.3", - "gulp-istanbul": "^0.5.0", + "gulp-istanbul": "^0.6.0", "gulp-jscs": "^1.4.0", "gulp-jshint": "^1.9.0", "gulp-load-plugins": "^0.8.0", From a98227710bcba56a0f279c4af9b86d85fe9730a7 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 10 Feb 2015 23:36:10 +0100 Subject: [PATCH 009/178] Moved from Atom to RSS2.0 feed Mostly this change is so the URL can be pretty, now it'll display at http://yoursite.com/feed and will work when minifying the site compared to when it was at /feed/. --- app/templates/app/_includes/head.html | 2 +- app/templates/app/atom.xml | 40 --------------------------- app/templates/app/feed.xml | 33 ++++++++++++++++++++++ app/templates/app/index.html | 2 +- 4 files changed, 35 insertions(+), 42 deletions(-) delete mode 100644 app/templates/app/atom.xml create mode 100644 app/templates/app/feed.xml diff --git a/app/templates/app/_includes/head.html b/app/templates/app/_includes/head.html index e51f1a0..506b7d0 100644 --- a/app/templates/app/_includes/head.html +++ b/app/templates/app/_includes/head.html @@ -17,5 +17,5 @@ - + diff --git a/app/templates/app/atom.xml b/app/templates/app/atom.xml deleted file mode 100644 index 10ef81f..0000000 --- a/app/templates/app/atom.xml +++ /dev/null @@ -1,40 +0,0 @@ ---- -layout: null -regenerate: true -permalink: /feed/ ---- - - - - - {{ site.title }} - {{ site.tagline }} - - - {{ site.time | date_to_xmlschema }} - {{ site.url }}/ - - {{ site.author.name }} - {{ site.author.email }} - - - {% for post in site.posts limit:10 %} - - {{ post.title | xml_escape }} - - {{ post.date | date_to_xmlschema }} - {{ post.date | date_to_xmlschema }} - {{ site.url }}{{ post.id }} - - {% if post.excerpt %}{{ post.excerpt | xml_escape }}{% endif %} - - {{ post.content | xml_escape }} - - - {{ site.author.name }} - {{ site.author.email }} - - - {% endfor %} - - diff --git a/app/templates/app/feed.xml b/app/templates/app/feed.xml new file mode 100644 index 0000000..0a8d4d9 --- /dev/null +++ b/app/templates/app/feed.xml @@ -0,0 +1,33 @@ +--- +layout: null +regenerate: true +permalink: /feed +--- + + + + <![CDATA[{{ site.title }}]]> + + {{ site.url }} + Jekyll + {{ site.time | date_to_rfc822 }} + + {% for post in site.posts limit:10 %} + + <![CDATA[{{ post.title }}]]> + {% if post.excerpt %} + + {% else %} + + {% endif %} + + {{ post.date | date_to_rfc822 }} + {{ site.url }}{{ post.url }} + {{ site.url }}{{ post.url }} + + {% endfor %} + + diff --git a/app/templates/app/index.html b/app/templates/app/index.html index 25ebe7b..8f1f40a 100644 --- a/app/templates/app/index.html +++ b/app/templates/app/index.html @@ -17,5 +17,5 @@

{% endfor %} -

subscribe via RSS

+

subscribe via RSS

From d0de17a18c20e7b1ada3033dde7a7cea20f01e75 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 13 Feb 2015 14:39:11 +0100 Subject: [PATCH 010/178] Moved path settings to a JSON file, updated tests --- app/index.js | 1 + app/templates/gulp.config.json | 36 +++++++++++++++++++ app/templates/gulpfile.js | 64 ++++++++++++++++++---------------- test/test-gulp.js | 1 + test/test-jekyll.js | 5 ++- 5 files changed, 73 insertions(+), 34 deletions(-) create mode 100644 app/templates/gulp.config.json diff --git a/app/index.js b/app/index.js index 7128f82..299872f 100644 --- a/app/index.js +++ b/app/index.js @@ -239,6 +239,7 @@ module.exports = yeoman.generators.Base.extend({ this.template("_config.build.yml", "_config.build.yml"); this.template("_README.md", "README.md"); this.template("gulpfile.js", "gulpfile.js"); + this.copy("gulp.config.json", "gulp.config.json"); this.copy("gitignore", ".gitignore"); this.copy("gitattributes", ".gitattributes"); this.copy("jshintrc", ".jshintrc"); diff --git a/app/templates/gulp.config.json b/app/templates/gulp.config.json new file mode 100644 index 0000000..1736ee5 --- /dev/null +++ b/app/templates/gulp.config.json @@ -0,0 +1,36 @@ +{ + "site": { + "src": "src", + "dest": "dist" + }, + "scss": { + "src": "src/assets/scss/style.scss", + "dest": ".tmp/assets/stylesheets/" + }, + "javascript": { + "src": "src/assets/javascript/*.js", + "dest": ".tmp/assets/javascript/" + }, + "images": { + "src": "src/assets/images/**/*", + "dest": ".tmp/assets/images/", + "build": "dist/assets/images/" + }, + "fonts": { + "src": "src/assets/fonts/**", + "dest": ".tmp/assets/fonts/", + "build": "dist/assets/fonts" + }, + "assets": { + "searchPath": ["dist", ".tmp"], + "html": "dist/**/*.html", + "dest": "dist" + }, + "watch": { + "baseDir": ["dist", ".tmp"], + "content": ["src/**/*.md", "src/**/*.html", "src/**/*.xml", "src/**/*.txt", "src/**/*.yml"], + "javascript": "src/assets/javascript/**/*.js", + "scss": "src/assets/scss/**/*.scss", + "images": "src/assets/images/**/*" + } +} diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index c7983a7..6b9de8f 100755 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -2,9 +2,11 @@ "use strict"; var gulp = require("gulp"); +// Load in paths from a external config file for easier changing of paths +var config = require("./gulp.config.json"); // Loads the plugins without having to list all of them, but you need // to call them as $.pluginname -var $ = require("gulp-load-plugins")(); +var $ = require("gulp-load-plugins")({ lasy: true }); // "trash" is used to clean out directories and such var trash = require("trash"); // Used to run shell commands @@ -20,7 +22,8 @@ var reload = browserSync.reload; var merge = require("merge-stream"); // Deletes the directory that the optimized site is output to -function clean(done) { trash(["dist"]); done(); } +function cleanDist(done) { trash(["dist"]); done(); } +function cleanAssets(done) { trash([".tmp"]); done(); } function rebuild(done) { trash(["src/.jekyll-metadata"]); done(); } // Runs the build command for Jekyll to compile the site locally @@ -35,7 +38,7 @@ function jekyllProd(done) { shell.exec("jekyll build --quiet --config _config.ym // Compiles the SASS files and moves them into the "assets/stylesheets" directory function styles() { // Looks at the style.scss file for what to include and creates a style.css file - return gulp.src("src/assets/scss/style.scss") + return gulp.src(config.scss.src) // Start creation of sourcemaps .pipe($.sourcemaps.init()) .pipe($.sass({errLogToconsole: true})) @@ -44,8 +47,7 @@ function styles() { // Write the sourcemaps to the directory of the gulp.src stream .pipe($.sourcemaps.write(".")) // Directory your CSS file goes to - .pipe(gulp.dest("src/assets/stylesheets/")) - .pipe(gulp.dest(".tmp/assets/stylesheets/")) + .pipe(gulp.dest(config.scss.dest)) // Outputs the size of the CSS file .pipe($.size({title: "styles"})) // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS @@ -54,21 +56,21 @@ function styles() { // Mostly used to create sourcemaps and live-reload JS function javascript() { - return gulp.src("src/assets/javascript/*.js") + return gulp.src(config.javascript.src) .pipe($.sourcemaps.init()) .pipe($.uglify({compress: false, preserveComments: "all"})) .pipe($.groupConcat({ - "index.js": "src/assets/javascript/*.js" + "index.js": config.javascript.src })) .pipe($.sourcemaps.write(".")) - .pipe(gulp.dest(".tmp/assets/javascript/")) + .pipe(gulp.dest(config.javascript.dest)) .pipe($.size({title: "javascript"})) .pipe(reload({stream: true})); } // Optimizes the images that exists function images() { - return gulp.src("src/assets/images/**/*") + return gulp.src(config.images.src) // Does not run on images that are already optimized .pipe($.cache($.imagemin({ // Lossless conversion to progressive JPGs @@ -76,25 +78,25 @@ function images() { // Interlace GIFs for progressive rendering interlaced: true }))) - .pipe(gulp.dest(".tmp/assets/images")) + .pipe(gulp.dest(config.images.dest)) .pipe($.size({title: "images"})); } // Copy over fonts to the ".tmp" directory function fonts() { - return gulp.src("src/assets/fonts/**") - .pipe(gulp.dest(".tmp/assets/fonts")) + return gulp.src(config.fonts.src) + .pipe(gulp.dest(config.fonts.dest)) .pipe($.size({ title: "fonts" })); } // Copy optimized images and (not optimized) fonts to the "dist" folder function copy() { - var images = gulp.src(".tmp/assets/images/**/*") - .pipe(gulp.dest("dist/assets/images")) + var images = gulp.src(config.images.dest) + .pipe(gulp.dest(config.images.build)) .pipe($.size({title: "copied images"})); - var fonts = gulp.src(".tmp/assets/fonts/**/*") - .pipe(gulp.dest("dist/assets/fonts")) + var fonts = gulp.src(config.fonts.dest) + .pipe(gulp.dest(config.fonts.build)) .pipe($.size({title: "copied fonts"})); return merge(images, fonts); @@ -102,9 +104,9 @@ function copy() { // Optimizes all the CSS, HTML and concats the JS etc function optimize() { - var assets = $.useref.assets({searchPath: ["dist", ".tmp"]}); + var assets = $.useref.assets({searchPath: config.assets.searchPath}); - return gulp.src("dist/**/*.html") + return gulp.src(config.assets.html) .pipe(assets) // Concatenate JavaScript files and preserve important comments .pipe($.if("*.js", $.uglify({preserveComments: "some"}))) @@ -128,7 +130,7 @@ function optimize() { removeRedundantAttributes: true }))) // Send the output to the correct folder - .pipe(gulp.dest("dist")) + .pipe(gulp.dest(config.assets.dest)) .pipe($.size({title: "optimizations"})); } @@ -225,7 +227,7 @@ function deploy() { // Run JS Lint against your JS function jslint() { - gulp.src(".tmp/assets/javascript/*.js") + gulp.src(config.javascript.dest) // Checks your JS code quality against your .jshintrc file .pipe($.jshint(".jshintrc")) .pipe($.jshint.reporter()); @@ -241,17 +243,17 @@ function doctor(done) { shell.exec("jekyll doctor"); done(); } function serve() { browserSync({ notify: true, - // tunnel: "", + // tunnel: true, server: { - baseDir: ["dist", ".tmp"] + baseDir: config.watch.baseDir } }); // Watch various files for changes and do the needful - gulp.watch(["src/**/*.md", "src/**/*.html", "src/**/*.xml", "src/**/*.txt", "src/**/*.yml"], [jekyllDev, reload]); - gulp.watch(["src/assets/javascript/**/*.js"], javascript); - gulp.watch(["src/assets/scss/**/*.scss"], styles); - gulp.watch(["src/assets/images/**/*"], reload); + gulp.watch(config.watch.content, [jekyllDev, reload]); + gulp.watch(config.watch.javascript, javascript); + gulp.watch(config.watch.scss, styles); + gulp.watch(config.watch.images, reload); } // Default task, run when just writing "gulp" in the terminal @@ -264,8 +266,7 @@ gulp.task("default", gulp.series( // Builds your site with the "build" command and then runs all the optimizations on // it and outputs it to "./dist" gulp.task("optimize", gulp.series( - gulp.series(rebuild), - gulp.series(jekyllProd), + gulp.series(rebuild, jekyllProd), gulp.parallel(styles, javascript, fonts, images, copy), gulp.series(optimize) )); @@ -281,9 +282,10 @@ gulp.task("deploy", deploy);<% } %> // Serves your site locally gulp.task("serve", serve); -// Clean out your dist folder -gulp.task("clean", clean); -gulp.task("rebuild", gulp.series("clean", rebuild)); +// Clean out your dist and .tmp folder and delete .jekyll-metadata +gulp.task("clean", cleanDist); +gulp.task("clean:assets", cleanAssets); +gulp.task("rebuild", gulp.series(cleanDist, cleanAssets, rebuild)); // Create your styles and create sourcemaps gulp.task("styles", styles); diff --git a/test/test-gulp.js b/test/test-gulp.js index 7fa53e2..970f50f 100644 --- a/test/test-gulp.js +++ b/test/test-gulp.js @@ -30,6 +30,7 @@ describe("Jekyllized generator test for Gulp tasks without any uploading", funct var expected = [ "bower.json", "package.json", + "gulp.config.json", "gulpfile.js", "src/index.html", "src/robots.txt", diff --git a/test/test-jekyll.js b/test/test-jekyll.js index 6041234..9199c5f 100644 --- a/test/test-jekyll.js +++ b/test/test-jekyll.js @@ -31,12 +31,11 @@ describe("Jekyllized generator", function () { var expected = [ "src/404.html", "src/about.md", - "src/atom.xml", + "src/feed.xml", "src/crossdomain.xml", "src/humans.txt", "src/index.html", - "src/robots.txt", - "src/sitemap.xml" + "src/robots.txt" ]; assert.file(expected); From dff2a895e4c00e163ad5bdc2d44c41896c248fdb Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 Mar 2015 19:54:22 +0100 Subject: [PATCH 011/178] Updated tests, packages and Travis settings Moved to JSCS for checking the JS style to be more consistent and find dumb errors before they are committed. Means that there a bunch of aesthetic changes to them. Also updated the tests to check for the functions that were added as we migrate to Gulp 4. Updated the packages and moved them from peerDeps to devDeps as NPM will apparently stop using peerDeps in NPM 3.0. Updated JShint settings and tests: We're now testing for both node 0.10, 0.12 and iojs as well. However we moved from the default Travis NPM version to the latest NPM version and fixed some minor errors with Travis and how tests are run. --- .jscsrc | 3 + .jshintrc | 33 ++--- .travis.yml | 6 +- README.md | 8 +- app/index.js | 272 ++++++++++++++++++---------------- app/templates/gulpfile.js | 177 +++++++++++----------- gulpfile.js | 70 +++++---- package.json | 25 ++-- test/test-creation-aws.js | 81 +++++----- test/test-creation-ghpages.js | 63 ++++---- test/test-creation-rsync.js | 69 +++++---- test/test-gulp.js | 123 +++++++++------ test/test-jekyll.js | 183 ++++++++++++----------- test/test-load.js | 11 +- test/test-package.js | 51 ++++--- 15 files changed, 610 insertions(+), 565 deletions(-) create mode 100644 .jscsrc diff --git a/.jscsrc b/.jscsrc new file mode 100644 index 0000000..4b5fa83 --- /dev/null +++ b/.jscsrc @@ -0,0 +1,3 @@ +{ + "preset": "google" +} diff --git a/.jshintrc b/.jshintrc index 84da426..3ef3f74 100644 --- a/.jshintrc +++ b/.jshintrc @@ -1,21 +1,16 @@ { - "node": true, - "esnext": true, - "bitwise": false, - "camelcase": true, - "curly": false, - "eqeqeq": true, - "immed": true, - "indent": 2, - "latedef": false, - "newcap": true, - "noarg": true, - "quotmark": "double", - "regexp": true, - "undef": true, - "unused": true, - "strict": true, - "trailing": true, - "smarttabs": true, - "white": true + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "eqnull": true, + "globalstrict": true, + "immed": true, + "latedef": true, + "mocha": true, + "newcap": true, + "noarg": true, + "node": true, + "strict": true, + "undef": true } diff --git a/.travis.yml b/.travis.yml index d592da3..48ede82 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,10 @@ language: node_js node_js: -- '0.10' +- "0.12" +- "0.10" +- iojs +before_install: +- npm install -g npm@'>2.7.0' after_script: - CODECLIMATE_REPO_TOKEN=7b0cbee1382c968a036868d26ec04d0ddc7b7aeef25ceead5ff9ff50a3c2ae8b codeclimate < coverage/lcov.info - rm -rf ./coverage diff --git a/README.md b/README.md index 278f164..6b94c81 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,12 @@ [![NPM version](https://badge.fury.io/js/generator-jekyllized.png)](http://badge.fury.io/js/generator-jekyllized) [![Coverage Status](https://coveralls.io/repos/sondr3/generator-jekyllized/badge.png)](https://coveralls.io/r/sondr3/generator-jekyllized) [![Code Climate](https://codeclimate.com/github/sondr3/generator-jekyllized/badges/gpa.svg)](https://codeclimate.com/github/sondr3/generator-jekyllized) -### Work in progress! Things may or may not work. +### Development is happening on the [beta][beta] branch! + +Waiting for Jekyll 3.0 and Gulp 4.0 to land, take a look if you want to! It's +also published on NPM under a 0.8-beta branch so you can start using it today, +however be warned that Gulp 3.x and Gulp 4.0 does not play nice together right +now! **Stylized and opinionated Jekyll development** @@ -148,6 +153,7 @@ repositories there are some things you need to do: ### [Changelog][changelog] +[beta]: https://github.com/sondr3/generator-jekyllized/tree/beta [jekyll]: https://jekyllrb.com [yeoman]: http://yeoman.io [yo]: https://github.com/yeoman/yo diff --git a/app/index.js b/app/index.js index 299872f..3113729 100644 --- a/app/index.js +++ b/app/index.js @@ -1,60 +1,63 @@ -"use strict"; -var path = require("path"); -var chalk = require("chalk"); -var yeoman = require("yeoman-generator"); -var yosay = require("yosay"); -var shelljs = require("shelljs"); +'use strict'; +var path = require('path'); +var chalk = require('chalk'); +var yeoman = require('yeoman-generator'); +var yosay = require('yosay'); +var shelljs = require('shelljs'); module.exports = yeoman.generators.Base.extend({ - constructor: function () { + constructor: function() { yeoman.generators.Base.apply(this, arguments); - this.option("skip-install", { - desc: "Whether dependencies should be installed", + this.option('skip-install', { + desc: 'Whether dependencies should be installed', defaults: false }); - this.option("skip-install-message", { - desc: "Whether commands run should be shown", + this.option('skip-install-message', { + desc: 'Whether commands run should be shown', defaults: false }); - var dependenciesInstalled = ["bundle", "ruby"].every(function (depend) { + var dependenciesInstalled = ['bundle', 'ruby'].every(function(depend) { return shelljs.which(depend); }); if (!dependenciesInstalled) { - this.log("MISSING DEPENDENCIES:" + - "\nEither " + chalk.white("Ruby") + " or " + chalk.white("Bundler") + " is not installed or missing from $PATH." + - "\nMake sure that they are either installed or added to $PATH."); + this.log('MISSING DEPENDENCIES:' + + '\nEither ' + chalk.white('Ruby') + ' or ' + chalk.white('Bundler') + + ' is not installed or missing from $PATH.' + + '\nMake sure that they are either installed or added to $PATH.'); shelljs.exit(1); } - this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, "../package.json"))); + this.pkg = JSON.parse(this.readFileAsString(path.join + (__dirname, '../package.json'))); }, - projectPrompting: function () { + projectPrompting: function() { var cb = this.async(); - this.log(yosay("Time to supercharge your Jekyll development, time to get Jekyllized!")); + this.log(yosay('Time to supercharge your Jekyll development!')); - this.log(chalk.yellow("\nTell me a little about your project >>")); + this.log(chalk.yellow('\nTell me a little about your project >>')); var prompts = [{ - name: "projectName", - message: "What is the name of your project?" + name: 'projectName', + message: 'What is the name of your project?' }, { - name: "projectDescription", - message: "Describe your project for me:" + name: 'projectDescription', + message: 'Describe your project for me:' }, { - name: "projectTagline", - message: "What is the tagline for your project?" + name: 'projectTagline', + message: 'What is the tagline for your project?' }, { - name: "projectURL", - message: chalk.red("If you are using GitHub Pages use username.github.io") + "\nWhat will the URL for your project be?" + name: 'projectURL', + message: chalk.red('If you are using GH Pages use username.github.io') + + '\nWhat will the URL for your project be?' }]; - this.prompt(prompts, function (props) { + this.prompt(prompts, function(props) { this.projectName = props.projectName; this.projectDescription = props.projectDescription; this.projectTagline = props.projectTagline; @@ -64,26 +67,26 @@ module.exports = yeoman.generators.Base.extend({ }.bind(this)); }, - authorPrompting: function () { + authorPrompting: function() { var cb = this.async(); - this.log(chalk.yellow("\nNow it\"s time to tell me about you. >>")); + this.log(chalk.yellow('\nNow it\'s time to tell me about you. >>')); var prompts = [{ - name: "authorName", - message: "What is your name?", + name: 'authorName', + message: 'What is your name?', }, { - name: "authorEmail", - message: "What is your email?", + name: 'authorEmail', + message: 'What is your email?', }, { - name: "authorBio", - message: "Write a short description of yourself:" + name: 'authorBio', + message: 'Write a short description of yourself:' }, { - name: "authorTwitter", - message: "Your Twitter URL:" + name: 'authorTwitter', + message: 'Your Twitter URL:' }]; - this.prompt(prompts, function (props) { + this.prompt(prompts, function(props) { this.authorName = props.authorName; this.authorEmail = props.authorEmail; this.authorBio = props.authorBio; @@ -93,36 +96,37 @@ module.exports = yeoman.generators.Base.extend({ }.bind(this)); }, - jekyllPrompting: function () { + jekyllPrompting: function() { var cb = this.async(); - this.log(chalk.yellow("\nNow on to set some Jekyll settings: >>") + - chalk.red("\nYou can change all of this later in the _config.yml file")); + this.log(chalk.yellow('\nNow on to set some Jekyll settings: >>') + + chalk.red('\nYou can change all of this later in the _config.yml file')); var prompts = [{ - name: "jekyllPermalinks", - type: "list", - message: "Permalink style" + (chalk.red( - "\n pretty: /:year/:month/:day/:title/" + - "\n date: /:year/:month/:day/:title.html" + - "\n none: /:categories/:title.html")) + "\n", - choices: ["pretty", "date", "none"] + name: 'jekyllPermalinks', + type: 'list', + message: 'Permalink style' + (chalk.red( + '\n pretty: /:year/:month/:day/:title/' + + '\n date: /:year/:month/:day/:title.html' + + '\n none: /:categories/:title.html')) + '\n', + choices: ['pretty', 'date', 'none'] }, { - name: "jekyllPaginate", - message: "How many posts do you want to show on your front page?" + chalk.red("\nMust be a number or all"), + name: 'jekyllPaginate', + message: 'How many posts do you want to show on your front page?' + + chalk.red('\nMust be a number or all'), default: 10, - validate: function (input) { + validate: function(input) { if (/^[0-9]*$/.test(input)) { return true; } if (/^all*$/i.test(input)) { return true; } - return "Must be a number or all"; + return 'Must be a number or all'; } }]; - this.prompt(prompts, function (props) { + this.prompt(prompts, function(props) { this.jekyllPermalinks = props.jekyllPermalinks; this.jekyllPaginate = props.jekyllPaginate; @@ -130,92 +134,97 @@ module.exports = yeoman.generators.Base.extend({ }.bind(this)); }, - uploadPrompting: function () { + uploadPrompting: function() { var cb = this.async(); - this.log(chalk.yellow("\nNow we only need some details about how to upload your site: >>") + - chalk.red("\nNOTE: Take whatever time you need to get these right/fill them in later in eithers credentials file.")); + this.log(chalk.yellow('\nTime to choose how to upload your site: >>') + + chalk.red('\nNOTE: Take whatever time you need to get these ' + + 'right/fill them in later in eithers credentials file.')); var prompts = [{ - name: "uploadChoices", - type: "list", - message: "How would you like to host/upload your site?", + name: 'uploadChoices', + type: 'list', + message: 'How would you like to host/upload your site?', choices: [{ - name: "Amazon S3 + Cloudfront", - value: "amazonCloudfrontS3", + name: 'Amazon S3 + Cloudfront', + value: 'amazonCloudfrontS3', }, { - name: "Rsync", - value: "rsync", + name: 'Rsync', + value: 'rsync', }, { - name: "Github Pages", - value: "githubPages", + name: 'Github Pages', + value: 'githubPages', }, { - name: "None", - value: "noUpload" + name: 'None', + value: 'noUpload' }] }, { - name: "amazonKey", - message: chalk.yellow("\n\nNow we just need to fill out the detailes needed to configure your site for Amazon S3 and Cloudfront: >>") + - chalk.red("\nNOTE: Take your time and get the correct settings from Amazon, or alternatively") + - chalk.red("\njust fill them in blankly and fill out the aws-credentials.json later.") + - "\nWhat is your key to AWS?", - when: function (answers) { - return answers.uploadChoices === "amazonCloudfrontS3"; + name: 'amazonKey', + message: chalk.yellow('\n\nNow we just need to fill out the detailes ' + + 'needed to configure your site for Amazon S3 and Cloudfront: >>') + + chalk.red('\nNOTE: Take your time to correctly fill these out') + + chalk.red('\nOr leave them blank and') + + chalk.red('\nfill them out later in aws-credentials.json.') + + '\nWhat is your key to AWS?', + when: function(answers) { + return answers.uploadChoices === 'amazonCloudfrontS3'; } }, { - name: "amazonSecret", - message: "What is your AWS secret?", - when: function (answers) { - return answers.uploadChoices === "amazonCloudfrontS3"; + name: 'amazonSecret', + message: 'What is your AWS secret?', + when: function(answers) { + return answers.uploadChoices === 'amazonCloudfrontS3'; } }, { - name: "amazonBucket", - message: "What do you want your S3 bucket to be called?", - when: function (answers) { - return answers.uploadChoices === "amazonCloudfrontS3"; + name: 'amazonBucket', + message: 'What do you want your S3 bucket to be called?', + when: function(answers) { + return answers.uploadChoices === 'amazonCloudfrontS3'; } }, { - name: "amazonDistID", - message: "What is the Cloudfront distribution ID?", - when: function (answers) { - return answers.uploadChoices === "amazonCloudfrontS3"; + name: 'amazonDistID', + message: 'What is the Cloudfront distribution ID?', + when: function(answers) { + return answers.uploadChoices === 'amazonCloudfrontS3'; } }, { - name: "rsyncUsername", - message: chalk.yellow("\n\nNow we just need to fill out the detailes needed to upload your site via Rsync: >>") + - chalk.red("\nNOTE: Take your time and get the correct settings for your server, or alternatively") + - chalk.red("\njust fill them in blankly and fill out the rsync-credentials.json later.") + - "\nWhat is the username of the user you will be uploading with?", - when: function (answers) { - return answers.uploadChoices === "rsync"; + name: 'rsyncUsername', + message: chalk.yellow('\n\nNow we just need to fill out the details ' + + 'needed to upload your site via Rsync: >>') + + chalk.red('\nNOTE: Take your time to correctly fill these out') + + chalk.red('\nOr leave them blank and') + + chalk.red('\nfill them out later in rsync-credentials.json.') + + '\nWhat is the username of the user you will be uploading with?', + when: function(answers) { + return answers.uploadChoices === 'rsync'; } }, { - name: "rsyncHostname", - message: chalk.red("\n(eg. example.com or 192.168.1.1)") + - "\nWhat is the hostname?", - when: function (answers) { - return answers.uploadChoices === "rsync"; + name: 'rsyncHostname', + message: chalk.red('\n(eg. example.com or 192.168.1.1)') + + '\nWhat is the hostname?', + when: function(answers) { + return answers.uploadChoices === 'rsync'; } }, { - name: "rsyncDestination", - message: chalk.red("\n(eg. /srv/www/site/public_html)") + - "\nWhere do you want to save the files?", - when: function (answers) { - return answers.uploadChoices === "rsync"; + name: 'rsyncDestination', + message: chalk.red('\n(eg. /srv/www/site/public_html)') + + '\nWhere do you want to save the files?', + when: function(answers) { + return answers.uploadChoices === 'rsync'; } }]; - this.prompt(prompts, function (props) { + this.prompt(prompts, function(props) { var features = props.uploadChoices; - var hasFeature = function (feat) { + var hasFeature = function(feat) { return features.indexOf(feat) !== -1; }; - this.amazonCloudfrontS3 = hasFeature("amazonCloudfrontS3"); - this.rsync = hasFeature("rsync"); - this.githubPages = hasFeature("githubPages"); - this.noUpload = hasFeature("noUpload"); + this.amazonCloudfrontS3 = hasFeature('amazonCloudfrontS3'); + this.rsync = hasFeature('rsync'); + this.githubPages = hasFeature('githubPages'); + this.noUpload = hasFeature('noUpload'); this.amazonKey = props.amazonKey; this.amazonSecret = props.amazonSecret; @@ -230,34 +239,35 @@ module.exports = yeoman.generators.Base.extend({ }.bind(this)); }, - scaffolding: function () { - this.copy("Gemfile", "Gemfile"); - this.copy("bowerrc", ".bowerrc"); - this.copy("_bower.json", "bower.json"); - this.template("_package.json", "package.json"); - this.template("_config.yml", "_config.yml"); - this.template("_config.build.yml", "_config.build.yml"); - this.template("_README.md", "README.md"); - this.template("gulpfile.js", "gulpfile.js"); - this.copy("gulp.config.json", "gulp.config.json"); - this.copy("gitignore", ".gitignore"); - this.copy("gitattributes", ".gitattributes"); - this.copy("jshintrc", ".jshintrc"); - this.copy("editorconfig", ".editorconfig"); - this.directory("app", "src"); + scaffolding: function() { + this.copy('Gemfile', 'Gemfile'); + this.copy('bowerrc', '.bowerrc'); + this.copy('_bower.json', 'bower.json'); + this.template('_package.json', 'package.json'); + this.template('_config.yml', '_config.yml'); + this.template('_config.build.yml', '_config.build.yml'); + this.template('_README.md', 'README.md'); + this.template('gulpfile.js', 'gulpfile.js'); + this.copy('gulp.config.json', 'gulp.config.json'); + this.copy('gitignore', '.gitignore'); + this.copy('gitattributes', '.gitattributes'); + this.copy('jshintrc', '.jshintrc'); + this.copy('editorconfig', '.editorconfig'); + this.directory('app', 'src'); if (this.amazonCloudfrontS3) { - this.template("conditionals/_aws-credentials.json", "aws-credentials.json"); - } - else if (this.rsync) { - this.template("conditionals/_rsync-credentials.json", "rsync-credentials.json"); + this.template('conditionals/_aws-credentials.json', + 'aws-credentials.json'); + } else if (this.rsync) { + this.template('conditionals/_rsync-credentials.json', + 'rsync-credentials.json'); } }, install: function() { this.installDependencies({ - skipInstall: this.options["skip-install"], - skipMessage: this.options["skip-install-message"] + skipInstall: this.options['skip-install'], + skipMessage: this.options['skip-install-message'] }); } }); diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js index 6b9de8f..7643154 100755 --- a/app/templates/gulpfile.js +++ b/app/templates/gulpfile.js @@ -1,41 +1,44 @@ -// Generated on <%= (new Date).toISOString().split("T")[0] %> using <%= pkg.name %> <%= pkg.version %> -"use strict"; +// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %> +'use strict'; -var gulp = require("gulp"); +var gulp = require('gulp'); // Load in paths from a external config file for easier changing of paths -var config = require("./gulp.config.json"); +var config = require('./gulp.config.json'); // Loads the plugins without having to list all of them, but you need // to call them as $.pluginname -var $ = require("gulp-load-plugins")({ lasy: true }); -// "trash" is used to clean out directories and such -var trash = require("trash"); +var $ = require('gulp-load-plugins')(); +// 'trash' is used to clean out directories and such +var trash = require('trash'); // Used to run shell commands -var shell = require("shelljs"); +var shell = require('shelljs'); <% if (amazonCloudfrontS3) { %>// Parallelize the uploads when uploading to Amazon S3 -// "fs" is used to read files from the system (used for AWS uploading) -var fs = require("fs"); -var parallelize = require("concurrent-transform"); +// 'fs' is used to read files from the system (used for AWS uploading) +var fs = require('fs'); +var parallelize = require('concurrent-transform'); <% } %>// BrowserSync is used to live-reload your website -var browserSync = require("browser-sync"); +var browserSync = require('browser-sync'); var reload = browserSync.reload; // merge is used to merge the output from two different streams into the same stream -var merge = require("merge-stream"); +var merge = require('merge-stream'); // Deletes the directory that the optimized site is output to -function cleanDist(done) { trash(["dist"]); done(); } -function cleanAssets(done) { trash([".tmp"]); done(); } -function rebuild(done) { trash(["src/.jekyll-metadata"]); done(); } +function cleanDist(done) { trash(['dist']); done(); } +function cleanAssets(done) { trash(['.tmp']); done(); } +function rebuild(done) { trash(['src/.jekyll-metadata']); done(); } // so Jekyll rebuilds the site properly // Runs the build command for Jekyll to compile the site locally // This will build the site with the production settings -function jekyllDev(done) { shell.exec("jekyll build --quiet"); done(); } +function jekyllDev(done) { shell.exec('jekyll build --quiet'); done(); } // Almost identical to the above task, but instead we load in the build configuration // that overwrites some of the settings in the regular configuration so that you // don't end up publishing your drafts or future posts -function jekyllProd(done) { shell.exec("jekyll build --quiet --config _config.yml,_config.build.yml"); done(); } +function jekyllProd(done) { + shell.exec('jekyll build --quiet --config _config.yml,_config.build.yml'); + done(); +} -// Compiles the SASS files and moves them into the "assets/stylesheets" directory +// Compiles the SASS files and moves them into the 'assets/stylesheets' directory function styles() { // Looks at the style.scss file for what to include and creates a style.css file return gulp.src(config.scss.src) @@ -43,13 +46,13 @@ function styles() { .pipe($.sourcemaps.init()) .pipe($.sass({errLogToconsole: true})) // AutoPrefix your CSS so it works between browsers - .pipe($.autoprefixer("last 1 version", { cascade: true })) + .pipe($.autoprefixer('last 1 version', {cascade: true})) // Write the sourcemaps to the directory of the gulp.src stream - .pipe($.sourcemaps.write(".")) + .pipe($.sourcemaps.write('.')) // Directory your CSS file goes to .pipe(gulp.dest(config.scss.dest)) // Outputs the size of the CSS file - .pipe($.size({title: "styles"})) + .pipe($.size({title: 'styles'})) // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS .pipe(reload({stream: true})); } @@ -58,13 +61,13 @@ function styles() { function javascript() { return gulp.src(config.javascript.src) .pipe($.sourcemaps.init()) - .pipe($.uglify({compress: false, preserveComments: "all"})) + .pipe($.uglify({compress: false, preserveComments: 'all'})) .pipe($.groupConcat({ - "index.js": config.javascript.src + 'index.js': config.javascript.src })) - .pipe($.sourcemaps.write(".")) + .pipe($.sourcemaps.write('.')) .pipe(gulp.dest(config.javascript.dest)) - .pipe($.size({title: "javascript"})) + .pipe($.size({title: 'javascript'})) .pipe(reload({stream: true})); } @@ -79,25 +82,25 @@ function images() { interlaced: true }))) .pipe(gulp.dest(config.images.dest)) - .pipe($.size({title: "images"})); + .pipe($.size({title: 'images'})); } -// Copy over fonts to the ".tmp" directory +// Copy over fonts to the '.tmp' directory function fonts() { return gulp.src(config.fonts.src) .pipe(gulp.dest(config.fonts.dest)) - .pipe($.size({ title: "fonts" })); + .pipe($.size({title: 'fonts'})); } -// Copy optimized images and (not optimized) fonts to the "dist" folder +// Copy optimized images and (not optimized) fonts to the 'dist' folder function copy() { var images = gulp.src(config.images.dest) .pipe(gulp.dest(config.images.build)) - .pipe($.size({title: "copied images"})); + .pipe($.size({title: 'copied images'})); var fonts = gulp.src(config.fonts.dest) .pipe(gulp.dest(config.fonts.build)) - .pipe($.size({title: "copied fonts"})); + .pipe($.size({title: 'copied fonts'})); return merge(images, fonts); } @@ -109,18 +112,21 @@ function optimize() { return gulp.src(config.assets.html) .pipe(assets) // Concatenate JavaScript files and preserve important comments - .pipe($.if("*.js", $.uglify({preserveComments: "some"}))) + .pipe($.if('*.js', $.uglify({preserveComments: 'some'}))) // Minify CSS - .pipe($.if("*.css", $.minifyCss())) + .pipe($.if('*.css', $.minifyCss())) // Start cache busting the files - .pipe($.revAll({quiet: true, ignore: [".eot", ".svg", ".ttf", ".woff", ".woff2"]})) + .pipe($.revAll({ + quiet: true, + ignore: ['.eot', '.svg', '.ttf', '.woff', '.woff2'] + })) .pipe(assets.restore()) // Conctenate your files based on what you specified in _layout/header.html .pipe($.useref()) // Replace the asset names with their cache busted names .pipe($.revReplace()) // Minify HTML - .pipe($.if("*.html", $.htmlmin({ + .pipe($.if('*.html', $.htmlmin({ removeComments: true, removeCommentsFromCDATA: true, removeCDATASectionsFromCDATA: true, @@ -131,63 +137,59 @@ function optimize() { }))) // Send the output to the correct folder .pipe(gulp.dest(config.assets.dest)) - .pipe($.size({title: "optimizations"})); -} + .pipe($.size({title: 'optimizations'})); +}<% if (amazonCloudfrontS3) { %> -<% if (amazonCloudfrontS3) { %>// Task to deploy your site to Amazon S3 and Cloudfront +// Task to deploy your site to Amazon S3 and Cloudfront function deploy() { - // Generate the needed credentials (bucket, secret key etc) from a "hidden" JSON file - var credentials = JSON.parse(fs.readFileSync("aws-credentials.json", "utf8")); + // Generate the needed credentials (bucket, secret key etc) from a 'hidden' JSON file + var credentials = JSON.parse(fs.readFileSync('aws-credentials.json', 'utf8')); var publisher = $.awspublish.create(credentials); // Give your files the proper headers - var headers = { - "Cache-Control": "max-age=0, no-transform, public", - "Content-Encoding": "gzip" - }; - gulp.src("dist/**/*") + gulp.src('dist/**/*') .pipe($.awspublishRouter({ routes: { - "^assets/(?:.+)\\.(?:js|css)$": { - key: "$&", + '^assets/(?:.+)\\.(?:js|css)$': { + key: '$&', headers: { - "Cache-Control": "max-age=315360000, no-transform, public", - "Content-Encoding": "gzip" + 'Cache-Control': 'max-age=315360000, no-transform, public', + 'Content-Encoding': 'gzip' } }, - "^assets/(?:.+)\\.(?:jpg|png|gif)$": { - key: "$&", + '^assets/(?:.+)\\.(?:jpg|png|gif)$': { + key: '$&', headers: { - "Cache-Control": "max-age=315360000, no-transform, public", - "Content-Encoding": "gzip" + 'Cache-Control': 'max-age=315360000, no-transform, public', + 'Content-Encoding': 'gzip' } }, - "^assets/fonts/(?:.+)\\.(?:eot|svg|ttf|woff)$": { - key: "$&", + '^assets/fonts/(?:.+)\\.(?:eot|svg|ttf|woff)$': { + key: '$&', headers: { - "Cache-Control": "max-age=315360000, no-transform, public" + 'Cache-Control': 'max-age=315360000, no-transform, public' } }, - "^.+\\.html": { - key: "$&", + '^.+\\.html': { + key: '$&', headers: { - "Cache-Control": "max-age=0, no-transform, public", - "Content-Encoding": "gzip" + 'Cache-Control': 'max-age=0, no-transform, public', + 'Content-Encoding': 'gzip' } }, - "^.+$": "$&" + '^.+$': '$&' } })) // Gzip the files for moar speed .pipe($.awspublish.gzip()) // Parallelize the number of concurrent uploads, in this case 30 .pipe(parallelize(publisher.publish(), 30)) - // Have your files in the system cache so you don"t have to recheck all the files every time + // Have your files in the system cache so you don't have to recheck all the files every time .pipe(publisher.cache()) - // Synchronize the contents of the bucket and local (this deletes everything that isn"t in local!) + // Synchronize the contents of the bucket and local (this deletes everything that isn't in local!) .pipe(publisher.sync()) // And print the ouput, glorious .pipe($.awspublish.reporter()) @@ -198,12 +200,12 @@ function deploy() { // Task to upload your site via Rsync to your server function deploy() { // Load in the variables needed for our Rsync synchronization - var secret = require("./rsync-credentials.json"); + var secret = require('./rsync-credentials.json'); - return gulp.src("dist/**") + return gulp.src('dist/**') .pipe($.rsync({ - // This uploads the contenst of "root", instead of the folder - root: "dist", + // This uploads the contenst of 'root', instead of the folder + root: 'dist', // Find your username, hostname and destination from your rsync-credentials.json hostname: secret.hostname, username: secret.username, @@ -214,14 +216,15 @@ function deploy() { progress: true })); }<% } %><% if (githubPages) { %> + // Task to upload your site to your personal GH Pages repo function deploy() { // Deploys your optimized site, you can change the settings in the html task if you want to - return gulp.src("dist/**/*") + return gulp.src('dist/**/*') .pipe($.ghPages({ // Currently only personal GitHub Pages are supported so it will upload to the master // branch and automatically overwrite anything that is in the directory - branch: "master" + branch: 'master' })); }<% } %> @@ -229,13 +232,13 @@ function deploy() { function jslint() { gulp.src(config.javascript.dest) // Checks your JS code quality against your .jshintrc file - .pipe($.jshint(".jshintrc")) + .pipe($.jshint('.jshintrc')) .pipe($.jshint.reporter()); } -// Runs "jekyll doctor" on your site to check for errors with your configuration +// Runs 'jekyll doctor' on your site to check for errors with your configuration // and will check for URL errors a well -function doctor(done) { shell.exec("jekyll doctor"); done(); } +function doctor(done) { shell.exec('jekyll doctor'); done(); } // BrowserSync will serve our site on a local server for us and other devices to use // It will also autoreload across all devices as well as keep the viewport synchronized @@ -256,42 +259,42 @@ function serve() { gulp.watch(config.watch.images, reload); } -// Default task, run when just writing "gulp" in the terminal -gulp.task("default", gulp.series( +// Default task, run when just writing 'gulp' in the terminal +gulp.task('default', gulp.series( gulp.series(jekyllDev), gulp.parallel(styles, javascript, fonts, images), gulp.series(serve) )); -// Builds your site with the "build" command and then runs all the optimizations on -// it and outputs it to "./dist" -gulp.task("optimize", gulp.series( +// Builds your site with the 'build' command and then runs all the optimizations on +// it and outputs it to './dist' +gulp.task('optimize', gulp.series( gulp.series(rebuild, jekyllProd), gulp.parallel(styles, javascript, fonts, images, copy), gulp.series(optimize) )); -gulp.task("build", gulp.series( +gulp.task('build', gulp.series( gulp.series(jekyllDev), gulp.parallel(styles, javascript, fonts, images) ));<% if (!noUpload) { %> // Deploy your site for all to see -gulp.task("deploy", deploy);<% } %> +gulp.task('deploy', deploy);<% } %> // Serves your site locally -gulp.task("serve", serve); +gulp.task('serve', serve); // Clean out your dist and .tmp folder and delete .jekyll-metadata -gulp.task("clean", cleanDist); -gulp.task("clean:assets", cleanAssets); -gulp.task("rebuild", gulp.series(cleanDist, cleanAssets, rebuild)); +gulp.task('clean', cleanDist); +gulp.task('clean:assets', cleanAssets); +gulp.task('rebuild', gulp.series(cleanDist, cleanAssets, rebuild)); // Create your styles and create sourcemaps -gulp.task("styles", styles); +gulp.task('styles', styles); // Create sourcemaps for your JS files -gulp.task("javascript", javascript); +gulp.task('javascript', javascript); // Checks your CSS, JS and Jekyll for errors -gulp.task("check", gulp.series(doctor, jslint)); +gulp.task('check', gulp.series(doctor, jslint)); diff --git a/gulpfile.js b/gulpfile.js index 83f2327..782fc44 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,52 +1,60 @@ -"use strict"; -var path = require("path"); -var gulp = require("gulp"); -var jshint = require("gulp-jshint"); -var istanbul = require("gulp-istanbul"); -var plumber = require("gulp-plumber"); -var mocha = require("gulp-mocha"); -var coveralls = require("gulp-coveralls"); +'use strict'; -var handleErr = function (err) { +var path = require('path'); +var gulp = require('gulp'); +var jscs = require('gulp-jscs'); +var jshint = require('gulp-jshint'); +var istanbul = require('gulp-istanbul'); +var plumber = require('gulp-plumber'); +var mocha = require('gulp-mocha'); +var coveralls = require('gulp-coveralls'); + +var handleErr = function(err) { console.log(err.message); process.exit(1); }; -gulp.task("static", function () { +gulp.task('check', function() { return gulp.src([ - "test/*.js", - "app/index.js", - "gulpfile.js" + 'test/*.js', + 'app/index.js', + 'gulpfile.js', + 'test/temp/test-gulp/gulpfile.js', + 'test/temp/test-jekyll/gulpfile.js', + 'test/temp/test-aws/gulpfile.js', + 'test/temp/test-rsync/gulpfile.js', + 'test/temp/test-pages/gulpfile.js' ]) - .pipe(jshint(".jshintrc")) - .pipe(jshint.reporter("jshint-stylish")) - .pipe(jshint.reporter("fail")) - .on("error", handleErr); + .pipe(jscs()) + .pipe(jshint('.jshintrc')) + .pipe(jshint.reporter('jshint-stylish')) + .pipe(jshint.reporter('fail')) + .on('error', handleErr); }); -gulp.task("test", function (cb) { - gulp.src([ - "app/index.js" +gulp.task('test', function(done) { + return gulp.src([ + 'app/index.js', + 'gulpfile.js' ]) - .pipe(istanbul({ - includeUntested: true - })) + .pipe(istanbul()) .pipe(istanbul.hookRequire()) - .on("finish", function () { - gulp.src(["test/*.js"]) + .on('finish', function() { + gulp.src(['test/*.js']) .pipe(plumber()) .pipe(mocha({ - reporter: "spec" + reporter: 'spec' })) .pipe(istanbul.writeReports()) - .on("end", cb); + .on('end', done); }); }); -gulp.task("coveralls", ["test"], function () { - if (!process.env.CI) return; - return gulp.src(path.join(__dirname, "coverage/lcov.info")) +gulp.task('coveralls', function() { + if (!process.env.CI) { return; } + return gulp.src(path.join(__dirname, 'coverage/lcov.info')) .pipe(coveralls()); }); -gulp.task("default", ["static", "test", "coveralls"]); +gulp.task('default', gulp.series('check', 'coveralls')); +gulp.task('help', gulp.series('test', 'check', 'coveralls')); diff --git a/package.json b/package.json index e2aaa88..731e0ea 100644 --- a/package.json +++ b/package.json @@ -27,36 +27,33 @@ } ], "scripts": { - "test": "gulp" + "test": "gulp test && gulp" }, "dependencies": { - "chalk": "^0.5.1", + "chalk": "^1.0.0", "globule": "~0.2.0", - "shelljs": "~0.3.0", + "shelljs": "^0.4.0", "yeoman-generator": "^0.18.6", "yosay": "^1.0.2" }, "devDependencies": { "codeclimate-test-reporter": "0.0.4", "coveralls": "^2.11.2", - "gulp": "^3.8.10", + "generator-mocha": ">=0.1.6", + "gulp": "git://github.com:gulpjs/gulp.git#4.0", "gulp-coveralls": "^0.1.3", - "gulp-istanbul": "^0.6.0", + "gulp-istanbul": "^0.7.0", "gulp-jscs": "^1.4.0", "gulp-jshint": "^1.9.0", - "gulp-load-plugins": "^0.8.0", + "gulp-load-plugins": "^0.9.0", "gulp-mocha": "^2.0.0", - "gulp-plumber": "^0.6.6", + "gulp-plumber": "^1.0.0", "istanbul": "~0.3.5", "jshint": "^2.5.11", "jshint-stylish": "^1.0.0", - "mocha": "~2.1.0", - "mocha-lcov-reporter": "0.0.1" - }, - "peerDependencies": { - "generator-mocha": ">=0.1.6", - "yo": ">=1.3.3", - "gulp": ">=3.8.10" + "mocha": "^2.2.1", + "mocha-lcov-reporter": "0.0.2", + "yo": ">=1.4" }, "engines": { "node": ">=0.10", diff --git a/test/test-creation-aws.js b/test/test-creation-aws.js index 3d9f48c..ddfeb67 100755 --- a/test/test-creation-aws.js +++ b/test/test-creation-aws.js @@ -1,62 +1,61 @@ -/*global describe, before, it*/ -"use strict"; - -var path = require("path"); -var helpers = require("yeoman-generator").test; -var assert = require("yeoman-generator").assert; - -describe("Jekyllized generator test when using Amazon AWS", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-aws")) - .withArguments(["--skip-install"]) +'use strict'; + +var path = require('path'); +var helpers = require('yeoman-generator').test; +var assert = require('yeoman-generator').assert; + +describe('Jekyllized generator test when using Amazon AWS', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-aws')) + .withArguments(['--skip-install']) .withPrompt({ - uploadChoices: ["amazonCloudfrontS3"], - amazonKey: ["123123123123123"], - amazonSecret: ["14141414141414"], - amazonBucket: ["135135135135135"], - amazonDistID: ["2121212121212121"] + uploadChoices: ['amazonCloudfrontS3'], + amazonKey: ['123123123123123'], + amazonSecret: ['14141414141414'], + amazonBucket: ['135135135135135'], + amazonDistID: ['2121212121212121'] }) - .on("end", done); + .on('end', done); }); - it("creates expected files", function () { + it('creates expected files', function() { var expected = [ - "bower.json", - "package.json", - "gulpfile.js", - "src/index.html", - "src/robots.txt", - "src/assets/favicon.ico", - "src/assets/scss/style.scss", - "aws-credentials.json" + 'bower.json', + 'package.json', + 'gulpfile.js', + 'src/index.html', + 'src/robots.txt', + 'src/assets/favicon.ico', + 'src/assets/scss/style.scss', + 'aws-credentials.json' ]; - assert.file(expected); + assert.file(expected); }); - it("should contain the correct deploy function", function () { - assert.fileContent("gulpfile.js", /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + it('should contain the correct deploy function', function() { + assert.fileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); }); - it("should NOT contain either the GH Pages or Rsync function", function () { - assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site via Rsync to your server/); - assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site to your personal GH Pages repo/); + it('should NOT contain either the GH Pages or Rsync function', function() { + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); }); - it("should contain deploy tasks", function () { - assert.fileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + it('should contain deploy tasks', function() { + assert.fileContent('gulpfile.js', /gulp.task\(\'deploy\'/); }); - it("should contain the correct packages", function () { + it('should contain the correct packages', function() { var expected = [ - ["package.json", /\"concurrent-transform\"/], - ["package.json", /\"gulp-awspublish\"/], - ["package.json", /\"gulp-awspublish-router\"/], - ["package.json", /\"gulp-cloudfront\"/] + ['package.json', /\"concurrent-transform\"/], + ['package.json', /\"gulp-awspublish\"/], + ['package.json', /\"gulp-awspublish-router\"/], + ['package.json', /\"gulp-cloudfront\"/] ]; - assert.fileContent(expected); + assert.fileContent(expected); }); }); diff --git a/test/test-creation-ghpages.js b/test/test-creation-ghpages.js index d4d5fb6..4365169 100644 --- a/test/test-creation-ghpages.js +++ b/test/test-creation-ghpages.js @@ -1,50 +1,49 @@ -/*global describe, before, it*/ -"use strict"; - -var path = require("path"); -var helpers = require("yeoman-generator").test; -var assert = require("yeoman-generator").assert; - -describe("Jekyllized generator test when using GitHub Pages", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-pages")) - .withArguments(["--skip-install"]) +'use strict'; + +var path = require('path'); +var helpers = require('yeoman-generator').test; +var assert = require('yeoman-generator').assert; + +describe('Jekyllized generator test when using GitHub Pages', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-pages')) + .withArguments(['--skip-install']) .withPrompt({ - uploadChoices: ["githubPages"] + uploadChoices: ['githubPages'] }) - .on("end", done); + .on('end', done); }); - it("creates expected files", function () { + it('creates expected files', function() { var expected = [ - "bower.json", - "package.json", - "gulpfile.js", - "src/index.html", - "src/robots.txt", - "src/assets/favicon.ico", - "src/assets/scss/style.scss" + 'bower.json', + 'package.json', + 'gulpfile.js', + 'src/index.html', + 'src/robots.txt', + 'src/assets/favicon.ico', + 'src/assets/scss/style.scss' ]; - assert.file(expected); + assert.file(expected); }); - it("should contain the correct deploy function", function () { - assert.fileContent("gulpfile.js", /\/\/ Task to upload your site to your personal GH Pages repo/); + it('should contain the correct deploy function', function() { + assert.fileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); }); - it("should NOT contain either the Amazon or Rsync function", function () { - assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site via Rsync to your server/); - assert.noFileContent("gulpfile.js", /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + it('should NOT contain either the Amazon or Rsync function', function() { + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); + assert.noFileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); }); - it("should contain deploy tasks", function () { - assert.fileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + it('should contain deploy tasks', function() { + assert.fileContent('gulpfile.js', /gulp.task\(\'deploy\'/); }); - it("should contain the correct packages", function () { - assert.fileContent("package.json", /\"gulp-gh-pages\"/); + it('should contain the correct packages', function() { + assert.fileContent('package.json', /\"gulp-gh-pages\"/); }); }); diff --git a/test/test-creation-rsync.js b/test/test-creation-rsync.js index a801dfd..efa7aaa 100755 --- a/test/test-creation-rsync.js +++ b/test/test-creation-rsync.js @@ -1,54 +1,53 @@ -/*global describe, before, it*/ -"use strict"; - -var path = require("path"); -var helpers = require("yeoman-generator").test; -var assert = require("yeoman-generator").assert; - -describe("Jekyllized generator test when using Rsync", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-rsync")) - .withArguments(["--skip-install"]) +'use strict'; + +var path = require('path'); +var helpers = require('yeoman-generator').test; +var assert = require('yeoman-generator').assert; + +describe('Jekyllized generator test when using Rsync', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-rsync')) + .withArguments(['--skip-install']) .withPrompt({ - uploadChoices: ["rsync"], - rsyncUsername: ["olanordmann"], - rsyncHostname: ["example.com"], - rsyncDestination: ["/srv/www/example.com/public_html"] + uploadChoices: ['rsync'], + rsyncUsername: ['olanordmann'], + rsyncHostname: ['example.com'], + rsyncDestination: ['/srv/www/example.com/public_html'] }) - .on("end", done); + .on('end', done); }); - it("creates expected files", function () { + it('creates expected files', function() { var expected = [ - "bower.json", - "package.json", - "gulpfile.js", - "src/index.html", - "src/robots.txt", - "src/assets/favicon.ico", - "src/assets/scss/style.scss", - "rsync-credentials.json" + 'bower.json', + 'package.json', + 'gulpfile.js', + 'src/index.html', + 'src/robots.txt', + 'src/assets/favicon.ico', + 'src/assets/scss/style.scss', + 'rsync-credentials.json' ]; assert.file(expected); }); - it("should contain the correct deploy function", function () { - assert.fileContent("gulpfile.js", /\/\/ Task to upload your site via Rsync to your server/); + it('should contain the correct deploy function', function() { + assert.fileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); }); - it("should NOT contain either the GH Pages or Amazon function", function () { - assert.noFileContent("gulpfile.js", /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); - assert.noFileContent("gulpfile.js", /\/\/ Task to upload your site to your personal GH Pages repo/); + it('should NOT contain either the GH Pages or Amazon function', function() { + assert.noFileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); }); - it("should contain deploy tasks", function () { - assert.fileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + it('should contain deploy tasks', function() { + assert.fileContent('gulpfile.js', /gulp.task\(\'deploy\'/); }); - it("should contain the correct packages", function () { - assert.fileContent("package.json", /\"gulp-rsync\"/); + it('should contain the correct packages', function() { + assert.fileContent('package.json', /\"gulp-rsync\"/); }); }); diff --git a/test/test-gulp.js b/test/test-gulp.js index 970f50f..6ca985d 100644 --- a/test/test-gulp.js +++ b/test/test-gulp.js @@ -1,73 +1,98 @@ -/*global describe, before, it*/ -"use strict"; +'use strict'; -var path = require("path"); -var assert = require("assert"); -var helpers = require("yeoman-generator").test; +var path = require('path'); +var assert = require('assert'); +var helpers = require('yeoman-generator').test; -describe("Jekyllized generator test for Gulp tasks without any uploading", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-gulp")) - .withArguments(["--skip-install"]) +describe('Test for Gulp tasks without any uploading', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-gulp')) + .withArguments(['--skip-install']) .withPrompt({ - projectName: ["Mocha Test"], - projectDescription: ["Mocha tests for Jekyllized"], - projectTagline: ["Better hope this doesn\"t blow up"], - projectURL: ["testing.com"], - authorName: ["Ola Nordmann"], - authorEmail: ["ola.nordmann@email.com"], - authorBio: ["Just your average Norwegian"], - authorTwitter: ["olanordmann123123"], - jekyllPermalinks: ["pretty"], - jekyllPaginate: ["10"], - uploadChoices: ["noUpload"] + projectName: ['Mocha Test'], + projectDescription: ['Mocha tests for Jekyllized'], + projectTagline: ['Better hope this doesn\'t blow up'], + projectURL: ['testing.com'], + authorName: ['Ola Nordmann'], + authorEmail: ['ola.nordmann@email.com'], + authorBio: ['Just your average Norwegian'], + authorTwitter: ['olanordmann123123'], + jekyllPermalinks: ['pretty'], + jekyllPaginate: ['10'], + uploadChoices: ['noUpload'] }) - .on("end", done); + .on('end', done); }); - it("creates expected files", function () { + it('creates expected files', function() { var expected = [ - "bower.json", - "package.json", - "gulp.config.json", - "gulpfile.js", - "src/index.html", - "src/robots.txt", - "src/assets/favicon.ico", - "src/assets/scss/style.scss" + 'bower.json', + 'package.json', + 'gulp.config.json', + 'gulpfile.js', + 'src/index.html', + 'src/robots.txt', + 'src/assets/favicon.ico', + 'src/assets/scss/style.scss' ]; - assert.file(expected); + assert.file(expected); }); - it("does not create unexpected files", function () { + it('does not create unexpected files', function() { var unexpected = [ - "aws-credentials.json", - "rsync-redentials.json" + 'aws-credentials.json', + 'rsync-redentials.json' ]; - assert.noFile(unexpected); + assert.noFile(unexpected); }); - it ("should contain the standard tasks", function () { + it ('should contain the default functions', function() { var expected = [ - ["gulpfile.js", /gulp.task\(\"default\"/], - ["gulpfile.js", /gulp.task\(\"optimize\"/], - ["gulpfile.js", /gulp.task\(\"build\"/], - ["gulpfile.js", /gulp.task\(\"serve\"/], - ["gulpfile.js", /gulp.task\(\"clean\"/], - ["gulpfile.js", /gulp.task\(\"rebuild\"/], - ["gulpfile.js", /gulp.task\(\"styles\"/], - ["gulpfile.js", /gulp.task\(\"javascript\"/], - ["gulpfile.js", /gulp.task\(\"check\"/] + ['gulpfile.js', /function cleanDist\(done\)/], + ['gulpfile.js', /function cleanAssets\(done\)/], + ['gulpfile.js', /function rebuild\(done\)/], + ['gulpfile.js', /function jekyllDev\(done\)/], + ['gulpfile.js', /function jekyllProd\(done\)/], + ['gulpfile.js', /function styles\(\)/], + ['gulpfile.js', /function javascript\(\)/], + ['gulpfile.js', /function images\(\)/], + ['gulpfile.js', /function fonts\(\)/], + ['gulpfile.js', /function copy\(\)/], + ['gulpfile.js', /function optimize\(\)/], + ['gulpfile.js', /function jslint\(\)/], + ['gulpfile.js', /function doctor\(done\)/], + ['gulpfile.js', /function serve\(\)/] ]; - assert.fileContent(expected); + assert.fileContent(expected); }); - it("should NOT contain a deploy task", function () { - assert.noFileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + it ('should contain the default tasks', function() { + var expected = [ + ['gulpfile.js', /gulp.task\(\'default\'/], + ['gulpfile.js', /gulp.task\(\'optimize\'/], + ['gulpfile.js', /gulp.task\(\'build\'/], + ['gulpfile.js', /gulp.task\(\'serve\'/], + ['gulpfile.js', /gulp.task\(\'clean\'/], + ['gulpfile.js', /gulp.task\(\'clean\:assets\'/], + ['gulpfile.js', /gulp.task\(\'rebuild\'/], + ['gulpfile.js', /gulp.task\(\'styles\'/], + ['gulpfile.js', /gulp.task\(\'javascript\'/], + ['gulpfile.js', /gulp.task\(\'check\'/] + ]; + + assert.fileContent(expected); + }); + + it('should NOT contain a deploy function', function() { + assert.noFileContent('gulpfile.js', /function deploy\(\)/); + }); + + it('should NOT contain a deploy task', function() { + assert.noFileContent('gulpfile.js', /gulp.task\(\'deploy\'/); }); }); diff --git a/test/test-jekyll.js b/test/test-jekyll.js index 9199c5f..64ecfb3 100644 --- a/test/test-jekyll.js +++ b/test/test-jekyll.js @@ -1,144 +1,143 @@ -/*global describe, before, it*/ -"use strict"; - -var path = require("path"); -var helpers = require("yeoman-generator").test; -var assert = require("yeoman-generator").assert; - -describe("Jekyllized generator", function () { - describe("test for Jekyll settings", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-jekyll")) - .withArguments(["--skip-install"]) +'use strict'; + +var path = require('path'); +var helpers = require('yeoman-generator').test; +var assert = require('yeoman-generator').assert; + +describe('Jekyllized generator', function() { + describe('test for Jekyll settings', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-jekyll')) + .withArguments(['--skip-install']) .withPrompt({ - projectName: ["Mocha Test"], - projectDescription: ["Mocha tests for Jekyllized"], - projectTagline: ["Better hope this doesn\"t blow up"], - projectURL: ["testing.com"], - authorName: ["Ola Nordmann"], - authorEmail: ["ola.nordmann@email.com"], - authorBio: ["Just your average Norwegian"], - authorTwitter: ["olanordmann123123"], - jekyllPermalinks: ["pretty"], - jekyllPaginate: ["10"], - uploadChoices: ["noUpload"] + projectName: ['Mocha Test'], + projectDescription: ['Mocha tests for Jekyllized'], + projectTagline: ['Better hope this doesn\'t blow up'], + projectURL: ['testing.com'], + authorName: ['Ola Nordmann'], + authorEmail: ['ola.nordmann@email.com'], + authorBio: ['Just your average Norwegian'], + authorTwitter: ['olanordmann123123'], + jekyllPermalinks: ['pretty'], + jekyllPaginate: ['10'], + uploadChoices: ['noUpload'] }) - .on("end", done); + .on('end', done); }); - it("creates the expected files", function () { + it('creates the expected files', function() { var expected = [ - "src/404.html", - "src/about.md", - "src/feed.xml", - "src/crossdomain.xml", - "src/humans.txt", - "src/index.html", - "src/robots.txt" + 'src/404.html', + 'src/about.md', + 'src/feed.xml', + 'src/crossdomain.xml', + 'src/humans.txt', + 'src/index.html', + 'src/robots.txt' ]; - assert.file(expected); + assert.file(expected); }); - it("gulpfile.js does NOT contain a deploy task", function () { - assert.noFileContent("gulpfile.js", /gulp.task\(\"deploy\"/); + it('gulpfile.js does NOT contain a deploy task', function() { + assert.noFileContent('gulpfile.js', /gulp.task\(\'deploy\'/); }); - it("_config.yml contains the correct settings", function () { + it('_config.yml contains the correct settings', function() { var expected = [ - ["_config.yml", /title\: Mocha Test/], - ["_config.yml", /description\: Mocha tests for Jekyllized/], - ["_config.yml", /tagline\: Better hope this doesn\"t blow up/], - ["_config.yml", /name\: Ola Nordmann/], - ["_config.yml", /email\: ola\.nordmann\@email\.com/], - ["_config.yml", /bio\: Just your average Norwegian/], - ["_config.yml", /twitter\: olanordmann123123/] + ['_config.yml', /title\: Mocha Test/], + ['_config.yml', /description\: Mocha tests for Jekyllized/], + ['_config.yml', /tagline\: Better hope this doesn\'t blow up/], + ['_config.yml', /name\: Ola Nordmann/], + ['_config.yml', /email\: ola\.nordmann\@email\.com/], + ['_config.yml', /bio\: Just your average Norwegian/], + ['_config.yml', /twitter\: olanordmann123123/] ]; - assert.fileContent(expected); + assert.fileContent(expected); }); - it("_config.build.yml contains the correct settings", function () { + it('_config.build.yml contains the correct settings', function() { var expected = [ - ["_config.build.yml", /future\: false/], - ["_config.build.yml", /show_drafts\: false/], - ["_config.build.yml", /lsi\: true/], - ["_config.build.yml", /limit_posts\: 0/], - ["_config.build.yml", /source\: src/], - ["_config.build.yml", /destination\: dist/] + ['_config.build.yml', /future\: false/], + ['_config.build.yml', /show_drafts\: false/], + ['_config.build.yml', /lsi\: true/], + ['_config.build.yml', /limit_posts\: 0/], + ['_config.build.yml', /source\: src/], + ['_config.build.yml', /destination\: dist/] ]; - assert.fileContent(expected); + assert.fileContent(expected); }); }); - describe("test with setting pretty permalinks and 10 posts per page", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-jekyll-pagination")) - .withArguments(["--skip-install"]) + describe('test with pretty permalinks and 10 posts per page', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-jekyll-pagination')) + .withArguments(['--skip-install']) .withPrompt({ - jekyllPermalinks: ["pretty"], - jekyllPaginate: ["10"], - uploadChoices: ["noUpload"] + jekyllPermalinks: ['pretty'], + jekyllPaginate: ['10'], + uploadChoices: ['noUpload'] }) - .on("end", done); + .on('end', done); }); - it("_config.yml permalink setting is 'pretty'", function () { - assert.fileContent("_config.yml", /permalink\: pretty/); + it('_config.yml permalink setting is "pretty"', function() { + assert.fileContent('_config.yml', /permalink\: pretty/); }); - it("_config.yml pagination is '10' posts per page", function () { - assert.fileContent("_config.yml", /paginate\: 10/); + it('_config.yml pagination is "10" posts per page', function() { + assert.fileContent('_config.yml', /paginate\: 10/); }); }); - describe("test with setting date permalinks and all posts on the same page", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-jekyll-pagination-1")) - .withArguments(["--skip-install"]) + describe('test with date permalinks and all posts together', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-jekyll-pagination-1')) + .withArguments(['--skip-install']) .withPrompt({ - jekyllPermalinks: ["date"], - jekyllPaginate: ["all"], - uploadChoices: ["noUpload"] + jekyllPermalinks: ['date'], + jekyllPaginate: ['all'], + uploadChoices: ['noUpload'] }) - .on("end", done); + .on('end', done); }); - it("_config.yml permalink setting is 'date'", function () { - assert.fileContent("_config.yml", /permalink\: date/); + it('_config.yml permalink setting is "date"', function() { + assert.fileContent('_config.yml', /permalink\: date/); }); - it("_config.yml pagination is 'all' posts per page", function () { - assert.fileContent("_config.yml", /paginate\: all/); + it('_config.yml pagination is "all" posts per page', function() { + assert.fileContent('_config.yml', /paginate\: all/); }); }); - describe("test with no permalinks setting and 1 post per page", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-jekyll-pagination-2")) - .withArguments(["--skip-install"]) + describe('test with no permalinks setting and 1 post per page', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-jekyll-pagination-2')) + .withArguments(['--skip-install']) .withPrompt({ - jekyllPermalinks: ["none"], - jekyllPaginate: ["1"], - uploadChoices: ["noUpload"] + jekyllPermalinks: ['none'], + jekyllPaginate: ['1'], + uploadChoices: ['noUpload'] }) - .on("end", done); + .on('end', done); }); - it("_config.yml permalink setting is 'none'", function () { - assert.fileContent("_config.yml", /permalink\: none/); + it('_config.yml permalink setting is "none"', function() { + assert.fileContent('_config.yml', /permalink\: none/); }); - it("_config.yml pagination is '1' posts per page", function () { - assert.fileContent("_config.yml", /paginate\: 1/); + it('_config.yml pagination is "1" posts per page', function() { + assert.fileContent('_config.yml', /paginate\: 1/); }); }); diff --git a/test/test-load.js b/test/test-load.js index 8b49714..dc2b04a 100644 --- a/test/test-load.js +++ b/test/test-load.js @@ -1,11 +1,10 @@ -/*global describe, it*/ -"use strict"; +'use strict'; -var assert = require("assert"); +var assert = require('assert'); -describe("Jekyllized generator", function () { - it("can be imported without blowing up", function () { - var app = require("../app"); +describe('Jekyllized generator', function() { + it('can be imported without blowing up', function() { + var app = require('../app'); assert(app !== undefined); }); }); diff --git a/test/test-package.js b/test/test-package.js index 45f6ccd..75d8154 100644 --- a/test/test-package.js +++ b/test/test-package.js @@ -1,38 +1,37 @@ -/*global describe, before, it*/ -"use strict"; +'use strict'; -var path = require("path"); -var assert = require("assert"); -var helpers = require("yeoman-generator").test; +var path = require('path'); +var assert = require('assert'); +var helpers = require('yeoman-generator').test; -describe("Jekyllized generator test for package.json", function () { - before(function (done) { - helpers.run(path.join(__dirname, "../app")) - .inDir(path.join(__dirname, "./temp/test-package")) - .withArguments(["--skip-install"]) +describe('Jekyllized generator test for package.json', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(__dirname, './temp/test-package')) + .withArguments(['--skip-install']) .withPrompt({ - projectName: ["Package Test"], - projectDescription: ["Package tests for Jekyllized"], - projectTagline: ["Better hope this doesn\"t blow up"], - projectURL: ["testing.com"], - authorName: ["Ola Nordmann"], - authorEmail: ["ola.nordmann@email.com"], - authorBio: ["Just your average Norwegian"], - authorTwitter: ["olanordmann123123"], - jekyllPermalinks: ["pretty"], - jekyllPaginate: ["10"], - uploadChoices: ["noUpload"] + projectName: ['Package Test'], + projectDescription: ['Package tests for Jekyllized'], + projectTagline: ['Better hope this doesn\'t blow up'], + projectURL: ['testing.com'], + authorName: ['Ola Nordmann'], + authorEmail: ['ola.nordmann@email.com'], + authorBio: ['Just your average Norwegian'], + authorTwitter: ['olanordmann123123'], + jekyllPermalinks: ['pretty'], + jekyllPaginate: ['10'], + uploadChoices: ['noUpload'] }) - .on("end", done); + .on('end', done); }); - it("should contain the proper names and version", function () { + it('should contain the proper names and version', function() { var expected = [ - ["package.json", /\"name\"\: \"test-package\"/], - ["package.json", /\"description\"\: \"Yeoman workflow for test package\"/] + ['package.json', /\"name\"\: \"test-package\"/], + ['package.json', /\"description\"\: \"Yeoman workflow for test package\"/] ]; - assert.fileContent(expected); + assert.fileContent(expected); }); }); From a083587c7c1c9823eaf474e0beeb6fb53d34ee34 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 26 Apr 2015 17:25:00 +0200 Subject: [PATCH 012/178] Updated the gulpfile and added trash to clean dirs --- gulpfile.js | 10 ++++++++-- package.json | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 782fc44..6818531 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,6 +7,7 @@ var jshint = require('gulp-jshint'); var istanbul = require('gulp-istanbul'); var plumber = require('gulp-plumber'); var mocha = require('gulp-mocha'); +var trash = require('trash'); var coveralls = require('gulp-coveralls'); var handleErr = function(err) { @@ -32,7 +33,7 @@ gulp.task('check', function() { .on('error', handleErr); }); -gulp.task('test', function(done) { +gulp.task('istanbul', function(done) { return gulp.src([ 'app/index.js', 'gulpfile.js' @@ -50,11 +51,16 @@ gulp.task('test', function(done) { }); }); +gulp.task('clean', function(done) { + trash(['test/temp']); + done(); +}); + gulp.task('coveralls', function() { if (!process.env.CI) { return; } return gulp.src(path.join(__dirname, 'coverage/lcov.info')) .pipe(coveralls()); }); +gulp.task('test', gulp.series('clean', 'istanbul')); gulp.task('default', gulp.series('check', 'coveralls')); -gulp.task('help', gulp.series('test', 'check', 'coveralls')); diff --git a/package.json b/package.json index 731e0ea..acc97d6 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "jshint-stylish": "^1.0.0", "mocha": "^2.2.1", "mocha-lcov-reporter": "0.0.2", + "trash": "^1.4.1", "yo": ">=1.4" }, "engines": { From bf0f1902faf12e44099e428e86bd9b0f63648775 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 19:46:33 +0200 Subject: [PATCH 013/178] Towards Yeoman 0.19 Splitting it all up into smaller generators and update to the next version of Yeoman. --- app/index.js | 273 ---------------- app/templates/Gemfile | 8 - app/templates/_README.md | 3 - app/templates/_bower.json | 5 - app/templates/_config.build.yml | 13 - app/templates/_config.yml | 69 ---- app/templates/_package.json | 48 --- app/templates/app/404.html | 11 - .../app/_drafts/2014-03-01-example-content.md | 157 --------- app/templates/app/_includes/footer.html | 44 --- app/templates/app/_includes/head.html | 21 -- app/templates/app/_includes/header.html | 24 -- .../app/_layouts/category-archive.html | 13 - app/templates/app/_layouts/default.html | 24 -- app/templates/app/_layouts/month-archive.html | 14 - app/templates/app/_layouts/page.html | 13 - app/templates/app/_layouts/post.html | 15 - app/templates/app/_layouts/tag-archive.html | 13 - app/templates/app/_layouts/year-archive.html | 14 - .../_posts/2014-03-03-welcome-to-jekyll.md | 39 --- app/templates/app/about.md | 15 - app/templates/app/assets/favicon.ico | Bin 486 -> 0 bytes .../apple-touch-icon-144-precomposed.png | Bin 1326 -> 0 bytes .../app/assets/javascript/javascript.js | 1 - .../app/assets/javascript/somejavascript.js | 0 app/templates/app/assets/scss/base.scss | 204 ------------ app/templates/app/assets/scss/layout.scss | 236 -------------- app/templates/app/assets/scss/main.scss | 38 --- app/templates/app/assets/scss/style.scss | 8 - .../app/assets/scss/syntax-highlighting.scss | 67 ---- app/templates/app/crossdomain.xml | 15 - app/templates/app/feed.xml | 33 -- app/templates/app/humans.txt | 16 - app/templates/app/index.html | 21 -- app/templates/app/robots.txt | 5 - app/templates/bowerrc | 3 - .../conditionals/_aws-credentials.json | 7 - .../conditionals/_rsync-credentials.json | 5 - app/templates/editorconfig | 13 - app/templates/gitattributes | 1 - app/templates/gitignore | 70 ---- app/templates/gulp.config.json | 36 --- app/templates/gulpfile.js | 300 ------------------ app/templates/jshintrc | 18 -- generators/app/index.js | 24 ++ gulpfile.js | 11 +- package.json | 26 +- test/app.js | 12 + test/test-creation-aws.js | 61 ---- test/test-creation-ghpages.js | 49 --- test/test-creation-rsync.js | 53 ---- test/test-gulp.js | 98 ------ test/test-jekyll.js | 145 --------- test/test-load.js | 10 - test/test-package.js | 37 --- 55 files changed, 44 insertions(+), 2415 deletions(-) delete mode 100644 app/index.js delete mode 100755 app/templates/Gemfile delete mode 100755 app/templates/_README.md delete mode 100755 app/templates/_bower.json delete mode 100644 app/templates/_config.build.yml delete mode 100755 app/templates/_config.yml delete mode 100755 app/templates/_package.json delete mode 100644 app/templates/app/404.html delete mode 100644 app/templates/app/_drafts/2014-03-01-example-content.md delete mode 100644 app/templates/app/_includes/footer.html delete mode 100644 app/templates/app/_includes/head.html delete mode 100644 app/templates/app/_includes/header.html delete mode 100644 app/templates/app/_layouts/category-archive.html delete mode 100644 app/templates/app/_layouts/default.html delete mode 100644 app/templates/app/_layouts/month-archive.html delete mode 100644 app/templates/app/_layouts/page.html delete mode 100644 app/templates/app/_layouts/post.html delete mode 100644 app/templates/app/_layouts/tag-archive.html delete mode 100644 app/templates/app/_layouts/year-archive.html delete mode 100644 app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md delete mode 100644 app/templates/app/about.md delete mode 100644 app/templates/app/assets/favicon.ico delete mode 100644 app/templates/app/assets/images/touch/apple-touch-icon-144-precomposed.png delete mode 100644 app/templates/app/assets/javascript/javascript.js delete mode 100644 app/templates/app/assets/javascript/somejavascript.js delete mode 100644 app/templates/app/assets/scss/base.scss delete mode 100644 app/templates/app/assets/scss/layout.scss delete mode 100644 app/templates/app/assets/scss/main.scss delete mode 100644 app/templates/app/assets/scss/style.scss delete mode 100644 app/templates/app/assets/scss/syntax-highlighting.scss delete mode 100644 app/templates/app/crossdomain.xml delete mode 100644 app/templates/app/feed.xml delete mode 100644 app/templates/app/humans.txt delete mode 100644 app/templates/app/index.html delete mode 100644 app/templates/app/robots.txt delete mode 100644 app/templates/bowerrc delete mode 100644 app/templates/conditionals/_aws-credentials.json delete mode 100644 app/templates/conditionals/_rsync-credentials.json delete mode 100644 app/templates/editorconfig delete mode 100644 app/templates/gitattributes delete mode 100644 app/templates/gitignore delete mode 100644 app/templates/gulp.config.json delete mode 100755 app/templates/gulpfile.js delete mode 100644 app/templates/jshintrc create mode 100644 generators/app/index.js create mode 100644 test/app.js delete mode 100755 test/test-creation-aws.js delete mode 100644 test/test-creation-ghpages.js delete mode 100755 test/test-creation-rsync.js delete mode 100644 test/test-gulp.js delete mode 100644 test/test-jekyll.js delete mode 100644 test/test-load.js delete mode 100644 test/test-package.js diff --git a/app/index.js b/app/index.js deleted file mode 100644 index 3113729..0000000 --- a/app/index.js +++ /dev/null @@ -1,273 +0,0 @@ -'use strict'; -var path = require('path'); -var chalk = require('chalk'); -var yeoman = require('yeoman-generator'); -var yosay = require('yosay'); -var shelljs = require('shelljs'); - -module.exports = yeoman.generators.Base.extend({ - constructor: function() { - yeoman.generators.Base.apply(this, arguments); - - this.option('skip-install', { - desc: 'Whether dependencies should be installed', - defaults: false - }); - - this.option('skip-install-message', { - desc: 'Whether commands run should be shown', - defaults: false - }); - - var dependenciesInstalled = ['bundle', 'ruby'].every(function(depend) { - return shelljs.which(depend); - }); - - if (!dependenciesInstalled) { - this.log('MISSING DEPENDENCIES:' + - '\nEither ' + chalk.white('Ruby') + ' or ' + chalk.white('Bundler') + - ' is not installed or missing from $PATH.' + - '\nMake sure that they are either installed or added to $PATH.'); - shelljs.exit(1); - } - - this.pkg = JSON.parse(this.readFileAsString(path.join - (__dirname, '../package.json'))); - }, - - projectPrompting: function() { - var cb = this.async(); - - this.log(yosay('Time to supercharge your Jekyll development!')); - - this.log(chalk.yellow('\nTell me a little about your project >>')); - - var prompts = [{ - name: 'projectName', - message: 'What is the name of your project?' - }, { - name: 'projectDescription', - message: 'Describe your project for me:' - }, { - name: 'projectTagline', - message: 'What is the tagline for your project?' - }, { - name: 'projectURL', - message: chalk.red('If you are using GH Pages use username.github.io') + - '\nWhat will the URL for your project be?' - }]; - - this.prompt(prompts, function(props) { - this.projectName = props.projectName; - this.projectDescription = props.projectDescription; - this.projectTagline = props.projectTagline; - this.projectURL = props.projectURL; - - cb(); - }.bind(this)); - }, - - authorPrompting: function() { - var cb = this.async(); - - this.log(chalk.yellow('\nNow it\'s time to tell me about you. >>')); - - var prompts = [{ - name: 'authorName', - message: 'What is your name?', - }, { - name: 'authorEmail', - message: 'What is your email?', - }, { - name: 'authorBio', - message: 'Write a short description of yourself:' - }, { - name: 'authorTwitter', - message: 'Your Twitter URL:' - }]; - - this.prompt(prompts, function(props) { - this.authorName = props.authorName; - this.authorEmail = props.authorEmail; - this.authorBio = props.authorBio; - this.authorTwitter = props.authorTwitter; - - cb(); - }.bind(this)); - }, - - jekyllPrompting: function() { - var cb = this.async(); - - this.log(chalk.yellow('\nNow on to set some Jekyll settings: >>') + - chalk.red('\nYou can change all of this later in the _config.yml file')); - - var prompts = [{ - name: 'jekyllPermalinks', - type: 'list', - message: 'Permalink style' + (chalk.red( - '\n pretty: /:year/:month/:day/:title/' + - '\n date: /:year/:month/:day/:title.html' + - '\n none: /:categories/:title.html')) + '\n', - choices: ['pretty', 'date', 'none'] - }, { - name: 'jekyllPaginate', - message: 'How many posts do you want to show on your front page?' + - chalk.red('\nMust be a number or all'), - default: 10, - validate: function(input) { - if (/^[0-9]*$/.test(input)) { - return true; - } - if (/^all*$/i.test(input)) { - return true; - } - return 'Must be a number or all'; - } - }]; - - this.prompt(prompts, function(props) { - this.jekyllPermalinks = props.jekyllPermalinks; - this.jekyllPaginate = props.jekyllPaginate; - - cb(); - }.bind(this)); - }, - - uploadPrompting: function() { - var cb = this.async(); - - this.log(chalk.yellow('\nTime to choose how to upload your site: >>') + - chalk.red('\nNOTE: Take whatever time you need to get these ' + - 'right/fill them in later in eithers credentials file.')); - - var prompts = [{ - name: 'uploadChoices', - type: 'list', - message: 'How would you like to host/upload your site?', - choices: [{ - name: 'Amazon S3 + Cloudfront', - value: 'amazonCloudfrontS3', - }, { - name: 'Rsync', - value: 'rsync', - }, { - name: 'Github Pages', - value: 'githubPages', - }, { - name: 'None', - value: 'noUpload' - }] - }, { - name: 'amazonKey', - message: chalk.yellow('\n\nNow we just need to fill out the detailes ' + - 'needed to configure your site for Amazon S3 and Cloudfront: >>') + - chalk.red('\nNOTE: Take your time to correctly fill these out') + - chalk.red('\nOr leave them blank and') + - chalk.red('\nfill them out later in aws-credentials.json.') + - '\nWhat is your key to AWS?', - when: function(answers) { - return answers.uploadChoices === 'amazonCloudfrontS3'; - } - }, { - name: 'amazonSecret', - message: 'What is your AWS secret?', - when: function(answers) { - return answers.uploadChoices === 'amazonCloudfrontS3'; - } - }, { - name: 'amazonBucket', - message: 'What do you want your S3 bucket to be called?', - when: function(answers) { - return answers.uploadChoices === 'amazonCloudfrontS3'; - } - }, { - name: 'amazonDistID', - message: 'What is the Cloudfront distribution ID?', - when: function(answers) { - return answers.uploadChoices === 'amazonCloudfrontS3'; - } - }, { - name: 'rsyncUsername', - message: chalk.yellow('\n\nNow we just need to fill out the details ' + - 'needed to upload your site via Rsync: >>') + - chalk.red('\nNOTE: Take your time to correctly fill these out') + - chalk.red('\nOr leave them blank and') + - chalk.red('\nfill them out later in rsync-credentials.json.') + - '\nWhat is the username of the user you will be uploading with?', - when: function(answers) { - return answers.uploadChoices === 'rsync'; - } - }, { - name: 'rsyncHostname', - message: chalk.red('\n(eg. example.com or 192.168.1.1)') + - '\nWhat is the hostname?', - when: function(answers) { - return answers.uploadChoices === 'rsync'; - } - }, { - name: 'rsyncDestination', - message: chalk.red('\n(eg. /srv/www/site/public_html)') + - '\nWhere do you want to save the files?', - when: function(answers) { - return answers.uploadChoices === 'rsync'; - } - }]; - - this.prompt(prompts, function(props) { - var features = props.uploadChoices; - - var hasFeature = function(feat) { - return features.indexOf(feat) !== -1; - }; - - this.amazonCloudfrontS3 = hasFeature('amazonCloudfrontS3'); - this.rsync = hasFeature('rsync'); - this.githubPages = hasFeature('githubPages'); - this.noUpload = hasFeature('noUpload'); - - this.amazonKey = props.amazonKey; - this.amazonSecret = props.amazonSecret; - this.amazonBucket = props.amazonBucket; - this.amazonDistID = props.amazonDistID; - - this.rsyncUsername = props.rsyncUsername; - this.rsyncHostname = props.rsyncHostname; - this.rsyncDestination = props.rsyncDestination; - - cb(); - }.bind(this)); - }, - - scaffolding: function() { - this.copy('Gemfile', 'Gemfile'); - this.copy('bowerrc', '.bowerrc'); - this.copy('_bower.json', 'bower.json'); - this.template('_package.json', 'package.json'); - this.template('_config.yml', '_config.yml'); - this.template('_config.build.yml', '_config.build.yml'); - this.template('_README.md', 'README.md'); - this.template('gulpfile.js', 'gulpfile.js'); - this.copy('gulp.config.json', 'gulp.config.json'); - this.copy('gitignore', '.gitignore'); - this.copy('gitattributes', '.gitattributes'); - this.copy('jshintrc', '.jshintrc'); - this.copy('editorconfig', '.editorconfig'); - this.directory('app', 'src'); - - if (this.amazonCloudfrontS3) { - this.template('conditionals/_aws-credentials.json', - 'aws-credentials.json'); - } else if (this.rsync) { - this.template('conditionals/_rsync-credentials.json', - 'rsync-credentials.json'); - } - }, - - install: function() { - this.installDependencies({ - skipInstall: this.options['skip-install'], - skipMessage: this.options['skip-install-message'] - }); - } -}); diff --git a/app/templates/Gemfile b/app/templates/Gemfile deleted file mode 100755 index 91437eb..0000000 --- a/app/templates/Gemfile +++ /dev/null @@ -1,8 +0,0 @@ -source "http://rubygems.org" - -gem 'jekyll' -gem 'redcarpet' - -# jekyll plugins -gem 'jekyll-archives', :git => 'https://github.com/jekyll/jekyll-archives' -gem 'jekyll-sitemap' diff --git a/app/templates/_README.md b/app/templates/_README.md deleted file mode 100755 index bad9b11..0000000 --- a/app/templates/_README.md +++ /dev/null @@ -1,3 +0,0 @@ -# <%= projectName %> - -[Describe the project.] diff --git a/app/templates/_bower.json b/app/templates/_bower.json deleted file mode 100755 index 885d2ad..0000000 --- a/app/templates/_bower.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "<%= _.slugify(appname) %>", - "version": "0.0.0", - "dependencies": {} -} diff --git a/app/templates/_config.build.yml b/app/templates/_config.build.yml deleted file mode 100644 index f2ccf67..0000000 --- a/app/templates/_config.build.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Run during the 'gulp build' command -# Overrides these options in _config.yml - -# Hides your drafts and future posts -future: false -show_drafts: false -# Gives you more accurate related posts -lsi: true -# Removes the upper limit for posts generated -limit_posts: 0 - -source: src -destination: dist diff --git a/app/templates/_config.yml b/app/templates/_config.yml deleted file mode 100755 index bc4e4ff..0000000 --- a/app/templates/_config.yml +++ /dev/null @@ -1,69 +0,0 @@ -# Title, decription, tagline and URL for your site -# Can be used in your theme by calling 'site.title' and so on -title: <%= projectName %> -description: <%= projectDescription %> -tagline: <%= projectTagline %> -url: <%= projectURL %> - -# Used so Jekyll outputs the site correctly so Gulp can do what it wants -source: src -destination: dist -exclude: ['assets'] - -# Same as the title etc for your site but can instead be -# called by using 'site.author.name' and so on -author: - name: <%= authorName %> - email: <%= authorEmail %> - bio: <%= authorBio %> - twitter: <%= authorTwitter %> - -# general setting for Jekyll -googleAnalytics: UA-XXXXX-X - -# _config.build.yml overwrites these options when you run `gulp build` -# Enables future posts (posts with dates in the future) and drafts -future: true -show_drafts: true -# Disables the more accurate related posts for faster generating of the site -lsi: false -# Only make the last 10 posts so generating isn't slow -limit_posts: 10 - -# Permalink structure and pagination options -relative_permalinks: true -permalink: <%= jekyllPermalinks %> -paginate: <%= jekyllPaginate%> -paginate_path: 'page:num' -excerpt_separator: '' - -# Extras for Jekyll -gems: - - jekyll-archives - - jekyll-sitemap - -# Markdown library -markdown: redcarpet -# Markdown library options -redcarpet: - extensions: ['no_intra_emphasis', 'tables', 'fenced_code_blocks', 'autolink', 'smart', - 'strikethrough', 'superscript', 'underline', 'highlight', 'footnotes'] -highlighter: true - -# Settings for archives -jekyll-archives: - enabled: - - year - - month - - categories - - tags - layouts: - year: 'year-archive' - month: 'month-archive' - category: 'category-archive' - tag: 'tag-archive' - permalinks: - year: '/archive/:year/' - month: '/archive/:year/:month/' - category: '/category/:name/' - tags: '/tag/:name/' diff --git a/app/templates/_package.json b/app/templates/_package.json deleted file mode 100755 index 441eba9..0000000 --- a/app/templates/_package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "<%= _.slugify(appname) %>", - "private": true, - "version": "0.0.0", - "description": "Yeoman workflow for <%= appname %>", - "dependencies": {}, - "devDependencies": { - "browser-sync": "^1.5.7",<% if (amazonCloudfrontS3) { %> - "concurrent-transform": "^1.0.0",<% } %> - "del": "^1.1.1", - "gulp": "file:../../../../../var/folders/f1/l2svxmy91tbdk94t9259sq040000gn/T/npm-43577-622ebfd0/git-cache-efb05e57fc27/4dc9eb895b07cd87ea7af0009e2a9197aa21a3a6", - "gulp-autoprefixer": "^2.0.0",<% if (amazonCloudfrontS3) { %> - "gulp-awspublish": "1.0.0", - "gulp-awspublish-router": "0.1.1",<% } %> - "gulp-cache": "~0.2.4", - "gulp-cached": "^1.0.1", - "gulp-changed": "^1.0.0",<% if (amazonCloudfrontS3) { %> - "gulp-cloudfront": "0.0.14",<% } %> - "gulp-filter": "^2.0.0",<% if (githubPages) { %> - "gulp-gh-pages": "^0.4.0",<% } %> - "gulp-group-concat": "^1.1.4", - "gulp-gzip": "0.0.8", - "gulp-htmlmin": "^1.0.0", - "gulp-if": "^1.2.4", - "gulp-imagemin": "^2.1.0", - "gulp-jshint": "^1.8.5", - "gulp-load-plugins": "^0.8.0", - "gulp-minify-css": "^0.4.4", - "gulp-rev-all": "^0.7.5", - "gulp-rev-replace": "^0.3.1",<% if (rsync) { %> - "gulp-rsync": "0.0.2",<% } %> - "gulp-sass": "^1.0.0", - "gulp-shell": "^0.2.9", - "gulp-size": "^1.1.0", - "gulp-sourcemaps": "^1.3.0", - "gulp-uglify": "^1.1.0", - "gulp-uncss": "^1.0.0", - "gulp-useref": "^1.0.2", - "jshint-stylish": "^1.0.0", - "merge-stream": "^0.1.6", - "shelljs": "^0.3.0", - "trash": "^1.4.0" - }, - "engines": { - "node": ">0.10.0" - }, - "scripts": {} -} diff --git a/app/templates/app/404.html b/app/templates/app/404.html deleted file mode 100644 index 46f2d7b..0000000 --- a/app/templates/app/404.html +++ /dev/null @@ -1,11 +0,0 @@ ---- -layout: default -title: "404: Page not found" ---- - -
-

404: Page not found

-

Sorry, we've misplaced that URL or it's pointing to something - that doesn't exist. Head back home to try finding it - again.

-
diff --git a/app/templates/app/_drafts/2014-03-01-example-content.md b/app/templates/app/_drafts/2014-03-01-example-content.md deleted file mode 100644 index fb41e06..0000000 --- a/app/templates/app/_drafts/2014-03-01-example-content.md +++ /dev/null @@ -1,157 +0,0 @@ ---- -layout: post -date: 2014-03-01 -title: Example content -categories: jekyll example ---- - -
Howdy! This is an example blog post that shows several -types of HTML content supported in this theme.
- -Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus mus. *Aenean eu leo quam.* Pellentesque ornare sem lacinia -quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis -consectetur purus sit amet fermentum. - -> Curabitur blandit tempus porttitor. Nullam quis risus eget urna mollis ornare -> vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit. - -Etiam porta **sem malesuada magna** mollis euismod. Cras mattis consectetur -purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur. - - - -## Inline HTML elements - -HTML defines a long list of available inline tags, a complete list of which can -be found on the [Mozilla Developer -Network](https://developer.mozilla.org/en-US/docs/Web/HTML/Element). - -- **To bold text**, use ``. -- *To italicize text*, use ``. -- Abbreviations, like HTML should - use ``, with an optional `title` attribute for the full phrase. -- Citations, like — Mark otto, should use ``. -- Deleted text should use `` and inserted text should - use ``. -- Superscript text uses `` and subscript text uses - ``. - -Most of these elements are styled by browsers with few modifications on our part. - -## Heading - -Vivamus sagittis lacus vel augue rutrum faucibus dolor auctor. Duis mollis, est -non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. -Morbi leo risus, porta ac consectetur ac, vestibulum at eros. - -### Code - -Cum sociis natoque penatibus et magnis dis `code element` montes, nascetur -ridiculus mus. - -{% highlight js %} -// Example can be run directly in your JavaScript console - -// Create a function that takes two arguments and returns the sum of those -arguments var adder = new Function("a", "b", "return a + b"); - -// Call the function -adder(2, 6); -// > 8 -{% endhighlight %} - -Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna -mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris -condimentum nibh, ut fermentum massa. - -### Gists via GitHub Pages - -Vestibulum id ligula porta felis euismod semper. Nullam quis risus eget urna -mollis ornare vel eu leo. Donec sed odio dui. - -{% gist 5555251 gist.md %} - -Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. -Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque -penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec sed -odio dui. Vestibulum id ligula porta felis euismod semper. - -### Lists - -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus -mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada -magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris -condimentum nibh, ut fermentum massa justo sit amet risus. - -* Praesent commodo cursus magna, vel scelerisque nisl consectetur et. -* Donec id elit non mi porta gravida at eget metus. -* Nulla vitae elit libero, a pharetra augue. - -Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a -pharetra augue. - -1. Vestibulum id ligula porta felis euismod semper. -2. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur - ridiculus mus. -3. Maecenas sed diam eget risus varius blandit sit amet non magna. - -Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at -lobortis. - -
-
HyperText Markup Language (HTML)
-
The language used to describe and define the content of a Web page
- -
Cascading Style Sheets (CSS)
-
Used to describe the appearance of Web content
- -
JavaScript (JS)
-
The programming language used to build advanced Web sites and applications
-
- -Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Morbi leo -risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna -mollis ornare vel eu leo. - -### Tables - -Aenean lacinia bibendum nulla sed consectetur. Lorem ipsum dolor sit amet, -consectetur adipiscing elit. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameUpvotesDownvotes
Totals2123
Alice1011
Bob43
Charlie79
- -Nullam id dolor id nibh ultricies vehicula ut id elit. Sed posuere consectetur -est at lobortis. Nullam quis risus eget urna mollis ornare vel eu leo. diff --git a/app/templates/app/_includes/footer.html b/app/templates/app/_includes/footer.html deleted file mode 100644 index 7b7c565..0000000 --- a/app/templates/app/_includes/footer.html +++ /dev/null @@ -1,44 +0,0 @@ - diff --git a/app/templates/app/_includes/head.html b/app/templates/app/_includes/head.html deleted file mode 100644 index 506b7d0..0000000 --- a/app/templates/app/_includes/head.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} - - - - - - - - - - - - - - - diff --git a/app/templates/app/_includes/header.html b/app/templates/app/_includes/header.html deleted file mode 100644 index cedae2c..0000000 --- a/app/templates/app/_includes/header.html +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/app/templates/app/_layouts/category-archive.html b/app/templates/app/_layouts/category-archive.html deleted file mode 100644 index 5875994..0000000 --- a/app/templates/app/_layouts/category-archive.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -layout: default ---- - -

Archive of posts with {{ page.type }} '{{ page.title }}'

-
    - {% for post in page.posts %} -
  • - - {{ post.title }} -
  • - {% endfor %} -
diff --git a/app/templates/app/_layouts/default.html b/app/templates/app/_layouts/default.html deleted file mode 100644 index 7ba65a5..0000000 --- a/app/templates/app/_layouts/default.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - {% include head.html %} - - - - {% include header.html %} - -
-
- {{ content }} -
-
- - {% include footer.html %} - - - - - - - - diff --git a/app/templates/app/_layouts/month-archive.html b/app/templates/app/_layouts/month-archive.html deleted file mode 100644 index a42bd21..0000000 --- a/app/templates/app/_layouts/month-archive.html +++ /dev/null @@ -1,14 +0,0 @@ ---- -layout: default ---- - -

Archive of posts from {{ page.date | date: "%B %Y" }}

- -
    -{% for post in page.posts %} -
  • - - {{ post.title }} -
  • -{% endfor %} -
diff --git a/app/templates/app/_layouts/page.html b/app/templates/app/_layouts/page.html deleted file mode 100644 index f375cc4..0000000 --- a/app/templates/app/_layouts/page.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -layout: default ---- -
- -
-

{{ page.title }}

-
- -
- {{ content }} -
-
diff --git a/app/templates/app/_layouts/post.html b/app/templates/app/_layouts/post.html deleted file mode 100644 index d4f8be3..0000000 --- a/app/templates/app/_layouts/post.html +++ /dev/null @@ -1,15 +0,0 @@ ---- -layout: default ---- -
- -
-

{{ page.title }}

- -
- -
- {{ content }} -
- -
diff --git a/app/templates/app/_layouts/tag-archive.html b/app/templates/app/_layouts/tag-archive.html deleted file mode 100644 index 5875994..0000000 --- a/app/templates/app/_layouts/tag-archive.html +++ /dev/null @@ -1,13 +0,0 @@ ---- -layout: default ---- - -

Archive of posts with {{ page.type }} '{{ page.title }}'

-
    - {% for post in page.posts %} -
  • - - {{ post.title }} -
  • - {% endfor %} -
diff --git a/app/templates/app/_layouts/year-archive.html b/app/templates/app/_layouts/year-archive.html deleted file mode 100644 index 1884340..0000000 --- a/app/templates/app/_layouts/year-archive.html +++ /dev/null @@ -1,14 +0,0 @@ ---- -layout: default ---- - -

Archive of posts from {{ page.date | date: "%Y" }}

- -
    -{% for post in page.posts %} -
  • - - {{ post.title }} -
  • -{% endfor %} -
diff --git a/app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md b/app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md deleted file mode 100644 index b4aa00e..0000000 --- a/app/templates/app/_posts/2014-03-03-welcome-to-jekyll.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -layout: post -date: 2015-02-03 -title: Welcome to Jekyll! -categories: jekyll ---- - -You'll find this post in your `_posts` directory - edit this post and re-build -(or run with the `-w` switch) to see your changes! To add new posts, simply add -a file in the `_posts` directory that follows the convention: -YYYY-MM-DD-name-of-post.ext. - - - -We've also added a lot of different settings for [Redcarpet][redcarpet], -including being able to ^superscript, _underline_, ==highlight==, -~~strikethrough~~, and footnotes.[^1] It even automatically makes links into -URLs: www.jekyllrb.com and you can put multiple underscores in words without -them leaning all over the place: this_word_has_underscores. It'll also make your -quotes look nice, like this: "hoho", your dashes and hypens will be dashing too: ----/--. - -Jekyll also offers powerful support for code snippets: - -{% highlight ruby %} -def print_hi(name) - puts "Hi, #{name}" -end -print_hi('Tom') -#=> prints 'Hi, Tom' to STDOUT. -{% endhighlight %} - -Check out the [Jekyll docs][jekyll] for more info on how to get the most out of -Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh]. - -[redcarpet]: https://github.com/vmg/redcarpet -[jekyll-gh]: https://github.com/jekyll/jekyll -[jekyll]: http://jekyllrb.com/docs/home/ -[^1]: Who are quite handy diff --git a/app/templates/app/about.md b/app/templates/app/about.md deleted file mode 100644 index 0b8de1d..0000000 --- a/app/templates/app/about.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -layout: page -title: About -permalink: /about/ ---- - -This is the base Jekyll theme. You can find out more info about customizing your -Jekyll theme, as well as basic Jekyll usage documentation at -[jekyllrb.com](http://jekyllrb.com/) - -You can find the source code for the Jekyll new theme at: -[github.com/jglovier/jekyll-new](https://github.com/jglovier/jekyll-new) - -You can find the source code for Jekyll at -[github.com/jekyll/jekyll](https://github.com/jekyll/jekyll) diff --git a/app/templates/app/assets/favicon.ico b/app/templates/app/assets/favicon.ico deleted file mode 100644 index 34b42063d5e65cf11a2f3ce3e9e04190a3d4e41c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 486 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WI14-?i-EKU7`vU!wgU;46*#5? zX$3HD|21bW0|R5Ir;B5V$MNKl%NJ4?s3t60`Es!s4;Obtf#;7MyTAFpII8;l$;Zi) zkNeA6m%aJ1@^b$D`UA;~n>Tb=lqt`%+g7~U0i{Foaa;NLXEn3EE_ikOQYHLAWcsjq{R2`R@?992nUwL?Vv{s$^)y5_;QN4fu zl<8p)itJ8`v9z-uKHDlH`kPPg-?zu?a=J?*8P1v&fB0#!43y85}Sb4q9e0JR&<;Q#;t diff --git a/app/templates/app/assets/images/touch/apple-touch-icon-144-precomposed.png b/app/templates/app/assets/images/touch/apple-touch-icon-144-precomposed.png deleted file mode 100644 index 177bbae293f6578146a9f604aedb799885ae75c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1326 zcmZ`(eKgYx82+&xR7Oa?j+3NP-Cd%)^yOU8|8&mtzR!7|^ZxPv@jP$AFDLvU8*MiN z000T__d)CU`qwhj*Yz__8EPHbq$4rup{a!QEF1|B98E}#!#e~Jafx^|9+yB)`wQ;@ z0N}m=pQB+HBnnxs|BXa|H!n5FD0i}+V%KwDiC&gC$jl{8v|G43QIaIk?E$i=pdr>d zkprcL*x^HP7PiM+Pi2l1HPtXKIiGGLf0QZP2IC0Vs++d=7(kXfA%^bgD&aI)J+7|M zUjN9S^F*jMFJ+n?+vlDmL!C1zd5wUp{xtw}4cNic!N^qyedF&)?qrv)!PwVs#D9dd zv+`9j_8pP8E1VFSbid1urADDRJ&lom>p3~vfj3so?1odMjRZpx^iin#aAIoA;w|?>ynx3d+HBBfj z_w!*F#R`a;9n9Ka-B3F>FK-Xx&TM|@)GOuGb1uj(l9D~3wPhmw6vc|MLE;i>JJZjcEeT@D;o>4XST05W{HB$QZ96y_`Ml;s zPZ2wA&**+`HgCmq0B}DNJ5c77$*YmBK31 zZaSM3W{n)&_acn89KA-X)6PW1F#smFGsnNj{H%NZgv+T2W9C37EQlFk%1#@m)xohf zB2Vq_Xv)gfvAsa3tV#TsSXZ^r9ZaOK(JXMayI@MonZ-tNIWw`Y~Xz zZ>AS-Y>nN&6-zb4f~~P&=ESpxhAD%<+`}MDnCPyiaALAYzaDeIZ4mvi zS9mZcH*TdrmbypD%Xz%GxHdnr)8x+0@aFiI#iX{Hn#lP@wo$3cu%%t{%D5%isHAm;(N0^$C1CwQ)P~=gOzbq z;T^eQikcOzR7T|I=liaQ`10@-;)sphGO)nmuQC4+y$eW?c%U4a~uk02lVo*{JT(IKt zy~uqFrnA6!k=NM6c?mZWmqJ-qJJ)+G<~Rr32UH z6*46UFgwk$RC;qs2hGO7TF;lNgV{G9SnK^Kef7ovXWiC;JgpfPum~yX5FDvd>K-5v NfIQ*z=P~T1e*tcge%Js2 diff --git a/app/templates/app/assets/javascript/javascript.js b/app/templates/app/assets/javascript/javascript.js deleted file mode 100644 index 940a3ff..0000000 --- a/app/templates/app/assets/javascript/javascript.js +++ /dev/null @@ -1 +0,0 @@ -console.log("Hello world!"); diff --git a/app/templates/app/assets/javascript/somejavascript.js b/app/templates/app/assets/javascript/somejavascript.js deleted file mode 100644 index e69de29..0000000 diff --git a/app/templates/app/assets/scss/base.scss b/app/templates/app/assets/scss/base.scss deleted file mode 100644 index e5fd0fd..0000000 --- a/app/templates/app/assets/scss/base.scss +++ /dev/null @@ -1,204 +0,0 @@ -/** - * Reset some basic elements - */ -body, h1, h2, h3, h4, h5, h6, -p, blockquote, pre, hr, -dl, dd, ol, ul, figure { - margin: 0; - padding: 0; -} - - - -/** - * Basic styling - */ -body { - font-family: $base-font-family; - font-size: $base-font-size; - line-height: $base-line-height; - font-weight: 300; - color: $text-color; - background-color: $background-color; - -webkit-text-size-adjust: 100%; -} - - - -/** - * Set `margin-bottom` to maintain vertical rhythm - */ -h1, h2, h3, h4, h5, h6, -p, blockquote, pre, -ul, ol, dl, figure, -%vertical-rhythm { - margin-bottom: $spacing-unit / 2; -} - - - -/** - * Images - */ -img { - max-width: 100%; - vertical-align: middle; -} - - - -/** - * Figures - */ -figure > img { - display: block; -} - -figcaption { - font-size: $small-font-size; -} - - - -/** - * Lists - */ -ul, ol { - margin-left: $spacing-unit; -} - -li { - > ul, - > ol { - margin-bottom: 0; - } -} - - - -/** - * Headings - */ -h1, h2, h3, h4, h5, h6 { - font-weight: 300; -} - - - -/** - * Links - */ -a { - color: $brand-color; - text-decoration: none; - - &:visited { - color: darken($brand-color, 15%); - } - - &:hover { - color: $text-color; - text-decoration: underline; - } -} - - - -/** - * Blockquotes - */ -blockquote { - color: $grey-color; - border-left: 4px solid $grey-color-light; - padding-left: $spacing-unit / 2; - font-size: 18px; - letter-spacing: -1px; - font-style: italic; - - > :last-child { - margin-bottom: 0; - } -} - - - -/** - * Code formatting - */ -pre, -code { - font-size: 15px; - border: 1px solid $grey-color-light; - border-radius: 3px; - background-color: #eef; -} - -code { - padding: 1px 5px; -} - -pre { - padding: 8px 12px; - overflow-x: scroll; - - > code { - border: 0; - padding-right: 0; - padding-left: 0; - } -} - - - -/** - * Wrapper - */ -.wrapper { - max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2)); - max-width: calc(#{$content-width} - (#{$spacing-unit} * 2)); - margin-right: auto; - margin-left: auto; - padding-right: $spacing-unit; - padding-left: $spacing-unit; - @extend %clearfix; - - @include media-query($on-laptop) { - max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit})); - max-width: calc(#{$content-width} - (#{$spacing-unit})); - padding-right: $spacing-unit / 2; - padding-left: $spacing-unit / 2; - } -} - - - -/** - * Clearfix - */ -%clearfix { - - &:after { - content: ""; - display: table; - clear: both; - } -} - - - -/** - * Icons - */ -.icon { - - > svg { - display: inline-block; - width: 16px; - height: 16px; - vertical-align: middle; - - path { - fill: $grey-color; - } - } -} diff --git a/app/templates/app/assets/scss/layout.scss b/app/templates/app/assets/scss/layout.scss deleted file mode 100644 index 3f9ff42..0000000 --- a/app/templates/app/assets/scss/layout.scss +++ /dev/null @@ -1,236 +0,0 @@ -/** - * Site header - */ -.site-header { - border-top: 5px solid $grey-color-dark; - border-bottom: 1px solid $grey-color-light; - min-height: 56px; - - // Positioning context for the mobile navigation icon - position: relative; -} - -.site-title { - font-size: 26px; - line-height: 56px; - letter-spacing: -1px; - margin-bottom: 0; - float: left; - - &, - &:visited { - color: $grey-color-dark; - } -} - -.site-nav { - float: right; - line-height: 56px; - - .menu-icon { - display: none; - } - - .page-link { - color: $text-color; - line-height: $base-line-height; - - // Gaps between nav items, but not on the last one - &:not(:last-child) { - margin-right: 20px; - } - } - - @include media-query($on-palm) { - position: absolute; - top: 9px; - right: $spacing-unit / 2; - background-color: $background-color; - border: 1px solid $grey-color-light; - border-radius: 5px; - text-align: right; - - .menu-icon { - display: block; - float: right; - width: 36px; - height: 26px; - line-height: 0; - padding-top: 10px; - text-align: center; - - > svg { - width: 18px; - height: 15px; - - path { - fill: $grey-color-dark; - } - } - } - - .trigger { - clear: both; - display: none; - } - - &:hover .trigger { - display: block; - padding-bottom: 5px; - } - - .page-link { - display: block; - padding: 5px 10px; - } - } -} - - - -/** - * Site footer - */ -.site-footer { - border-top: 1px solid $grey-color-light; - padding: $spacing-unit 0; -} - -.footer-heading { - font-size: 18px; - margin-bottom: $spacing-unit / 2; -} - -.contact-list, -.social-media-list { - list-style: none; - margin-left: 0; -} - -.footer-col-wrapper { - font-size: 15px; - color: $grey-color; - margin-left: -$spacing-unit / 2; - @extend %clearfix; -} - -.footer-col { - float: left; - margin-bottom: $spacing-unit / 2; - padding-left: $spacing-unit / 2; -} - -.footer-col-1 { - width: -webkit-calc(35% - (#{$spacing-unit} / 2)); - width: calc(35% - (#{$spacing-unit} / 2)); -} - -.footer-col-2 { - width: -webkit-calc(20% - (#{$spacing-unit} / 2)); - width: calc(20% - (#{$spacing-unit} / 2)); -} - -.footer-col-3 { - width: -webkit-calc(45% - (#{$spacing-unit} / 2)); - width: calc(45% - (#{$spacing-unit} / 2)); -} - -@include media-query($on-laptop) { - .footer-col-1, - .footer-col-2 { - width: -webkit-calc(50% - (#{$spacing-unit} / 2)); - width: calc(50% - (#{$spacing-unit} / 2)); - } - - .footer-col-3 { - width: -webkit-calc(100% - (#{$spacing-unit} / 2)); - width: calc(100% - (#{$spacing-unit} / 2)); - } -} - -@include media-query($on-palm) { - .footer-col { - float: none; - width: -webkit-calc(100% - (#{$spacing-unit} / 2)); - width: calc(100% - (#{$spacing-unit} / 2)); - } -} - - - -/** - * Page content - */ -.page-content { - padding: $spacing-unit 0; -} - -.page-heading { - font-size: 20px; -} - -.post-list { - margin-left: 0; - list-style: none; - - > li { - margin-bottom: $spacing-unit; - } -} - -.post-meta { - font-size: $small-font-size; - color: $grey-color; -} - -.post-link { - display: block; - font-size: 24px; -} - - - -/** - * Posts - */ -.post-header { - margin-bottom: $spacing-unit; -} - -.post-title { - font-size: 42px; - letter-spacing: -1px; - line-height: 1; - - @include media-query($on-laptop) { - font-size: 36px; - } -} - -.post-content { - margin-bottom: $spacing-unit; - - h2 { - font-size: 32px; - - @include media-query($on-laptop) { - font-size: 28px; - } - } - - h3 { - font-size: 26px; - - @include media-query($on-laptop) { - font-size: 22px; - } - } - - h4 { - font-size: 20px; - - @include media-query($on-laptop) { - font-size: 18px; - } - } -} diff --git a/app/templates/app/assets/scss/main.scss b/app/templates/app/assets/scss/main.scss deleted file mode 100644 index 0e4f004..0000000 --- a/app/templates/app/assets/scss/main.scss +++ /dev/null @@ -1,38 +0,0 @@ -@charset "utf-8"; - -// Our variables - -$base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -$base-font-size: 16px; -$base-font-weight: 300; -$small-font-size: $base-font-size * 0.875; -$base-line-height: 1.5; - -$spacing-unit: 30px; - -$text-color: #111; -$background-color: #fdfdfd; -$brand-color: #2a7ae2; - -$grey-color: #828282; -$grey-color-light: lighten($grey-color, 40%); -$grey-color-dark: darken($grey-color, 25%); - -// Width of the content area -$content-width: 800px; - -$on-palm: 600px; -$on-laptop: 800px; - -// Using media queries with like this: -// @include media-query($on-palm) { -// .wrapper { -// padding-right: $spacing-unit / 2; -// padding-left: $spacing-unit / 2; -// } -// } -@mixin media-query($device) { - @media screen and (max-width: $device) { - @content; - } -} diff --git a/app/templates/app/assets/scss/style.scss b/app/templates/app/assets/scss/style.scss deleted file mode 100644 index f265500..0000000 --- a/app/templates/app/assets/scss/style.scss +++ /dev/null @@ -1,8 +0,0 @@ -/* -The main SCSS file for everything, yep -*/ - -@import "main"; -@import "base"; -@import "layout"; -@import "syntax-highlighting"; diff --git a/app/templates/app/assets/scss/syntax-highlighting.scss b/app/templates/app/assets/scss/syntax-highlighting.scss deleted file mode 100644 index e36627d..0000000 --- a/app/templates/app/assets/scss/syntax-highlighting.scss +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Syntax highlighting styles - */ -.highlight { - background: #fff; - @extend %vertical-rhythm; - - .c { color: #998; font-style: italic } // Comment - .err { color: #a61717; background-color: #e3d2d2 } // Error - .k { font-weight: bold } // Keyword - .o { font-weight: bold } // Operator - .cm { color: #998; font-style: italic } // Comment.Multiline - .cp { color: #999; font-weight: bold } // Comment.Preproc - .c1 { color: #998; font-style: italic } // Comment.Single - .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special - .gd { color: #000; background-color: #fdd } // Generic.Deleted - .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific - .ge { font-style: italic } // Generic.Emph - .gr { color: #a00 } // Generic.Error - .gh { color: #999 } // Generic.Heading - .gi { color: #000; background-color: #dfd } // Generic.Inserted - .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific - .go { color: #888 } // Generic.Output - .gp { color: #555 } // Generic.Prompt - .gs { font-weight: bold } // Generic.Strong - .gu { color: #aaa } // Generic.Subheading - .gt { color: #a00 } // Generic.Traceback - .kc { font-weight: bold } // Keyword.Constant - .kd { font-weight: bold } // Keyword.Declaration - .kp { font-weight: bold } // Keyword.Pseudo - .kr { font-weight: bold } // Keyword.Reserved - .kt { color: #458; font-weight: bold } // Keyword.Type - .m { color: #099 } // Literal.Number - .s { color: #d14 } // Literal.String - .na { color: #008080 } // Name.Attribute - .nb { color: #0086B3 } // Name.Builtin - .nc { color: #458; font-weight: bold } // Name.Class - .no { color: #008080 } // Name.Constant - .ni { color: #800080 } // Name.Entity - .ne { color: #900; font-weight: bold } // Name.Exception - .nf { color: #900; font-weight: bold } // Name.Function - .nn { color: #555 } // Name.Namespace - .nt { color: #000080 } // Name.Tag - .nv { color: #008080 } // Name.Variable - .ow { font-weight: bold } // Operator.Word - .w { color: #bbb } // Text.Whitespace - .mf { color: #099 } // Literal.Number.Float - .mh { color: #099 } // Literal.Number.Hex - .mi { color: #099 } // Literal.Number.Integer - .mo { color: #099 } // Literal.Number.Oct - .sb { color: #d14 } // Literal.String.Backtick - .sc { color: #d14 } // Literal.String.Char - .sd { color: #d14 } // Literal.String.Doc - .s2 { color: #d14 } // Literal.String.Double - .se { color: #d14 } // Literal.String.Escape - .sh { color: #d14 } // Literal.String.Heredoc - .si { color: #d14 } // Literal.String.Interpol - .sx { color: #d14 } // Literal.String.Other - .sr { color: #009926 } // Literal.String.Regex - .s1 { color: #d14 } // Literal.String.Single - .ss { color: #990073 } // Literal.String.Symbol - .bp { color: #999 } // Name.Builtin.Pseudo - .vc { color: #008080 } // Name.Variable.Class - .vg { color: #008080 } // Name.Variable.Global - .vi { color: #008080 } // Name.Variable.Instance - .il { color: #099 } // Literal.Number.Integer.Long -} diff --git a/app/templates/app/crossdomain.xml b/app/templates/app/crossdomain.xml deleted file mode 100644 index 29a035d..0000000 --- a/app/templates/app/crossdomain.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - diff --git a/app/templates/app/feed.xml b/app/templates/app/feed.xml deleted file mode 100644 index 0a8d4d9..0000000 --- a/app/templates/app/feed.xml +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: null -regenerate: true -permalink: /feed ---- - - - - <![CDATA[{{ site.title }}]]> - - {{ site.url }} - Jekyll - {{ site.time | date_to_rfc822 }} - - {% for post in site.posts limit:10 %} - - <![CDATA[{{ post.title }}]]> - {% if post.excerpt %} - - {% else %} - - {% endif %} - - {{ post.date | date_to_rfc822 }} - {{ site.url }}{{ post.url }} - {{ site.url }}{{ post.url }} - - {% endfor %} - - diff --git a/app/templates/app/humans.txt b/app/templates/app/humans.txt deleted file mode 100644 index 9955e38..0000000 --- a/app/templates/app/humans.txt +++ /dev/null @@ -1,16 +0,0 @@ -# humanstxt.org/ -# The humans responsible & technology colophon - -# TEAM - - <%= authorName %> -- -- @<%= authorTwitter %> - -# THANKS - - - -# TECHNOLOGY COLOPHON - - HTML5, CSS3, JavaScript - Jekyll, Lanyon/Poole, HTML5 Boilerplate - Yeoman, Jekyllized diff --git a/app/templates/app/index.html b/app/templates/app/index.html deleted file mode 100644 index 8f1f40a..0000000 --- a/app/templates/app/index.html +++ /dev/null @@ -1,21 +0,0 @@ ---- -layout: default -regenerate: true ---- -
-

Posts

- -
    - {% for post in site.posts %} -
  • - - -

    - {{ post.title }} -

    -
  • - {% endfor %} -
- -

subscribe via RSS

-
diff --git a/app/templates/app/robots.txt b/app/templates/app/robots.txt deleted file mode 100644 index d0e5f1b..0000000 --- a/app/templates/app/robots.txt +++ /dev/null @@ -1,5 +0,0 @@ -# www.robotstxt.org/ - -# Allow crawling of all content -User-agent: * -Disallow: diff --git a/app/templates/bowerrc b/app/templates/bowerrc deleted file mode 100644 index f79669e..0000000 --- a/app/templates/bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "src/_bower_components" -} diff --git a/app/templates/conditionals/_aws-credentials.json b/app/templates/conditionals/_aws-credentials.json deleted file mode 100644 index 7a16e0c..0000000 --- a/app/templates/conditionals/_aws-credentials.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "key": "<%= amazonKey %>", - "secret": "<%= amazonSecret %>", - "bucket": "<%= amazonBucket %>", - "region": "us-west-1", - "distributionId": "<%= amazonDistID %>" -} diff --git a/app/templates/conditionals/_rsync-credentials.json b/app/templates/conditionals/_rsync-credentials.json deleted file mode 100644 index 37fcc84..0000000 --- a/app/templates/conditionals/_rsync-credentials.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "username": "<%= rsyncUsername %>", - "hostname": "<%= rsyncHostname %>", - "destination": "<%= rsyncDestination %>" -} diff --git a/app/templates/editorconfig b/app/templates/editorconfig deleted file mode 100644 index 8f6cc4f..0000000 --- a/app/templates/editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# http://editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false \ No newline at end of file diff --git a/app/templates/gitattributes b/app/templates/gitattributes deleted file mode 100644 index 2125666..0000000 --- a/app/templates/gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto \ No newline at end of file diff --git a/app/templates/gitignore b/app/templates/gitignore deleted file mode 100644 index 1ac3139..0000000 --- a/app/templates/gitignore +++ /dev/null @@ -1,70 +0,0 @@ -# .gitignore for jekyllized projects - -# Ignore hidden folders -# This takes care of .tmp, .sass-cache, and many others -.*/ - -# OSX -._* -.AppleDouble -.DS_Store -.localized -.LSOverride -.Spotlight-V100 -.Trashes -Icon - -# Windows -Desktop.ini -ehthumbs.db -Thumbs.db - -# Linux -*~ - -# Tags -# Ignore tags created by etags and ctags -TAGS -tags - -# Always-ignore files and folders # -*.diff -*.err -*.log -*.orig -*.rej -*.swn -*.swo -*.swp -._* -*~ - -# Ignore packages # -*.7z -*.dmg -*.gz -*.iso -*.jar -*.rar -*.tar -*.zip - -# Packages -node_modules/* -.tmp -test/ - -# Sublime -*.sublime-project -*.sublime-workspace -*.sublime-projectcompletions - -app/_bower_components - -# Output folders -serve -site - -# hide the AWS and Rsync credentials file -aws-credentials.json -rsync-credentials.json diff --git a/app/templates/gulp.config.json b/app/templates/gulp.config.json deleted file mode 100644 index 1736ee5..0000000 --- a/app/templates/gulp.config.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "site": { - "src": "src", - "dest": "dist" - }, - "scss": { - "src": "src/assets/scss/style.scss", - "dest": ".tmp/assets/stylesheets/" - }, - "javascript": { - "src": "src/assets/javascript/*.js", - "dest": ".tmp/assets/javascript/" - }, - "images": { - "src": "src/assets/images/**/*", - "dest": ".tmp/assets/images/", - "build": "dist/assets/images/" - }, - "fonts": { - "src": "src/assets/fonts/**", - "dest": ".tmp/assets/fonts/", - "build": "dist/assets/fonts" - }, - "assets": { - "searchPath": ["dist", ".tmp"], - "html": "dist/**/*.html", - "dest": "dist" - }, - "watch": { - "baseDir": ["dist", ".tmp"], - "content": ["src/**/*.md", "src/**/*.html", "src/**/*.xml", "src/**/*.txt", "src/**/*.yml"], - "javascript": "src/assets/javascript/**/*.js", - "scss": "src/assets/scss/**/*.scss", - "images": "src/assets/images/**/*" - } -} diff --git a/app/templates/gulpfile.js b/app/templates/gulpfile.js deleted file mode 100755 index 7643154..0000000 --- a/app/templates/gulpfile.js +++ /dev/null @@ -1,300 +0,0 @@ -// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %> -'use strict'; - -var gulp = require('gulp'); -// Load in paths from a external config file for easier changing of paths -var config = require('./gulp.config.json'); -// Loads the plugins without having to list all of them, but you need -// to call them as $.pluginname -var $ = require('gulp-load-plugins')(); -// 'trash' is used to clean out directories and such -var trash = require('trash'); -// Used to run shell commands -var shell = require('shelljs'); -<% if (amazonCloudfrontS3) { %>// Parallelize the uploads when uploading to Amazon S3 -// 'fs' is used to read files from the system (used for AWS uploading) -var fs = require('fs'); -var parallelize = require('concurrent-transform'); -<% } %>// BrowserSync is used to live-reload your website -var browserSync = require('browser-sync'); -var reload = browserSync.reload; -// merge is used to merge the output from two different streams into the same stream -var merge = require('merge-stream'); - -// Deletes the directory that the optimized site is output to -function cleanDist(done) { trash(['dist']); done(); } -function cleanAssets(done) { trash(['.tmp']); done(); } -function rebuild(done) { trash(['src/.jekyll-metadata']); done(); } // so Jekyll rebuilds the site properly - -// Runs the build command for Jekyll to compile the site locally -// This will build the site with the production settings -function jekyllDev(done) { shell.exec('jekyll build --quiet'); done(); } - -// Almost identical to the above task, but instead we load in the build configuration -// that overwrites some of the settings in the regular configuration so that you -// don't end up publishing your drafts or future posts -function jekyllProd(done) { - shell.exec('jekyll build --quiet --config _config.yml,_config.build.yml'); - done(); -} - -// Compiles the SASS files and moves them into the 'assets/stylesheets' directory -function styles() { - // Looks at the style.scss file for what to include and creates a style.css file - return gulp.src(config.scss.src) - // Start creation of sourcemaps - .pipe($.sourcemaps.init()) - .pipe($.sass({errLogToconsole: true})) - // AutoPrefix your CSS so it works between browsers - .pipe($.autoprefixer('last 1 version', {cascade: true})) - // Write the sourcemaps to the directory of the gulp.src stream - .pipe($.sourcemaps.write('.')) - // Directory your CSS file goes to - .pipe(gulp.dest(config.scss.dest)) - // Outputs the size of the CSS file - .pipe($.size({title: 'styles'})) - // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS - .pipe(reload({stream: true})); -} - -// Mostly used to create sourcemaps and live-reload JS -function javascript() { - return gulp.src(config.javascript.src) - .pipe($.sourcemaps.init()) - .pipe($.uglify({compress: false, preserveComments: 'all'})) - .pipe($.groupConcat({ - 'index.js': config.javascript.src - })) - .pipe($.sourcemaps.write('.')) - .pipe(gulp.dest(config.javascript.dest)) - .pipe($.size({title: 'javascript'})) - .pipe(reload({stream: true})); -} - -// Optimizes the images that exists -function images() { - return gulp.src(config.images.src) - // Does not run on images that are already optimized - .pipe($.cache($.imagemin({ - // Lossless conversion to progressive JPGs - progressive: true, - // Interlace GIFs for progressive rendering - interlaced: true - }))) - .pipe(gulp.dest(config.images.dest)) - .pipe($.size({title: 'images'})); -} - -// Copy over fonts to the '.tmp' directory -function fonts() { - return gulp.src(config.fonts.src) - .pipe(gulp.dest(config.fonts.dest)) - .pipe($.size({title: 'fonts'})); -} - -// Copy optimized images and (not optimized) fonts to the 'dist' folder -function copy() { - var images = gulp.src(config.images.dest) - .pipe(gulp.dest(config.images.build)) - .pipe($.size({title: 'copied images'})); - - var fonts = gulp.src(config.fonts.dest) - .pipe(gulp.dest(config.fonts.build)) - .pipe($.size({title: 'copied fonts'})); - - return merge(images, fonts); -} - -// Optimizes all the CSS, HTML and concats the JS etc -function optimize() { - var assets = $.useref.assets({searchPath: config.assets.searchPath}); - - return gulp.src(config.assets.html) - .pipe(assets) - // Concatenate JavaScript files and preserve important comments - .pipe($.if('*.js', $.uglify({preserveComments: 'some'}))) - // Minify CSS - .pipe($.if('*.css', $.minifyCss())) - // Start cache busting the files - .pipe($.revAll({ - quiet: true, - ignore: ['.eot', '.svg', '.ttf', '.woff', '.woff2'] - })) - .pipe(assets.restore()) - // Conctenate your files based on what you specified in _layout/header.html - .pipe($.useref()) - // Replace the asset names with their cache busted names - .pipe($.revReplace()) - // Minify HTML - .pipe($.if('*.html', $.htmlmin({ - removeComments: true, - removeCommentsFromCDATA: true, - removeCDATASectionsFromCDATA: true, - collapseWhitespace: true, - collapseBooleanAttributes: true, - removeAttributeQuotes: true, - removeRedundantAttributes: true - }))) - // Send the output to the correct folder - .pipe(gulp.dest(config.assets.dest)) - .pipe($.size({title: 'optimizations'})); -}<% if (amazonCloudfrontS3) { %> - -// Task to deploy your site to Amazon S3 and Cloudfront -function deploy() { - // Generate the needed credentials (bucket, secret key etc) from a 'hidden' JSON file - var credentials = JSON.parse(fs.readFileSync('aws-credentials.json', 'utf8')); - var publisher = $.awspublish.create(credentials); - // Give your files the proper headers - - gulp.src('dist/**/*') - .pipe($.awspublishRouter({ - routes: { - '^assets/(?:.+)\\.(?:js|css)$': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=315360000, no-transform, public', - 'Content-Encoding': 'gzip' - } - }, - - '^assets/(?:.+)\\.(?:jpg|png|gif)$': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=315360000, no-transform, public', - 'Content-Encoding': 'gzip' - } - }, - - '^assets/fonts/(?:.+)\\.(?:eot|svg|ttf|woff)$': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=315360000, no-transform, public' - } - }, - - '^.+\\.html': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=0, no-transform, public', - 'Content-Encoding': 'gzip' - } - }, - '^.+$': '$&' - } - })) - // Gzip the files for moar speed - .pipe($.awspublish.gzip()) - // Parallelize the number of concurrent uploads, in this case 30 - .pipe(parallelize(publisher.publish(), 30)) - // Have your files in the system cache so you don't have to recheck all the files every time - .pipe(publisher.cache()) - // Synchronize the contents of the bucket and local (this deletes everything that isn't in local!) - .pipe(publisher.sync()) - // And print the ouput, glorious - .pipe($.awspublish.reporter()) - // And update the default root object - .pipe($.cloudfront(credentials)); -}<% } %><% if (rsync) { %> - -// Task to upload your site via Rsync to your server -function deploy() { - // Load in the variables needed for our Rsync synchronization - var secret = require('./rsync-credentials.json'); - - return gulp.src('dist/**') - .pipe($.rsync({ - // This uploads the contenst of 'root', instead of the folder - root: 'dist', - // Find your username, hostname and destination from your rsync-credentials.json - hostname: secret.hostname, - username: secret.username, - destination: secret.destination, - // Incremental uploading, adds a small delay but minimizes the amount of files transferred - incremental: true, - // Shows the progress on your files while uploading - progress: true - })); -}<% } %><% if (githubPages) { %> - -// Task to upload your site to your personal GH Pages repo -function deploy() { - // Deploys your optimized site, you can change the settings in the html task if you want to - return gulp.src('dist/**/*') - .pipe($.ghPages({ - // Currently only personal GitHub Pages are supported so it will upload to the master - // branch and automatically overwrite anything that is in the directory - branch: 'master' - })); -}<% } %> - -// Run JS Lint against your JS -function jslint() { - gulp.src(config.javascript.dest) - // Checks your JS code quality against your .jshintrc file - .pipe($.jshint('.jshintrc')) - .pipe($.jshint.reporter()); -} - -// Runs 'jekyll doctor' on your site to check for errors with your configuration -// and will check for URL errors a well -function doctor(done) { shell.exec('jekyll doctor'); done(); } - -// BrowserSync will serve our site on a local server for us and other devices to use -// It will also autoreload across all devices as well as keep the viewport synchronized -// between them. -function serve() { - browserSync({ - notify: true, - // tunnel: true, - server: { - baseDir: config.watch.baseDir - } - }); - - // Watch various files for changes and do the needful - gulp.watch(config.watch.content, [jekyllDev, reload]); - gulp.watch(config.watch.javascript, javascript); - gulp.watch(config.watch.scss, styles); - gulp.watch(config.watch.images, reload); -} - -// Default task, run when just writing 'gulp' in the terminal -gulp.task('default', gulp.series( - gulp.series(jekyllDev), - gulp.parallel(styles, javascript, fonts, images), - gulp.series(serve) -)); - -// Builds your site with the 'build' command and then runs all the optimizations on -// it and outputs it to './dist' -gulp.task('optimize', gulp.series( - gulp.series(rebuild, jekyllProd), - gulp.parallel(styles, javascript, fonts, images, copy), - gulp.series(optimize) -)); - -gulp.task('build', gulp.series( - gulp.series(jekyllDev), - gulp.parallel(styles, javascript, fonts, images) -));<% if (!noUpload) { %> - -// Deploy your site for all to see -gulp.task('deploy', deploy);<% } %> - -// Serves your site locally -gulp.task('serve', serve); - -// Clean out your dist and .tmp folder and delete .jekyll-metadata -gulp.task('clean', cleanDist); -gulp.task('clean:assets', cleanAssets); -gulp.task('rebuild', gulp.series(cleanDist, cleanAssets, rebuild)); - -// Create your styles and create sourcemaps -gulp.task('styles', styles); - -// Create sourcemaps for your JS files -gulp.task('javascript', javascript); - -// Checks your CSS, JS and Jekyll for errors -gulp.task('check', gulp.series(doctor, jslint)); diff --git a/app/templates/jshintrc b/app/templates/jshintrc deleted file mode 100644 index a89f882..0000000 --- a/app/templates/jshintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "node": true, - "browser": true, - "esnext": true, - "bitwise": false, - "curly": false, - "eqeqeq": true, - "eqnull": true, - "immed": true, - "latedef": true, - "newcap": true, - "noarg": true, - "quotmark": "double", - "undef": true, - "strict": false, - "trailing": true, - "smarttabs": true -} diff --git a/generators/app/index.js b/generators/app/index.js new file mode 100644 index 0000000..d98e298 --- /dev/null +++ b/generators/app/index.js @@ -0,0 +1,24 @@ +'use strict'; + +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + constructor: function () { + generators.Base.apply(this, arguments); + + this.option('travis', { + type: Boolean, + required: false, + defaults: true, + description: 'Include travis config' + }); + }, + + initializing: function () { + if (this.option.travis) { + this.composeWith('jekyllized:travis', {}, { + local: require.resolve('../travis') + }); + } + } +}); diff --git a/gulpfile.js b/gulpfile.js index 6818531..cc44ee6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -18,13 +18,8 @@ var handleErr = function(err) { gulp.task('check', function() { return gulp.src([ 'test/*.js', - 'app/index.js', - 'gulpfile.js', - 'test/temp/test-gulp/gulpfile.js', - 'test/temp/test-jekyll/gulpfile.js', - 'test/temp/test-aws/gulpfile.js', - 'test/temp/test-rsync/gulpfile.js', - 'test/temp/test-pages/gulpfile.js' + 'generators/app/index.js', + 'gulpfile.js' ]) .pipe(jscs()) .pipe(jshint('.jshintrc')) @@ -35,7 +30,7 @@ gulp.task('check', function() { gulp.task('istanbul', function(done) { return gulp.src([ - 'app/index.js', + 'generators/app/index.js', 'gulpfile.js' ]) .pipe(istanbul()) diff --git a/package.json b/package.json index acc97d6..5be9692 100644 --- a/package.json +++ b/package.json @@ -9,23 +9,10 @@ "h5bp", "sass" ], - "bugs": "https://github.com/sondr3/generator-jekyllized/issues", - "author": { - "name": "Sondre Nilsen", - "email": "nilsen.sondre@gmail.com", - "url": "https://github.com/sondr3" - }, + "author": "Sondre Nilsen", + "repository": "sondr3/generator-jekyllized", + "license": "MIT", "main": "app/index.js", - "repository": { - "type": "git", - "url": "git://github.com/sondr3/generator-jekyllized.git" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/sondr3/generator-jekyllized/blob/master/LICENSE" - } - ], "scripts": { "test": "gulp test && gulp" }, @@ -33,7 +20,7 @@ "chalk": "^1.0.0", "globule": "~0.2.0", "shelljs": "^0.4.0", - "yeoman-generator": "^0.18.6", + "yeoman-generator": "^0.19.0", "yosay": "^1.0.2" }, "devDependencies": { @@ -54,10 +41,7 @@ "mocha": "^2.2.1", "mocha-lcov-reporter": "0.0.2", "trash": "^1.4.1", + "yeoman-assert": "^2.0.0", "yo": ">=1.4" - }, - "engines": { - "node": ">=0.10", - "npm": ">=1.2.10" } } diff --git a/test/app.js b/test/app.js new file mode 100644 index 0000000..ce6a425 --- /dev/null +++ b/test/app.js @@ -0,0 +1,12 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:app', function () { + before(function (done) { + helpers.run(path.join(__dirname, '../generators/app')) + .on('end', done); + }); +}); diff --git a/test/test-creation-aws.js b/test/test-creation-aws.js deleted file mode 100755 index ddfeb67..0000000 --- a/test/test-creation-aws.js +++ /dev/null @@ -1,61 +0,0 @@ -'use strict'; - -var path = require('path'); -var helpers = require('yeoman-generator').test; -var assert = require('yeoman-generator').assert; - -describe('Jekyllized generator test when using Amazon AWS', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-aws')) - .withArguments(['--skip-install']) - .withPrompt({ - uploadChoices: ['amazonCloudfrontS3'], - amazonKey: ['123123123123123'], - amazonSecret: ['14141414141414'], - amazonBucket: ['135135135135135'], - amazonDistID: ['2121212121212121'] - }) - .on('end', done); - }); - - it('creates expected files', function() { - var expected = [ - 'bower.json', - 'package.json', - 'gulpfile.js', - 'src/index.html', - 'src/robots.txt', - 'src/assets/favicon.ico', - 'src/assets/scss/style.scss', - 'aws-credentials.json' - ]; - - assert.file(expected); - }); - - it('should contain the correct deploy function', function() { - assert.fileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); - }); - - it('should NOT contain either the GH Pages or Rsync function', function() { - assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); - assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); - }); - - it('should contain deploy tasks', function() { - assert.fileContent('gulpfile.js', /gulp.task\(\'deploy\'/); - }); - - it('should contain the correct packages', function() { - var expected = [ - ['package.json', /\"concurrent-transform\"/], - ['package.json', /\"gulp-awspublish\"/], - ['package.json', /\"gulp-awspublish-router\"/], - ['package.json', /\"gulp-cloudfront\"/] - ]; - - assert.fileContent(expected); - }); - -}); diff --git a/test/test-creation-ghpages.js b/test/test-creation-ghpages.js deleted file mode 100644 index 4365169..0000000 --- a/test/test-creation-ghpages.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -var path = require('path'); -var helpers = require('yeoman-generator').test; -var assert = require('yeoman-generator').assert; - -describe('Jekyllized generator test when using GitHub Pages', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-pages')) - .withArguments(['--skip-install']) - .withPrompt({ - uploadChoices: ['githubPages'] - }) - .on('end', done); - }); - - it('creates expected files', function() { - var expected = [ - 'bower.json', - 'package.json', - 'gulpfile.js', - 'src/index.html', - 'src/robots.txt', - 'src/assets/favicon.ico', - 'src/assets/scss/style.scss' - ]; - - assert.file(expected); - }); - - it('should contain the correct deploy function', function() { - assert.fileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); - }); - - it('should NOT contain either the Amazon or Rsync function', function() { - assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); - assert.noFileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); - }); - - it('should contain deploy tasks', function() { - assert.fileContent('gulpfile.js', /gulp.task\(\'deploy\'/); - }); - - it('should contain the correct packages', function() { - assert.fileContent('package.json', /\"gulp-gh-pages\"/); - }); - -}); diff --git a/test/test-creation-rsync.js b/test/test-creation-rsync.js deleted file mode 100755 index efa7aaa..0000000 --- a/test/test-creation-rsync.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -var path = require('path'); -var helpers = require('yeoman-generator').test; -var assert = require('yeoman-generator').assert; - -describe('Jekyllized generator test when using Rsync', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-rsync')) - .withArguments(['--skip-install']) - .withPrompt({ - uploadChoices: ['rsync'], - rsyncUsername: ['olanordmann'], - rsyncHostname: ['example.com'], - rsyncDestination: ['/srv/www/example.com/public_html'] - }) - .on('end', done); - }); - - it('creates expected files', function() { - var expected = [ - 'bower.json', - 'package.json', - 'gulpfile.js', - 'src/index.html', - 'src/robots.txt', - 'src/assets/favicon.ico', - 'src/assets/scss/style.scss', - 'rsync-credentials.json' - ]; - - assert.file(expected); - }); - - it('should contain the correct deploy function', function() { - assert.fileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); - }); - - it('should NOT contain either the GH Pages or Amazon function', function() { - assert.noFileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); - assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); - }); - - it('should contain deploy tasks', function() { - assert.fileContent('gulpfile.js', /gulp.task\(\'deploy\'/); - }); - - it('should contain the correct packages', function() { - assert.fileContent('package.json', /\"gulp-rsync\"/); - }); - -}); diff --git a/test/test-gulp.js b/test/test-gulp.js deleted file mode 100644 index 6ca985d..0000000 --- a/test/test-gulp.js +++ /dev/null @@ -1,98 +0,0 @@ -'use strict'; - -var path = require('path'); -var assert = require('assert'); -var helpers = require('yeoman-generator').test; - -describe('Test for Gulp tasks without any uploading', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-gulp')) - .withArguments(['--skip-install']) - .withPrompt({ - projectName: ['Mocha Test'], - projectDescription: ['Mocha tests for Jekyllized'], - projectTagline: ['Better hope this doesn\'t blow up'], - projectURL: ['testing.com'], - authorName: ['Ola Nordmann'], - authorEmail: ['ola.nordmann@email.com'], - authorBio: ['Just your average Norwegian'], - authorTwitter: ['olanordmann123123'], - jekyllPermalinks: ['pretty'], - jekyllPaginate: ['10'], - uploadChoices: ['noUpload'] - }) - .on('end', done); - }); - - it('creates expected files', function() { - var expected = [ - 'bower.json', - 'package.json', - 'gulp.config.json', - 'gulpfile.js', - 'src/index.html', - 'src/robots.txt', - 'src/assets/favicon.ico', - 'src/assets/scss/style.scss' - ]; - - assert.file(expected); - }); - - it('does not create unexpected files', function() { - var unexpected = [ - 'aws-credentials.json', - 'rsync-redentials.json' - ]; - - assert.noFile(unexpected); - }); - - it ('should contain the default functions', function() { - var expected = [ - ['gulpfile.js', /function cleanDist\(done\)/], - ['gulpfile.js', /function cleanAssets\(done\)/], - ['gulpfile.js', /function rebuild\(done\)/], - ['gulpfile.js', /function jekyllDev\(done\)/], - ['gulpfile.js', /function jekyllProd\(done\)/], - ['gulpfile.js', /function styles\(\)/], - ['gulpfile.js', /function javascript\(\)/], - ['gulpfile.js', /function images\(\)/], - ['gulpfile.js', /function fonts\(\)/], - ['gulpfile.js', /function copy\(\)/], - ['gulpfile.js', /function optimize\(\)/], - ['gulpfile.js', /function jslint\(\)/], - ['gulpfile.js', /function doctor\(done\)/], - ['gulpfile.js', /function serve\(\)/] - ]; - - assert.fileContent(expected); - }); - - it ('should contain the default tasks', function() { - var expected = [ - ['gulpfile.js', /gulp.task\(\'default\'/], - ['gulpfile.js', /gulp.task\(\'optimize\'/], - ['gulpfile.js', /gulp.task\(\'build\'/], - ['gulpfile.js', /gulp.task\(\'serve\'/], - ['gulpfile.js', /gulp.task\(\'clean\'/], - ['gulpfile.js', /gulp.task\(\'clean\:assets\'/], - ['gulpfile.js', /gulp.task\(\'rebuild\'/], - ['gulpfile.js', /gulp.task\(\'styles\'/], - ['gulpfile.js', /gulp.task\(\'javascript\'/], - ['gulpfile.js', /gulp.task\(\'check\'/] - ]; - - assert.fileContent(expected); - }); - - it('should NOT contain a deploy function', function() { - assert.noFileContent('gulpfile.js', /function deploy\(\)/); - }); - - it('should NOT contain a deploy task', function() { - assert.noFileContent('gulpfile.js', /gulp.task\(\'deploy\'/); - }); - -}); diff --git a/test/test-jekyll.js b/test/test-jekyll.js deleted file mode 100644 index 64ecfb3..0000000 --- a/test/test-jekyll.js +++ /dev/null @@ -1,145 +0,0 @@ -'use strict'; - -var path = require('path'); -var helpers = require('yeoman-generator').test; -var assert = require('yeoman-generator').assert; - -describe('Jekyllized generator', function() { - describe('test for Jekyll settings', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-jekyll')) - .withArguments(['--skip-install']) - .withPrompt({ - projectName: ['Mocha Test'], - projectDescription: ['Mocha tests for Jekyllized'], - projectTagline: ['Better hope this doesn\'t blow up'], - projectURL: ['testing.com'], - authorName: ['Ola Nordmann'], - authorEmail: ['ola.nordmann@email.com'], - authorBio: ['Just your average Norwegian'], - authorTwitter: ['olanordmann123123'], - jekyllPermalinks: ['pretty'], - jekyllPaginate: ['10'], - uploadChoices: ['noUpload'] - }) - .on('end', done); - }); - - it('creates the expected files', function() { - var expected = [ - 'src/404.html', - 'src/about.md', - 'src/feed.xml', - 'src/crossdomain.xml', - 'src/humans.txt', - 'src/index.html', - 'src/robots.txt' - ]; - - assert.file(expected); - }); - - it('gulpfile.js does NOT contain a deploy task', function() { - assert.noFileContent('gulpfile.js', /gulp.task\(\'deploy\'/); - }); - - it('_config.yml contains the correct settings', function() { - var expected = [ - ['_config.yml', /title\: Mocha Test/], - ['_config.yml', /description\: Mocha tests for Jekyllized/], - ['_config.yml', /tagline\: Better hope this doesn\'t blow up/], - ['_config.yml', /name\: Ola Nordmann/], - ['_config.yml', /email\: ola\.nordmann\@email\.com/], - ['_config.yml', /bio\: Just your average Norwegian/], - ['_config.yml', /twitter\: olanordmann123123/] - ]; - - assert.fileContent(expected); - }); - - it('_config.build.yml contains the correct settings', function() { - var expected = [ - ['_config.build.yml', /future\: false/], - ['_config.build.yml', /show_drafts\: false/], - ['_config.build.yml', /lsi\: true/], - ['_config.build.yml', /limit_posts\: 0/], - ['_config.build.yml', /source\: src/], - ['_config.build.yml', /destination\: dist/] - ]; - - assert.fileContent(expected); - }); - - }); - - describe('test with pretty permalinks and 10 posts per page', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-jekyll-pagination')) - .withArguments(['--skip-install']) - .withPrompt({ - jekyllPermalinks: ['pretty'], - jekyllPaginate: ['10'], - uploadChoices: ['noUpload'] - }) - .on('end', done); - }); - - it('_config.yml permalink setting is "pretty"', function() { - assert.fileContent('_config.yml', /permalink\: pretty/); - }); - - it('_config.yml pagination is "10" posts per page', function() { - assert.fileContent('_config.yml', /paginate\: 10/); - }); - - }); - - describe('test with date permalinks and all posts together', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-jekyll-pagination-1')) - .withArguments(['--skip-install']) - .withPrompt({ - jekyllPermalinks: ['date'], - jekyllPaginate: ['all'], - uploadChoices: ['noUpload'] - }) - .on('end', done); - }); - - it('_config.yml permalink setting is "date"', function() { - assert.fileContent('_config.yml', /permalink\: date/); - }); - - it('_config.yml pagination is "all" posts per page', function() { - assert.fileContent('_config.yml', /paginate\: all/); - }); - - }); - - describe('test with no permalinks setting and 1 post per page', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-jekyll-pagination-2')) - .withArguments(['--skip-install']) - .withPrompt({ - jekyllPermalinks: ['none'], - jekyllPaginate: ['1'], - uploadChoices: ['noUpload'] - }) - .on('end', done); - }); - - it('_config.yml permalink setting is "none"', function() { - assert.fileContent('_config.yml', /permalink\: none/); - }); - - it('_config.yml pagination is "1" posts per page', function() { - assert.fileContent('_config.yml', /paginate\: 1/); - }); - - }); - -}); diff --git a/test/test-load.js b/test/test-load.js deleted file mode 100644 index dc2b04a..0000000 --- a/test/test-load.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var assert = require('assert'); - -describe('Jekyllized generator', function() { - it('can be imported without blowing up', function() { - var app = require('../app'); - assert(app !== undefined); - }); -}); diff --git a/test/test-package.js b/test/test-package.js deleted file mode 100644 index 75d8154..0000000 --- a/test/test-package.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -var path = require('path'); -var assert = require('assert'); -var helpers = require('yeoman-generator').test; - -describe('Jekyllized generator test for package.json', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../app')) - .inDir(path.join(__dirname, './temp/test-package')) - .withArguments(['--skip-install']) - .withPrompt({ - projectName: ['Package Test'], - projectDescription: ['Package tests for Jekyllized'], - projectTagline: ['Better hope this doesn\'t blow up'], - projectURL: ['testing.com'], - authorName: ['Ola Nordmann'], - authorEmail: ['ola.nordmann@email.com'], - authorBio: ['Just your average Norwegian'], - authorTwitter: ['olanordmann123123'], - jekyllPermalinks: ['pretty'], - jekyllPaginate: ['10'], - uploadChoices: ['noUpload'] - }) - .on('end', done); - }); - - it('should contain the proper names and version', function() { - var expected = [ - ['package.json', /\"name\"\: \"test-package\"/], - ['package.json', /\"description\"\: \"Yeoman workflow for test package\"/] - ]; - - assert.fileContent(expected); - }); - -}); From fe9b959b86721fd71413356fad3d5e862a277af9 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 20:10:50 +0200 Subject: [PATCH 014/178] Added subgenerators for jshint/jscs/editorconfig --- generators/app/index.js | 24 ++++++++----------- generators/editorconfig/index.js | 12 ++++++++++ .../editorconfig/templates/editorconfig | 12 ++++++++++ generators/jscs/index.js | 12 ++++++++++ generators/jscs/templates/jscsrc | 3 +++ generators/jshint/index.js | 12 ++++++++++ generators/jshint/templates/jshintrc | 18 ++++++++++++++ gulpfile.js | 4 ++-- test/app.js | 8 +++++++ test/editorconfig.js | 18 ++++++++++++++ test/jscs.js | 18 ++++++++++++++ test/jshint.js | 18 ++++++++++++++ 12 files changed, 143 insertions(+), 16 deletions(-) create mode 100644 generators/editorconfig/index.js create mode 100644 generators/editorconfig/templates/editorconfig create mode 100644 generators/jscs/index.js create mode 100644 generators/jscs/templates/jscsrc create mode 100644 generators/jshint/index.js create mode 100644 generators/jshint/templates/jshintrc create mode 100644 test/editorconfig.js create mode 100644 test/jscs.js create mode 100644 test/jshint.js diff --git a/generators/app/index.js b/generators/app/index.js index d98e298..791ba5a 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -3,22 +3,18 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - constructor: function () { - generators.Base.apply(this, arguments); - this.option('travis', { - type: Boolean, - required: false, - defaults: true, - description: 'Include travis config' + initializing: function () { + this.composeWith('jekyllized:editorconfig', {}, { + local: require.resolve('../editorconfig') }); - }, - initializing: function () { - if (this.option.travis) { - this.composeWith('jekyllized:travis', {}, { - local: require.resolve('../travis') - }); - } + this.composeWith('jekyllized:jshint', {}, { + local: require.resolve('../jshint') + }); + + this.composeWith('jekyllized:jscs', {}, { + local: require.resolve('../jscs') + }); } }); diff --git a/generators/editorconfig/index.js b/generators/editorconfig/index.js new file mode 100644 index 0000000..08a6d13 --- /dev/null +++ b/generators/editorconfig/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + initializing: function () { + this.fs.copy( + this.templatePath('editorconfig'), + this.destinationPath('.editorconfig') + ); + } +}); diff --git a/generators/editorconfig/templates/editorconfig b/generators/editorconfig/templates/editorconfig new file mode 100644 index 0000000..4a7ea30 --- /dev/null +++ b/generators/editorconfig/templates/editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/generators/jscs/index.js b/generators/jscs/index.js new file mode 100644 index 0000000..2500263 --- /dev/null +++ b/generators/jscs/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + initializing: function () { + this.fs.copy( + this.templatePath('jscsrc'), + this.destinationPath('.jscsrc') + ); + } +}); diff --git a/generators/jscs/templates/jscsrc b/generators/jscs/templates/jscsrc new file mode 100644 index 0000000..4b5fa83 --- /dev/null +++ b/generators/jscs/templates/jscsrc @@ -0,0 +1,3 @@ +{ + "preset": "google" +} diff --git a/generators/jshint/index.js b/generators/jshint/index.js new file mode 100644 index 0000000..294e1ae --- /dev/null +++ b/generators/jshint/index.js @@ -0,0 +1,12 @@ +'use strict'; + +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + initializing: function () { + this.fs.copy( + this.templatePath('jshintrc'), + this.destinationPath('.jshintrc') + ); + } +}); diff --git a/generators/jshint/templates/jshintrc b/generators/jshint/templates/jshintrc new file mode 100644 index 0000000..a89f882 --- /dev/null +++ b/generators/jshint/templates/jshintrc @@ -0,0 +1,18 @@ +{ + "node": true, + "browser": true, + "esnext": true, + "bitwise": false, + "curly": false, + "eqeqeq": true, + "eqnull": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "double", + "undef": true, + "strict": false, + "trailing": true, + "smarttabs": true +} diff --git a/gulpfile.js b/gulpfile.js index cc44ee6..33afba7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -18,7 +18,7 @@ var handleErr = function(err) { gulp.task('check', function() { return gulp.src([ 'test/*.js', - 'generators/app/index.js', + 'generators/**/index.js', 'gulpfile.js' ]) .pipe(jscs()) @@ -30,7 +30,7 @@ gulp.task('check', function() { gulp.task('istanbul', function(done) { return gulp.src([ - 'generators/app/index.js', + 'generators/**/index.js', 'gulpfile.js' ]) .pipe(istanbul()) diff --git a/test/app.js b/test/app.js index ce6a425..c4132e8 100644 --- a/test/app.js +++ b/test/app.js @@ -9,4 +9,12 @@ describe('jekyllized:app', function () { helpers.run(path.join(__dirname, '../generators/app')) .on('end', done); }); + + it('creates files', function () { + assert.file([ + '.editorconfig', + '.jshintrc', + '.jscsrc' + ]); + }); }); diff --git a/test/editorconfig.js b/test/editorconfig.js new file mode 100644 index 0000000..1c95b0f --- /dev/null +++ b/test/editorconfig.js @@ -0,0 +1,18 @@ +'use strict'; + +var path = require ('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:editorconfig', function () { + before(function (done) { + helpers.run(path.join(__dirname, '../generators/editorconfig')) + .on('end', done); + }); + + it('created .editorconfig', function () { + assert.file([ + '.editorconfig' + ]); + }); +}); diff --git a/test/jscs.js b/test/jscs.js new file mode 100644 index 0000000..1c98f85 --- /dev/null +++ b/test/jscs.js @@ -0,0 +1,18 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:jscs', function () { + before(function (done) { + helpers.run(path.join(__dirname, '../generators/app')) + .on('end', done); + }); + + it('creates .jscsrc', function () { + assert.file([ + '.jscsrc' + ]); + }); +}); diff --git a/test/jshint.js b/test/jshint.js new file mode 100644 index 0000000..96e2623 --- /dev/null +++ b/test/jshint.js @@ -0,0 +1,18 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:jshint', function () { + before(function (done) { + helpers.run(path.join(__dirname, '../generators/jshint')) + .on('end', done); + }); + + it('creates .jshintrc', function () { + assert.file([ + '.jshintrc' + ]); + }); +}); From 6b74b18e91d58c84221ddd8dd8cfe247bf38aed1 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 20:18:20 +0200 Subject: [PATCH 015/178] Update link to Gulp 4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5be9692..968663f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "codeclimate-test-reporter": "0.0.4", "coveralls": "^2.11.2", "generator-mocha": ">=0.1.6", - "gulp": "git://github.com:gulpjs/gulp.git#4.0", + "gulp": "git://github.com/gulpjs/gulp#4.0", "gulp-coveralls": "^0.1.3", "gulp-istanbul": "^0.7.0", "gulp-jscs": "^1.4.0", From 70eb5105bd4bbee79a262ace1025a1d816f55d23 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 20:34:06 +0200 Subject: [PATCH 016/178] Updated code style --- generators/app/index.js | 2 +- generators/editorconfig/index.js | 2 +- generators/jscs/index.js | 2 +- generators/jshint/index.js | 2 +- test/app.js | 6 +++--- test/editorconfig.js | 6 +++--- test/jscs.js | 6 +++--- test/jshint.js | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index 791ba5a..1ec26be 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -4,7 +4,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function () { + initializing: function() { this.composeWith('jekyllized:editorconfig', {}, { local: require.resolve('../editorconfig') }); diff --git a/generators/editorconfig/index.js b/generators/editorconfig/index.js index 08a6d13..59e8bcf 100644 --- a/generators/editorconfig/index.js +++ b/generators/editorconfig/index.js @@ -3,7 +3,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function () { + initializing: function() { this.fs.copy( this.templatePath('editorconfig'), this.destinationPath('.editorconfig') diff --git a/generators/jscs/index.js b/generators/jscs/index.js index 2500263..c253388 100644 --- a/generators/jscs/index.js +++ b/generators/jscs/index.js @@ -3,7 +3,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function () { + initializing: function() { this.fs.copy( this.templatePath('jscsrc'), this.destinationPath('.jscsrc') diff --git a/generators/jshint/index.js b/generators/jshint/index.js index 294e1ae..699aa53 100644 --- a/generators/jshint/index.js +++ b/generators/jshint/index.js @@ -3,7 +3,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function () { + initializing: function() { this.fs.copy( this.templatePath('jshintrc'), this.destinationPath('.jshintrc') diff --git a/test/app.js b/test/app.js index c4132e8..98859b8 100644 --- a/test/app.js +++ b/test/app.js @@ -4,13 +4,13 @@ var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-generator').test; -describe('jekyllized:app', function () { - before(function (done) { +describe('jekyllized:app', function() { + before(function(done) { helpers.run(path.join(__dirname, '../generators/app')) .on('end', done); }); - it('creates files', function () { + it('creates files', function() { assert.file([ '.editorconfig', '.jshintrc', diff --git a/test/editorconfig.js b/test/editorconfig.js index 1c95b0f..5d26aca 100644 --- a/test/editorconfig.js +++ b/test/editorconfig.js @@ -4,13 +4,13 @@ var path = require ('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-generator').test; -describe('jekyllized:editorconfig', function () { - before(function (done) { +describe('jekyllized:editorconfig', function() { + before(function(done) { helpers.run(path.join(__dirname, '../generators/editorconfig')) .on('end', done); }); - it('created .editorconfig', function () { + it('created .editorconfig', function() { assert.file([ '.editorconfig' ]); diff --git a/test/jscs.js b/test/jscs.js index 1c98f85..49664c5 100644 --- a/test/jscs.js +++ b/test/jscs.js @@ -4,13 +4,13 @@ var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-generator').test; -describe('jekyllized:jscs', function () { - before(function (done) { +describe('jekyllized:jscs', function() { + before(function(done) { helpers.run(path.join(__dirname, '../generators/app')) .on('end', done); }); - it('creates .jscsrc', function () { + it('creates .jscsrc', function() { assert.file([ '.jscsrc' ]); diff --git a/test/jshint.js b/test/jshint.js index 96e2623..d5a8aed 100644 --- a/test/jshint.js +++ b/test/jshint.js @@ -4,13 +4,13 @@ var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-generator').test; -describe('jekyllized:jshint', function () { - before(function (done) { +describe('jekyllized:jshint', function() { + before(function(done) { helpers.run(path.join(__dirname, '../generators/jshint')) .on('end', done); }); - it('creates .jshintrc', function () { + it('creates .jshintrc', function() { assert.file([ '.jshintrc' ]); From 729ec19acb357f8c8f202e0235616f6c6f208367 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 20:56:19 +0200 Subject: [PATCH 017/178] Added git submodule and minor formatting changes --- generators/app/index.js | 4 ++ generators/git/index.js | 17 +++++++ generators/git/templates/gitattributes | 1 + generators/git/templates/gitignore | 70 ++++++++++++++++++++++++++ test/app.js | 4 +- test/editorconfig.js | 4 +- test/git.js | 20 ++++++++ test/jscs.js | 4 +- test/jshint.js | 4 +- 9 files changed, 118 insertions(+), 10 deletions(-) create mode 100644 generators/git/index.js create mode 100644 generators/git/templates/gitattributes create mode 100644 generators/git/templates/gitignore create mode 100644 test/git.js diff --git a/generators/app/index.js b/generators/app/index.js index 1ec26be..857b783 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -16,5 +16,9 @@ module.exports = generators.Base.extend({ this.composeWith('jekyllized:jscs', {}, { local: require.resolve('../jscs') }); + + this.composeWith('jekyllized:git', {}, { + local: require.resolve('../git') + }); } }); diff --git a/generators/git/index.js b/generators/git/index.js new file mode 100644 index 0000000..9f18676 --- /dev/null +++ b/generators/git/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + initializing: function() { + this.fs.copy( + this.templatePath('gitignore'), + this.destinationPath('.gitignore') + ); + + this.fs.copy( + this.templatePath('gitattributes'), + this.destinationPath('.gitattributes') + ); + } +}); diff --git a/generators/git/templates/gitattributes b/generators/git/templates/gitattributes new file mode 100644 index 0000000..2125666 --- /dev/null +++ b/generators/git/templates/gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/generators/git/templates/gitignore b/generators/git/templates/gitignore new file mode 100644 index 0000000..1ac3139 --- /dev/null +++ b/generators/git/templates/gitignore @@ -0,0 +1,70 @@ +# .gitignore for jekyllized projects + +# Ignore hidden folders +# This takes care of .tmp, .sass-cache, and many others +.*/ + +# OSX +._* +.AppleDouble +.DS_Store +.localized +.LSOverride +.Spotlight-V100 +.Trashes +Icon + +# Windows +Desktop.ini +ehthumbs.db +Thumbs.db + +# Linux +*~ + +# Tags +# Ignore tags created by etags and ctags +TAGS +tags + +# Always-ignore files and folders # +*.diff +*.err +*.log +*.orig +*.rej +*.swn +*.swo +*.swp +._* +*~ + +# Ignore packages # +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Packages +node_modules/* +.tmp +test/ + +# Sublime +*.sublime-project +*.sublime-workspace +*.sublime-projectcompletions + +app/_bower_components + +# Output folders +serve +site + +# hide the AWS and Rsync credentials file +aws-credentials.json +rsync-credentials.json diff --git a/test/app.js b/test/app.js index 98859b8..caae5b5 100644 --- a/test/app.js +++ b/test/app.js @@ -14,7 +14,9 @@ describe('jekyllized:app', function() { assert.file([ '.editorconfig', '.jshintrc', - '.jscsrc' + '.jscsrc', + '.gitignore', + '.gitattributes' ]); }); }); diff --git a/test/editorconfig.js b/test/editorconfig.js index 5d26aca..70f1280 100644 --- a/test/editorconfig.js +++ b/test/editorconfig.js @@ -11,8 +11,6 @@ describe('jekyllized:editorconfig', function() { }); it('created .editorconfig', function() { - assert.file([ - '.editorconfig' - ]); + assert.file('.editorconfig'); }); }); diff --git a/test/git.js b/test/git.js new file mode 100644 index 0000000..bcbe697 --- /dev/null +++ b/test/git.js @@ -0,0 +1,20 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:git', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../generators/git')) + .on('end', done); + }); + + it('creates .gitignore', function() { + assert.file('.gitignore'); + }); + + it('creates .gitattributes', function() { + assert.file('.gitattributes'); + }); +}); diff --git a/test/jscs.js b/test/jscs.js index 49664c5..d6ee51d 100644 --- a/test/jscs.js +++ b/test/jscs.js @@ -11,8 +11,6 @@ describe('jekyllized:jscs', function() { }); it('creates .jscsrc', function() { - assert.file([ - '.jscsrc' - ]); + assert.file('.jscsrc'); }); }); diff --git a/test/jshint.js b/test/jshint.js index d5a8aed..746f637 100644 --- a/test/jshint.js +++ b/test/jshint.js @@ -11,8 +11,6 @@ describe('jekyllized:jshint', function() { }); it('creates .jshintrc', function() { - assert.file([ - '.jshintrc' - ]); + assert.file('.jshintrc'); }); }); From 21e356fee126aa8a430a858b6fd2d6af604473d5 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 22:46:38 +0200 Subject: [PATCH 018/178] Added subgenerator for packages and fixed a typo --- generators/app/index.js | 4 ++ generators/package/index.js | 75 +++++++++++++++++++++++++++++++++++++ test/app.js | 9 ++++- test/editorconfig.js | 2 +- test/package.js | 63 +++++++++++++++++++++++++++++++ 5 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 generators/package/index.js create mode 100644 test/package.js diff --git a/generators/app/index.js b/generators/app/index.js index 857b783..ed458b8 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -20,5 +20,9 @@ module.exports = generators.Base.extend({ this.composeWith('jekyllized:git', {}, { local: require.resolve('../git') }); + + this.composeWith('jekyllized:package', {}, { + local: require.resolve('../package') + }); } }); diff --git a/generators/package/index.js b/generators/package/index.js new file mode 100644 index 0000000..b397ec5 --- /dev/null +++ b/generators/package/index.js @@ -0,0 +1,75 @@ +'use strict'; + +var _ = require('lodash'); +var chalk = require('chalk'); +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + initializing: function() { + this.props = {}; + this.pkg = this.fs.readJSON(this.destinationPath('package.json'), {}); + }, + + prompting: { + projectQuestions: function() { + var done = this.async(); + + var prompts = [{ + name: 'projectName', + message: 'What is the name of your project?' + }, { + name: 'projectDescription', + message: 'Describe your project' + }, { + name: 'projectURL', + message: chalk.red('If you are using GHPages use username.github.io') + + '\nWhat will the URL for your project be?' + }]; + + this.prompt(prompts, function(props) { + this.props = _.extend(this.props, props); + + done(); + }.bind(this)); + }, + + authorQuestions: function() { + var done = this.async(); + + var prompts = [{ + name: 'authorName', + message: 'What\'s your name?' + }, { + name: 'authorEmail', + message: 'What\'s your email?' + }, { + name: 'authorBio', + message: 'Write a short description about yourself' + }, { + name: 'authorTwitter', + message: 'Your Twitter handle' + }]; + + this.prompt(prompts, function(props) { + this.props = _.extend(this.props, props); + + done(); + }.bind(this)); + } + }, + + writing: function() { + var pkgJsonFields = { + name: _.kebabCase(this.props.projectName), + version: '0.0.0', + description: this.props.projectDescription, + homepage: this.props.projectURL, + author: { + name: this.props.authorName, + email: this.props.authorEmail + } + }; + + this.fs.writeJSON('package.json', _.extend(pkgJsonFields, this.pkg)); + } +}); diff --git a/test/app.js b/test/app.js index caae5b5..323e366 100644 --- a/test/app.js +++ b/test/app.js @@ -7,6 +7,12 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:app', function() { before(function(done) { helpers.run(path.join(__dirname, '../generators/app')) + .on('ready', function(gen) { + gen.fs.copy( + path.join(__dirname, '../package.json'), + gen.destinationPath('package.json') + ); + }) .on('end', done); }); @@ -16,7 +22,8 @@ describe('jekyllized:app', function() { '.jshintrc', '.jscsrc', '.gitignore', - '.gitattributes' + '.gitattributes', + 'package.json' ]); }); }); diff --git a/test/editorconfig.js b/test/editorconfig.js index 70f1280..efe30f4 100644 --- a/test/editorconfig.js +++ b/test/editorconfig.js @@ -10,7 +10,7 @@ describe('jekyllized:editorconfig', function() { .on('end', done); }); - it('created .editorconfig', function() { + it('creates .editorconfig', function() { assert.file('.editorconfig'); }); }); diff --git a/test/package.js b/test/package.js new file mode 100644 index 0000000..0768277 --- /dev/null +++ b/test/package.js @@ -0,0 +1,63 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; +var _ = require('lodash'); + +describe('jekyllized:package', function() { + describe('running on new project', function() { + before(function(done) { + this.answers = { + projectName: 'jekyllized', + projectDescription: 'Test site for Jekyllized', + projectURL: 'www.test.com', + authorName: 'Ola Nordmann', + authorEmail: 'ola.nordmann@gmail.com' + }; + helpers.run(path.join(__dirname, '../generators/package')) + .withPrompts(this.answers) + .on('end', done); + }); + + it('creates package.json', function() { + assert.file('package.json'); + assert.fileContent('package.json', JSON.stringify({ + name: this.answers.projectName, + version: '0.0.0', + description: this.answers.projectDescription, + homepage: this.answers.projectURL, + author: { + name: this.answers.authorName, + email: this.answers.authorEmail + } + }, null, 2)); + }); + }); + + describe('running on existing project', function() { + before(function(done) { + this.pkg = { + version: '3.1.4', + description: '404 not found', + homepage: 'ulv.no', + author: 'Kari Nordmann' + }; + + helpers.run(path.join(__dirname, '../generators/package')) + .inDir(path.join(__dirname, 'tmp/package')) + .withPrompts({ + projectName: 'jekyllized' + }) + .on('ready', function(gen) { + gen.fs.writeJSON(gen.destinationPath('package.json'), this.pkg); + }.bind(this)) + .on('end', done); + }); + + it('creates package.json', function() { + var pkg = _.extend({name: 'jekyllized'}, this.pkg); + assert.fileContent('package.json', JSON.stringify(pkg, null, 2)); + }); + }); +}); From dd974a2157ee372c718fd4e2ede958af0b48e063 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 22:48:38 +0200 Subject: [PATCH 019/178] Don't create a test directory [ci-skip] --- test/package.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/package.js b/test/package.js index 0768277..c2efb60 100644 --- a/test/package.js +++ b/test/package.js @@ -45,7 +45,6 @@ describe('jekyllized:package', function() { }; helpers.run(path.join(__dirname, '../generators/package')) - .inDir(path.join(__dirname, 'tmp/package')) .withPrompts({ projectName: 'jekyllized' }) From ee0b2b3a4a5dea8b7301f0e63564c75eb97d5981 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 23:48:13 +0200 Subject: [PATCH 020/178] Somehow lodash vanished --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 968663f..f71f799 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "dependencies": { "chalk": "^1.0.0", "globule": "~0.2.0", + "lodash": "^3.7.0", "shelljs": "^0.4.0", "yeoman-generator": "^0.19.0", "yosay": "^1.0.2" From 8cc242fd37d9b185552cda1924b19d6ec6f96fcb Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 2 May 2015 00:17:12 +0200 Subject: [PATCH 021/178] Updated ordering of importance, added config file --- generators/editorconfig/index.js | 2 +- generators/git/index.js | 2 +- generators/jscs/index.js | 2 +- generators/jshint/index.js | 2 +- generators/package/index.js | 2 ++ 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/generators/editorconfig/index.js b/generators/editorconfig/index.js index 59e8bcf..6cc921f 100644 --- a/generators/editorconfig/index.js +++ b/generators/editorconfig/index.js @@ -3,7 +3,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function() { + configuring: function() { this.fs.copy( this.templatePath('editorconfig'), this.destinationPath('.editorconfig') diff --git a/generators/git/index.js b/generators/git/index.js index 9f18676..259e0c9 100644 --- a/generators/git/index.js +++ b/generators/git/index.js @@ -3,7 +3,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function() { + configuring: function() { this.fs.copy( this.templatePath('gitignore'), this.destinationPath('.gitignore') diff --git a/generators/jscs/index.js b/generators/jscs/index.js index c253388..3d25c86 100644 --- a/generators/jscs/index.js +++ b/generators/jscs/index.js @@ -3,7 +3,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function() { + configuring: function() { this.fs.copy( this.templatePath('jscsrc'), this.destinationPath('.jscsrc') diff --git a/generators/jshint/index.js b/generators/jshint/index.js index 699aa53..717e3ab 100644 --- a/generators/jshint/index.js +++ b/generators/jshint/index.js @@ -3,7 +3,7 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function() { + configuring: function() { this.fs.copy( this.templatePath('jshintrc'), this.destinationPath('.jshintrc') diff --git a/generators/package/index.js b/generators/package/index.js index b397ec5..ffa1667 100644 --- a/generators/package/index.js +++ b/generators/package/index.js @@ -28,6 +28,7 @@ module.exports = generators.Base.extend({ this.prompt(prompts, function(props) { this.props = _.extend(this.props, props); + this.config.set(this.props); done(); }.bind(this)); @@ -52,6 +53,7 @@ module.exports = generators.Base.extend({ this.prompt(prompts, function(props) { this.props = _.extend(this.props, props); + this.config.set(this.props); done(); }.bind(this)); From 336e2693bc3f8b42d5d6ed37212b325a6e4149fb Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 2 May 2015 02:23:49 +0200 Subject: [PATCH 022/178] Merged package subgen with app generator --- generators/app/index.js | 62 ++++++++++++++++++++++-- generators/package/index.js | 77 ----------------------------- package.json | 22 ++++----- test/app.js | 96 ++++++++++++++++++++++++++++++------- test/package.js | 62 ------------------------ 5 files changed, 148 insertions(+), 171 deletions(-) delete mode 100644 generators/package/index.js delete mode 100644 test/package.js diff --git a/generators/app/index.js b/generators/app/index.js index ed458b8..e74ef3e 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -1,10 +1,66 @@ 'use strict'; +var _ = require('lodash'); +var chalk = require('chalk'); var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - initializing: function() { + this.props = {}; + this.pkg = this.fs.readJSON(this.destinationPath('package.json'), {}); + }, + + prompting: function() { + var done = this.async(); + + var prompts = [{ + name: 'projectName', + message: 'What is the name of your project?' + }, { + name: 'projectDescription', + message: 'Describe your project' + }, { + name: 'projectURL', + message: chalk.red('If you are using GHPages use username.github.io') + + '\nWhat will the URL for your project be?' + }, { + name: 'authorName', + message: 'What\'s your name?' + }, { + name: 'authorEmail', + message: 'What\'s your email?' + }, { + name: 'authorBio', + message: 'Write a short description about yourself' + }, { + name: 'authorTwitter', + message: 'Your Twitter handle' + }]; + + this.prompt(prompts, function(props) { + this.props = _.extend(this.props, props); + this.config.set(this.props); + + done(); + }.bind(this)); + }, + + writing: function() { + var pkgJSONFields = { + name: _.kebabCase(this.props.projectName), + version: '0.0.0', + description: this.props.projectDescription, + homepage: this.props.projectURL, + author: { + name: this.props.authorName, + email: this.props.authorEmail + } + }; + + this.fs.writeJSON('package.json', _.extend(pkgJSONFields, this.pkg)); + }, + + default: function() { this.composeWith('jekyllized:editorconfig', {}, { local: require.resolve('../editorconfig') }); @@ -21,8 +77,8 @@ module.exports = generators.Base.extend({ local: require.resolve('../git') }); - this.composeWith('jekyllized:package', {}, { - local: require.resolve('../package') + this.composeWith('jekyllized:gulp', {}, { + local: require.resolve('../gulp') }); } }); diff --git a/generators/package/index.js b/generators/package/index.js deleted file mode 100644 index ffa1667..0000000 --- a/generators/package/index.js +++ /dev/null @@ -1,77 +0,0 @@ -'use strict'; - -var _ = require('lodash'); -var chalk = require('chalk'); -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - initializing: function() { - this.props = {}; - this.pkg = this.fs.readJSON(this.destinationPath('package.json'), {}); - }, - - prompting: { - projectQuestions: function() { - var done = this.async(); - - var prompts = [{ - name: 'projectName', - message: 'What is the name of your project?' - }, { - name: 'projectDescription', - message: 'Describe your project' - }, { - name: 'projectURL', - message: chalk.red('If you are using GHPages use username.github.io') + - '\nWhat will the URL for your project be?' - }]; - - this.prompt(prompts, function(props) { - this.props = _.extend(this.props, props); - this.config.set(this.props); - - done(); - }.bind(this)); - }, - - authorQuestions: function() { - var done = this.async(); - - var prompts = [{ - name: 'authorName', - message: 'What\'s your name?' - }, { - name: 'authorEmail', - message: 'What\'s your email?' - }, { - name: 'authorBio', - message: 'Write a short description about yourself' - }, { - name: 'authorTwitter', - message: 'Your Twitter handle' - }]; - - this.prompt(prompts, function(props) { - this.props = _.extend(this.props, props); - this.config.set(this.props); - - done(); - }.bind(this)); - } - }, - - writing: function() { - var pkgJsonFields = { - name: _.kebabCase(this.props.projectName), - version: '0.0.0', - description: this.props.projectDescription, - homepage: this.props.projectURL, - author: { - name: this.props.authorName, - email: this.props.authorEmail - } - }; - - this.fs.writeJSON('package.json', _.extend(pkgJsonFields, this.pkg)); - } -}); diff --git a/package.json b/package.json index f71f799..2f8861b 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dependencies": { "chalk": "^1.0.0", "globule": "~0.2.0", - "lodash": "^3.7.0", + "lodash": "^3.8.0", "shelljs": "^0.4.0", "yeoman-generator": "^0.19.0", "yosay": "^1.0.2" @@ -27,19 +27,19 @@ "devDependencies": { "codeclimate-test-reporter": "0.0.4", "coveralls": "^2.11.2", - "generator-mocha": ">=0.1.6", + "generator-mocha": "^0.1.7", "gulp": "git://github.com/gulpjs/gulp#4.0", - "gulp-coveralls": "^0.1.3", - "gulp-istanbul": "^0.7.0", - "gulp-jscs": "^1.4.0", - "gulp-jshint": "^1.9.0", - "gulp-load-plugins": "^0.9.0", - "gulp-mocha": "^2.0.0", + "gulp-coveralls": "^0.1.4", + "gulp-istanbul": "^0.8.1", + "gulp-jscs": "^1.6.0", + "gulp-jshint": "^1.10.0", + "gulp-load-plugins": "^0.10.0", + "gulp-mocha": "^2.0.1", "gulp-plumber": "^1.0.0", - "istanbul": "~0.3.5", - "jshint": "^2.5.11", + "istanbul": "^0.3.13", + "jshint": "^2.7.0", "jshint-stylish": "^1.0.0", - "mocha": "^2.2.1", + "mocha": "^2.2.4", "mocha-lcov-reporter": "0.0.2", "trash": "^1.4.1", "yeoman-assert": "^2.0.0", diff --git a/test/app.js b/test/app.js index 323e366..05ad042 100644 --- a/test/app.js +++ b/test/app.js @@ -1,29 +1,89 @@ 'use strict'; +var _ = require('lodash'); var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-generator').test; +var fs = require('fs'); + +function assertObjectContains(obj, content) { + Object.keys(content).forEach(function(key) { + if (typeof content[key] === 'object') { + assertObjectContains(content[key], obj[key]); + } else { + assert.equal(content[key], obj[key]); + } + }); +} + +function assertJSONFileContains(filename, content) { + var obj = JSON.parse(fs.readFileSync(filename, 'utf8')); + assertObjectContains(obj, content); +} describe('jekyllized:app', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../generators/app')) - .on('ready', function(gen) { - gen.fs.copy( - path.join(__dirname, '../package.json'), - gen.destinationPath('package.json') - ); - }) - .on('end', done); + describe('running on new project', function() { + before(function(done) { + this.answers = { + projectName: 'jekyllized', + projectDescription: 'Test site for Jekyllized', + projectURL: 'www.test.com', + authorName: 'Ola Nordmann', + authorEmail: 'ola.nordmann@gmail.com' + }; + helpers.run(path.join(__dirname, '../generators/app')) + .withPrompts(this.answers) + .on('end', done); + }); + + it('creates files', function() { + assert.file([ + '.editorconfig', + '.jshintrc', + '.jscsrc', + '.gitignore', + '.gitattributes', + 'package.json' + ]); + }); + + it('creates package.json', function() { + assert.file('package.json'); + assertJSONFileContains('package.json', { + name: this.answers.projectName, + version: '0.0.0', + description: this.answers.projectDescription, + homepage: this.answers.projectURL, + author: { + name: this.answers.authorName, + email: this.answers.authorEmail + }, + }); + }); }); - it('creates files', function() { - assert.file([ - '.editorconfig', - '.jshintrc', - '.jscsrc', - '.gitignore', - '.gitattributes', - 'package.json' - ]); + describe('running on existing project', function() { + before(function(done) { + this.pkg = { + version: '3.1.4', + description: '404 not found', + homepage: 'ulv.no', + author: 'Kari Nordmann' + }; + + helpers.run(path.join(__dirname, '../generators/app')) + .withPrompts({ + projectName: 'jekyllized' + }) + .on('ready', function(gen) { + gen.fs.writeJSON(gen.destinationPath('package.json'), this.pkg); + }.bind(this)) + .on('end', done); + }); + + it('creates package.json', function() { + var pkg = _.extend({name: 'jekyllized'}, this.pkg); + assertJSONFileContains('package.json', pkg); + }); }); }); diff --git a/test/package.js b/test/package.js deleted file mode 100644 index c2efb60..0000000 --- a/test/package.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -var path = require('path'); -var assert = require('yeoman-assert'); -var helpers = require('yeoman-generator').test; -var _ = require('lodash'); - -describe('jekyllized:package', function() { - describe('running on new project', function() { - before(function(done) { - this.answers = { - projectName: 'jekyllized', - projectDescription: 'Test site for Jekyllized', - projectURL: 'www.test.com', - authorName: 'Ola Nordmann', - authorEmail: 'ola.nordmann@gmail.com' - }; - helpers.run(path.join(__dirname, '../generators/package')) - .withPrompts(this.answers) - .on('end', done); - }); - - it('creates package.json', function() { - assert.file('package.json'); - assert.fileContent('package.json', JSON.stringify({ - name: this.answers.projectName, - version: '0.0.0', - description: this.answers.projectDescription, - homepage: this.answers.projectURL, - author: { - name: this.answers.authorName, - email: this.answers.authorEmail - } - }, null, 2)); - }); - }); - - describe('running on existing project', function() { - before(function(done) { - this.pkg = { - version: '3.1.4', - description: '404 not found', - homepage: 'ulv.no', - author: 'Kari Nordmann' - }; - - helpers.run(path.join(__dirname, '../generators/package')) - .withPrompts({ - projectName: 'jekyllized' - }) - .on('ready', function(gen) { - gen.fs.writeJSON(gen.destinationPath('package.json'), this.pkg); - }.bind(this)) - .on('end', done); - }); - - it('creates package.json', function() { - var pkg = _.extend({name: 'jekyllized'}, this.pkg); - assert.fileContent('package.json', JSON.stringify(pkg, null, 2)); - }); - }); -}); From 06677501c219110071a9da36693b6d0022ee00e8 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 2 May 2015 02:25:42 +0200 Subject: [PATCH 023/178] Initial commit for jekyllized:gulp Not complete at all but it's a first step at least. --- generators/gulp/index.js | 86 +++++ .../gulp/templates/aws-credentials.json | 7 + generators/gulp/templates/gulpfile.js | 11 + generators/gulp/templates/old-gulpfile.js | 299 ++++++++++++++++++ .../gulp/templates/rsync-credentials.json | 5 + test/gulp.js | 26 ++ 6 files changed, 434 insertions(+) create mode 100644 generators/gulp/index.js create mode 100644 generators/gulp/templates/aws-credentials.json create mode 100644 generators/gulp/templates/gulpfile.js create mode 100755 generators/gulp/templates/old-gulpfile.js create mode 100644 generators/gulp/templates/rsync-credentials.json create mode 100644 test/gulp.js diff --git a/generators/gulp/index.js b/generators/gulp/index.js new file mode 100644 index 0000000..c34e265 --- /dev/null +++ b/generators/gulp/index.js @@ -0,0 +1,86 @@ +'use strict'; + +var _ = require('lodash'); +var chalk = require('chalk'); +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + prompting: function() { + var done = this.async(); + + var prompts = [{ + type: 'list', + name: 'uploading', + message: 'How would you like to host/upload your site?', + choices: [{ + name: 'Amazon S3', + value: 'amazonS3' + }, { + name: 'Rsync', + value: 'rsync' + }, { + name: 'GitHub Pages', + value: 'ghpages' + }, { + name: 'None', + value: 'noUpload' + }] + }]; + + this.prompt(prompts, function(props) { + this.props = _.extend(this.props, props); + this.config.set(this.props); + + done(); + }.bind(this)); + }, + + writing: { + package: function() { + var pkg = this.fs.readJSON(this.destinationPath('package.json'), {}); + + pkg.devDependencies = pkg.devDependencies || {}; + _.extend(pkg.devDependencies, { + 'browser-sync': '^1.5.7', + 'del': '^1.1.1', + 'gulp': 'git://github.com/gulpjs/gulp#4.0', + 'gulp-autoprefixer': '^2.0.0', + 'gulp-cache': '~0.2.4', + 'gulp-cached': '^1.0.1', + 'gulp-changed': '^1.0.0', + 'gulp-filter': '^2.0.0', + 'gulp-group-concat': '^1.1.4', + 'gulp-gzip': '0.0.8', + 'gulp-htmlmin': '^1.0.0', + 'gulp-if': '^1.2.4', + 'gulp-imagemin': '^2.1.0', + 'gulp-jshint': '^1.8.5', + 'gulp-load-plugins': '^0.8.0', + 'gulp-minify-css': '^0.4.4', + 'gulp-rev-all': '^0.7.5', + 'gulp-rev-replace': '^0.3.1', + 'gulp-sass': '^1.0.0', + 'gulp-shell': '^0.2.9', + 'gulp-size': '^1.1.0', + 'gulp-sourcemaps': '^1.3.0', + 'gulp-uglify': '^1.1.0', + 'gulp-uncss': '^1.0.0', + 'gulp-useref': '^1.0.2', + 'jshint-stylish': '^1.0.0', + 'merge-stream': '^0.1.6', + 'shelljs': '^0.3.0', + 'trash': '^1.4.0' + }); + + this.fs.writeJSON(this.destinationPath('package.json'), pkg); + }, + + gulpfile: function() { + + this.fs.copyTpl( + this.templatePath('gulpfile.js'), + this.destinationPath('gulpfile.js') + ); + } + } +}); diff --git a/generators/gulp/templates/aws-credentials.json b/generators/gulp/templates/aws-credentials.json new file mode 100644 index 0000000..7a16e0c --- /dev/null +++ b/generators/gulp/templates/aws-credentials.json @@ -0,0 +1,7 @@ +{ + "key": "<%= amazonKey %>", + "secret": "<%= amazonSecret %>", + "bucket": "<%= amazonBucket %>", + "region": "us-west-1", + "distributionId": "<%= amazonDistID %>" +} diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js new file mode 100644 index 0000000..89fbb54 --- /dev/null +++ b/generators/gulp/templates/gulpfile.js @@ -0,0 +1,11 @@ +'use strict'; + +// THIS IS A TEMPORARY FILE +// BECAUSE THERE IS JUST SO MANY +// WRONG VARIABLES IN THE OTHER ONE +// +// MAKES TESTING A GODDAMN NIGHTMARE + +function hello() { + console.log('Yay'); +} diff --git a/generators/gulp/templates/old-gulpfile.js b/generators/gulp/templates/old-gulpfile.js new file mode 100755 index 0000000..0a8bde0 --- /dev/null +++ b/generators/gulp/templates/old-gulpfile.js @@ -0,0 +1,299 @@ +'use strict'; + +var gulp = require('gulp'); +// Load in paths from a external config file for easier changing of paths +var config = require('./gulp.config.json'); +// Loads the plugins without having to list all of them, but you need +// to call them as $.pluginname +var $ = require('gulp-load-plugins')(); +// 'trash' is used to clean out directories and such +var trash = require('trash'); +// Used to run shell commands +var shell = require('shelljs'); +<% if (amazonCloudfrontS3) { %>// Parallelize the uploads when uploading to Amazon S3 +// 'fs' is used to read files from the system (used for AWS uploading) +var fs = require('fs'); +var parallelize = require('concurrent-transform'); +<% } %>// BrowserSync is used to live-reload your website +var browserSync = require('browser-sync'); +var reload = browserSync.reload; +// merge is used to merge the output from two different streams into the same stream +var merge = require('merge-stream'); + +// Deletes the directory that the optimized site is output to +function cleanDist(done) { trash(['dist']); done(); } +function cleanAssets(done) { trash(['.tmp']); done(); } +function rebuild(done) { trash(['src/.jekyll-metadata']); done(); } // so Jekyll rebuilds the site properly + +// Runs the build command for Jekyll to compile the site locally +// This will build the site with the production settings +function jekyllDev(done) { shell.exec('jekyll build --quiet'); done(); } + +// Almost identical to the above task, but instead we load in the build configuration +// that overwrites some of the settings in the regular configuration so that you +// don't end up publishing your drafts or future posts +function jekyllProd(done) { + shell.exec('jekyll build --quiet --config _config.yml,_config.build.yml'); + done(); +} + +// Compiles the SASS files and moves them into the 'assets/stylesheets' directory +function styles() { + // Looks at the style.scss file for what to include and creates a style.css file + return gulp.src(config.scss.src) + // Start creation of sourcemaps + .pipe($.sourcemaps.init()) + .pipe($.sass({errLogToconsole: true})) + // AutoPrefix your CSS so it works between browsers + .pipe($.autoprefixer('last 1 version', {cascade: true})) + // Write the sourcemaps to the directory of the gulp.src stream + .pipe($.sourcemaps.write('.')) + // Directory your CSS file goes to + .pipe(gulp.dest(config.scss.dest)) + // Outputs the size of the CSS file + .pipe($.size({title: 'styles'})) + // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS + .pipe(reload({stream: true})); +} + +// Mostly used to create sourcemaps and live-reload JS +function javascript() { + return gulp.src(config.javascript.src) + .pipe($.sourcemaps.init()) + .pipe($.uglify({compress: false, preserveComments: 'all'})) + .pipe($.groupConcat({ + 'index.js': config.javascript.src + })) + .pipe($.sourcemaps.write('.')) + .pipe(gulp.dest(config.javascript.dest)) + .pipe($.size({title: 'javascript'})) + .pipe(reload({stream: true})); +} + +// Optimizes the images that exists +function images() { + return gulp.src(config.images.src) + // Does not run on images that are already optimized + .pipe($.cache($.imagemin({ + // Lossless conversion to progressive JPGs + progressive: true, + // Interlace GIFs for progressive rendering + interlaced: true + }))) + .pipe(gulp.dest(config.images.dest)) + .pipe($.size({title: 'images'})); +} + +// Copy over fonts to the '.tmp' directory +function fonts() { + return gulp.src(config.fonts.src) + .pipe(gulp.dest(config.fonts.dest)) + .pipe($.size({title: 'fonts'})); +} + +// Copy optimized images and (not optimized) fonts to the 'dist' folder +function copy() { + var images = gulp.src(config.images.dest) + .pipe(gulp.dest(config.images.build)) + .pipe($.size({title: 'copied images'})); + + var fonts = gulp.src(config.fonts.dest) + .pipe(gulp.dest(config.fonts.build)) + .pipe($.size({title: 'copied fonts'})); + + return merge(images, fonts); +} + +// Optimizes all the CSS, HTML and concats the JS etc +function optimize() { + var assets = $.useref.assets({searchPath: config.assets.searchPath}); + + return gulp.src(config.assets.html) + .pipe(assets) + // Concatenate JavaScript files and preserve important comments + .pipe($.if('*.js', $.uglify({preserveComments: 'some'}))) + // Minify CSS + .pipe($.if('*.css', $.minifyCss())) + // Start cache busting the files + .pipe($.revAll({ + quiet: true, + ignore: ['.eot', '.svg', '.ttf', '.woff', '.woff2'] + })) + .pipe(assets.restore()) + // Conctenate your files based on what you specified in _layout/header.html + .pipe($.useref()) + // Replace the asset names with their cache busted names + .pipe($.revReplace()) + // Minify HTML + .pipe($.if('*.html', $.htmlmin({ + removeComments: true, + removeCommentsFromCDATA: true, + removeCDATASectionsFromCDATA: true, + collapseWhitespace: true, + collapseBooleanAttributes: true, + removeAttributeQuotes: true, + removeRedundantAttributes: true + }))) + // Send the output to the correct folder + .pipe(gulp.dest(config.assets.dest)) + .pipe($.size({title: 'optimizations'})); +}<% if (amazonCloudfrontS3) { %> + +// Task to deploy your site to Amazon S3 and Cloudfront +function deploy() { + // Generate the needed credentials (bucket, secret key etc) from a 'hidden' JSON file + var credentials = JSON.parse(fs.readFileSync('aws-credentials.json', 'utf8')); + var publisher = $.awspublish.create(credentials); + // Give your files the proper headers + + gulp.src('dist/**/*') + .pipe($.awspublishRouter({ + routes: { + '^assets/(?:.+)\\.(?:js|css)$': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=315360000, no-transform, public', + 'Content-Encoding': 'gzip' + } + }, + + '^assets/(?:.+)\\.(?:jpg|png|gif)$': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=315360000, no-transform, public', + 'Content-Encoding': 'gzip' + } + }, + + '^assets/fonts/(?:.+)\\.(?:eot|svg|ttf|woff)$': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=315360000, no-transform, public' + } + }, + + '^.+\\.html': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=0, no-transform, public', + 'Content-Encoding': 'gzip' + } + }, + '^.+$': '$&' + } + })) + // Gzip the files for moar speed + .pipe($.awspublish.gzip()) + // Parallelize the number of concurrent uploads, in this case 30 + .pipe(parallelize(publisher.publish(), 30)) + // Have your files in the system cache so you don't have to recheck all the files every time + .pipe(publisher.cache()) + // Synchronize the contents of the bucket and local (this deletes everything that isn't in local!) + .pipe(publisher.sync()) + // And print the ouput, glorious + .pipe($.awspublish.reporter()) + // And update the default root object + .pipe($.cloudfront(credentials)); +}<% } %><% if (rsync) { %> + +// Task to upload your site via Rsync to your server +function deploy() { + // Load in the variables needed for our Rsync synchronization + var secret = require('./rsync-credentials.json'); + + return gulp.src('dist/**') + .pipe($.rsync({ + // This uploads the contenst of 'root', instead of the folder + root: 'dist', + // Find your username, hostname and destination from your rsync-credentials.json + hostname: secret.hostname, + username: secret.username, + destination: secret.destination, + // Incremental uploading, adds a small delay but minimizes the amount of files transferred + incremental: true, + // Shows the progress on your files while uploading + progress: true + })); +}<% } %><% if (githubPages) { %> + +// Task to upload your site to your personal GH Pages repo +function deploy() { + // Deploys your optimized site, you can change the settings in the html task if you want to + return gulp.src('dist/**/*') + .pipe($.ghPages({ + // Currently only personal GitHub Pages are supported so it will upload to the master + // branch and automatically overwrite anything that is in the directory + branch: 'master' + })); +}<% } %> + +// Run JS Lint against your JS +function jslint() { + gulp.src(config.javascript.dest) + // Checks your JS code quality against your .jshintrc file + .pipe($.jshint('.jshintrc')) + .pipe($.jshint.reporter()); +} + +// Runs 'jekyll doctor' on your site to check for errors with your configuration +// and will check for URL errors a well +function doctor(done) { shell.exec('jekyll doctor'); done(); } + +// BrowserSync will serve our site on a local server for us and other devices to use +// It will also autoreload across all devices as well as keep the viewport synchronized +// between them. +function serve() { + browserSync({ + notify: true, + // tunnel: true, + server: { + baseDir: config.watch.baseDir + } + }); + + // Watch various files for changes and do the needful + gulp.watch(config.watch.content, [jekyllDev, reload]); + gulp.watch(config.watch.javascript, javascript); + gulp.watch(config.watch.scss, styles); + gulp.watch(config.watch.images, reload); +} + +// Default task, run when just writing 'gulp' in the terminal +gulp.task('default', gulp.series( + gulp.series(jekyllDev), + gulp.parallel(styles, javascript, fonts, images), + gulp.series(serve) +)); + +// Builds your site with the 'build' command and then runs all the optimizations on +// it and outputs it to './dist' +gulp.task('optimize', gulp.series( + gulp.series(rebuild, jekyllProd), + gulp.parallel(styles, javascript, fonts, images, copy), + gulp.series(optimize) +)); + +gulp.task('build', gulp.series( + gulp.series(jekyllDev), + gulp.parallel(styles, javascript, fonts, images) +));<% if (!noUpload) { %> + +// Deploy your site for all to see +gulp.task('deploy', deploy);<% } %> + +// Serves your site locally +gulp.task('serve', serve); + +// Clean out your dist and .tmp folder and delete .jekyll-metadata +gulp.task('clean', cleanDist); +gulp.task('clean:assets', cleanAssets); +gulp.task('rebuild', gulp.series(cleanDist, cleanAssets, rebuild)); + +// Create your styles and create sourcemaps +gulp.task('styles', styles); + +// Create sourcemaps for your JS files +gulp.task('javascript', javascript); + +// Checks your CSS, JS and Jekyll for errors +gulp.task('check', gulp.series(doctor, jslint)); diff --git a/generators/gulp/templates/rsync-credentials.json b/generators/gulp/templates/rsync-credentials.json new file mode 100644 index 0000000..37fcc84 --- /dev/null +++ b/generators/gulp/templates/rsync-credentials.json @@ -0,0 +1,5 @@ +{ + "username": "<%= rsyncUsername %>", + "hostname": "<%= rsyncHostname %>", + "destination": "<%= rsyncDestination %>" +} diff --git a/test/gulp.js b/test/gulp.js new file mode 100644 index 0000000..7afdf6e --- /dev/null +++ b/test/gulp.js @@ -0,0 +1,26 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:gulp', function() { + describe('without any uploading', function() { + before(function(done) { + this.answers = { + uploading: 'noUploadg' + }; + helpers.run(path.join(__dirname, '../generators/gulp')) + .withPrompts(this.answers) + .on('end', done); + }); + + it('creates gulpfile', function() { + assert.file('gulpfile.js'); + }); + + it('creates package.json file', function() { + assert.file('package.json'); + }); + }); +}); From 420aac0c0263f094ef75ff924742584c92c4bc5f Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 17 May 2015 22:39:37 +0200 Subject: [PATCH 024/178] Move some subgenerators to a boilerplate generator Moved the git, editorconfig, jscs and jshint subgenerator into a boilerplate generator instead because I like that approach better. --- generators/app/index.js | 16 +---- generators/editorconfig/index.js | 12 ---- .../editorconfig/templates/editorconfig | 12 ---- generators/git/index.js | 17 ----- generators/git/templates/gitattributes | 1 - generators/git/templates/gitignore | 70 ------------------- generators/jscs/index.js | 12 ---- generators/jscs/templates/jscsrc | 3 - generators/jshint/index.js | 12 ---- generators/jshint/templates/jshintrc | 18 ----- test/app.js | 3 +- test/editorconfig.js | 2 +- test/git.js | 2 +- test/gulp.js | 3 +- test/jscs.js | 2 +- test/jshint.js | 2 +- 16 files changed, 10 insertions(+), 177 deletions(-) delete mode 100644 generators/editorconfig/index.js delete mode 100644 generators/editorconfig/templates/editorconfig delete mode 100644 generators/git/index.js delete mode 100644 generators/git/templates/gitattributes delete mode 100644 generators/git/templates/gitignore delete mode 100644 generators/jscs/index.js delete mode 100644 generators/jscs/templates/jscsrc delete mode 100644 generators/jshint/index.js delete mode 100644 generators/jshint/templates/jshintrc diff --git a/generators/app/index.js b/generators/app/index.js index e74ef3e..aad8e0c 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -61,20 +61,8 @@ module.exports = generators.Base.extend({ }, default: function() { - this.composeWith('jekyllized:editorconfig', {}, { - local: require.resolve('../editorconfig') - }); - - this.composeWith('jekyllized:jshint', {}, { - local: require.resolve('../jshint') - }); - - this.composeWith('jekyllized:jscs', {}, { - local: require.resolve('../jscs') - }); - - this.composeWith('jekyllized:git', {}, { - local: require.resolve('../git') + this.composeWith('jekyllized:boilerplate', {}, { + local: require.resolve('../boilerplate') }); this.composeWith('jekyllized:gulp', {}, { diff --git a/generators/editorconfig/index.js b/generators/editorconfig/index.js deleted file mode 100644 index 6cc921f..0000000 --- a/generators/editorconfig/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('editorconfig'), - this.destinationPath('.editorconfig') - ); - } -}); diff --git a/generators/editorconfig/templates/editorconfig b/generators/editorconfig/templates/editorconfig deleted file mode 100644 index 4a7ea30..0000000 --- a/generators/editorconfig/templates/editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/generators/git/index.js b/generators/git/index.js deleted file mode 100644 index 259e0c9..0000000 --- a/generators/git/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('gitignore'), - this.destinationPath('.gitignore') - ); - - this.fs.copy( - this.templatePath('gitattributes'), - this.destinationPath('.gitattributes') - ); - } -}); diff --git a/generators/git/templates/gitattributes b/generators/git/templates/gitattributes deleted file mode 100644 index 2125666..0000000 --- a/generators/git/templates/gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto \ No newline at end of file diff --git a/generators/git/templates/gitignore b/generators/git/templates/gitignore deleted file mode 100644 index 1ac3139..0000000 --- a/generators/git/templates/gitignore +++ /dev/null @@ -1,70 +0,0 @@ -# .gitignore for jekyllized projects - -# Ignore hidden folders -# This takes care of .tmp, .sass-cache, and many others -.*/ - -# OSX -._* -.AppleDouble -.DS_Store -.localized -.LSOverride -.Spotlight-V100 -.Trashes -Icon - -# Windows -Desktop.ini -ehthumbs.db -Thumbs.db - -# Linux -*~ - -# Tags -# Ignore tags created by etags and ctags -TAGS -tags - -# Always-ignore files and folders # -*.diff -*.err -*.log -*.orig -*.rej -*.swn -*.swo -*.swp -._* -*~ - -# Ignore packages # -*.7z -*.dmg -*.gz -*.iso -*.jar -*.rar -*.tar -*.zip - -# Packages -node_modules/* -.tmp -test/ - -# Sublime -*.sublime-project -*.sublime-workspace -*.sublime-projectcompletions - -app/_bower_components - -# Output folders -serve -site - -# hide the AWS and Rsync credentials file -aws-credentials.json -rsync-credentials.json diff --git a/generators/jscs/index.js b/generators/jscs/index.js deleted file mode 100644 index 3d25c86..0000000 --- a/generators/jscs/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('jscsrc'), - this.destinationPath('.jscsrc') - ); - } -}); diff --git a/generators/jscs/templates/jscsrc b/generators/jscs/templates/jscsrc deleted file mode 100644 index 4b5fa83..0000000 --- a/generators/jscs/templates/jscsrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "preset": "google" -} diff --git a/generators/jshint/index.js b/generators/jshint/index.js deleted file mode 100644 index 717e3ab..0000000 --- a/generators/jshint/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('jshintrc'), - this.destinationPath('.jshintrc') - ); - } -}); diff --git a/generators/jshint/templates/jshintrc b/generators/jshint/templates/jshintrc deleted file mode 100644 index a89f882..0000000 --- a/generators/jshint/templates/jshintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "node": true, - "browser": true, - "esnext": true, - "bitwise": false, - "curly": false, - "eqeqeq": true, - "eqnull": true, - "immed": true, - "latedef": true, - "newcap": true, - "noarg": true, - "quotmark": "double", - "undef": true, - "strict": false, - "trailing": true, - "smarttabs": true -} diff --git a/test/app.js b/test/app.js index 05ad042..110153f 100644 --- a/test/app.js +++ b/test/app.js @@ -43,7 +43,8 @@ describe('jekyllized:app', function() { '.jscsrc', '.gitignore', '.gitattributes', - 'package.json' + 'package.json', + 'gulpfile.js' ]); }); diff --git a/test/editorconfig.js b/test/editorconfig.js index efe30f4..4c17c0d 100644 --- a/test/editorconfig.js +++ b/test/editorconfig.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:editorconfig', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/editorconfig')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); diff --git a/test/git.js b/test/git.js index bcbe697..d0eff3c 100644 --- a/test/git.js +++ b/test/git.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:git', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/git')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); diff --git a/test/gulp.js b/test/gulp.js index 7afdf6e..3e1994e 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -8,9 +8,10 @@ describe('jekyllized:gulp', function() { describe('without any uploading', function() { before(function(done) { this.answers = { - uploading: 'noUploadg' + uploading: 'noUpload' }; helpers.run(path.join(__dirname, '../generators/gulp')) + .inDir(path.join(__dirname, 'tmp/gulp')) .withPrompts(this.answers) .on('end', done); }); diff --git a/test/jscs.js b/test/jscs.js index d6ee51d..1faf17d 100644 --- a/test/jscs.js +++ b/test/jscs.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:jscs', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/app')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); diff --git a/test/jshint.js b/test/jshint.js index 746f637..bf61454 100644 --- a/test/jshint.js +++ b/test/jshint.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:jshint', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/jshint')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); From d314bebe12cadc4c5eecf53e200decf154c2a7ba Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 17 May 2015 22:44:42 +0200 Subject: [PATCH 025/178] Probably a good idea to include the new directory --- generators/boilerplate/index.js | 32 +++++++++ generators/boilerplate/templates/editorconfig | 12 ++++ .../boilerplate/templates/gitattributes | 1 + generators/boilerplate/templates/gitignore | 70 +++++++++++++++++++ generators/boilerplate/templates/jscsrc | 3 + generators/boilerplate/templates/jshintrc | 18 +++++ 6 files changed, 136 insertions(+) create mode 100644 generators/boilerplate/index.js create mode 100644 generators/boilerplate/templates/editorconfig create mode 100644 generators/boilerplate/templates/gitattributes create mode 100644 generators/boilerplate/templates/gitignore create mode 100644 generators/boilerplate/templates/jscsrc create mode 100644 generators/boilerplate/templates/jshintrc diff --git a/generators/boilerplate/index.js b/generators/boilerplate/index.js new file mode 100644 index 0000000..fd475ca --- /dev/null +++ b/generators/boilerplate/index.js @@ -0,0 +1,32 @@ +'use strict'; + +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + configuring: function() { + this.fs.copy( + this.templatePath('editorconfig'), + this.destinationPath('.editorconfig') + ); + + this.fs.copy( + this.templatePath('gitattributes'), + this.destinationPath('.gitattributes') + ); + + this.fs.copy( + this.templatePath('gitignore'), + this.destinationPath('.gitignore') + ); + + this.fs.copy( + this.templatePath('jscsrc'), + this.destinationPath('.jscsrc') + ); + + this.fs.copy( + this.templatePath('jshintrc'), + this.destinationPath('.jshintrc') + ); + } +}); diff --git a/generators/boilerplate/templates/editorconfig b/generators/boilerplate/templates/editorconfig new file mode 100644 index 0000000..4a7ea30 --- /dev/null +++ b/generators/boilerplate/templates/editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/generators/boilerplate/templates/gitattributes b/generators/boilerplate/templates/gitattributes new file mode 100644 index 0000000..2125666 --- /dev/null +++ b/generators/boilerplate/templates/gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/generators/boilerplate/templates/gitignore b/generators/boilerplate/templates/gitignore new file mode 100644 index 0000000..1ac3139 --- /dev/null +++ b/generators/boilerplate/templates/gitignore @@ -0,0 +1,70 @@ +# .gitignore for jekyllized projects + +# Ignore hidden folders +# This takes care of .tmp, .sass-cache, and many others +.*/ + +# OSX +._* +.AppleDouble +.DS_Store +.localized +.LSOverride +.Spotlight-V100 +.Trashes +Icon + +# Windows +Desktop.ini +ehthumbs.db +Thumbs.db + +# Linux +*~ + +# Tags +# Ignore tags created by etags and ctags +TAGS +tags + +# Always-ignore files and folders # +*.diff +*.err +*.log +*.orig +*.rej +*.swn +*.swo +*.swp +._* +*~ + +# Ignore packages # +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Packages +node_modules/* +.tmp +test/ + +# Sublime +*.sublime-project +*.sublime-workspace +*.sublime-projectcompletions + +app/_bower_components + +# Output folders +serve +site + +# hide the AWS and Rsync credentials file +aws-credentials.json +rsync-credentials.json diff --git a/generators/boilerplate/templates/jscsrc b/generators/boilerplate/templates/jscsrc new file mode 100644 index 0000000..4b5fa83 --- /dev/null +++ b/generators/boilerplate/templates/jscsrc @@ -0,0 +1,3 @@ +{ + "preset": "google" +} diff --git a/generators/boilerplate/templates/jshintrc b/generators/boilerplate/templates/jshintrc new file mode 100644 index 0000000..a89f882 --- /dev/null +++ b/generators/boilerplate/templates/jshintrc @@ -0,0 +1,18 @@ +{ + "node": true, + "browser": true, + "esnext": true, + "bitwise": false, + "curly": false, + "eqeqeq": true, + "eqnull": true, + "immed": true, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "double", + "undef": true, + "strict": false, + "trailing": true, + "smarttabs": true +} From 24ad2df30d2b5a9cf22be3deee41b247bbbccf22 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 18 May 2015 00:43:10 +0200 Subject: [PATCH 026/178] More updates to the gulp subgenerator and tests Made the subgenerator properly scaffold a gulpfile and packages now and updated the tests accordingly for the gulpfile and moved most of the small tests into a boilerplate test file. Also updated the gulpfile at the root directory to look for JS errors in the generated gulpfiles and run a singular test task so even when there are errors it will actually fail. Neat. Also updated yeoman-generator to a newer version (0.20.1) for some templating goodness. --- .gitignore | 4 +- generators/gulp/index.js | 84 +++-- .../gulp/templates/aws-credentials.json | 9 +- generators/gulp/templates/gulpfile.js | 310 +++++++++++++++++- generators/gulp/templates/old-gulpfile.js | 299 ----------------- .../gulp/templates/rsync-credentials.json | 6 +- gulpfile.js | 4 +- package.json | 4 +- test/{git.js => boilerplate.js} | 16 +- test/editorconfig.js | 16 - test/gulp.js | 202 +++++++++++- test/jscs.js | 16 - test/jshint.js | 16 - 13 files changed, 584 insertions(+), 402 deletions(-) mode change 100644 => 100755 generators/gulp/templates/gulpfile.js delete mode 100755 generators/gulp/templates/old-gulpfile.js rename test/{git.js => boilerplate.js} (56%) delete mode 100644 test/editorconfig.js delete mode 100644 test/jscs.js delete mode 100644 test/jshint.js diff --git a/.gitignore b/.gitignore index a1848f0..66b6fc7 100755 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ # .gitignore for jekyllized projects # Folders that shouldn't be tracked node_modules/ -temp/ coverage/ .envrc .coveralls.yml -test/test-*/ +test/tmp/ +npm-shrinkwrap.json # Ignore hidden folders # This takes care of .tmp, .sass-cache, and many others diff --git a/generators/gulp/index.js b/generators/gulp/index.js index c34e265..371ec06 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -5,34 +5,31 @@ var chalk = require('chalk'); var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ - prompting: function() { - var done = this.async(); + constructor: function() { + generators.Base.apply(this, arguments); - var prompts = [{ - type: 'list', - name: 'uploading', - message: 'How would you like to host/upload your site?', - choices: [{ - name: 'Amazon S3', - value: 'amazonS3' - }, { - name: 'Rsync', - value: 'rsync' - }, { - name: 'GitHub Pages', - value: 'ghpages' - }, { - name: 'None', - value: 'noUpload' - }] - }]; + this.option('amazonS3', { + type: Boolean, + name: 'amazonS3', + desc: 'Do you want to upload to Amazon S3?' + }); - this.prompt(prompts, function(props) { - this.props = _.extend(this.props, props); - this.config.set(this.props); + this.option('rsync', { + type: Boolean, + name: 'rsync', + desc: 'Do you want to upload to Rsync?' + }); - done(); - }.bind(this)); + this.option('ghpages', { + type: Boolean, + name: 'ghPages', + desc: 'Do you want to upload to GitHub Pages?' + }); + this.option('noUpload', { + type: Boolean, + name: 'noUpload', + desc: 'No uploading' + }); }, writing: { @@ -72,15 +69,48 @@ module.exports = generators.Base.extend({ 'trash': '^1.4.0' }); + if (this.options.amazonS3) { + pkg.devDependencies['gulp-awspublish'] = '^0.1.0'; + pkg.devDependencies['gulp-awspublish-router'] = '^0.1.0'; + pkg.devDependencies['concurrent-transform'] = '^1.0.0'; + } + + if (this.options.rsync) { + pkg.devDependencies['gulp-rsync'] = '^0.0.2'; + } + + if (this.options.ghPages) { + pkg.devDependencies['gulp-gh-pages'] = '^0.4.0'; + } + this.fs.writeJSON(this.destinationPath('package.json'), pkg); }, gulpfile: function() { - this.fs.copyTpl( this.templatePath('gulpfile.js'), - this.destinationPath('gulpfile.js') + this.destinationPath('gulpfile.js'), + { + amazonS3: this.options.amazonS3, + rsync: this.options.rsync, + ghPages: this.options.ghPages, + noUpload: this.options.noUpload + } ); + + if (this.options.amazonS3) { + this.fs.copyTpl( + this.templatePath('aws-credentials.json'), + this.destinationPath('aws-credentials.json') + ); + } + + if (this.options.rsync) { + this.fs.copyTpl( + this.templatePath('rsync-credentials.json'), + this.destinationPath('rsync-credentials.json') + ); + } } } }); diff --git a/generators/gulp/templates/aws-credentials.json b/generators/gulp/templates/aws-credentials.json index 7a16e0c..ad78bf3 100644 --- a/generators/gulp/templates/aws-credentials.json +++ b/generators/gulp/templates/aws-credentials.json @@ -1,7 +1,6 @@ { - "key": "<%= amazonKey %>", - "secret": "<%= amazonSecret %>", - "bucket": "<%= amazonBucket %>", - "region": "us-west-1", - "distributionId": "<%= amazonDistID %>" + "key": "AWS KEY GOES HERE", + "secret": "AWS SECRET GOES HERE", + "bucket": "www.example.org", + "region": "us-west-1" } diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js old mode 100644 new mode 100755 index 89fbb54..f563497 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -1,11 +1,307 @@ 'use strict'; -// THIS IS A TEMPORARY FILE -// BECAUSE THERE IS JUST SO MANY -// WRONG VARIABLES IN THE OTHER ONE -// -// MAKES TESTING A GODDAMN NIGHTMARE +var gulp = require('gulp'); +// Load in paths from a external config file for easier changing of paths +var config = require('./gulp.config.json'); +// Loads the plugins without having to list all of them, but you need +// to call them as $.pluginname +var $ = require('gulp-load-plugins')(); +// 'trash' is used to clean out directories and such +var trash = require('trash'); +// Used to run shell commands +var shell = require('shelljs'); +<% if (amazonS3) { -%> +// Parallelize the uploads when uploading to Amazon S3 +// 'fs' is used to read files from the system (used for AWS uploading) +var fs = require('fs'); +var parallelize = require('concurrent-transform'); +<% } -%> +// BrowserSync is used to live-reload your website +var browserSync = require('browser-sync'); +var reload = browserSync.reload; +// merge is used to merge the output from two different streams into the same stream +var merge = require('merge-stream'); -function hello() { - console.log('Yay'); +// Deletes the directory that the optimized site is output to +function cleanDist(done) { trash(['dist']); done(); } +function cleanAssets(done) { trash(['.tmp']); done(); } +function rebuild(done) { trash(['src/.jekyll-metadata']); done(); } // so Jekyll rebuilds the site properly + +// Runs the build command for Jekyll to compile the site locally +// This will build the site with the production settings +function jekyllDev(done) { shell.exec('jekyll build --quiet'); done(); } + +// Almost identical to the above task, but instead we load in the build configuration +// that overwrites some of the settings in the regular configuration so that you +// don't end up publishing your drafts or future posts +function jekyllProd(done) { + shell.exec('jekyll build --quiet --config _config.yml,_config.build.yml'); + done(); +} + +// Compiles the SASS files and moves them into the 'assets/stylesheets' directory +function styles() { + // Looks at the style.scss file for what to include and creates a style.css file + return gulp.src(config.scss.src) + // Start creation of sourcemaps + .pipe($.sourcemaps.init()) + .pipe($.sass({errLogToconsole: true})) + // AutoPrefix your CSS so it works between browsers + .pipe($.autoprefixer('last 1 version', {cascade: true})) + // Write the sourcemaps to the directory of the gulp.src stream + .pipe($.sourcemaps.write('.')) + // Directory your CSS file goes to + .pipe(gulp.dest(config.scss.dest)) + // Outputs the size of the CSS file + .pipe($.size({title: 'styles'})) + // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS + .pipe(reload({stream: true})); +} + +// Mostly used to create sourcemaps and live-reload JS +function javascript() { + return gulp.src(config.javascript.src) + .pipe($.sourcemaps.init()) + .pipe($.uglify({compress: false, preserveComments: 'all'})) + .pipe($.groupConcat({ + 'index.js': config.javascript.src + })) + .pipe($.sourcemaps.write('.')) + .pipe(gulp.dest(config.javascript.dest)) + .pipe($.size({title: 'javascript'})) + .pipe(reload({stream: true})); +} + +// Optimizes the images that exists +function images() { + return gulp.src(config.images.src) + // Does not run on images that are already optimized + .pipe($.cache($.imagemin({ + // Lossless conversion to progressive JPGs + progressive: true, + // Interlace GIFs for progressive rendering + interlaced: true + }))) + .pipe(gulp.dest(config.images.dest)) + .pipe($.size({title: 'images'})); +} + +// Copy over fonts to the '.tmp' directory +function fonts() { + return gulp.src(config.fonts.src) + .pipe(gulp.dest(config.fonts.dest)) + .pipe($.size({title: 'fonts'})); +} + +// Copy optimized images and (not optimized) fonts to the 'dist' folder +function copy() { + var images = gulp.src(config.images.dest) + .pipe(gulp.dest(config.images.build)) + .pipe($.size({title: 'copied images'})); + + var fonts = gulp.src(config.fonts.dest) + .pipe(gulp.dest(config.fonts.build)) + .pipe($.size({title: 'copied fonts'})); + + return merge(images, fonts); +} + +// Optimizes all the CSS, HTML and concats the JS etc +function optimize() { + var assets = $.useref.assets({searchPath: config.assets.searchPath}); + + return gulp.src(config.assets.html) + .pipe(assets) + // Concatenate JavaScript files and preserve important comments + .pipe($.if('*.js', $.uglify({preserveComments: 'some'}))) + // Minify CSS + .pipe($.if('*.css', $.minifyCss())) + // Start cache busting the files + .pipe($.revAll({ + quiet: true, + ignore: ['.eot', '.svg', '.ttf', '.woff', '.woff2'] + })) + .pipe(assets.restore()) + // Conctenate your files based on what you specified in _layout/header.html + .pipe($.useref()) + // Replace the asset names with their cache busted names + .pipe($.revReplace()) + // Minify HTML + .pipe($.if('*.html', $.htmlmin({ + removeComments: true, + removeCommentsFromCDATA: true, + removeCDATASectionsFromCDATA: true, + collapseWhitespace: true, + collapseBooleanAttributes: true, + removeAttributeQuotes: true, + removeRedundantAttributes: true + }))) + // Send the output to the correct folder + .pipe(gulp.dest(config.assets.dest)) + .pipe($.size({title: 'optimizations'})); } +<% if (amazonS3) { -%> + +// Task to deploy your site to Amazon S3 and Cloudfront +function deploy() { + // Generate the needed credentials (bucket, secret key etc) from a 'hidden' JSON file + var credentials = JSON.parse(fs.readFileSync('aws-credentials.json', 'utf8')); + var publisher = $.awspublish.create(credentials); + // Give your files the proper headers + + gulp.src('dist/**/*') + .pipe($.awspublishRouter({ + routes: { + '^assets/(?:.+)\\.(?:js|css)$': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=315360000, no-transform, public', + 'Content-Encoding': 'gzip' + } + }, + + '^assets/(?:.+)\\.(?:jpg|png|gif)$': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=315360000, no-transform, public', + 'Content-Encoding': 'gzip' + } + }, + + '^assets/fonts/(?:.+)\\.(?:eot|svg|ttf|woff)$': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=315360000, no-transform, public' + } + }, + + '^.+\\.html': { + key: '$&', + headers: { + 'Cache-Control': 'max-age=0, no-transform, public', + 'Content-Encoding': 'gzip' + } + }, + '^.+$': '$&' + } + })) + // Gzip the files for moar speed + .pipe($.awspublish.gzip()) + // Parallelize the number of concurrent uploads, in this case 30 + .pipe(parallelize(publisher.publish(), 30)) + // Have your files in the system cache so you don't have to recheck all the files every time + .pipe(publisher.cache()) + // Synchronize the contents of the bucket and local (this deletes everything that isn't in local!) + .pipe(publisher.sync()) + // And print the ouput, glorious + .pipe($.awspublish.reporter()) + // And update the default root object + .pipe($.cloudfront(credentials)); +} +<% } -%><% if (rsync) { -%> + +// Task to upload your site via Rsync to your server +function deploy() { + // Load in the variables needed for our Rsync synchronization + var secret = require('./rsync-credentials.json'); + + return gulp.src('dist/**') + .pipe($.rsync({ + // This uploads the contenst of 'root', instead of the folder + root: 'dist', + // Find your username, hostname and destination from your rsync-credentials.json + hostname: secret.hostname, + username: secret.username, + destination: secret.destination, + // Incremental uploading, adds a small delay but minimizes the amount of files transferred + incremental: true, + // Shows the progress on your files while uploading + progress: true + })); +} +<% } -%><% if (ghPages) { -%> + +// Task to upload your site to your personal GH Pages repo +function deploy() { + // Deploys your optimized site, you can change the settings in the html task if you want to + return gulp.src('dist/**/*') + .pipe($.ghPages({ + // Currently only personal GitHub Pages are supported so it will upload to the master + // branch and automatically overwrite anything that is in the directory + branch: 'master' + })); +} +<% } -%> + +// Run JS Lint against your JS +function jslint() { + gulp.src(config.javascript.dest) + // Checks your JS code quality against your .jshintrc file + .pipe($.jshint('.jshintrc')) + .pipe($.jshint.reporter()); +} + +// Runs 'jekyll doctor' on your site to check for errors with your configuration +// and will check for URL errors a well +function doctor(done) { shell.exec('jekyll doctor'); done(); } + +// BrowserSync will serve our site on a local server for us and other devices to use +// It will also autoreload across all devices as well as keep the viewport synchronized +// between them. +function serve() { + browserSync({ + notify: true, + // tunnel: true, + server: { + baseDir: config.watch.baseDir + } + }); + + // Watch various files for changes and do the needful + gulp.watch(config.watch.content, [jekyllDev, reload]); + gulp.watch(config.watch.javascript, javascript); + gulp.watch(config.watch.scss, styles); + gulp.watch(config.watch.images, reload); +} + +// Default task, run when just writing 'gulp' in the terminal +gulp.task('default', gulp.series( + gulp.series(jekyllDev), + gulp.parallel(styles, javascript, fonts, images), + gulp.series(serve) +)); + +// Builds your site with the 'build' command and then runs all the optimizations on +// it and outputs it to './dist' +gulp.task('optimize', gulp.series( + gulp.series(rebuild, jekyllProd), + gulp.parallel(styles, javascript, fonts, images, copy), + gulp.series(optimize) +)); + +gulp.task('build', gulp.series( + gulp.series(jekyllDev), + gulp.parallel(styles, javascript, fonts, images) +)); +<% if (!noUpload) { -%> + +// Deploy your site for all to see +gulp.task('deploy', deploy); +<% } -%> + +// Serves your site locally +gulp.task('serve', serve); + +// Clean out your dist and .tmp folder and delete .jekyll-metadata +gulp.task('clean', cleanDist); +gulp.task('clean:assets', cleanAssets); +gulp.task('rebuild', gulp.series(cleanDist, cleanAssets, rebuild)); + +// Create your styles and create sourcemaps +gulp.task('styles', styles); + +// Create sourcemaps for your JS files +gulp.task('javascript', javascript); + +// Checks your CSS, JS and Jekyll for errors +gulp.task('check', gulp.series(doctor, jslint)); diff --git a/generators/gulp/templates/old-gulpfile.js b/generators/gulp/templates/old-gulpfile.js deleted file mode 100755 index 0a8bde0..0000000 --- a/generators/gulp/templates/old-gulpfile.js +++ /dev/null @@ -1,299 +0,0 @@ -'use strict'; - -var gulp = require('gulp'); -// Load in paths from a external config file for easier changing of paths -var config = require('./gulp.config.json'); -// Loads the plugins without having to list all of them, but you need -// to call them as $.pluginname -var $ = require('gulp-load-plugins')(); -// 'trash' is used to clean out directories and such -var trash = require('trash'); -// Used to run shell commands -var shell = require('shelljs'); -<% if (amazonCloudfrontS3) { %>// Parallelize the uploads when uploading to Amazon S3 -// 'fs' is used to read files from the system (used for AWS uploading) -var fs = require('fs'); -var parallelize = require('concurrent-transform'); -<% } %>// BrowserSync is used to live-reload your website -var browserSync = require('browser-sync'); -var reload = browserSync.reload; -// merge is used to merge the output from two different streams into the same stream -var merge = require('merge-stream'); - -// Deletes the directory that the optimized site is output to -function cleanDist(done) { trash(['dist']); done(); } -function cleanAssets(done) { trash(['.tmp']); done(); } -function rebuild(done) { trash(['src/.jekyll-metadata']); done(); } // so Jekyll rebuilds the site properly - -// Runs the build command for Jekyll to compile the site locally -// This will build the site with the production settings -function jekyllDev(done) { shell.exec('jekyll build --quiet'); done(); } - -// Almost identical to the above task, but instead we load in the build configuration -// that overwrites some of the settings in the regular configuration so that you -// don't end up publishing your drafts or future posts -function jekyllProd(done) { - shell.exec('jekyll build --quiet --config _config.yml,_config.build.yml'); - done(); -} - -// Compiles the SASS files and moves them into the 'assets/stylesheets' directory -function styles() { - // Looks at the style.scss file for what to include and creates a style.css file - return gulp.src(config.scss.src) - // Start creation of sourcemaps - .pipe($.sourcemaps.init()) - .pipe($.sass({errLogToconsole: true})) - // AutoPrefix your CSS so it works between browsers - .pipe($.autoprefixer('last 1 version', {cascade: true})) - // Write the sourcemaps to the directory of the gulp.src stream - .pipe($.sourcemaps.write('.')) - // Directory your CSS file goes to - .pipe(gulp.dest(config.scss.dest)) - // Outputs the size of the CSS file - .pipe($.size({title: 'styles'})) - // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS - .pipe(reload({stream: true})); -} - -// Mostly used to create sourcemaps and live-reload JS -function javascript() { - return gulp.src(config.javascript.src) - .pipe($.sourcemaps.init()) - .pipe($.uglify({compress: false, preserveComments: 'all'})) - .pipe($.groupConcat({ - 'index.js': config.javascript.src - })) - .pipe($.sourcemaps.write('.')) - .pipe(gulp.dest(config.javascript.dest)) - .pipe($.size({title: 'javascript'})) - .pipe(reload({stream: true})); -} - -// Optimizes the images that exists -function images() { - return gulp.src(config.images.src) - // Does not run on images that are already optimized - .pipe($.cache($.imagemin({ - // Lossless conversion to progressive JPGs - progressive: true, - // Interlace GIFs for progressive rendering - interlaced: true - }))) - .pipe(gulp.dest(config.images.dest)) - .pipe($.size({title: 'images'})); -} - -// Copy over fonts to the '.tmp' directory -function fonts() { - return gulp.src(config.fonts.src) - .pipe(gulp.dest(config.fonts.dest)) - .pipe($.size({title: 'fonts'})); -} - -// Copy optimized images and (not optimized) fonts to the 'dist' folder -function copy() { - var images = gulp.src(config.images.dest) - .pipe(gulp.dest(config.images.build)) - .pipe($.size({title: 'copied images'})); - - var fonts = gulp.src(config.fonts.dest) - .pipe(gulp.dest(config.fonts.build)) - .pipe($.size({title: 'copied fonts'})); - - return merge(images, fonts); -} - -// Optimizes all the CSS, HTML and concats the JS etc -function optimize() { - var assets = $.useref.assets({searchPath: config.assets.searchPath}); - - return gulp.src(config.assets.html) - .pipe(assets) - // Concatenate JavaScript files and preserve important comments - .pipe($.if('*.js', $.uglify({preserveComments: 'some'}))) - // Minify CSS - .pipe($.if('*.css', $.minifyCss())) - // Start cache busting the files - .pipe($.revAll({ - quiet: true, - ignore: ['.eot', '.svg', '.ttf', '.woff', '.woff2'] - })) - .pipe(assets.restore()) - // Conctenate your files based on what you specified in _layout/header.html - .pipe($.useref()) - // Replace the asset names with their cache busted names - .pipe($.revReplace()) - // Minify HTML - .pipe($.if('*.html', $.htmlmin({ - removeComments: true, - removeCommentsFromCDATA: true, - removeCDATASectionsFromCDATA: true, - collapseWhitespace: true, - collapseBooleanAttributes: true, - removeAttributeQuotes: true, - removeRedundantAttributes: true - }))) - // Send the output to the correct folder - .pipe(gulp.dest(config.assets.dest)) - .pipe($.size({title: 'optimizations'})); -}<% if (amazonCloudfrontS3) { %> - -// Task to deploy your site to Amazon S3 and Cloudfront -function deploy() { - // Generate the needed credentials (bucket, secret key etc) from a 'hidden' JSON file - var credentials = JSON.parse(fs.readFileSync('aws-credentials.json', 'utf8')); - var publisher = $.awspublish.create(credentials); - // Give your files the proper headers - - gulp.src('dist/**/*') - .pipe($.awspublishRouter({ - routes: { - '^assets/(?:.+)\\.(?:js|css)$': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=315360000, no-transform, public', - 'Content-Encoding': 'gzip' - } - }, - - '^assets/(?:.+)\\.(?:jpg|png|gif)$': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=315360000, no-transform, public', - 'Content-Encoding': 'gzip' - } - }, - - '^assets/fonts/(?:.+)\\.(?:eot|svg|ttf|woff)$': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=315360000, no-transform, public' - } - }, - - '^.+\\.html': { - key: '$&', - headers: { - 'Cache-Control': 'max-age=0, no-transform, public', - 'Content-Encoding': 'gzip' - } - }, - '^.+$': '$&' - } - })) - // Gzip the files for moar speed - .pipe($.awspublish.gzip()) - // Parallelize the number of concurrent uploads, in this case 30 - .pipe(parallelize(publisher.publish(), 30)) - // Have your files in the system cache so you don't have to recheck all the files every time - .pipe(publisher.cache()) - // Synchronize the contents of the bucket and local (this deletes everything that isn't in local!) - .pipe(publisher.sync()) - // And print the ouput, glorious - .pipe($.awspublish.reporter()) - // And update the default root object - .pipe($.cloudfront(credentials)); -}<% } %><% if (rsync) { %> - -// Task to upload your site via Rsync to your server -function deploy() { - // Load in the variables needed for our Rsync synchronization - var secret = require('./rsync-credentials.json'); - - return gulp.src('dist/**') - .pipe($.rsync({ - // This uploads the contenst of 'root', instead of the folder - root: 'dist', - // Find your username, hostname and destination from your rsync-credentials.json - hostname: secret.hostname, - username: secret.username, - destination: secret.destination, - // Incremental uploading, adds a small delay but minimizes the amount of files transferred - incremental: true, - // Shows the progress on your files while uploading - progress: true - })); -}<% } %><% if (githubPages) { %> - -// Task to upload your site to your personal GH Pages repo -function deploy() { - // Deploys your optimized site, you can change the settings in the html task if you want to - return gulp.src('dist/**/*') - .pipe($.ghPages({ - // Currently only personal GitHub Pages are supported so it will upload to the master - // branch and automatically overwrite anything that is in the directory - branch: 'master' - })); -}<% } %> - -// Run JS Lint against your JS -function jslint() { - gulp.src(config.javascript.dest) - // Checks your JS code quality against your .jshintrc file - .pipe($.jshint('.jshintrc')) - .pipe($.jshint.reporter()); -} - -// Runs 'jekyll doctor' on your site to check for errors with your configuration -// and will check for URL errors a well -function doctor(done) { shell.exec('jekyll doctor'); done(); } - -// BrowserSync will serve our site on a local server for us and other devices to use -// It will also autoreload across all devices as well as keep the viewport synchronized -// between them. -function serve() { - browserSync({ - notify: true, - // tunnel: true, - server: { - baseDir: config.watch.baseDir - } - }); - - // Watch various files for changes and do the needful - gulp.watch(config.watch.content, [jekyllDev, reload]); - gulp.watch(config.watch.javascript, javascript); - gulp.watch(config.watch.scss, styles); - gulp.watch(config.watch.images, reload); -} - -// Default task, run when just writing 'gulp' in the terminal -gulp.task('default', gulp.series( - gulp.series(jekyllDev), - gulp.parallel(styles, javascript, fonts, images), - gulp.series(serve) -)); - -// Builds your site with the 'build' command and then runs all the optimizations on -// it and outputs it to './dist' -gulp.task('optimize', gulp.series( - gulp.series(rebuild, jekyllProd), - gulp.parallel(styles, javascript, fonts, images, copy), - gulp.series(optimize) -)); - -gulp.task('build', gulp.series( - gulp.series(jekyllDev), - gulp.parallel(styles, javascript, fonts, images) -));<% if (!noUpload) { %> - -// Deploy your site for all to see -gulp.task('deploy', deploy);<% } %> - -// Serves your site locally -gulp.task('serve', serve); - -// Clean out your dist and .tmp folder and delete .jekyll-metadata -gulp.task('clean', cleanDist); -gulp.task('clean:assets', cleanAssets); -gulp.task('rebuild', gulp.series(cleanDist, cleanAssets, rebuild)); - -// Create your styles and create sourcemaps -gulp.task('styles', styles); - -// Create sourcemaps for your JS files -gulp.task('javascript', javascript); - -// Checks your CSS, JS and Jekyll for errors -gulp.task('check', gulp.series(doctor, jslint)); diff --git a/generators/gulp/templates/rsync-credentials.json b/generators/gulp/templates/rsync-credentials.json index 37fcc84..7fbb6ab 100644 --- a/generators/gulp/templates/rsync-credentials.json +++ b/generators/gulp/templates/rsync-credentials.json @@ -1,5 +1,5 @@ { - "username": "<%= rsyncUsername %>", - "hostname": "<%= rsyncHostname %>", - "destination": "<%= rsyncDestination %>" + "username": "example", + "hostname": "192.168.1.1", + "destination": "/srv/example.com/www/" } diff --git a/gulpfile.js b/gulpfile.js index 33afba7..407918a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -18,6 +18,7 @@ var handleErr = function(err) { gulp.task('check', function() { return gulp.src([ 'test/*.js', + 'test/tmp/**/*.js', 'generators/**/index.js', 'gulpfile.js' ]) @@ -47,7 +48,7 @@ gulp.task('istanbul', function(done) { }); gulp.task('clean', function(done) { - trash(['test/temp']); + trash(['test/tmp']); done(); }); @@ -57,5 +58,4 @@ gulp.task('coveralls', function() { .pipe(coveralls()); }); -gulp.task('test', gulp.series('clean', 'istanbul')); gulp.task('default', gulp.series('check', 'coveralls')); diff --git a/package.json b/package.json index 2f8861b..1d9d70b 100644 --- a/package.json +++ b/package.json @@ -14,14 +14,14 @@ "license": "MIT", "main": "app/index.js", "scripts": { - "test": "gulp test && gulp" + "test": "gulp istanbul && gulp" }, "dependencies": { "chalk": "^1.0.0", "globule": "~0.2.0", "lodash": "^3.8.0", "shelljs": "^0.4.0", - "yeoman-generator": "^0.19.0", + "yeoman-generator": "^0.20.1", "yosay": "^1.0.2" }, "devDependencies": { diff --git a/test/git.js b/test/boilerplate.js similarity index 56% rename from test/git.js rename to test/boilerplate.js index d0eff3c..6f6376d 100644 --- a/test/git.js +++ b/test/boilerplate.js @@ -1,15 +1,27 @@ 'use strict'; -var path = require('path'); +var path = require ('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-generator').test; -describe('jekyllized:git', function() { +describe('jekyllized:boilerplate', function() { before(function(done) { helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); + it('creates .editorconfig', function() { + assert.file('.editorconfig'); + }); + + it('creates .jshintrc', function() { + assert.file('.jshintrc'); + }); + + it('creates .jscsrc', function() { + assert.file('.jscsrc'); + }); + it('creates .gitignore', function() { assert.file('.gitignore'); }); diff --git a/test/editorconfig.js b/test/editorconfig.js deleted file mode 100644 index 4c17c0d..0000000 --- a/test/editorconfig.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var path = require ('path'); -var assert = require('yeoman-assert'); -var helpers = require('yeoman-generator').test; - -describe('jekyllized:editorconfig', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../generators/boilerplate')) - .on('end', done); - }); - - it('creates .editorconfig', function() { - assert.file('.editorconfig'); - }); -}); diff --git a/test/gulp.js b/test/gulp.js index 3e1994e..18c7acd 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -5,14 +5,11 @@ var assert = require('yeoman-assert'); var helpers = require('yeoman-generator').test; describe('jekyllized:gulp', function() { - describe('without any uploading', function() { + describe('no uploading', function() { before(function(done) { - this.answers = { - uploading: 'noUpload' - }; helpers.run(path.join(__dirname, '../generators/gulp')) .inDir(path.join(__dirname, 'tmp/gulp')) - .withPrompts(this.answers) + .withOptions({noUpload: true}) .on('end', done); }); @@ -23,5 +20,200 @@ describe('jekyllized:gulp', function() { it('creates package.json file', function() { assert.file('package.json'); }); + + it('does not create credentials files', function() { + assert.noFile('aws-credentials.json'); + assert.noFile('rsync-credentials.json'); + }); + + it('does not contain uploading packages', function() { + var unexpected = [ + ['package.json', /\"gulp-awspublish/], + ['package.json', /\"gulp-awspublish-router/], + ['package.json', /\"concurrent-transform/], + ['package.json', /\"gulp-rsync/], + ['package.json', /\"gulp-gh-pages/], + ]; + + assert.noFileContent(unexpected); + }); + + it('contains default gulp functions', function() { + var expected = [ + ['gulpfile.js', /function cleanDist/], + ['gulpfile.js', /function cleanAssets/], + ['gulpfile.js', /function rebuild/], + ['gulpfile.js', /function jekyllDev/], + ['gulpfile.js', /function jekyllProd/], + ['gulpfile.js', /function styles/], + ['gulpfile.js', /function javascript/], + ['gulpfile.js', /function images/], + ['gulpfile.js', /function fonts/], + ['gulpfile.js', /function copy/], + ['gulpfile.js', /function optimize/], + ['gulpfile.js', /function jslint/], + ['gulpfile.js', /function doctor/], + ['gulpfile.js', /function serve/] + ]; + + assert.fileContent(expected); + }); + + it('contains default gulp tasks', function() { + var expected = [ + ['gulpfile.js', /gulp.task\(\'default\'/], + ['gulpfile.js', /gulp.task\(\'optimize\'/], + ['gulpfile.js', /gulp.task\(\'build\'/], + ['gulpfile.js', /gulp.task\(\'serve\'/], + ['gulpfile.js', /gulp.task\(\'clean\'/], + ['gulpfile.js', /gulp.task\(\'clean\:assets\'/], + ['gulpfile.js', /gulp.task\(\'rebuild\'/], + ['gulpfile.js', /gulp.task\(\'styles\'/], + ['gulpfile.js', /gulp.task\(\'javascript\'/], + ['gulpfile.js', /gulp.task\(\'check\'/] + ]; + + assert.fileContent(expected); + }); + + it('does not contain deploy function', function() { + assert.noFileContent('gulpfile.js', 'function deploy'); + }); + + it('does not contain deploy task', function() { + assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); + }); + }); + + describe('Amazon S3', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../generators/gulp')) + .inDir(path.join(__dirname, 'tmp/gulp-aws')) + .withOptions({amazonS3: true}) + .on('end', done); + }); + + it('creates gulpfile', function() { + assert.file('gulpfile.js'); + }); + + it('creates package.json file', function() { + assert.file('package.json'); + }); + + it('contain correct uploading packages', function() { + var expected = [ + ['package.json', /\"gulp-awspublish/], + ['package.json', /\"gulp-awspublish-router/], + ['package.json', /\"concurrent-transform/] + ]; + + assert.fileContent(expected); + }); + + it('does not contain wrong uploading packages', function() { + var unexpected = [ + ['package.json', /\"gulp-rsync/], + ['package.json', /\"gulp-gh-pages/] + ]; + + assert.noFileContent(unexpected); + }); + + it('contains deploy function', function() { + assert.fileContent('gulpfile.js', 'function deploy'); + }); + + it('contains deploy task', function() { + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); + }); + + it('creates credentials file', function() { + assert.file('aws-credentials.json'); + }); + }); + + describe('Rsync', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../generators/gulp')) + .inDir(path.join(__dirname, 'tmp/gulp-rsync')) + .withOptions({rsync: true}) + .on('end', done); + }); + + it('creates gulpfile', function() { + assert.file('gulpfile.js'); + }); + + it('creates package.json file', function() { + assert.file('package.json'); + }); + + it('contain correct uploading packages', function() { + assert.fileContent('package.json', '\"gulp-rsync'); + }); + + it('does not contain wrong uploading packages', function() { + var unexpected = [ + ['package.json', /\"gulp-awspublish/], + ['package.json', /\"gulp-awspublish-router/], + ['package.json', /\"concurrent-transform/], + ['package.json', /\"gulp-gh-pages/] + ]; + + assert.noFileContent(unexpected); + }); + + it('contains deploy function', function() { + assert.fileContent('gulpfile.js', 'function deploy'); + }); + + it('contains deploy task', function() { + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); + }); + + it('creates credentials file', function() { + assert.file('rsync-credentials.json'); + }); + }); + + describe('GitHub pages', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../generators/gulp')) + .inDir(path.join(__dirname, 'tmp/gulp-pages')) + .withOptions({ghPages: true}) + .on('end', done); + }); + + it('creates gulpfile', function() { + assert.file('gulpfile.js'); + }); + + it('creates package.json file', function() { + assert.file('package.json'); + }); + + it('contain correct uploading packages', function() { + assert.fileContent('package.json', '\"gulp-gh-pages'); + }); + + it('does not contain wrong uploading packages', function() { + var unexpected = [ + ['package.json', /\"gulp-awspublish/], + ['package.json', /\"gulp-awspublish-router/], + ['package.json', /\"concurrent-transform/], + ['package.json', /\"gulp-rsync/] + ]; + + assert.noFileContent(unexpected); + }); + + it('contains deploy function', function() { + assert.fileContent('gulpfile.js', 'function deploy'); + }); + + it('contains deploy task', function() { + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); + }); }); }); diff --git a/test/jscs.js b/test/jscs.js deleted file mode 100644 index 1faf17d..0000000 --- a/test/jscs.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var path = require('path'); -var assert = require('yeoman-assert'); -var helpers = require('yeoman-generator').test; - -describe('jekyllized:jscs', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../generators/boilerplate')) - .on('end', done); - }); - - it('creates .jscsrc', function() { - assert.file('.jscsrc'); - }); -}); diff --git a/test/jshint.js b/test/jshint.js deleted file mode 100644 index bf61454..0000000 --- a/test/jshint.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var path = require('path'); -var assert = require('yeoman-assert'); -var helpers = require('yeoman-generator').test; - -describe('jekyllized:jshint', function() { - before(function(done) { - helpers.run(path.join(__dirname, '../generators/boilerplate')) - .on('end', done); - }); - - it('creates .jshintrc', function() { - assert.file('.jshintrc'); - }); -}); From bf65d66542aefcda8197e6dcb6e45f55392d452b Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 19 May 2015 20:40:21 +0200 Subject: [PATCH 027/178] Updated packages, fixed errors on tests Not too sure honestly what caused them but playing around some more with the gulpfile seems to have fixed them. --- generators/gulp/templates/gulpfile.js | 9 +++++---- gulpfile.js | 1 + package.json | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index f563497..29eaa89 100755 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -140,8 +140,8 @@ function optimize() { .pipe(gulp.dest(config.assets.dest)) .pipe($.size({title: 'optimizations'})); } -<% if (amazonS3) { -%> +<% if (amazonS3) { -%> // Task to deploy your site to Amazon S3 and Cloudfront function deploy() { // Generate the needed credentials (bucket, secret key etc) from a 'hidden' JSON file @@ -198,8 +198,8 @@ function deploy() { // And update the default root object .pipe($.cloudfront(credentials)); } -<% } -%><% if (rsync) { -%> +<% } -%><% if (rsync) { -%> // Task to upload your site via Rsync to your server function deploy() { // Load in the variables needed for our Rsync synchronization @@ -219,8 +219,8 @@ function deploy() { progress: true })); } -<% } -%><% if (ghPages) { -%> +<% } -%><% if (ghPages) { -%> // Task to upload your site to your personal GH Pages repo function deploy() { // Deploys your optimized site, you can change the settings in the html task if you want to @@ -231,8 +231,9 @@ function deploy() { branch: 'master' })); } -<% } -%> +<% } -%> +<% if (noUpload) { -%><% } -%> // Run JS Lint against your JS function jslint() { gulp.src(config.javascript.dest) diff --git a/gulpfile.js b/gulpfile.js index 407918a..b2170b6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -58,4 +58,5 @@ gulp.task('coveralls', function() { .pipe(coveralls()); }); +gulp.task('test', gulp.series('clean', 'istanbul')); gulp.task('default', gulp.series('check', 'coveralls')); diff --git a/package.json b/package.json index 1d9d70b..a34c6f3 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "chalk": "^1.0.0", "globule": "~0.2.0", "lodash": "^3.8.0", - "shelljs": "^0.4.0", + "shelljs": "^0.5.0", "yeoman-generator": "^0.20.1", "yosay": "^1.0.2" }, @@ -30,7 +30,7 @@ "generator-mocha": "^0.1.7", "gulp": "git://github.com/gulpjs/gulp#4.0", "gulp-coveralls": "^0.1.4", - "gulp-istanbul": "^0.8.1", + "gulp-istanbul": "^0.9.0", "gulp-jscs": "^1.6.0", "gulp-jshint": "^1.10.0", "gulp-load-plugins": "^0.10.0", From 66e580dded0f325d3eab0c8b71672bd5fa680d23 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 19 May 2015 20:58:07 +0200 Subject: [PATCH 028/178] Updated tests and the test runner task --- gulpfile.js | 8 +++----- test/gulp.js | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index b2170b6..65d6114 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,15 +34,13 @@ gulp.task('istanbul', function(done) { 'generators/**/index.js', 'gulpfile.js' ]) - .pipe(istanbul()) + .pipe(istanbul()) .pipe(istanbul.hookRequire()) .on('finish', function() { gulp.src(['test/*.js']) - .pipe(plumber()) - .pipe(mocha({ - reporter: 'spec' - })) + .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()) + .pipe(istanbul.enforceThresholds({thresholds: {global: 90}})) .on('end', done); }); }); diff --git a/test/gulp.js b/test/gulp.js index 18c7acd..c44df7a 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -122,12 +122,18 @@ describe('jekyllized:gulp', function() { it('contains deploy function', function() { assert.fileContent('gulpfile.js', 'function deploy'); + assert.fileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); }); it('contains deploy task', function() { assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); + it('does not contain wrong uploading tasks', function() { + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); + }); + it('creates credentials file', function() { assert.file('aws-credentials.json'); }); @@ -166,12 +172,18 @@ describe('jekyllized:gulp', function() { it('contains deploy function', function() { assert.fileContent('gulpfile.js', 'function deploy'); + assert.fileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); }); it('contains deploy task', function() { assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); + it('does not contain the wrong uploading task', function() { + assert.noFileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); + }); + it('creates credentials file', function() { assert.file('rsync-credentials.json'); }); @@ -210,10 +222,16 @@ describe('jekyllized:gulp', function() { it('contains deploy function', function() { assert.fileContent('gulpfile.js', 'function deploy'); + assert.fileContent('gulpfile.js', /\/\/ Task to upload your site to your personal GH Pages repo/); }); it('contains deploy task', function() { assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); + + it('does not contain the wrong uploadgin task', function() { + assert.noFileContent('gulpfile.js', /\/\/ Task to upload your site via Rsync to your server/); + assert.noFileContent('gulpfile.js', /\/\/ Task to deploy your site to Amazon S3 and Cloudfront/); + }); }); }); From b74a88b72d215d64eede6596ce9d0587d93f55a0 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 19 May 2015 23:27:00 +0200 Subject: [PATCH 029/178] Added subgenerator for jekyll Added a subgenerator for Jekyll, updated the main app index.js file accordingly, added tests for Jekyll (currently not 100% complete), and updated tests and such for it. Everything should now work as it did before starting to split things up, at least the tests indicate so. --- generators/app/index.js | 79 +++++- generators/gulp/index.js | 45 ++-- generators/gulp/templates/gulpfile.js | 2 +- generators/jekyll/index.js | 113 +++++++++ generators/jekyll/templates/Gemfile | 8 + generators/jekyll/templates/app/404.html | 11 + .../app/_drafts/2014-03-01-example-content.md | 157 ++++++++++++ .../templates/app/_includes/footer.html | 44 ++++ .../jekyll/templates/app/_includes/head.html | 21 ++ .../templates/app/_includes/header.html | 24 ++ .../app/_layouts/category-archive.html | 13 + .../templates/app/_layouts/default.html | 24 ++ .../templates/app/_layouts/month-archive.html | 14 ++ .../jekyll/templates/app/_layouts/page.html | 13 + .../jekyll/templates/app/_layouts/post.html | 15 ++ .../templates/app/_layouts/tag-archive.html | 13 + .../templates/app/_layouts/year-archive.html | 14 ++ .../_posts/2014-03-03-welcome-to-jekyll.md | 39 +++ generators/jekyll/templates/app/about.md | 15 ++ .../jekyll/templates/app/assets/favicon.ico | Bin 0 -> 486 bytes .../apple-touch-icon-144-precomposed.png | Bin 0 -> 1326 bytes .../app/assets/javascript/javascript.js | 1 + .../app/assets/javascript/somejavascript.js | 0 .../templates/app/assets/scss/base.scss | 204 +++++++++++++++ .../templates/app/assets/scss/layout.scss | 236 ++++++++++++++++++ .../templates/app/assets/scss/main.scss | 38 +++ .../templates/app/assets/scss/style.scss | 8 + .../app/assets/scss/syntax-highlighting.scss | 67 +++++ .../jekyll/templates/app/crossdomain.xml | 15 ++ generators/jekyll/templates/app/feed.xml | 33 +++ generators/jekyll/templates/app/humans.txt | 16 ++ generators/jekyll/templates/app/index.html | 21 ++ generators/jekyll/templates/app/robots.txt | 5 + generators/jekyll/templates/config.build.yml | 13 + generators/jekyll/templates/config.yml | 68 +++++ gulpfile.js | 2 +- index.js | 8 + package.json | 5 + test/app.js | 15 +- test/gulp.js | 8 +- test/jekyll.js | 76 ++++++ 41 files changed, 1455 insertions(+), 48 deletions(-) create mode 100644 generators/jekyll/index.js create mode 100755 generators/jekyll/templates/Gemfile create mode 100644 generators/jekyll/templates/app/404.html create mode 100644 generators/jekyll/templates/app/_drafts/2014-03-01-example-content.md create mode 100644 generators/jekyll/templates/app/_includes/footer.html create mode 100644 generators/jekyll/templates/app/_includes/head.html create mode 100644 generators/jekyll/templates/app/_includes/header.html create mode 100644 generators/jekyll/templates/app/_layouts/category-archive.html create mode 100644 generators/jekyll/templates/app/_layouts/default.html create mode 100644 generators/jekyll/templates/app/_layouts/month-archive.html create mode 100644 generators/jekyll/templates/app/_layouts/page.html create mode 100644 generators/jekyll/templates/app/_layouts/post.html create mode 100644 generators/jekyll/templates/app/_layouts/tag-archive.html create mode 100644 generators/jekyll/templates/app/_layouts/year-archive.html create mode 100644 generators/jekyll/templates/app/_posts/2014-03-03-welcome-to-jekyll.md create mode 100644 generators/jekyll/templates/app/about.md create mode 100644 generators/jekyll/templates/app/assets/favicon.ico create mode 100644 generators/jekyll/templates/app/assets/images/touch/apple-touch-icon-144-precomposed.png create mode 100644 generators/jekyll/templates/app/assets/javascript/javascript.js create mode 100644 generators/jekyll/templates/app/assets/javascript/somejavascript.js create mode 100644 generators/jekyll/templates/app/assets/scss/base.scss create mode 100644 generators/jekyll/templates/app/assets/scss/layout.scss create mode 100644 generators/jekyll/templates/app/assets/scss/main.scss create mode 100644 generators/jekyll/templates/app/assets/scss/style.scss create mode 100644 generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss create mode 100644 generators/jekyll/templates/app/crossdomain.xml create mode 100644 generators/jekyll/templates/app/feed.xml create mode 100644 generators/jekyll/templates/app/humans.txt create mode 100644 generators/jekyll/templates/app/index.html create mode 100644 generators/jekyll/templates/app/robots.txt create mode 100644 generators/jekyll/templates/config.build.yml create mode 100755 generators/jekyll/templates/config.yml create mode 100644 index.js create mode 100644 test/jekyll.js diff --git a/generators/app/index.js b/generators/app/index.js index aad8e0c..ca68822 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -11,35 +11,72 @@ module.exports = generators.Base.extend({ }, prompting: function() { + var self = this; var done = this.async(); var prompts = [{ name: 'projectName', - message: 'What is the name of your project?' + message: 'What is the name of your project?', + store: true }, { name: 'projectDescription', - message: 'Describe your project' + message: 'Describe your project', + store: true }, { name: 'projectURL', message: chalk.red('If you are using GHPages use username.github.io') + - '\nWhat will the URL for your project be?' + '\nWhat will the URL for your project be?', + store: true }, { name: 'authorName', - message: 'What\'s your name?' + message: 'What\'s your name?', + store: true }, { name: 'authorEmail', - message: 'What\'s your email?' + message: 'What\'s your email?', + store: true }, { name: 'authorBio', - message: 'Write a short description about yourself' + message: 'Write a short description about yourself', + store: true }, { name: 'authorTwitter', - message: 'Your Twitter handle' + message: 'Your Twitter handle', + store: true, + }, { + name: 'uploading', + type: 'list', + message: 'How do you want to upload your site?', + choices: ['Amazon S3', 'Rsync', 'Github Pages', 'None'], + store: true + }, { + name: 'jekyllPermalinks', + type: 'list', + message: 'Permalink style' + (chalk.red( + '\n pretty: /:year/:month/:day/:title/' + + '\n date: /:year/:month/:day/:title.html' + + '\n none: /:categories/:title.html')) + '\n', + choices: ['pretty', 'date', 'none'], + store: true + }, { + name: 'jekyllPaginate', + message: 'How many posts do you want to show on your front page?' + + chalk.red('\nMust be a number or all'), + store: true, + default: 10, + validate: function(input) { + if (/^[0-9]*$/.test(input)) { + return true; + } + if (/^all*$/i.test(input)) { + return true; + } + return 'Must be a number or all'; + } }]; this.prompt(prompts, function(props) { this.props = _.extend(this.props, props); - this.config.set(this.props); done(); }.bind(this)); @@ -65,8 +102,32 @@ module.exports = generators.Base.extend({ local: require.resolve('../boilerplate') }); - this.composeWith('jekyllized:gulp', {}, { + this.composeWith('jekyllized:gulp', { + options: { + uploading: this.props.uploading + } + }, { local: require.resolve('../gulp') }); + + this.composeWith('jekyllized:jekyll', { + options: { + projectName: this.props.projectName, + projectDescription: this.props.projectDescription, + projectURL: this.props.projectURL, + authorName: this.props.authorName, + authorEmail: this.props.authorEmail, + authorBio: this.props.authorBio, + authorTwitter: this.props.authorTwitter, + jekyllPermalinks: this.props.jekyllPermalinks, + jekyllPaginate: this.props.jekyllPaginate + } + }, { + local: require.resolve('../jekyll') + }); + }, + + installing: function() { + this.npmInstall(); } }); diff --git a/generators/gulp/index.js b/generators/gulp/index.js index 371ec06..d461f26 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -8,27 +8,12 @@ module.exports = generators.Base.extend({ constructor: function() { generators.Base.apply(this, arguments); - this.option('amazonS3', { - type: Boolean, - name: 'amazonS3', - desc: 'Do you want to upload to Amazon S3?' - }); - - this.option('rsync', { - type: Boolean, - name: 'rsync', - desc: 'Do you want to upload to Rsync?' - }); - - this.option('ghpages', { - type: Boolean, - name: 'ghPages', - desc: 'Do you want to upload to GitHub Pages?' - }); - this.option('noUpload', { - type: Boolean, - name: 'noUpload', - desc: 'No uploading' + this.option('uploading', { + required: true, + name: 'uploading', + type: 'list', + message: 'How do you want to upload your site?', + choices: ['Amazon S3', 'Rsync', 'Github Pages', 'None'], }); }, @@ -69,17 +54,17 @@ module.exports = generators.Base.extend({ 'trash': '^1.4.0' }); - if (this.options.amazonS3) { + if (this.options.uploading === 'Amazon S3') { pkg.devDependencies['gulp-awspublish'] = '^0.1.0'; pkg.devDependencies['gulp-awspublish-router'] = '^0.1.0'; pkg.devDependencies['concurrent-transform'] = '^1.0.0'; } - if (this.options.rsync) { + if (this.options.uploading === 'Rsync') { pkg.devDependencies['gulp-rsync'] = '^0.0.2'; } - if (this.options.ghPages) { + if (this.options.uploading === 'Github Pages') { pkg.devDependencies['gulp-gh-pages'] = '^0.4.0'; } @@ -91,21 +76,21 @@ module.exports = generators.Base.extend({ this.templatePath('gulpfile.js'), this.destinationPath('gulpfile.js'), { - amazonS3: this.options.amazonS3, - rsync: this.options.rsync, - ghPages: this.options.ghPages, - noUpload: this.options.noUpload + amazonS3: this.options.uploading === 'Amazon S3', + rsync: this.options.uploading === 'Rsync', + ghpages: this.options.uploading === 'Github Pages', + noUpload: this.options.uploading === 'None' } ); - if (this.options.amazonS3) { + if (this.options.uploading === 'Amazon S3') { this.fs.copyTpl( this.templatePath('aws-credentials.json'), this.destinationPath('aws-credentials.json') ); } - if (this.options.rsync) { + if (this.options.uploading === 'Rsync') { this.fs.copyTpl( this.templatePath('rsync-credentials.json'), this.destinationPath('rsync-credentials.json') diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index 29eaa89..da854fe 100755 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -220,7 +220,7 @@ function deploy() { })); } -<% } -%><% if (ghPages) { -%> +<% } -%><% if (ghpages) { -%> // Task to upload your site to your personal GH Pages repo function deploy() { // Deploys your optimized site, you can change the settings in the html task if you want to diff --git a/generators/jekyll/index.js b/generators/jekyll/index.js new file mode 100644 index 0000000..49b2b14 --- /dev/null +++ b/generators/jekyll/index.js @@ -0,0 +1,113 @@ +'use strict'; + +var _ = require('lodash'); +var chalk = require('chalk'); +var generators = require('yeoman-generator'); +var path = require('path'); +var yosay = require('yosay'); +var shelljs = require('shelljs'); + +module.exports = generators.Base.extend({ + constructor: function() { + generators.Base.apply(this, arguments); + + var dependenciesInstalled = ['bundle', 'ruby'].every(function(depend) { + return shelljs.which(depend); + }); + + if (!dependenciesInstalled) { + this.log('MISSING DEPENDENCIES:' + + '\nEither ' + chalk.white('Ruby') + ' or ' + chalk.white('Bundler') + + ' is not installed or missing from $PATH.' + + '\nMake sure that they are either installed or added to $PATH.'); + shelljs.exit(1); + } + + this.option('projectName', { + type: String, + required: true, + desc: 'Project name' + }); + + this.option('projectDescription', { + type: String, + required: true, + desc: 'Project description' + }); + + this.option('projectURL', { + type: String, + required: true, + desc: 'Project URL' + }); + + this.option('authorName', { + type: String, + required: true, + desc: 'Author name' + }); + + this.option('authorEmail', { + type: String, + required: true, + desc: 'Author email' + }); + + this.option('authorBio', { + type: String, + required: true, + desc: 'Author bio' + }); + + this.option('authorTwitter', { + type: String, + required: true, + desc: 'Author twitter' + }); + + this.option('jekyllPermalink', { + type: String, + required: true, + desc: 'Jekyll permalinks' + }); + + this.option('jekyllPaginate', { + type: String, + required: true, + desc: 'Jekyll paginate' + }); + }, + + writing: function() { + this.fs.copy( + this.templatePath('Gemfile'), + this.destinationPath('Gemfile') + ); + + this.fs.copyTpl( + this.templatePath('config.yml'), + this.destinationPath('_config.yml'), + { + projectName: this.options.projectName, + projectDescription: this.options.projectDescription, + projectURL: this.options.projectURL, + authorName: this.options.authorName, + authorEmail: this.options.authorEmail, + authorBio: this.options.authorBio, + authorTwitter: this.options.authorTwitter, + jekyllPermalinks: this.options.jekyllPermalinks, + jekyllPaginate: this.options.jekyllPaginate + } + ); + + this.fs.copyTpl( + this.templatePath('config.build.yml'), + this.destinationPath('_config.build.yml') + ); + + this.fs.copy( + this.templatePath('app'), + this.destinationPath('src') + ); + } +}); diff --git a/generators/jekyll/templates/Gemfile b/generators/jekyll/templates/Gemfile new file mode 100755 index 0000000..91437eb --- /dev/null +++ b/generators/jekyll/templates/Gemfile @@ -0,0 +1,8 @@ +source "http://rubygems.org" + +gem 'jekyll' +gem 'redcarpet' + +# jekyll plugins +gem 'jekyll-archives', :git => 'https://github.com/jekyll/jekyll-archives' +gem 'jekyll-sitemap' diff --git a/generators/jekyll/templates/app/404.html b/generators/jekyll/templates/app/404.html new file mode 100644 index 0000000..46f2d7b --- /dev/null +++ b/generators/jekyll/templates/app/404.html @@ -0,0 +1,11 @@ +--- +layout: default +title: "404: Page not found" +--- + +
+

404: Page not found

+

Sorry, we've misplaced that URL or it's pointing to something + that doesn't exist. Head back home to try finding it + again.

+
diff --git a/generators/jekyll/templates/app/_drafts/2014-03-01-example-content.md b/generators/jekyll/templates/app/_drafts/2014-03-01-example-content.md new file mode 100644 index 0000000..fb41e06 --- /dev/null +++ b/generators/jekyll/templates/app/_drafts/2014-03-01-example-content.md @@ -0,0 +1,157 @@ +--- +layout: post +date: 2014-03-01 +title: Example content +categories: jekyll example +--- + +
Howdy! This is an example blog post that shows several +types of HTML content supported in this theme.
+ +Cum sociis natoque penatibus et magnis dis parturient montes, +nascetur ridiculus mus. *Aenean eu leo quam.* Pellentesque ornare sem lacinia +quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis +consectetur purus sit amet fermentum. + +> Curabitur blandit tempus porttitor. Nullam quis risus eget urna mollis ornare +> vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit. + +Etiam porta **sem malesuada magna** mollis euismod. Cras mattis consectetur +purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur. + + + +## Inline HTML elements + +HTML defines a long list of available inline tags, a complete list of which can +be found on the [Mozilla Developer +Network](https://developer.mozilla.org/en-US/docs/Web/HTML/Element). + +- **To bold text**, use ``. +- *To italicize text*, use ``. +- Abbreviations, like HTML should + use ``, with an optional `title` attribute for the full phrase. +- Citations, like — Mark otto, should use ``. +- Deleted text should use `` and inserted text should + use ``. +- Superscript text uses `` and subscript text uses + ``. + +Most of these elements are styled by browsers with few modifications on our part. + +## Heading + +Vivamus sagittis lacus vel augue rutrum faucibus dolor auctor. Duis mollis, est +non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. +Morbi leo risus, porta ac consectetur ac, vestibulum at eros. + +### Code + +Cum sociis natoque penatibus et magnis dis `code element` montes, nascetur +ridiculus mus. + +{% highlight js %} +// Example can be run directly in your JavaScript console + +// Create a function that takes two arguments and returns the sum of those +arguments var adder = new Function("a", "b", "return a + b"); + +// Call the function +adder(2, 6); +// > 8 +{% endhighlight %} + +Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna +mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris +condimentum nibh, ut fermentum massa. + +### Gists via GitHub Pages + +Vestibulum id ligula porta felis euismod semper. Nullam quis risus eget urna +mollis ornare vel eu leo. Donec sed odio dui. + +{% gist 5555251 gist.md %} + +Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. +Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque +penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec sed +odio dui. Vestibulum id ligula porta felis euismod semper. + +### Lists + +Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus +mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada +magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris +condimentum nibh, ut fermentum massa justo sit amet risus. + +* Praesent commodo cursus magna, vel scelerisque nisl consectetur et. +* Donec id elit non mi porta gravida at eget metus. +* Nulla vitae elit libero, a pharetra augue. + +Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a +pharetra augue. + +1. Vestibulum id ligula porta felis euismod semper. +2. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur + ridiculus mus. +3. Maecenas sed diam eget risus varius blandit sit amet non magna. + +Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at +lobortis. + +
+
HyperText Markup Language (HTML)
+
The language used to describe and define the content of a Web page
+ +
Cascading Style Sheets (CSS)
+
Used to describe the appearance of Web content
+ +
JavaScript (JS)
+
The programming language used to build advanced Web sites and applications
+
+ +Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Morbi leo +risus, porta ac consectetur ac, vestibulum at eros. Nullam quis risus eget urna +mollis ornare vel eu leo. + +### Tables + +Aenean lacinia bibendum nulla sed consectetur. Lorem ipsum dolor sit amet, +consectetur adipiscing elit. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameUpvotesDownvotes
Totals2123
Alice1011
Bob43
Charlie79
+ +Nullam id dolor id nibh ultricies vehicula ut id elit. Sed posuere consectetur +est at lobortis. Nullam quis risus eget urna mollis ornare vel eu leo. diff --git a/generators/jekyll/templates/app/_includes/footer.html b/generators/jekyll/templates/app/_includes/footer.html new file mode 100644 index 0000000..7b7c565 --- /dev/null +++ b/generators/jekyll/templates/app/_includes/footer.html @@ -0,0 +1,44 @@ + diff --git a/generators/jekyll/templates/app/_includes/head.html b/generators/jekyll/templates/app/_includes/head.html new file mode 100644 index 0000000..506b7d0 --- /dev/null +++ b/generators/jekyll/templates/app/_includes/head.html @@ -0,0 +1,21 @@ + + + + + + {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} + + + + + + + + + + + + + + + diff --git a/generators/jekyll/templates/app/_includes/header.html b/generators/jekyll/templates/app/_includes/header.html new file mode 100644 index 0000000..cedae2c --- /dev/null +++ b/generators/jekyll/templates/app/_includes/header.html @@ -0,0 +1,24 @@ + diff --git a/generators/jekyll/templates/app/_layouts/category-archive.html b/generators/jekyll/templates/app/_layouts/category-archive.html new file mode 100644 index 0000000..5875994 --- /dev/null +++ b/generators/jekyll/templates/app/_layouts/category-archive.html @@ -0,0 +1,13 @@ +--- +layout: default +--- + +

Archive of posts with {{ page.type }} '{{ page.title }}'

+
    + {% for post in page.posts %} +
  • + + {{ post.title }} +
  • + {% endfor %} +
diff --git a/generators/jekyll/templates/app/_layouts/default.html b/generators/jekyll/templates/app/_layouts/default.html new file mode 100644 index 0000000..7ba65a5 --- /dev/null +++ b/generators/jekyll/templates/app/_layouts/default.html @@ -0,0 +1,24 @@ + + + + {% include head.html %} + + + + {% include header.html %} + +
+
+ {{ content }} +
+
+ + {% include footer.html %} + + + + + + + + diff --git a/generators/jekyll/templates/app/_layouts/month-archive.html b/generators/jekyll/templates/app/_layouts/month-archive.html new file mode 100644 index 0000000..a42bd21 --- /dev/null +++ b/generators/jekyll/templates/app/_layouts/month-archive.html @@ -0,0 +1,14 @@ +--- +layout: default +--- + +

Archive of posts from {{ page.date | date: "%B %Y" }}

+ +
    +{% for post in page.posts %} +
  • + + {{ post.title }} +
  • +{% endfor %} +
diff --git a/generators/jekyll/templates/app/_layouts/page.html b/generators/jekyll/templates/app/_layouts/page.html new file mode 100644 index 0000000..f375cc4 --- /dev/null +++ b/generators/jekyll/templates/app/_layouts/page.html @@ -0,0 +1,13 @@ +--- +layout: default +--- +
+ +
+

{{ page.title }}

+
+ +
+ {{ content }} +
+
diff --git a/generators/jekyll/templates/app/_layouts/post.html b/generators/jekyll/templates/app/_layouts/post.html new file mode 100644 index 0000000..d4f8be3 --- /dev/null +++ b/generators/jekyll/templates/app/_layouts/post.html @@ -0,0 +1,15 @@ +--- +layout: default +--- +
+ +
+

{{ page.title }}

+ +
+ +
+ {{ content }} +
+ +
diff --git a/generators/jekyll/templates/app/_layouts/tag-archive.html b/generators/jekyll/templates/app/_layouts/tag-archive.html new file mode 100644 index 0000000..5875994 --- /dev/null +++ b/generators/jekyll/templates/app/_layouts/tag-archive.html @@ -0,0 +1,13 @@ +--- +layout: default +--- + +

Archive of posts with {{ page.type }} '{{ page.title }}'

+
    + {% for post in page.posts %} +
  • + + {{ post.title }} +
  • + {% endfor %} +
diff --git a/generators/jekyll/templates/app/_layouts/year-archive.html b/generators/jekyll/templates/app/_layouts/year-archive.html new file mode 100644 index 0000000..1884340 --- /dev/null +++ b/generators/jekyll/templates/app/_layouts/year-archive.html @@ -0,0 +1,14 @@ +--- +layout: default +--- + +

Archive of posts from {{ page.date | date: "%Y" }}

+ +
    +{% for post in page.posts %} +
  • + + {{ post.title }} +
  • +{% endfor %} +
diff --git a/generators/jekyll/templates/app/_posts/2014-03-03-welcome-to-jekyll.md b/generators/jekyll/templates/app/_posts/2014-03-03-welcome-to-jekyll.md new file mode 100644 index 0000000..b4aa00e --- /dev/null +++ b/generators/jekyll/templates/app/_posts/2014-03-03-welcome-to-jekyll.md @@ -0,0 +1,39 @@ +--- +layout: post +date: 2015-02-03 +title: Welcome to Jekyll! +categories: jekyll +--- + +You'll find this post in your `_posts` directory - edit this post and re-build +(or run with the `-w` switch) to see your changes! To add new posts, simply add +a file in the `_posts` directory that follows the convention: +YYYY-MM-DD-name-of-post.ext. + + + +We've also added a lot of different settings for [Redcarpet][redcarpet], +including being able to ^superscript, _underline_, ==highlight==, +~~strikethrough~~, and footnotes.[^1] It even automatically makes links into +URLs: www.jekyllrb.com and you can put multiple underscores in words without +them leaning all over the place: this_word_has_underscores. It'll also make your +quotes look nice, like this: "hoho", your dashes and hypens will be dashing too: +---/--. + +Jekyll also offers powerful support for code snippets: + +{% highlight ruby %} +def print_hi(name) + puts "Hi, #{name}" +end +print_hi('Tom') +#=> prints 'Hi, Tom' to STDOUT. +{% endhighlight %} + +Check out the [Jekyll docs][jekyll] for more info on how to get the most out of +Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh]. + +[redcarpet]: https://github.com/vmg/redcarpet +[jekyll-gh]: https://github.com/jekyll/jekyll +[jekyll]: http://jekyllrb.com/docs/home/ +[^1]: Who are quite handy diff --git a/generators/jekyll/templates/app/about.md b/generators/jekyll/templates/app/about.md new file mode 100644 index 0000000..0b8de1d --- /dev/null +++ b/generators/jekyll/templates/app/about.md @@ -0,0 +1,15 @@ +--- +layout: page +title: About +permalink: /about/ +--- + +This is the base Jekyll theme. You can find out more info about customizing your +Jekyll theme, as well as basic Jekyll usage documentation at +[jekyllrb.com](http://jekyllrb.com/) + +You can find the source code for the Jekyll new theme at: +[github.com/jglovier/jekyll-new](https://github.com/jglovier/jekyll-new) + +You can find the source code for Jekyll at +[github.com/jekyll/jekyll](https://github.com/jekyll/jekyll) diff --git a/generators/jekyll/templates/app/assets/favicon.ico b/generators/jekyll/templates/app/assets/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..34b42063d5e65cf11a2f3ce3e9e04190a3d4e41c GIT binary patch literal 486 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1SJ1Ryj={WI14-?i-EKU7`vU!wgU;46*#5? zX$3HD|21bW0|R5Ir;B5V$MNKl%NJ4?s3t60`Es!s4;Obtf#;7MyTAFpII8;l$;Zi) zkNeA6m%aJ1@^b$D`UA;~n>Tb=lqt`%+g7~U0i{Foaa;NLXEn3EE_ikOQYHLAWcsjq{R2`R@?992nUwL?Vv{s$^)y5_;QN4fu zl<8p)itJ8`v9z-uKHDlH`kPPg-?zu?a=J?*8P1v&fB0#!43y85}Sb4q9e0JR&<;Q#;t literal 0 HcmV?d00001 diff --git a/generators/jekyll/templates/app/assets/images/touch/apple-touch-icon-144-precomposed.png b/generators/jekyll/templates/app/assets/images/touch/apple-touch-icon-144-precomposed.png new file mode 100644 index 0000000000000000000000000000000000000000..177bbae293f6578146a9f604aedb799885ae75c0 GIT binary patch literal 1326 zcmZ`(eKgYx82+&xR7Oa?j+3NP-Cd%)^yOU8|8&mtzR!7|^ZxPv@jP$AFDLvU8*MiN z000T__d)CU`qwhj*Yz__8EPHbq$4rup{a!QEF1|B98E}#!#e~Jafx^|9+yB)`wQ;@ z0N}m=pQB+HBnnxs|BXa|H!n5FD0i}+V%KwDiC&gC$jl{8v|G43QIaIk?E$i=pdr>d zkprcL*x^HP7PiM+Pi2l1HPtXKIiGGLf0QZP2IC0Vs++d=7(kXfA%^bgD&aI)J+7|M zUjN9S^F*jMFJ+n?+vlDmL!C1zd5wUp{xtw}4cNic!N^qyedF&)?qrv)!PwVs#D9dd zv+`9j_8pP8E1VFSbid1urADDRJ&lom>p3~vfj3so?1odMjRZpx^iin#aAIoA;w|?>ynx3d+HBBfj z_w!*F#R`a;9n9Ka-B3F>FK-Xx&TM|@)GOuGb1uj(l9D~3wPhmw6vc|MLE;i>JJZjcEeT@D;o>4XST05W{HB$QZ96y_`Ml;s zPZ2wA&**+`HgCmq0B}DNJ5c77$*YmBK31 zZaSM3W{n)&_acn89KA-X)6PW1F#smFGsnNj{H%NZgv+T2W9C37EQlFk%1#@m)xohf zB2Vq_Xv)gfvAsa3tV#TsSXZ^r9ZaOK(JXMayI@MonZ-tNIWw`Y~Xz zZ>AS-Y>nN&6-zb4f~~P&=ESpxhAD%<+`}MDnCPyiaALAYzaDeIZ4mvi zS9mZcH*TdrmbypD%Xz%GxHdnr)8x+0@aFiI#iX{Hn#lP@wo$3cu%%t{%D5%isHAm;(N0^$C1CwQ)P~=gOzbq z;T^eQikcOzR7T|I=liaQ`10@-;)sphGO)nmuQC4+y$eW?c%U4a~uk02lVo*{JT(IKt zy~uqFrnA6!k=NM6c?mZWmqJ-qJJ)+G<~Rr32UH z6*46UFgwk$RC;qs2hGO7TF;lNgV{G9SnK^Kef7ovXWiC;JgpfPum~yX5FDvd>K-5v NfIQ*z=P~T1e*tcge%Js2 literal 0 HcmV?d00001 diff --git a/generators/jekyll/templates/app/assets/javascript/javascript.js b/generators/jekyll/templates/app/assets/javascript/javascript.js new file mode 100644 index 0000000..b9d3e23 --- /dev/null +++ b/generators/jekyll/templates/app/assets/javascript/javascript.js @@ -0,0 +1 @@ +console.log('Hello world!'); diff --git a/generators/jekyll/templates/app/assets/javascript/somejavascript.js b/generators/jekyll/templates/app/assets/javascript/somejavascript.js new file mode 100644 index 0000000..e69de29 diff --git a/generators/jekyll/templates/app/assets/scss/base.scss b/generators/jekyll/templates/app/assets/scss/base.scss new file mode 100644 index 0000000..e5fd0fd --- /dev/null +++ b/generators/jekyll/templates/app/assets/scss/base.scss @@ -0,0 +1,204 @@ +/** + * Reset some basic elements + */ +body, h1, h2, h3, h4, h5, h6, +p, blockquote, pre, hr, +dl, dd, ol, ul, figure { + margin: 0; + padding: 0; +} + + + +/** + * Basic styling + */ +body { + font-family: $base-font-family; + font-size: $base-font-size; + line-height: $base-line-height; + font-weight: 300; + color: $text-color; + background-color: $background-color; + -webkit-text-size-adjust: 100%; +} + + + +/** + * Set `margin-bottom` to maintain vertical rhythm + */ +h1, h2, h3, h4, h5, h6, +p, blockquote, pre, +ul, ol, dl, figure, +%vertical-rhythm { + margin-bottom: $spacing-unit / 2; +} + + + +/** + * Images + */ +img { + max-width: 100%; + vertical-align: middle; +} + + + +/** + * Figures + */ +figure > img { + display: block; +} + +figcaption { + font-size: $small-font-size; +} + + + +/** + * Lists + */ +ul, ol { + margin-left: $spacing-unit; +} + +li { + > ul, + > ol { + margin-bottom: 0; + } +} + + + +/** + * Headings + */ +h1, h2, h3, h4, h5, h6 { + font-weight: 300; +} + + + +/** + * Links + */ +a { + color: $brand-color; + text-decoration: none; + + &:visited { + color: darken($brand-color, 15%); + } + + &:hover { + color: $text-color; + text-decoration: underline; + } +} + + + +/** + * Blockquotes + */ +blockquote { + color: $grey-color; + border-left: 4px solid $grey-color-light; + padding-left: $spacing-unit / 2; + font-size: 18px; + letter-spacing: -1px; + font-style: italic; + + > :last-child { + margin-bottom: 0; + } +} + + + +/** + * Code formatting + */ +pre, +code { + font-size: 15px; + border: 1px solid $grey-color-light; + border-radius: 3px; + background-color: #eef; +} + +code { + padding: 1px 5px; +} + +pre { + padding: 8px 12px; + overflow-x: scroll; + + > code { + border: 0; + padding-right: 0; + padding-left: 0; + } +} + + + +/** + * Wrapper + */ +.wrapper { + max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2)); + max-width: calc(#{$content-width} - (#{$spacing-unit} * 2)); + margin-right: auto; + margin-left: auto; + padding-right: $spacing-unit; + padding-left: $spacing-unit; + @extend %clearfix; + + @include media-query($on-laptop) { + max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit})); + max-width: calc(#{$content-width} - (#{$spacing-unit})); + padding-right: $spacing-unit / 2; + padding-left: $spacing-unit / 2; + } +} + + + +/** + * Clearfix + */ +%clearfix { + + &:after { + content: ""; + display: table; + clear: both; + } +} + + + +/** + * Icons + */ +.icon { + + > svg { + display: inline-block; + width: 16px; + height: 16px; + vertical-align: middle; + + path { + fill: $grey-color; + } + } +} diff --git a/generators/jekyll/templates/app/assets/scss/layout.scss b/generators/jekyll/templates/app/assets/scss/layout.scss new file mode 100644 index 0000000..3f9ff42 --- /dev/null +++ b/generators/jekyll/templates/app/assets/scss/layout.scss @@ -0,0 +1,236 @@ +/** + * Site header + */ +.site-header { + border-top: 5px solid $grey-color-dark; + border-bottom: 1px solid $grey-color-light; + min-height: 56px; + + // Positioning context for the mobile navigation icon + position: relative; +} + +.site-title { + font-size: 26px; + line-height: 56px; + letter-spacing: -1px; + margin-bottom: 0; + float: left; + + &, + &:visited { + color: $grey-color-dark; + } +} + +.site-nav { + float: right; + line-height: 56px; + + .menu-icon { + display: none; + } + + .page-link { + color: $text-color; + line-height: $base-line-height; + + // Gaps between nav items, but not on the last one + &:not(:last-child) { + margin-right: 20px; + } + } + + @include media-query($on-palm) { + position: absolute; + top: 9px; + right: $spacing-unit / 2; + background-color: $background-color; + border: 1px solid $grey-color-light; + border-radius: 5px; + text-align: right; + + .menu-icon { + display: block; + float: right; + width: 36px; + height: 26px; + line-height: 0; + padding-top: 10px; + text-align: center; + + > svg { + width: 18px; + height: 15px; + + path { + fill: $grey-color-dark; + } + } + } + + .trigger { + clear: both; + display: none; + } + + &:hover .trigger { + display: block; + padding-bottom: 5px; + } + + .page-link { + display: block; + padding: 5px 10px; + } + } +} + + + +/** + * Site footer + */ +.site-footer { + border-top: 1px solid $grey-color-light; + padding: $spacing-unit 0; +} + +.footer-heading { + font-size: 18px; + margin-bottom: $spacing-unit / 2; +} + +.contact-list, +.social-media-list { + list-style: none; + margin-left: 0; +} + +.footer-col-wrapper { + font-size: 15px; + color: $grey-color; + margin-left: -$spacing-unit / 2; + @extend %clearfix; +} + +.footer-col { + float: left; + margin-bottom: $spacing-unit / 2; + padding-left: $spacing-unit / 2; +} + +.footer-col-1 { + width: -webkit-calc(35% - (#{$spacing-unit} / 2)); + width: calc(35% - (#{$spacing-unit} / 2)); +} + +.footer-col-2 { + width: -webkit-calc(20% - (#{$spacing-unit} / 2)); + width: calc(20% - (#{$spacing-unit} / 2)); +} + +.footer-col-3 { + width: -webkit-calc(45% - (#{$spacing-unit} / 2)); + width: calc(45% - (#{$spacing-unit} / 2)); +} + +@include media-query($on-laptop) { + .footer-col-1, + .footer-col-2 { + width: -webkit-calc(50% - (#{$spacing-unit} / 2)); + width: calc(50% - (#{$spacing-unit} / 2)); + } + + .footer-col-3 { + width: -webkit-calc(100% - (#{$spacing-unit} / 2)); + width: calc(100% - (#{$spacing-unit} / 2)); + } +} + +@include media-query($on-palm) { + .footer-col { + float: none; + width: -webkit-calc(100% - (#{$spacing-unit} / 2)); + width: calc(100% - (#{$spacing-unit} / 2)); + } +} + + + +/** + * Page content + */ +.page-content { + padding: $spacing-unit 0; +} + +.page-heading { + font-size: 20px; +} + +.post-list { + margin-left: 0; + list-style: none; + + > li { + margin-bottom: $spacing-unit; + } +} + +.post-meta { + font-size: $small-font-size; + color: $grey-color; +} + +.post-link { + display: block; + font-size: 24px; +} + + + +/** + * Posts + */ +.post-header { + margin-bottom: $spacing-unit; +} + +.post-title { + font-size: 42px; + letter-spacing: -1px; + line-height: 1; + + @include media-query($on-laptop) { + font-size: 36px; + } +} + +.post-content { + margin-bottom: $spacing-unit; + + h2 { + font-size: 32px; + + @include media-query($on-laptop) { + font-size: 28px; + } + } + + h3 { + font-size: 26px; + + @include media-query($on-laptop) { + font-size: 22px; + } + } + + h4 { + font-size: 20px; + + @include media-query($on-laptop) { + font-size: 18px; + } + } +} diff --git a/generators/jekyll/templates/app/assets/scss/main.scss b/generators/jekyll/templates/app/assets/scss/main.scss new file mode 100644 index 0000000..0e4f004 --- /dev/null +++ b/generators/jekyll/templates/app/assets/scss/main.scss @@ -0,0 +1,38 @@ +@charset "utf-8"; + +// Our variables + +$base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +$base-font-size: 16px; +$base-font-weight: 300; +$small-font-size: $base-font-size * 0.875; +$base-line-height: 1.5; + +$spacing-unit: 30px; + +$text-color: #111; +$background-color: #fdfdfd; +$brand-color: #2a7ae2; + +$grey-color: #828282; +$grey-color-light: lighten($grey-color, 40%); +$grey-color-dark: darken($grey-color, 25%); + +// Width of the content area +$content-width: 800px; + +$on-palm: 600px; +$on-laptop: 800px; + +// Using media queries with like this: +// @include media-query($on-palm) { +// .wrapper { +// padding-right: $spacing-unit / 2; +// padding-left: $spacing-unit / 2; +// } +// } +@mixin media-query($device) { + @media screen and (max-width: $device) { + @content; + } +} diff --git a/generators/jekyll/templates/app/assets/scss/style.scss b/generators/jekyll/templates/app/assets/scss/style.scss new file mode 100644 index 0000000..f265500 --- /dev/null +++ b/generators/jekyll/templates/app/assets/scss/style.scss @@ -0,0 +1,8 @@ +/* +The main SCSS file for everything, yep +*/ + +@import "main"; +@import "base"; +@import "layout"; +@import "syntax-highlighting"; diff --git a/generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss b/generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss new file mode 100644 index 0000000..e36627d --- /dev/null +++ b/generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss @@ -0,0 +1,67 @@ +/** + * Syntax highlighting styles + */ +.highlight { + background: #fff; + @extend %vertical-rhythm; + + .c { color: #998; font-style: italic } // Comment + .err { color: #a61717; background-color: #e3d2d2 } // Error + .k { font-weight: bold } // Keyword + .o { font-weight: bold } // Operator + .cm { color: #998; font-style: italic } // Comment.Multiline + .cp { color: #999; font-weight: bold } // Comment.Preproc + .c1 { color: #998; font-style: italic } // Comment.Single + .cs { color: #999; font-weight: bold; font-style: italic } // Comment.Special + .gd { color: #000; background-color: #fdd } // Generic.Deleted + .gd .x { color: #000; background-color: #faa } // Generic.Deleted.Specific + .ge { font-style: italic } // Generic.Emph + .gr { color: #a00 } // Generic.Error + .gh { color: #999 } // Generic.Heading + .gi { color: #000; background-color: #dfd } // Generic.Inserted + .gi .x { color: #000; background-color: #afa } // Generic.Inserted.Specific + .go { color: #888 } // Generic.Output + .gp { color: #555 } // Generic.Prompt + .gs { font-weight: bold } // Generic.Strong + .gu { color: #aaa } // Generic.Subheading + .gt { color: #a00 } // Generic.Traceback + .kc { font-weight: bold } // Keyword.Constant + .kd { font-weight: bold } // Keyword.Declaration + .kp { font-weight: bold } // Keyword.Pseudo + .kr { font-weight: bold } // Keyword.Reserved + .kt { color: #458; font-weight: bold } // Keyword.Type + .m { color: #099 } // Literal.Number + .s { color: #d14 } // Literal.String + .na { color: #008080 } // Name.Attribute + .nb { color: #0086B3 } // Name.Builtin + .nc { color: #458; font-weight: bold } // Name.Class + .no { color: #008080 } // Name.Constant + .ni { color: #800080 } // Name.Entity + .ne { color: #900; font-weight: bold } // Name.Exception + .nf { color: #900; font-weight: bold } // Name.Function + .nn { color: #555 } // Name.Namespace + .nt { color: #000080 } // Name.Tag + .nv { color: #008080 } // Name.Variable + .ow { font-weight: bold } // Operator.Word + .w { color: #bbb } // Text.Whitespace + .mf { color: #099 } // Literal.Number.Float + .mh { color: #099 } // Literal.Number.Hex + .mi { color: #099 } // Literal.Number.Integer + .mo { color: #099 } // Literal.Number.Oct + .sb { color: #d14 } // Literal.String.Backtick + .sc { color: #d14 } // Literal.String.Char + .sd { color: #d14 } // Literal.String.Doc + .s2 { color: #d14 } // Literal.String.Double + .se { color: #d14 } // Literal.String.Escape + .sh { color: #d14 } // Literal.String.Heredoc + .si { color: #d14 } // Literal.String.Interpol + .sx { color: #d14 } // Literal.String.Other + .sr { color: #009926 } // Literal.String.Regex + .s1 { color: #d14 } // Literal.String.Single + .ss { color: #990073 } // Literal.String.Symbol + .bp { color: #999 } // Name.Builtin.Pseudo + .vc { color: #008080 } // Name.Variable.Class + .vg { color: #008080 } // Name.Variable.Global + .vi { color: #008080 } // Name.Variable.Instance + .il { color: #099 } // Literal.Number.Integer.Long +} diff --git a/generators/jekyll/templates/app/crossdomain.xml b/generators/jekyll/templates/app/crossdomain.xml new file mode 100644 index 0000000..29a035d --- /dev/null +++ b/generators/jekyll/templates/app/crossdomain.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/generators/jekyll/templates/app/feed.xml b/generators/jekyll/templates/app/feed.xml new file mode 100644 index 0000000..0a8d4d9 --- /dev/null +++ b/generators/jekyll/templates/app/feed.xml @@ -0,0 +1,33 @@ +--- +layout: null +regenerate: true +permalink: /feed +--- + + + + <![CDATA[{{ site.title }}]]> + + {{ site.url }} + Jekyll + {{ site.time | date_to_rfc822 }} + + {% for post in site.posts limit:10 %} + + <![CDATA[{{ post.title }}]]> + {% if post.excerpt %} + + {% else %} + + {% endif %} + + {{ post.date | date_to_rfc822 }} + {{ site.url }}{{ post.url }} + {{ site.url }}{{ post.url }} + + {% endfor %} + + diff --git a/generators/jekyll/templates/app/humans.txt b/generators/jekyll/templates/app/humans.txt new file mode 100644 index 0000000..9955e38 --- /dev/null +++ b/generators/jekyll/templates/app/humans.txt @@ -0,0 +1,16 @@ +# humanstxt.org/ +# The humans responsible & technology colophon + +# TEAM + + <%= authorName %> -- -- @<%= authorTwitter %> + +# THANKS + + + +# TECHNOLOGY COLOPHON + + HTML5, CSS3, JavaScript + Jekyll, Lanyon/Poole, HTML5 Boilerplate + Yeoman, Jekyllized diff --git a/generators/jekyll/templates/app/index.html b/generators/jekyll/templates/app/index.html new file mode 100644 index 0000000..8f1f40a --- /dev/null +++ b/generators/jekyll/templates/app/index.html @@ -0,0 +1,21 @@ +--- +layout: default +regenerate: true +--- +
+

Posts

+ +
    + {% for post in site.posts %} +
  • + + +

    + {{ post.title }} +

    +
  • + {% endfor %} +
+ +

subscribe via RSS

+
diff --git a/generators/jekyll/templates/app/robots.txt b/generators/jekyll/templates/app/robots.txt new file mode 100644 index 0000000..d0e5f1b --- /dev/null +++ b/generators/jekyll/templates/app/robots.txt @@ -0,0 +1,5 @@ +# www.robotstxt.org/ + +# Allow crawling of all content +User-agent: * +Disallow: diff --git a/generators/jekyll/templates/config.build.yml b/generators/jekyll/templates/config.build.yml new file mode 100644 index 0000000..f2ccf67 --- /dev/null +++ b/generators/jekyll/templates/config.build.yml @@ -0,0 +1,13 @@ +# Run during the 'gulp build' command +# Overrides these options in _config.yml + +# Hides your drafts and future posts +future: false +show_drafts: false +# Gives you more accurate related posts +lsi: true +# Removes the upper limit for posts generated +limit_posts: 0 + +source: src +destination: dist diff --git a/generators/jekyll/templates/config.yml b/generators/jekyll/templates/config.yml new file mode 100755 index 0000000..97e3c21 --- /dev/null +++ b/generators/jekyll/templates/config.yml @@ -0,0 +1,68 @@ +# Title, decription, tagline and URL for your site +# Can be used in your theme by calling 'site.title' and so on +title: <%= projectName %> +description: <%= projectDescription %> +url: <%= projectURL %> + +# Used so Jekyll outputs the site correctly so Gulp can do what it wants +source: src +destination: dist +exclude: ['assets'] + +# Same as the title etc for your site but can instead be +# called by using 'site.author.name' and so on +author: + name: <%= authorName %> + email: <%= authorEmail %> + bio: <%= authorBio %> + twitter: <%= authorTwitter %> + +# general setting for Jekyll +googleAnalytics: UA-XXXXX-X + +# _config.build.yml overwrites these options when you run `gulp build` +# Enables future posts (posts with dates in the future) and drafts +future: true +show_drafts: true +# Disables the more accurate related posts for faster generating of the site +lsi: false +# Only make the last 10 posts so generating isn't slow +limit_posts: 10 + +# Permalink structure and pagination options +relative_permalinks: true +permalink: <%= jekyllPermalinks %> +paginate: <%= jekyllPaginate%> +paginate_path: 'page:num' +excerpt_separator: '' + +# Extras for Jekyll +gems: + - jekyll-archives + - jekyll-sitemap + +# Markdown library +markdown: redcarpet +# Markdown library options +redcarpet: + extensions: ['no_intra_emphasis', 'tables', 'fenced_code_blocks', 'autolink', 'smart', + 'strikethrough', 'superscript', 'underline', 'highlight', 'footnotes'] +highlighter: true + +# Settings for archives +jekyll-archives: + enabled: + - year + - month + - categories + - tags + layouts: + year: 'year-archive' + month: 'month-archive' + category: 'category-archive' + tag: 'tag-archive' + permalinks: + year: '/archive/:year/' + month: '/archive/:year/:month/' + category: '/category/:name/' + tags: '/tag/:name/' diff --git a/gulpfile.js b/gulpfile.js index 65d6114..81f5711 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -40,7 +40,7 @@ gulp.task('istanbul', function(done) { gulp.src(['test/*.js']) .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()) - .pipe(istanbul.enforceThresholds({thresholds: {global: 90}})) + .pipe(istanbul.enforceThresholds({thresholds: {global: 70}})) .on('end', done); }); }); diff --git a/index.js b/index.js new file mode 100644 index 0000000..0257a50 --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = { + 'app': require.resolve('./generators/app'), + 'boilerplate': require.resolve('./generators/boilerplate'), + 'gulp': require.resolve('./generators/gulp'), + 'jekyll': require.resolve('./generators/jekyll') +}; diff --git a/package.json b/package.json index a34c6f3..30f5f92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "generator-jekyllized", "version": "0.7.1", + "main": "index.js", "description": "Jekyll workflow with Gulp, SASS, AutoPrefixer, asset optimization and cache busting and much more. Can you really want more?", "keywords": [ "yeoman-generator", @@ -16,6 +17,10 @@ "scripts": { "test": "gulp istanbul && gulp" }, + "files": [ + "index.js", + "generators" + ], "dependencies": { "chalk": "^1.0.0", "globule": "~0.2.0", diff --git a/test/app.js b/test/app.js index 110153f..e439d10 100644 --- a/test/app.js +++ b/test/app.js @@ -29,9 +29,15 @@ describe('jekyllized:app', function() { projectDescription: 'Test site for Jekyllized', projectURL: 'www.test.com', authorName: 'Ola Nordmann', - authorEmail: 'ola.nordmann@gmail.com' + authorEmail: 'ola.nordmann@gmail.com', + authorBio: 'A norwegian dude', + authorTwitter: '0lanordmann', + uploading: 'None', + jekyllPermalinks: 'pretty', + jekyllPaginate: '10' }; helpers.run(path.join(__dirname, '../generators/app')) + .inDir(path.join(__dirname, 'tmp/app')) .withPrompts(this.answers) .on('end', done); }); @@ -44,7 +50,10 @@ describe('jekyllized:app', function() { '.gitignore', '.gitattributes', 'package.json', - 'gulpfile.js' + 'gulpfile.js', + '_config.yml', + '_config.build.yml', + 'Gemfile' ]); }); @@ -82,7 +91,7 @@ describe('jekyllized:app', function() { .on('end', done); }); - it('creates package.json', function() { + it('extends package.json', function() { var pkg = _.extend({name: 'jekyllized'}, this.pkg); assertJSONFileContains('package.json', pkg); }); diff --git a/test/gulp.js b/test/gulp.js index c44df7a..91dd8d8 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -9,7 +9,7 @@ describe('jekyllized:gulp', function() { before(function(done) { helpers.run(path.join(__dirname, '../generators/gulp')) .inDir(path.join(__dirname, 'tmp/gulp')) - .withOptions({noUpload: true}) + .withOptions({uploading: 'None'}) .on('end', done); }); @@ -89,7 +89,7 @@ describe('jekyllized:gulp', function() { before(function(done) { helpers.run(path.join(__dirname, '../generators/gulp')) .inDir(path.join(__dirname, 'tmp/gulp-aws')) - .withOptions({amazonS3: true}) + .withOptions({uploading: 'Amazon S3'}) .on('end', done); }); @@ -143,7 +143,7 @@ describe('jekyllized:gulp', function() { before(function(done) { helpers.run(path.join(__dirname, '../generators/gulp')) .inDir(path.join(__dirname, 'tmp/gulp-rsync')) - .withOptions({rsync: true}) + .withOptions({uploading: 'Rsync'}) .on('end', done); }); @@ -193,7 +193,7 @@ describe('jekyllized:gulp', function() { before(function(done) { helpers.run(path.join(__dirname, '../generators/gulp')) .inDir(path.join(__dirname, 'tmp/gulp-pages')) - .withOptions({ghPages: true}) + .withOptions({uploading: 'Github Pages'}) .on('end', done); }); diff --git a/test/jekyll.js b/test/jekyll.js new file mode 100644 index 0000000..5b481b2 --- /dev/null +++ b/test/jekyll.js @@ -0,0 +1,76 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:jekyll', function() { + describe('default settings', function() { + before(function(done) { + this.options = { + projectName: 'jekyllized', + projectDescription: 'Tests for Jekyllized', + projectURL: 'example.org', + authorName: 'Ola Nordmann', + authorEmail: 'ola.nordmann@email.com', + authorBio: 'I am a tester for tests', + authorTwitter: '0lanordmann', + jekyllPermalinks: 'pretty', + jekyllPaginate: '10' + }; + helpers.run(path.join(__dirname, '../generators/jekyll')) + .inDir(path.join(__dirname, 'tmp/jekyll')) + .withOptions(this.options) + .on('end', done); + }); + + it('creates Gemfile', function() { + assert.file('Gemfile'); + }); + + it('creates _config.yml files', function() { + assert.file('_config.yml'); + assert.file('_config.build.yml'); + }); + + it('creates src directory', function() { + var expected = [ + 'src/404.html', + 'src/about.md', + 'src/feed.xml', + 'src/crossdomain.xml', + 'src/humans.txt', + 'src/index.html', + 'src/robots.txt' + ]; + + assert.file(expected); + }); + + it('_config.yml contains the correct settings', function() { + var expected = [ + ['_config.yml', /title\: jekyllized/], + ['_config.yml', /description\: Tests for Jekyllized/], + ['_config.yml', /name\: Ola Nordmann/], + ['_config.yml', /email\: ola\.nordmann\@email\.com/], + ['_config.yml', /bio\: I am a tester for tests/], + ['_config.yml', /twitter\: 0lanordmann/] + ]; + + assert.fileContent(expected); + }); + + it('_config.build.yml contains the correct settings', function() { + var expected = [ + ['_config.build.yml', /future\: false/], + ['_config.build.yml', /show_drafts\: false/], + ['_config.build.yml', /lsi\: true/], + ['_config.build.yml', /limit_posts\: 0/], + ['_config.build.yml', /source\: src/], + ['_config.build.yml', /destination\: dist/] + ]; + + assert.fileContent(expected); + }); + }); +}); From 391f5f1d0ea36f72c07c8426b354b1a7d9210c28 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 25 Jun 2015 18:56:41 +0200 Subject: [PATCH 030/178] Updated Jekyll generator and removed some settings Removed the part of the generator that looks for Bundler and Ruby, not really something I need for this. The generator doesn't ask for pagination anymore, 10 is a good default and it's what I use all the time. Updated the tests accordingly. --- generators/app/index.js | 18 +----------------- generators/jekyll/index.js | 23 ++--------------------- generators/jekyll/templates/config.yml | 2 +- test/jekyll.js | 4 +--- 4 files changed, 5 insertions(+), 42 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index ca68822..9d008e1 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -58,21 +58,6 @@ module.exports = generators.Base.extend({ '\n none: /:categories/:title.html')) + '\n', choices: ['pretty', 'date', 'none'], store: true - }, { - name: 'jekyllPaginate', - message: 'How many posts do you want to show on your front page?' + - chalk.red('\nMust be a number or all'), - store: true, - default: 10, - validate: function(input) { - if (/^[0-9]*$/.test(input)) { - return true; - } - if (/^all*$/i.test(input)) { - return true; - } - return 'Must be a number or all'; - } }]; this.prompt(prompts, function(props) { @@ -119,8 +104,7 @@ module.exports = generators.Base.extend({ authorEmail: this.props.authorEmail, authorBio: this.props.authorBio, authorTwitter: this.props.authorTwitter, - jekyllPermalinks: this.props.jekyllPermalinks, - jekyllPaginate: this.props.jekyllPaginate + jekyllPermalinks: this.props.jekyllPermalinks } }, { local: require.resolve('../jekyll') diff --git a/generators/jekyll/index.js b/generators/jekyll/index.js index 49b2b14..4d10124 100644 --- a/generators/jekyll/index.js +++ b/generators/jekyll/index.js @@ -11,18 +11,6 @@ module.exports = generators.Base.extend({ constructor: function() { generators.Base.apply(this, arguments); - var dependenciesInstalled = ['bundle', 'ruby'].every(function(depend) { - return shelljs.which(depend); - }); - - if (!dependenciesInstalled) { - this.log('MISSING DEPENDENCIES:' + - '\nEither ' + chalk.white('Ruby') + ' or ' + chalk.white('Bundler') + - ' is not installed or missing from $PATH.' + - '\nMake sure that they are either installed or added to $PATH.'); - shelljs.exit(1); - } - this.option('projectName', { type: String, required: true, @@ -65,17 +53,11 @@ module.exports = generators.Base.extend({ desc: 'Author twitter' }); - this.option('jekyllPermalink', { + this.option('jekyllPermalinks', { type: String, required: true, desc: 'Jekyll permalinks' }); - - this.option('jekyllPaginate', { - type: String, - required: true, - desc: 'Jekyll paginate' - }); }, writing: function() { @@ -95,8 +77,7 @@ module.exports = generators.Base.extend({ authorEmail: this.options.authorEmail, authorBio: this.options.authorBio, authorTwitter: this.options.authorTwitter, - jekyllPermalinks: this.options.jekyllPermalinks, - jekyllPaginate: this.options.jekyllPaginate + jekyllPermalinks: this.options.jekyllPermalinks } ); diff --git a/generators/jekyll/templates/config.yml b/generators/jekyll/templates/config.yml index 97e3c21..f6375da 100755 --- a/generators/jekyll/templates/config.yml +++ b/generators/jekyll/templates/config.yml @@ -32,7 +32,7 @@ limit_posts: 10 # Permalink structure and pagination options relative_permalinks: true permalink: <%= jekyllPermalinks %> -paginate: <%= jekyllPaginate%> +paginate: 10 paginate_path: 'page:num' excerpt_separator: '' diff --git a/test/jekyll.js b/test/jekyll.js index 5b481b2..2848600 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -14,9 +14,7 @@ describe('jekyllized:jekyll', function() { authorName: 'Ola Nordmann', authorEmail: 'ola.nordmann@email.com', authorBio: 'I am a tester for tests', - authorTwitter: '0lanordmann', - jekyllPermalinks: 'pretty', - jekyllPaginate: '10' + authorTwitter: '0lanordmann' }; helpers.run(path.join(__dirname, '../generators/jekyll')) .inDir(path.join(__dirname, 'tmp/jekyll')) From 3256f72415dbe13c4d9eb9bffea84a8d5ea081c0 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 25 Jun 2015 19:34:33 +0200 Subject: [PATCH 031/178] Updated packages and Jekyll tests Updated packages so they're not out of date and added tests for Jekyll's permalink settings and started on a test that actually installs the generator so it can be thoroughly tested. --- index.js | 8 ++++---- package.json | 37 ++++++++++++++++++------------------ test/install.js | 9 +++++++++ test/jekyll.js | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 23 deletions(-) create mode 100644 test/install.js diff --git a/index.js b/index.js index 0257a50..c2d63ed 100644 --- a/index.js +++ b/index.js @@ -1,8 +1,8 @@ 'use strict'; module.exports = { - 'app': require.resolve('./generators/app'), - 'boilerplate': require.resolve('./generators/boilerplate'), - 'gulp': require.resolve('./generators/gulp'), - 'jekyll': require.resolve('./generators/jekyll') + app: require.resolve('./generators/app'), + boilerplate: require.resolve('./generators/boilerplate'), + gulp: require.resolve('./generators/gulp'), + jekyll: require.resolve('./generators/jekyll') }; diff --git a/package.json b/package.json index 30f5f92..326ff7b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "author": "Sondre Nilsen", "repository": "sondr3/generator-jekyllized", "license": "MIT", - "main": "app/index.js", "scripts": { "test": "gulp istanbul && gulp" }, @@ -23,31 +22,31 @@ ], "dependencies": { "chalk": "^1.0.0", - "globule": "~0.2.0", - "lodash": "^3.8.0", - "shelljs": "^0.5.0", + "globule": "^0.2.0", + "lodash": "^3.9.3", + "shelljs": "^0.5.1", "yeoman-generator": "^0.20.1", - "yosay": "^1.0.2" + "yosay": "^1.0.4" }, "devDependencies": { - "codeclimate-test-reporter": "0.0.4", + "codeclimate-test-reporter": "^0.0.4", "coveralls": "^2.11.2", - "generator-mocha": "^0.1.7", - "gulp": "git://github.com/gulpjs/gulp#4.0", + "generator-mocha": "^0.1.8", + "gulp": "git://github.com/gulpjs/gulp.git#4.0", "gulp-coveralls": "^0.1.4", - "gulp-istanbul": "^0.9.0", + "gulp-istanbul": "^0.10.0", "gulp-jscs": "^1.6.0", - "gulp-jshint": "^1.10.0", - "gulp-load-plugins": "^0.10.0", - "gulp-mocha": "^2.0.1", - "gulp-plumber": "^1.0.0", - "istanbul": "^0.3.13", - "jshint": "^2.7.0", - "jshint-stylish": "^1.0.0", - "mocha": "^2.2.4", - "mocha-lcov-reporter": "0.0.2", + "gulp-jshint": "^1.11.0", + "gulp-load-plugins": "^1.0.0-rc.1", + "gulp-mocha": "^2.1.2", + "gulp-plumber": "^1.0.1", + "istanbul": "^0.3.16", + "jshint": "^2.8.0", + "jshint-stylish": "^2.0.1", + "mocha": "^2.2.5", + "mocha-lcov-reporter": "^0.0.2", "trash": "^1.4.1", "yeoman-assert": "^2.0.0", - "yo": ">=1.4" + "yo": "^1.4.7" } } diff --git a/test/install.js b/test/install.js new file mode 100644 index 0000000..a19aa23 --- /dev/null +++ b/test/install.js @@ -0,0 +1,9 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('installing jekyllized', function() { + +}); diff --git a/test/jekyll.js b/test/jekyll.js index 2848600..08f2271 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -71,4 +71,54 @@ describe('jekyllized:jekyll', function() { assert.fileContent(expected); }); }); + + describe('different permalink settings', function() { + describe('pretty permalinks', function() { + before(function(done) { + this.options = { + jekyllPermalinks: 'pretty' + }; + helpers.run(path.join(__dirname, '../generators/jekyll')) + .inDir(path.join(__dirname, 'tmp/jekyll-pretty')) + .withOptions(this.options) + .on('end', done); + }); + + it('sets pretty permalinks', function() { + assert.fileContent('_config.yml', 'permalink: pretty'); + }); + }); + + describe('date permalinks', function() { + before(function(done) { + this.options = { + jekyllPermalinks: 'date' + }; + helpers.run(path.join(__dirname, '../generators/jekyll')) + .inDir(path.join(__dirname, 'tmp/jekyll-date')) + .withOptions(this.options) + .on('end', done); + }); + + it('sets date permalinks', function() { + assert.fileContent('_config.yml', 'permalink: date'); + }); + }); + + describe('"none" permalinks', function() { + before(function(done) { + this.options = { + jekyllPermalinks: 'none' + }; + helpers.run(path.join(__dirname, '../generators/jekyll')) + .inDir(path.join(__dirname, 'tmp/jekyll-none')) + .withOptions(this.options) + .on('end', done); + }); + + it('sets "none" permalinks', function() { + assert.fileContent('_config.yml', 'permalink: none'); + }); + }); + }); }); From c787ca5ea58e2d945694ff0e92de9df446c9418b Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 3 Jun 2015 21:07:06 +0200 Subject: [PATCH 032/178] Fix errors with install and watching for changes --- generators/gulp/templates/gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index da854fe..22e6912 100755 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -259,7 +259,7 @@ function serve() { }); // Watch various files for changes and do the needful - gulp.watch(config.watch.content, [jekyllDev, reload]); + gulp.watch(config.watch.content, gulp.series(jekyllDev, reload)); gulp.watch(config.watch.javascript, javascript); gulp.watch(config.watch.scss, styles); gulp.watch(config.watch.images, reload); From 752f5979dd826feed899d75f63a78910761b613a Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 25 Jun 2015 20:08:12 +0200 Subject: [PATCH 033/178] The boilerplate generator now creates a README --- generators/app/index.js | 9 ++++- generators/boilerplate/index.js | 39 ++++++++++++++++++++++ generators/boilerplate/templates/README.md | 30 +++++++++++++++++ test/boilerplate.js | 29 ++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 generators/boilerplate/templates/README.md diff --git a/generators/app/index.js b/generators/app/index.js index 9d008e1..9b86d74 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -83,7 +83,14 @@ module.exports = generators.Base.extend({ }, default: function() { - this.composeWith('jekyllized:boilerplate', {}, { + this.composeWith('jekyllized:boilerplate', { + options: { + projectName: this.props.projectName, + projectDescription: this.props.projectDescription, + projectURL: this.props.projectURL, + authorName: this.props.authorName + } + }, { local: require.resolve('../boilerplate') }); diff --git a/generators/boilerplate/index.js b/generators/boilerplate/index.js index fd475ca..776316f 100644 --- a/generators/boilerplate/index.js +++ b/generators/boilerplate/index.js @@ -3,7 +3,46 @@ var generators = require('yeoman-generator'); module.exports = generators.Base.extend({ + constructor: function() { + generators.Base.apply(this, arguments); + + this.option('projectName', { + type: String, + required: true, + desc: 'Project name' + }); + + this.option('projectDescription', { + type: String, + required: true, + desc: 'Project description' + }); + + this.option('projectURL', { + type: String, + required: true, + desc: 'Project URL' + }); + + this.option('authorName', { + type: String, + required: true, + desc: 'Author name' + }); + }, + configuring: function() { + this.fs.copyTpl( + this.templatePath('README.md'), + this.destinationPath('README.md'), + { + projectName: this.options.projectName, + projectDescription: this.options.projectDescription, + projectURL: this.options.projectURL, + authorName: this.options.authorName + } + ); + this.fs.copy( this.templatePath('editorconfig'), this.destinationPath('.editorconfig') diff --git a/generators/boilerplate/templates/README.md b/generators/boilerplate/templates/README.md new file mode 100644 index 0000000..4e56304 --- /dev/null +++ b/generators/boilerplate/templates/README.md @@ -0,0 +1,30 @@ +# <%= projectName %> + +> <%= projectDescription %> + +## To get started + +```sh +$ gulp +``` + +And you'll have a new Jekyll site generated for you and displayed in your +browser. Neato. + +## Usage + +```sh +$ gulp build +``` + +```sh +$ gulp publish +``` + +```sh +$ gulp deploy +``` + +## Owner + +> [<%= authorName %>](<%= projectURL %>) diff --git a/test/boilerplate.js b/test/boilerplate.js index 6f6376d..ac30dbf 100644 --- a/test/boilerplate.js +++ b/test/boilerplate.js @@ -29,4 +29,33 @@ describe('jekyllized:boilerplate', function() { it('creates .gitattributes', function() { assert.file('.gitattributes'); }); + + describe('README', function() { + before(function(done) { + this.options = { + projectName: 'README', + projectDescription: 'This is a great README', + projectURL: 'hello-world.com', + authorName: 'Ola Nordmann' + }; + helpers.run(path.join(__dirname, '../generators/boilerplate')) + .inDir(path.join(__dirname, 'tmp/readme')) + .withOptions(this.options) + .on('end', done); + }); + + it('creates README.md', function() { + assert.file('README.md'); + }); + + it('contains correct info', function() { + var expected = [ + ['README.md', /\# README/], + ['README.md', /\> This is a great README/], + ['README.md', /\[Ola Nordmann\]\(hello-world.com\)/] + ]; + + assert.fileContent(expected); + }); + }); }); From e772f0da28e0a9fe35d5646ffcfefef07538681e Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 25 Jun 2015 20:33:59 +0200 Subject: [PATCH 034/178] Updated packages for jekyllized and removed unused line --- generators/gulp/index.js | 28 ++++++++++++++-------------- generators/jekyll/index.js | 1 - test/install.js | 9 --------- 3 files changed, 14 insertions(+), 24 deletions(-) delete mode 100644 test/install.js diff --git a/generators/gulp/index.js b/generators/gulp/index.js index d461f26..f3f7a9d 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -23,49 +23,49 @@ module.exports = generators.Base.extend({ pkg.devDependencies = pkg.devDependencies || {}; _.extend(pkg.devDependencies, { - 'browser-sync': '^1.5.7', + 'browser-sync': '^2.7.12', 'del': '^1.1.1', - 'gulp': 'git://github.com/gulpjs/gulp#4.0', + 'gulp': 'git://github.com/gulpjs/gulp.git#4.0', 'gulp-autoprefixer': '^2.0.0', 'gulp-cache': '~0.2.4', 'gulp-cached': '^1.0.1', 'gulp-changed': '^1.0.0', 'gulp-filter': '^2.0.0', 'gulp-group-concat': '^1.1.4', - 'gulp-gzip': '0.0.8', + 'gulp-gzip': '^1.1.0', 'gulp-htmlmin': '^1.0.0', 'gulp-if': '^1.2.4', 'gulp-imagemin': '^2.1.0', 'gulp-jshint': '^1.8.5', - 'gulp-load-plugins': '^0.8.0', - 'gulp-minify-css': '^0.4.4', - 'gulp-rev-all': '^0.7.5', - 'gulp-rev-replace': '^0.3.1', - 'gulp-sass': '^1.0.0', - 'gulp-shell': '^0.2.9', + 'gulp-load-plugins': '^0.10.0', + 'gulp-minify-css': '^1.2.0', + 'gulp-rev-all': '^0.8.21', + 'gulp-rev-replace': '^0.4.2', + 'gulp-sass': '^2.0.2', + 'gulp-shell': '^0.4.2', 'gulp-size': '^1.1.0', 'gulp-sourcemaps': '^1.3.0', 'gulp-uglify': '^1.1.0', 'gulp-uncss': '^1.0.0', 'gulp-useref': '^1.0.2', - 'jshint-stylish': '^1.0.0', + 'jshint-stylish': '^2.0.1', 'merge-stream': '^0.1.6', - 'shelljs': '^0.3.0', + 'shelljs': '^0.5.1', 'trash': '^1.4.0' }); if (this.options.uploading === 'Amazon S3') { - pkg.devDependencies['gulp-awspublish'] = '^0.1.0'; + pkg.devDependencies['gulp-awspublish'] = '^2.0.0'; pkg.devDependencies['gulp-awspublish-router'] = '^0.1.0'; pkg.devDependencies['concurrent-transform'] = '^1.0.0'; } if (this.options.uploading === 'Rsync') { - pkg.devDependencies['gulp-rsync'] = '^0.0.2'; + pkg.devDependencies['gulp-rsync'] = '^0.0.5'; } if (this.options.uploading === 'Github Pages') { - pkg.devDependencies['gulp-gh-pages'] = '^0.4.0'; + pkg.devDependencies['gulp-gh-pages'] = '^0.5.2'; } this.fs.writeJSON(this.destinationPath('package.json'), pkg); diff --git a/generators/jekyll/index.js b/generators/jekyll/index.js index 4d10124..ee4f839 100644 --- a/generators/jekyll/index.js +++ b/generators/jekyll/index.js @@ -5,7 +5,6 @@ var chalk = require('chalk'); var generators = require('yeoman-generator'); var path = require('path'); var yosay = require('yosay'); -var shelljs = require('shelljs'); module.exports = generators.Base.extend({ constructor: function() { diff --git a/test/install.js b/test/install.js deleted file mode 100644 index a19aa23..0000000 --- a/test/install.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -var path = require('path'); -var assert = require('yeoman-assert'); -var helpers = require('yeoman-generator').test; - -describe('installing jekyllized', function() { - -}); From 0f075c8d82c7c99214ec23e64757fbb33645a99c Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 25 Jun 2015 23:05:56 +0200 Subject: [PATCH 035/178] Updated Gulpfile, packages, JShint and Jekyll - Moved from using a config file with paths back to just having them in the file itself - Updated the packages that will be installed with Jekyllized - Added some more gems to Jekyll, most notably jekyll-feed and removed the feed.xml file as it does it for you - Added Octopress with the base installation for some sweet Jekyll goodness - Updated the theme to be up-to-date with Jekylls - Added a URI field for authors for jekyll-feed - Updated the theme accordingly to the new updates - Updated tests to reflect the changes --- generators/app/index.js | 6 +++ generators/boilerplate/templates/jshintrc | 2 +- generators/gulp/templates/gulpfile.js | 51 ++++++++++--------- generators/jekyll/index.js | 7 +++ generators/jekyll/templates/Gemfile | 8 ++- .../jekyll/templates/app/_includes/head.html | 2 +- .../jekyll/templates/app/_templates/draft | 4 ++ .../jekyll/templates/app/_templates/page | 4 ++ .../jekyll/templates/app/_templates/post | 5 ++ .../templates/app/assets/scss/base.scss | 14 ++--- .../templates/app/assets/scss/layout.scss | 5 ++ .../templates/app/assets/scss/main.scss | 45 ++++++++-------- generators/jekyll/templates/app/feed.xml | 33 ------------ generators/jekyll/templates/app/index.html | 2 +- generators/jekyll/templates/config.yml | 21 ++++---- test/jekyll.js | 6 ++- 16 files changed, 114 insertions(+), 101 deletions(-) create mode 100644 generators/jekyll/templates/app/_templates/draft create mode 100644 generators/jekyll/templates/app/_templates/page create mode 100644 generators/jekyll/templates/app/_templates/post delete mode 100644 generators/jekyll/templates/app/feed.xml diff --git a/generators/app/index.js b/generators/app/index.js index 9b86d74..48d9f7c 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -35,6 +35,11 @@ module.exports = generators.Base.extend({ name: 'authorEmail', message: 'What\'s your email?', store: true + }, { + name: 'authorURI', + message: 'Can be the same as this site!' + + '\nWhat is your homepage?', + store: true }, { name: 'authorBio', message: 'Write a short description about yourself', @@ -109,6 +114,7 @@ module.exports = generators.Base.extend({ projectURL: this.props.projectURL, authorName: this.props.authorName, authorEmail: this.props.authorEmail, + authorURI: this.props.authorURI, authorBio: this.props.authorBio, authorTwitter: this.props.authorTwitter, jekyllPermalinks: this.props.jekyllPermalinks diff --git a/generators/boilerplate/templates/jshintrc b/generators/boilerplate/templates/jshintrc index a89f882..23ca7ec 100644 --- a/generators/boilerplate/templates/jshintrc +++ b/generators/boilerplate/templates/jshintrc @@ -10,7 +10,7 @@ "latedef": true, "newcap": true, "noarg": true, - "quotmark": "double", + "quotmark": "single", "undef": true, "strict": false, "trailing": true, diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index 22e6912..86d2536 100755 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -1,8 +1,6 @@ 'use strict'; var gulp = require('gulp'); -// Load in paths from a external config file for easier changing of paths -var config = require('./gulp.config.json'); // Loads the plugins without having to list all of them, but you need // to call them as $.pluginname var $ = require('gulp-load-plugins')(); @@ -42,7 +40,7 @@ function jekyllProd(done) { // Compiles the SASS files and moves them into the 'assets/stylesheets' directory function styles() { // Looks at the style.scss file for what to include and creates a style.css file - return gulp.src(config.scss.src) + return gulp.src('src/assets/scss/**/*.scss') // Start creation of sourcemaps .pipe($.sourcemaps.init()) .pipe($.sass({errLogToconsole: true})) @@ -51,7 +49,7 @@ function styles() { // Write the sourcemaps to the directory of the gulp.src stream .pipe($.sourcemaps.write('.')) // Directory your CSS file goes to - .pipe(gulp.dest(config.scss.dest)) + .pipe(gulp.dest('.tmp/assets/stylesheets')) // Outputs the size of the CSS file .pipe($.size({title: 'styles'})) // Injects the CSS changes to your browser since Jekyll doesn't rebuild the CSS @@ -60,21 +58,21 @@ function styles() { // Mostly used to create sourcemaps and live-reload JS function javascript() { - return gulp.src(config.javascript.src) + return gulp.src('src/assets/javascript/**/*.js') .pipe($.sourcemaps.init()) .pipe($.uglify({compress: false, preserveComments: 'all'})) .pipe($.groupConcat({ - 'index.js': config.javascript.src + 'index.js': 'src/assets/javascript/**/*.js' })) .pipe($.sourcemaps.write('.')) - .pipe(gulp.dest(config.javascript.dest)) + .pipe(gulp.dest('.tmp/assets/javascript')) .pipe($.size({title: 'javascript'})) .pipe(reload({stream: true})); } // Optimizes the images that exists function images() { - return gulp.src(config.images.src) + return gulp.src('src/assets/images/**/*') // Does not run on images that are already optimized .pipe($.cache($.imagemin({ // Lossless conversion to progressive JPGs @@ -82,25 +80,25 @@ function images() { // Interlace GIFs for progressive rendering interlaced: true }))) - .pipe(gulp.dest(config.images.dest)) + .pipe(gulp.dest('.tmp/assets/images')) .pipe($.size({title: 'images'})); } // Copy over fonts to the '.tmp' directory function fonts() { - return gulp.src(config.fonts.src) - .pipe(gulp.dest(config.fonts.dest)) + return gulp.src('src/assets/fonts/**/*') + .pipe(gulp.dest('.tmp/assets/font')) .pipe($.size({title: 'fonts'})); } // Copy optimized images and (not optimized) fonts to the 'dist' folder function copy() { - var images = gulp.src(config.images.dest) - .pipe(gulp.dest(config.images.build)) + var images = gulp.src('.tmp/assets/images/**/*') + .pipe(gulp.dest('dist/assets/images')) .pipe($.size({title: 'copied images'})); - var fonts = gulp.src(config.fonts.dest) - .pipe(gulp.dest(config.fonts.build)) + var fonts = gulp.src('.tmp/assets/fonts/**/*') + .pipe(gulp.dest('dist/assets/fonts')) .pipe($.size({title: 'copied fonts'})); return merge(images, fonts); @@ -108,9 +106,9 @@ function copy() { // Optimizes all the CSS, HTML and concats the JS etc function optimize() { - var assets = $.useref.assets({searchPath: config.assets.searchPath}); + var assets = $.useref.assets({searchPath: ['dist', '.tmp']}); - return gulp.src(config.assets.html) + return gulp.src('dist/**/*.html') .pipe(assets) // Concatenate JavaScript files and preserve important comments .pipe($.if('*.js', $.uglify({preserveComments: 'some'}))) @@ -137,7 +135,7 @@ function optimize() { removeRedundantAttributes: true }))) // Send the output to the correct folder - .pipe(gulp.dest(config.assets.dest)) + .pipe(gulp.dest('dist')) .pipe($.size({title: 'optimizations'})); } @@ -236,7 +234,7 @@ function deploy() { <% if (noUpload) { -%><% } -%> // Run JS Lint against your JS function jslint() { - gulp.src(config.javascript.dest) + gulp.src('.tmp/assets/javascript/*.js') // Checks your JS code quality against your .jshintrc file .pipe($.jshint('.jshintrc')) .pipe($.jshint.reporter()); @@ -254,15 +252,20 @@ function serve() { notify: true, // tunnel: true, server: { - baseDir: config.watch.baseDir + baseDir: ['dist', '.tmp'] } }); // Watch various files for changes and do the needful - gulp.watch(config.watch.content, gulp.series(jekyllDev, reload)); - gulp.watch(config.watch.javascript, javascript); - gulp.watch(config.watch.scss, styles); - gulp.watch(config.watch.images, reload); + gulp.watch(['src/**/*.md', + 'src/**/*.html', + 'src/**/*.xml', + 'src/**/*.txt', + 'src/**/*.yml'], + gulp.series(jekyllDev, reload)); + gulp.watch('src/assets/javascript/**/*.js', javascript); + gulp.watch('src/assets/scss/**/*.scss', styles); + gulp.watch('src/assets/images/**/*', reload); } // Default task, run when just writing 'gulp' in the terminal diff --git a/generators/jekyll/index.js b/generators/jekyll/index.js index ee4f839..cad1069 100644 --- a/generators/jekyll/index.js +++ b/generators/jekyll/index.js @@ -40,6 +40,12 @@ module.exports = generators.Base.extend({ desc: 'Author email' }); + this.option('authorURI', { + type: String, + required: true, + desc: 'Author URI' + }); + this.option('authorBio', { type: String, required: true, @@ -74,6 +80,7 @@ module.exports = generators.Base.extend({ projectURL: this.options.projectURL, authorName: this.options.authorName, authorEmail: this.options.authorEmail, + authorURI: this.options.authorURI, authorBio: this.options.authorBio, authorTwitter: this.options.authorTwitter, jekyllPermalinks: this.options.jekyllPermalinks diff --git a/generators/jekyll/templates/Gemfile b/generators/jekyll/templates/Gemfile index 91437eb..c1199b1 100755 --- a/generators/jekyll/templates/Gemfile +++ b/generators/jekyll/templates/Gemfile @@ -1,8 +1,14 @@ source "http://rubygems.org" -gem 'jekyll' +gem 'jekyll', '~> 3.0.0.pre.beta7' gem 'redcarpet' # jekyll plugins gem 'jekyll-archives', :git => 'https://github.com/jekyll/jekyll-archives' gem 'jekyll-sitemap' +gem 'jekyll-paginate' +gem 'jekyll-feed' +gem 'jekyll-gist' + +# octopress +gem 'octopress', '~> 3.0' diff --git a/generators/jekyll/templates/app/_includes/head.html b/generators/jekyll/templates/app/_includes/head.html index 506b7d0..a28c4cd 100644 --- a/generators/jekyll/templates/app/_includes/head.html +++ b/generators/jekyll/templates/app/_includes/head.html @@ -17,5 +17,5 @@ - + {% feed_meta %} diff --git a/generators/jekyll/templates/app/_templates/draft b/generators/jekyll/templates/app/_templates/draft new file mode 100644 index 0000000..26041ea --- /dev/null +++ b/generators/jekyll/templates/app/_templates/draft @@ -0,0 +1,4 @@ +--- +layout: {{ layout }} +title: "{{ title }}" +--- diff --git a/generators/jekyll/templates/app/_templates/page b/generators/jekyll/templates/app/_templates/page new file mode 100644 index 0000000..26041ea --- /dev/null +++ b/generators/jekyll/templates/app/_templates/page @@ -0,0 +1,4 @@ +--- +layout: {{ layout }} +title: "{{ title }}" +--- diff --git a/generators/jekyll/templates/app/_templates/post b/generators/jekyll/templates/app/_templates/post new file mode 100644 index 0000000..fa5e2f8 --- /dev/null +++ b/generators/jekyll/templates/app/_templates/post @@ -0,0 +1,5 @@ +--- +layout: {{ layout }} +title: "{{ title }}" +date: {{ date }} +--- diff --git a/generators/jekyll/templates/app/assets/scss/base.scss b/generators/jekyll/templates/app/assets/scss/base.scss index e5fd0fd..0883c3c 100644 --- a/generators/jekyll/templates/app/assets/scss/base.scss +++ b/generators/jekyll/templates/app/assets/scss/base.scss @@ -14,13 +14,15 @@ dl, dd, ol, ul, figure { * Basic styling */ body { - font-family: $base-font-family; - font-size: $base-font-size; - line-height: $base-line-height; - font-weight: 300; + font: $base-font-weight #{$base-font-size}/#{$base-line-height} $base-font-family; color: $text-color; background-color: $background-color; -webkit-text-size-adjust: 100%; + -webkit-font-feature-settings: "kern" 1; + -moz-font-feature-settings: "kern" 1; + -o-font-feature-settings: "kern" 1; + font-feature-settings: "kern" 1; + font-kerning: normal; } @@ -80,7 +82,7 @@ li { * Headings */ h1, h2, h3, h4, h5, h6 { - font-weight: 300; + font-weight: $base-font-weight; } @@ -139,7 +141,7 @@ code { pre { padding: 8px 12px; - overflow-x: scroll; + overflow-x: auto; > code { border: 0; diff --git a/generators/jekyll/templates/app/assets/scss/layout.scss b/generators/jekyll/templates/app/assets/scss/layout.scss index 3f9ff42..b09c82f 100644 --- a/generators/jekyll/templates/app/assets/scss/layout.scss +++ b/generators/jekyll/templates/app/assets/scss/layout.scss @@ -82,6 +82,11 @@ .page-link { display: block; padding: 5px 10px; + + &:not(:last-child) { + margin-right: 0; + } + margin-left: 20px; } } } diff --git a/generators/jekyll/templates/app/assets/scss/main.scss b/generators/jekyll/templates/app/assets/scss/main.scss index 0e4f004..a6ddf59 100644 --- a/generators/jekyll/templates/app/assets/scss/main.scss +++ b/generators/jekyll/templates/app/assets/scss/main.scss @@ -1,38 +1,37 @@ @charset "utf-8"; // Our variables - $base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -$base-font-size: 16px; +$base-font-size: 16px; $base-font-weight: 300; -$small-font-size: $base-font-size * 0.875; +$small-font-size: $base-font-size * 0.875; $base-line-height: 1.5; -$spacing-unit: 30px; +$spacing-unit: 30px; -$text-color: #111; +$text-color: #111; $background-color: #fdfdfd; -$brand-color: #2a7ae2; +$brand-color: #2a7ae2; -$grey-color: #828282; +$grey-color: #828282; $grey-color-light: lighten($grey-color, 40%); -$grey-color-dark: darken($grey-color, 25%); +$grey-color-dark: darken($grey-color, 25%); // Width of the content area -$content-width: 800px; - -$on-palm: 600px; -$on-laptop: 800px; - -// Using media queries with like this: -// @include media-query($on-palm) { -// .wrapper { -// padding-right: $spacing-unit / 2; -// padding-left: $spacing-unit / 2; -// } -// } +$content-width: 800px; + +$on-palm: 600px; +$on-laptop: 800px; + +// Using media queries with like this: +// @include media-query($on-palm) { +// .wrapper { +// padding-right: $spacing-unit / 2; +// padding-left: $spacing-unit / 2; +// } +// } @mixin media-query($device) { - @media screen and (max-width: $device) { - @content; - } + @media screen and (max-width: $device) { + @content; + } } diff --git a/generators/jekyll/templates/app/feed.xml b/generators/jekyll/templates/app/feed.xml deleted file mode 100644 index 0a8d4d9..0000000 --- a/generators/jekyll/templates/app/feed.xml +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: null -regenerate: true -permalink: /feed ---- - - - - <![CDATA[{{ site.title }}]]> - - {{ site.url }} - Jekyll - {{ site.time | date_to_rfc822 }} - - {% for post in site.posts limit:10 %} - - <![CDATA[{{ post.title }}]]> - {% if post.excerpt %} - - {% else %} - - {% endif %} - - {{ post.date | date_to_rfc822 }} - {{ site.url }}{{ post.url }} - {{ site.url }}{{ post.url }} - - {% endfor %} - - diff --git a/generators/jekyll/templates/app/index.html b/generators/jekyll/templates/app/index.html index 8f1f40a..553b899 100644 --- a/generators/jekyll/templates/app/index.html +++ b/generators/jekyll/templates/app/index.html @@ -17,5 +17,5 @@

{% endfor %} -

subscribe via RSS

+

subscribe via RSS

diff --git a/generators/jekyll/templates/config.yml b/generators/jekyll/templates/config.yml index f6375da..6557faa 100755 --- a/generators/jekyll/templates/config.yml +++ b/generators/jekyll/templates/config.yml @@ -1,6 +1,6 @@ # Title, decription, tagline and URL for your site # Can be used in your theme by calling 'site.title' and so on -title: <%= projectName %> +name: <%= projectName %> description: <%= projectDescription %> url: <%= projectURL %> @@ -14,6 +14,7 @@ exclude: ['assets'] author: name: <%= authorName %> email: <%= authorEmail %> + uri: <%= authorURI %> bio: <%= authorBio %> twitter: <%= authorTwitter %> @@ -30,25 +31,27 @@ lsi: false limit_posts: 10 # Permalink structure and pagination options -relative_permalinks: true permalink: <%= jekyllPermalinks %> paginate: 10 paginate_path: 'page:num' excerpt_separator: '' -# Extras for Jekyll -gems: - - jekyll-archives - - jekyll-sitemap - -# Markdown library +# Markdown library and options markdown: redcarpet -# Markdown library options redcarpet: extensions: ['no_intra_emphasis', 'tables', 'fenced_code_blocks', 'autolink', 'smart', 'strikethrough', 'superscript', 'underline', 'highlight', 'footnotes'] highlighter: true +# Extending Jekyll +gems: + - jekyll-archives + - jekyll-feed + - jekyll-gist + - jekyll-paginate + - jekyll-sitemap + + # Settings for archives jekyll-archives: enabled: diff --git a/test/jekyll.js b/test/jekyll.js index 08f2271..f2f4e63 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -13,6 +13,7 @@ describe('jekyllized:jekyll', function() { projectURL: 'example.org', authorName: 'Ola Nordmann', authorEmail: 'ola.nordmann@email.com', + authorURI: 'homepage.com', authorBio: 'I am a tester for tests', authorTwitter: '0lanordmann' }; @@ -35,7 +36,6 @@ describe('jekyllized:jekyll', function() { var expected = [ 'src/404.html', 'src/about.md', - 'src/feed.xml', 'src/crossdomain.xml', 'src/humans.txt', 'src/index.html', @@ -47,10 +47,12 @@ describe('jekyllized:jekyll', function() { it('_config.yml contains the correct settings', function() { var expected = [ - ['_config.yml', /title\: jekyllized/], + ['_config.yml', /name\: jekyllized/], ['_config.yml', /description\: Tests for Jekyllized/], + ['_config.yml', /url\: example.org/], ['_config.yml', /name\: Ola Nordmann/], ['_config.yml', /email\: ola\.nordmann\@email\.com/], + ['_config.yml', /uri\: homepage.com/], ['_config.yml', /bio\: I am a tester for tests/], ['_config.yml', /twitter\: 0lanordmann/] ]; From 9f451dd548e66bc8c3ecd09e38a88b4ef42b620c Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 26 Jun 2015 00:33:43 +0200 Subject: [PATCH 036/178] Fixed SCSS generation and updated Jekyll templates --- generators/app/index.js | 1 + generators/gulp/templates/gulpfile.js | 2 +- generators/jekyll/templates/app/_includes/head.html | 2 +- generators/jekyll/templates/app/_includes/header.html | 2 +- generators/jekyll/templates/config.yml | 3 --- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index 48d9f7c..3165b69 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -126,5 +126,6 @@ module.exports = generators.Base.extend({ installing: function() { this.npmInstall(); + this.spawnCommand('bundle', ['install']); } }); diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index 86d2536..423d6bd 100755 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -40,7 +40,7 @@ function jekyllProd(done) { // Compiles the SASS files and moves them into the 'assets/stylesheets' directory function styles() { // Looks at the style.scss file for what to include and creates a style.css file - return gulp.src('src/assets/scss/**/*.scss') + return gulp.src('src/assets/scss/style.scss') // Start creation of sourcemaps .pipe($.sourcemaps.init()) .pipe($.sass({errLogToconsole: true})) diff --git a/generators/jekyll/templates/app/_includes/head.html b/generators/jekyll/templates/app/_includes/head.html index a28c4cd..a90473b 100644 --- a/generators/jekyll/templates/app/_includes/head.html +++ b/generators/jekyll/templates/app/_includes/head.html @@ -3,7 +3,7 @@ - {% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %} + {% if page.title %}{{ page.title }}{% else %}{{ site.name }}{% endif %} diff --git a/generators/jekyll/templates/app/_includes/header.html b/generators/jekyll/templates/app/_includes/header.html index cedae2c..0e0ef74 100644 --- a/generators/jekyll/templates/app/_includes/header.html +++ b/generators/jekyll/templates/app/_includes/header.html @@ -2,7 +2,7 @@
- {{ site.title }} + {{ site.name }}
diff --git a/generators/jekyll/templates/app/_includes/head.html b/generators/jekyll/templates/app/_includes/head.html index cd2803e..abe2035 100644 --- a/generators/jekyll/templates/app/_includes/head.html +++ b/generators/jekyll/templates/app/_includes/head.html @@ -3,7 +3,7 @@ - {% if page.title %}{{ page.title }}{% else %}{{ site.name }}{% endif %} + {% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %} diff --git a/generators/jekyll/templates/app/_includes/header.html b/generators/jekyll/templates/app/_includes/header.html index 0e0ef74..ee39294 100644 --- a/generators/jekyll/templates/app/_includes/header.html +++ b/generators/jekyll/templates/app/_includes/header.html @@ -2,7 +2,7 @@
- {{ site.name }} + {{ site.title }} diff --git a/generators/jekyll/templates/app/_layouts/default.html b/generators/jekyll/templates/app/_layouts/default.html index ee4fb72..d63389d 100644 --- a/generators/jekyll/templates/app/_layouts/default.html +++ b/generators/jekyll/templates/app/_layouts/default.html @@ -1,5 +1,5 @@ - + {% include head.html %} @@ -20,4 +20,5 @@ + diff --git a/generators/jekyll/templates/app/_layouts/page.html b/generators/jekyll/templates/app/_layouts/page.html index f375cc4..ce233ad 100644 --- a/generators/jekyll/templates/app/_layouts/page.html +++ b/generators/jekyll/templates/app/_layouts/page.html @@ -10,4 +10,5 @@

{{ page.title }}

{{ content }}
+ diff --git a/generators/jekyll/templates/app/_layouts/post.html b/generators/jekyll/templates/app/_layouts/post.html index d4f8be3..3a0fb52 100644 --- a/generators/jekyll/templates/app/_layouts/post.html +++ b/generators/jekyll/templates/app/_layouts/post.html @@ -5,7 +5,7 @@

{{ page.title }}

- +
diff --git a/generators/jekyll/templates/app/about.md b/generators/jekyll/templates/app/about.md index 0b8de1d..d0e6de5 100644 --- a/generators/jekyll/templates/app/about.md +++ b/generators/jekyll/templates/app/about.md @@ -4,12 +4,12 @@ title: About permalink: /about/ --- -This is the base Jekyll theme. You can find out more info about customizing your -Jekyll theme, as well as basic Jekyll usage documentation at -[jekyllrb.com](http://jekyllrb.com/) +This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](http://jekyllrb.com/) You can find the source code for the Jekyll new theme at: -[github.com/jglovier/jekyll-new](https://github.com/jglovier/jekyll-new) +{% include icon-github.html username="jglovier" %} / +[jekyll-new](https://github.com/jglovier/jekyll-new) You can find the source code for Jekyll at -[github.com/jekyll/jekyll](https://github.com/jekyll/jekyll) +{% include icon-github.html username="jekyll" %} / +[jekyll](https://github.com/jekyll/jekyll) diff --git a/generators/jekyll/templates/app/assets/scss/layout.scss b/generators/jekyll/templates/app/assets/scss/layout.scss index b09c82f..9cbfdde 100644 --- a/generators/jekyll/templates/app/assets/scss/layout.scss +++ b/generators/jekyll/templates/app/assets/scss/layout.scss @@ -12,6 +12,7 @@ .site-title { font-size: 26px; + font-weight: 300; line-height: 56px; letter-spacing: -1px; margin-bottom: 0; diff --git a/generators/jekyll/templates/app/assets/scss/main.scss b/generators/jekyll/templates/app/assets/scss/main.scss index a6ddf59..fa4bf56 100644 --- a/generators/jekyll/templates/app/assets/scss/main.scss +++ b/generators/jekyll/templates/app/assets/scss/main.scss @@ -3,7 +3,7 @@ // Our variables $base-font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; $base-font-size: 16px; -$base-font-weight: 300; +$base-font-weight: 400; $small-font-size: $base-font-size * 0.875; $base-line-height: 1.5; @@ -23,7 +23,9 @@ $content-width: 800px; $on-palm: 600px; $on-laptop: 800px; -// Using media queries with like this: + + +// Use media queries like this: // @include media-query($on-palm) { // .wrapper { // padding-right: $spacing-unit / 2; diff --git a/generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss b/generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss index e36627d..8fac597 100644 --- a/generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss +++ b/generators/jekyll/templates/app/assets/scss/syntax-highlighting.scss @@ -5,6 +5,10 @@ background: #fff; @extend %vertical-rhythm; + .highlighter-rouge & { + background: #eef; + } + .c { color: #998; font-style: italic } // Comment .err { color: #a61717; background-color: #e3d2d2 } // Error .k { font-weight: bold } // Keyword diff --git a/generators/jekyll/templates/app/index.html b/generators/jekyll/templates/app/index.html index 553b899..97ae9c2 100644 --- a/generators/jekyll/templates/app/index.html +++ b/generators/jekyll/templates/app/index.html @@ -1,8 +1,9 @@ --- layout: default -regenerate: true --- +
+

Posts

-

subscribe via RSS

+

subscribe via RSS

diff --git a/generators/jekyll/templates/config.yml b/generators/jekyll/templates/config.yml index 8c7d09d..14aa9c3 100644 --- a/generators/jekyll/templates/config.yml +++ b/generators/jekyll/templates/config.yml @@ -1,6 +1,6 @@ # Title, decription, tagline and URL for your site # Can be used in your theme by calling 'site.title' and so on -name: <%= projectName %> +title: <%= projectName %> description: <%= projectDescription %> url: <%= projectURL %> @@ -18,6 +18,7 @@ author: uri: <%= authorURI %> bio: <%= authorBio %> twitter: <%= authorTwitter %> + github: <%= authorGithub %> # _config.build.yml overwrites these options when you run `gulp build` # Enables future posts (posts with dates in the future) and drafts From ca98d6b0df67b8d307b3be667c3a5b437224c4c2 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 1 Apr 2016 03:25:03 +0200 Subject: [PATCH 112/178] Forgot to add the new Github/Twitter files. Whoops --- generators/jekyll/templates/app/_includes/icon-github.html | 1 + generators/jekyll/templates/app/_includes/icon-github.svg | 1 + generators/jekyll/templates/app/_includes/icon-twitter.html | 1 + generators/jekyll/templates/app/_includes/icon-twitter.svg | 1 + 4 files changed, 4 insertions(+) create mode 100644 generators/jekyll/templates/app/_includes/icon-github.html create mode 100644 generators/jekyll/templates/app/_includes/icon-github.svg create mode 100644 generators/jekyll/templates/app/_includes/icon-twitter.html create mode 100644 generators/jekyll/templates/app/_includes/icon-twitter.svg diff --git a/generators/jekyll/templates/app/_includes/icon-github.html b/generators/jekyll/templates/app/_includes/icon-github.html new file mode 100644 index 0000000..e501a16 --- /dev/null +++ b/generators/jekyll/templates/app/_includes/icon-github.html @@ -0,0 +1 @@ +{% include icon-github.svg %}{{ include.username }} diff --git a/generators/jekyll/templates/app/_includes/icon-github.svg b/generators/jekyll/templates/app/_includes/icon-github.svg new file mode 100644 index 0000000..4422c4f --- /dev/null +++ b/generators/jekyll/templates/app/_includes/icon-github.svg @@ -0,0 +1 @@ + diff --git a/generators/jekyll/templates/app/_includes/icon-twitter.html b/generators/jekyll/templates/app/_includes/icon-twitter.html new file mode 100644 index 0000000..e623dbd --- /dev/null +++ b/generators/jekyll/templates/app/_includes/icon-twitter.html @@ -0,0 +1 @@ +{{ include.username }} diff --git a/generators/jekyll/templates/app/_includes/icon-twitter.svg b/generators/jekyll/templates/app/_includes/icon-twitter.svg new file mode 100644 index 0000000..dcf660e --- /dev/null +++ b/generators/jekyll/templates/app/_includes/icon-twitter.svg @@ -0,0 +1 @@ + From a3321531180b717d6066040fcd513abb0765e63d Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 1 Apr 2016 03:26:02 +0200 Subject: [PATCH 113/178] Add Github information, minor fixes to generator Since the updated layout for Jekyll includes a Github field, we need to add this to the generator as well. Also did some minor grammatical tweaks and changes to the questions asked to the user. --- generators/app/index.js | 13 +++++++++---- generators/jekyll/index.js | 9 ++++++++- test/app.js | 2 +- test/jekyll.js | 8 +++++--- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index 0b51e8a..bd59ad8 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -48,7 +48,7 @@ module.exports = generators.Base.extend({ store: true }, { name: 'projectURL', - message: chalk.yellow('If you are using GHPages use username.github.io\n') + + message: chalk.yellow('If you will be using Github Pages, use username.github.io\n') + chalk.yellow('? ') + 'What will the URL for your project be?', store: true }, { @@ -61,7 +61,7 @@ module.exports = generators.Base.extend({ store: true }, { name: 'authorURI', - message: chalk.yellow('Can be the same as this site!\n') + + message: chalk.yellow('Can be the same as this site\n') + chalk.yellow('? ') + 'What is your homepage?', store: true }, { @@ -70,8 +70,12 @@ module.exports = generators.Base.extend({ store: true }, { name: 'authorTwitter', - message: chalk.yellow('Don\'t include @ in front of your username\n') + - chalk.yellow('? ') + 'Your Twitter handle:', + message: chalk.blue('You can leave these blank if they are not going to be used\n') + + chalk.yellow('? ') + 'Your Twitter handle ' + chalk.yellow('(without the @):'), + store: true + }, { + name: 'authorGithub', + message: 'Your Github username:', store: true }, { name: 'uploading', @@ -143,6 +147,7 @@ module.exports = generators.Base.extend({ authorURI: this.props.authorURI, authorBio: this.props.authorBio, authorTwitter: this.props.authorTwitter, + authorGithub: this.props.authorGithub, jekyllPermalinks: this.props.jekyllPermalinks } }, { diff --git a/generators/jekyll/index.js b/generators/jekyll/index.js index d00e48a..87b6b41 100644 --- a/generators/jekyll/index.js +++ b/generators/jekyll/index.js @@ -51,7 +51,13 @@ module.exports = generators.Base.extend({ this.option('authorTwitter', { type: String, required: true, - desc: 'Author twitter' + desc: 'Author Twitter' + }); + + this.option('authorGithub', { + type: String, + required: true, + desc: 'Author Github' }); this.option('jekyllPermalinks', { @@ -79,6 +85,7 @@ module.exports = generators.Base.extend({ authorURI: this.options.authorURI, authorBio: this.options.authorBio, authorTwitter: this.options.authorTwitter, + authorGithub: this.options.authorGithub, jekyllPermalinks: this.options.jekyllPermalinks } ); diff --git a/test/app.js b/test/app.js index f88bf16..bb1c5c6 100644 --- a/test/app.js +++ b/test/app.js @@ -16,13 +16,13 @@ describe('jekyllized:app', function () { authorEmail: 'ola.nordmann@gmail.com', authorBio: 'A norwegian dude', authorTwitter: '0lanordmann', + authorGithub: '0lanordmann', uploading: 'None', jekyllPermalinks: 'pretty', jekyllPaginate: '10' }; this.deps = [ [helpers.createDummyGenerator(), 'jekyllized:boilerplate'], - [helpers.createDummyGenerator(), 'jekyllized:bower'], [helpers.createDummyGenerator(), 'jekyllized:gulp'], [helpers.createDummyGenerator(), 'jekyllized:jekyll'] ]; diff --git a/test/jekyll.js b/test/jekyll.js index f7d1159..323117e 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -15,7 +15,8 @@ describe('jekyllized:jekyll', function () { authorEmail: 'ola.nordmann@email.com', authorURI: 'homepage.com', authorBio: 'I am a tester for tests', - authorTwitter: '0lanordmann' + authorTwitter: '0lanordmann', + authorGithub: '0lanordmann' }; helpers.run(path.join(__dirname, '../generators/jekyll')) .inDir(path.join(__dirname, 'tmp/jekyll')) @@ -47,14 +48,15 @@ describe('jekyllized:jekyll', function () { it('_config.yml contains the correct settings', function () { [ - 'name: jekyllized', + 'title: jekyllized', 'description: Tests for Jekyllized', 'url: example.org', 'name: Ola Nordmann', 'email: ola.nordmann@email.com', 'uri: homepage.com', 'bio: I am a tester for tests', - 'twitter: 0lanordmann' + 'twitter: 0lanordmann', + 'github: 0lanordmann' ].forEach(function (config) { assert.fileContent('_config.yml', config); }); From c770bd97a889c16dd010878d0de5c6a5f406a6f8 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 1 Apr 2016 03:33:41 +0200 Subject: [PATCH 114/178] Remove Octopress --- generators/jekyll/index.js | 10 +++++----- generators/jekyll/templates/Gemfile | 3 --- generators/jekyll/templates/app/_templates/draft | 4 ---- generators/jekyll/templates/app/_templates/page | 4 ---- generators/jekyll/templates/app/_templates/post | 5 ----- 5 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 generators/jekyll/templates/app/_templates/draft delete mode 100644 generators/jekyll/templates/app/_templates/page delete mode 100644 generators/jekyll/templates/app/_templates/post diff --git a/generators/jekyll/index.js b/generators/jekyll/index.js index 87b6b41..9746e64 100644 --- a/generators/jekyll/index.js +++ b/generators/jekyll/index.js @@ -90,6 +90,11 @@ module.exports = generators.Base.extend({ } ); + this.fs.copyTpl( + this.templatePath('config.build.yml'), + this.destinationPath('_config.build.yml') + ); + this.fs.copyTpl( this.templatePath('humans.txt'), this.destinationPath('src/humans.txt'), @@ -99,11 +104,6 @@ module.exports = generators.Base.extend({ } ); - this.fs.copyTpl( - this.templatePath('config.build.yml'), - this.destinationPath('_config.build.yml') - ); - this.fs.copy( this.templatePath('app'), this.destinationPath('src') diff --git a/generators/jekyll/templates/Gemfile b/generators/jekyll/templates/Gemfile index 7a0f60c..7f0fc03 100644 --- a/generators/jekyll/templates/Gemfile +++ b/generators/jekyll/templates/Gemfile @@ -11,6 +11,3 @@ gem 'jekyll-gist' gem 'jekyll-paginate' gem 'jekyll-sitemap' gem 'jekyll-seo-tag' - -# octopress -gem 'octopress', '~> 3.0' diff --git a/generators/jekyll/templates/app/_templates/draft b/generators/jekyll/templates/app/_templates/draft deleted file mode 100644 index 26041ea..0000000 --- a/generators/jekyll/templates/app/_templates/draft +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: {{ layout }} -title: "{{ title }}" ---- diff --git a/generators/jekyll/templates/app/_templates/page b/generators/jekyll/templates/app/_templates/page deleted file mode 100644 index 26041ea..0000000 --- a/generators/jekyll/templates/app/_templates/page +++ /dev/null @@ -1,4 +0,0 @@ ---- -layout: {{ layout }} -title: "{{ title }}" ---- diff --git a/generators/jekyll/templates/app/_templates/post b/generators/jekyll/templates/app/_templates/post deleted file mode 100644 index fa5e2f8..0000000 --- a/generators/jekyll/templates/app/_templates/post +++ /dev/null @@ -1,5 +0,0 @@ ---- -layout: {{ layout }} -title: "{{ title }}" -date: {{ date }} ---- From 605026a5d253a63d777c3689c999bc18186b7be9 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 1 Apr 2016 04:40:19 +0200 Subject: [PATCH 115/178] New beta release, update README and settings Push a new beta release with the latest fixes. Also updated and rewrote parts of the README because I felt like it. Finally I removed some superflous settings from the build config file for Jekyll as they were already decleared in the regular config file. --- README.md | 142 +++++++++---------- generators/jekyll/templates/config.build.yml | 3 - package.json | 2 +- test/jekyll.js | 4 +- 4 files changed, 73 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 7b92679..f1e3c1e 100644 --- a/README.md +++ b/README.md @@ -2,51 +2,45 @@ [![NPM version](https://badge.fury.io/js/generator-jekyllized.png)](http://badge.fury.io/js/generator-jekyllized) [![Coverage Status](https://coveralls.io/repos/sondr3/generator-jekyllized/badge.png)](https://coveralls.io/r/sondr3/generator-jekyllized) [![Code Climate](https://codeclimate.com/github/sondr3/generator-jekyllized/badges/gpa.svg)](https://codeclimate.com/github/sondr3/generator-jekyllized) -### Development is happening on the [beta][beta] branch! - *Waiting on Gulp 4.0 to be released for the beta to go back to being the main version of Jekyllized. If you want to try it as it is right now you can install it from NPM under the `next` tag. Just read the installation instructions!* -## Overview +## Introduction -Jekyllized is a very opinionated [Yeoman][yeoman] generator for very quickly and -effortlessly allowing you to build [Jekyll][jekyll] based sites with -[Gulp][gulp]. Get started using [Yo][yo] to scaffold your site and start -developing. Your assets are automatically updated when developing and injected -into your browser with [BrowserSync][browsersync] and are also optimized when -you're ready to publish. +`generator-jekyllized` is a very opinionated [Yeoman][yeoman] generator built +with [Jekyll][jekyll] and [gulp][gulp]. You will be able to quickly scaffold +your site and start developing. As you are working on your site your assets will +automatically be updated and injected into your browser as well as your posts. +When you are done developing and want to publish it you are two commands away +from having everything optimized and published. ## Features > Rapidly prototype -When developing locally all your changes are automatically injected into your -browser. Change the background color of your website in SCSS and it will -automatically be built by [libsass][libsass], prefixed with -[AutoPrefixer][autoprefixer] and have source maps included. JavaScript is the -same, the changes are automatically injected and source maps are included. -Jekyll is also automatically reloaded when you change something in a post, and -the browser updates accordingly. Simple and rapid prototyping. +While developing locally everything you change will automatically be updated and +injected into your browser. Changing your SCSS or JavaScript files will +automatically updated them, create sourcemaps and inject them. Writing or +editing posts and pages for your website will do the same. Simple and effective. > Jekyll -Built on top of a modern and mature base, you get the full power of Jekyll to -power your site. Automatically have a sitemap and Atom feed generated, archives -for your tags and categories and more. +Built on top of Jekyll 3, you get a mature and stable base with the full power +that Jekyll brings you. You'll have sitemaps and Atom feeds generated, archives +for your posts created and SEO meta data tags added to your posts and pages. > Optimize your assets -Done with developing and ready for publishing? Jekyllized has you covered there -as well, running the generator with `--prod` makes everything run with -production settings: optimize, minify, gzip and cache bust your CSS and JS. Gzip -and minify your HTML. Optimize your images. +When you are done developing you can have your assets optimized and injected +correctly into your HTML. Your assets will be minified, compressed with gzip, +cache busted and otherwise optimized. Your images will be run through +compressors to save space and even your HTML will be minified. > Deploying -Support for deploying to either Amazon S3, Github Pages or via Rsync, you're -covered when everything is ready. Run a single command after your site is build -with production settings (`gulp deploy`) and your site is uploaded to your -choice of platform. +Finally, once everything is done and you are ready to publish your site, you can +do it via either Amazon S3, Github Pages or Rsync. With a single command your +new/updated site is uploaded to your platform of choice. ## Getting started @@ -61,62 +55,74 @@ choice of platform. generator-jekyllized@next -g` #### Install -* **Scaffold:** Run `yo jekyllized` in the directory you want your site to - scaffold in -* **Start:** Run `gulp` and watch the magic unfold and/or look at the - [FAQ][frequentlyasked] - for more options. +* **Scaffold:** Run `yo jekyllized` in the directory you want scaffold your site + in +* **Start:** Run `gulp` and watch the magic unfold ## Usage #### `gulp [--prod]` -Running this will build your assets, copy your images and fonts, build your site -and start a BrowserSync session in your browser. Any change you make to (pretty -much) any file in the `src` directory will have the associated change be -automatically updated, built and pushed to your browser. By default all -optimizations are disabled, and source maps are enabled for easy debugging. +This is the default command, and probably the one you'll use the most. This +command will build your assets and site with development settings. You'll get +sourcemaps, your drafts will be generated and you'll only generate the last 10 +posts (for speed). As you are changing your posts, pages and assets they will +automatically update and inject into your browser via +[BrowserSync][browsersync]. + +> `--prod` -When you run the command with `--prod` you are changing into production -settings. It's mostly the same as the default, however all your CSS and JS are -minifed, gzipped, cache busted and your HTML is minified as well and source maps -are disabled. Use when you're done developing locally to verify that nothing is -broken and that everything works. +Once you are done and want to verify that everything works with production +settings you add the flag `--prod` and your assets will be optimized. Your CSS, +JS and HTML will be minified and gzipped, plus the CSS and JS will be cache +busted. The images will be compressed and Jekyll will generate a site with all +your posts and no drafts. #### `gulp build [--prod]` -This command is identical to the `gulp` command, the only difference is that it -doesn't create a BrowserSync session in your browser. +This command is identical to the normal `gulp [--prod]` however it will not +create a BrowserSync session in your browser. #### `gulp (build) [--prod]` main subtasks -When run without `--prod` both `styles` and `scripts` will create a sourcemap -and will not optimize/minify etc any of your assets. With `--prod` it will not -create sourcemaps. - > `gulp jekyll [--prod]` -Builds your site with either development settings or production settings, -depending on whether `--prod` is true or not. - -> `gulp styles [--prod]` +Without production settings Jekyll will only create the 10 latest posts and will +create both future posts and drafts. With `--prod` none of that is true and it +will generate all your posts. -Creates a `style.css` file from your SASS via `libsass` and uses AutoPrefixer to -add prefixes automatically. If you are working on your site it will inject the -updated CSS into your website. When run with `--prod` it will also minify, gzip -and cache bust it. +> `gulp styles|scripts [--prod]` -> `gulp scripts [--prod]` - -Essentially the same as with your styles, only with your JavaScript. +Both your CSS and JS will have sourcemaps generated for them under development +settings. Once you generate them with production settings sourcemap generation +is disabled. Both will be minified, gzipped and cache busted with production +settings. > `gulp images` -Optimizes and caches your images. +Optimizes and caches your images. This is a set it and forget it command for the +most part. > `gulp html --prod` **Does nothing without `--prod`.** Minifies and gzips your HTML files. +> `gulp serve` + +If you just want to watch your site you can run this command. If wanted you can +also edit the `serve` task to allow it to tunnel via [localtunnel][localtunnel] +so people outside your local network can view it as well: + +```js + // tunnel: true, +``` + +You can also change the behaviour for how it opens the URL when you run `gulp +[--prod]`, you can see the options [here][browsersync-open]: + +```js + // open: false, +``` + #### `gulp deploy` When you're done developing and have built your site with either `gulp --prod` @@ -242,9 +248,9 @@ Pages. Luckily the Jekyll documentation [has you covered][jekyll-url]. > Why don't you support Stylus/LESS/Angular/etc -Because I've never used them nor do I have any plans to use them. If you want to -you can create a pull request for them and I'll have a look and see whether -it'll work or not. +Because I've never used them nor do I have any plans of using them. Furthermore, +they're a bit outside what I want with this generator anyways. I want a lean, +simple and opinionated generator, not a big complicated one. ## Contributing @@ -256,12 +262,9 @@ See the [contribution][contribute] docs. MIT © Sondre Nilsen (https://github.com/sondr3) -[autoprefixer]: https://github.com/ai/autoprefixer [awspublish]: https://github.com/pgherveou/gulp-awspublish -[beta]: https://github.com/sondr3/generator-jekyllized/tree/beta -[bower]: http://bower.io/ [browsersync]: https://github.com/shakyShane/browser-sync -[bundler]: http://bundler.io +[browsersync-open]: https://browsersync.io/docs/options/#option-open [contribute]: https://github.com/sondr3/generator-jekyllized/blob/beta/CONTRIBUTING.md [changelog]: https://github.com/sondr3/generator-jekyllized/blob/master/CHANGELOG.md [frequentlyasked]: https://github.com/sondr3/generator-jekyllized#frequently-asked-questions @@ -271,9 +274,6 @@ MIT © Sondre Nilsen (https://github.com/sondr3) [jekyll-url]: http://jekyllrb.com/docs/github-pages/#project-page-url-structure [jekyll]: https://jekyllrb.com [libsass]: https://github.com/hcatlin/libsass -[nodejs]: http://nodejs.org/ -[redcarpet]: https://github.com/vmg/redcarpet +[localtunnel]: http://localtunnel.me/ [rsync]: https://github.com/jerrysu/gulp-rsync -[rubylang]: http://www.ruby-lang.org/ [yeoman]: http://yeoman.io -[yo]: https://github.com/yeoman/yo diff --git a/generators/jekyll/templates/config.build.yml b/generators/jekyll/templates/config.build.yml index f2ccf67..3c94059 100644 --- a/generators/jekyll/templates/config.build.yml +++ b/generators/jekyll/templates/config.build.yml @@ -8,6 +8,3 @@ show_drafts: false lsi: true # Removes the upper limit for posts generated limit_posts: 0 - -source: src -destination: dist diff --git a/package.json b/package.json index 0e0e749..49df8d8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.11", + "version": "1.0.0-beta.12", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ diff --git a/test/jekyll.js b/test/jekyll.js index 323117e..da062d1 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -67,9 +67,7 @@ describe('jekyllized:jekyll', function () { 'future: false', 'show_drafts: false', 'lsi: true', - 'limit_posts: 0', - 'source: src', - 'destination: dist' + 'limit_posts: 0' ].forEach(function (config) { assert.fileContent('_config.build.yml', config); }); From 5c316e56ffd710f4c9e1bd37357d418d19660709 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 1 Apr 2016 19:07:45 +0200 Subject: [PATCH 116/178] Update changelog [ci skip] --- CHANGELOG.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 223a15c..6d114e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ + +## 1.0.0-beta.12 +> 2016-04-01 + +Updated to the latest theme of Jekyll and it's CSS and removed Octopress as it +wasn't used at all. Added support for the Github field in Jekyll as well and +rewrote parts of the REAMEs for the project. Mostly cosmetic changes. + +#### Changelog: +* [[`605026a5d2`](https://github.com/sondr3/generator-jekyllized/commit/605026a5d2)] - New beta release, update README and settings +* [[`c770bd97a8`](https://github.com/sondr3/generator-jekyllized/commit/c770bd97a8)] - Remove Octopress +* [[`a332153118`](https://github.com/sondr3/generator-jekyllized/commit/a332153118)] - Add Github information, minor fixes to generator +* [[`ca98d6b0df`](https://github.com/sondr3/generator-jekyllized/commit/ca98d6b0df)] - Forgot to add the new Github/Twitter files. Whoops +* [[`5f2f19dd43`](https://github.com/sondr3/generator-jekyllized/commit/5f2f19dd43)] - Update to latest Jekyll theme and settings +* [[`c1a9e25193`](https://github.com/sondr3/generator-jekyllized/commit/c1a9e25193)] - Installation instructions +* [[`dd314da58f`](https://github.com/sondr3/generator-jekyllized/commit/dd314da58f)] - New beta release + ## 1.0.0-beta.11 > 2016-03-30 @@ -5,8 +22,8 @@ Fix injecting JS as well, forgot that JS as well is injected into the browser. #### Changelog: -* [[`a60aa79ed2`](https://github.com/Sondre Nilsen/generator-jekyllized/commit/a60aa79ed2)]: Fix injecting for JS as well -* [[`7bdf3908b5`](https://github.com/Sondre Nilsen/generator-jekyllized/commit/7bdf3908b5)]: Update how versions works +* [[`a60aa79ed2`](https://github.com/sondr3/generator-jekyllized/commit/a60aa79ed2)]: Fix injecting for JS as well +* [[`7bdf3908b5`](https://github.com/sondr3/generator-jekyllized/commit/7bdf3908b5)]: Update how versions works ## 1.0.0-beta.10 From d16c4944efae7ee2e5cc3d4c60dc12d6ca22d5b9 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 02:11:26 +0200 Subject: [PATCH 117/178] Remove LSI It would in some cases cause issues, and honestly wasn't used for much at all. Removed it for now. Closes #119. --- generators/jekyll/templates/Gemfile | 1 - generators/jekyll/templates/config.build.yml | 2 -- test/jekyll.js | 1 - 3 files changed, 4 deletions(-) diff --git a/generators/jekyll/templates/Gemfile b/generators/jekyll/templates/Gemfile index 7f0fc03..aeb0d35 100644 --- a/generators/jekyll/templates/Gemfile +++ b/generators/jekyll/templates/Gemfile @@ -2,7 +2,6 @@ source "http://rubygems.org" gem 'jekyll' gem 'redcarpet' -gem 'classifier-reborn' # jekyll plugins gem 'jekyll-archives' diff --git a/generators/jekyll/templates/config.build.yml b/generators/jekyll/templates/config.build.yml index 3c94059..9416832 100644 --- a/generators/jekyll/templates/config.build.yml +++ b/generators/jekyll/templates/config.build.yml @@ -4,7 +4,5 @@ # Hides your drafts and future posts future: false show_drafts: false -# Gives you more accurate related posts -lsi: true # Removes the upper limit for posts generated limit_posts: 0 diff --git a/test/jekyll.js b/test/jekyll.js index da062d1..ccc3db1 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -66,7 +66,6 @@ describe('jekyllized:jekyll', function () { [ 'future: false', 'show_drafts: false', - 'lsi: true', 'limit_posts: 0' ].forEach(function (config) { assert.fileContent('_config.build.yml', config); From a67e69c08360f9789103b1b9da1fb16b5ff7e0fb Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 12:05:28 +0200 Subject: [PATCH 118/178] Fix uploading for AWS Apparently I forgot to return the source, whoops. --- generators/gulp/templates/gulpfile.babel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/gulp/templates/gulpfile.babel.js b/generators/gulp/templates/gulpfile.babel.js index e2db580..0b92ac7 100644 --- a/generators/gulp/templates/gulpfile.babel.js +++ b/generators/gulp/templates/gulpfile.babel.js @@ -203,7 +203,7 @@ gulp.task('deploy', () => { 'Cache-Control': 'max-axe=315360000, no-transform, public' }; - gulp.src('dist/**/*') + return gulp.src('dist/**/*') .pipe($.awspublish.gzip()) .pipe(parallelize(publisher.publish(headers), 30)) .pipe(publisher.cache()) From 48b77fa66da4d794ac021fdc6bef2aa3f059f185 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 12:18:11 +0200 Subject: [PATCH 119/178] Update READMEs and new release --- CHANGELOG.md | 12 ++++++++++++ README.md | 6 ++++++ generators/boilerplate/templates/README.md | 5 +++++ package.json | 2 +- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d114e7..ba6eb2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ + +## 1.0.0-beta.13 +> 2016-04-14 + +Fixed a issue where Jekyll wouldn't generate when run with LSI turned on, so +this was disabled as it isn't used for anything. And fixed the uploading for +AWS. + +#### Changelog: +* [[`a67e69c083`](https://github.com/sondre/generator-jekyllized/commit/a67e69c083)] - Fix uploading for AWS +* [[`d16c4944ef`](https://github.com/sondre/generator-jekyllized/commit/d16c4944ef)] - Remove LSI + ## 1.0.0-beta.12 > 2016-04-01 diff --git a/README.md b/README.md index f1e3c1e..f4eb6ba 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,12 @@ new/updated site is uploaded to your platform of choice. in * **Start:** Run `gulp` and watch the magic unfold +#### Update +It's recommended that you keep your `gulpfile` up to date with the generator. +First, update `generator-jekyllized`: `npm update generator-jekyllized -g`, then +run `yo jekyllized:gulp` in the directory you want to update. Note that this +will overwrite any local changes you've made, so make sure to make a backup. + ## Usage #### `gulp [--prod]` diff --git a/generators/boilerplate/templates/README.md b/generators/boilerplate/templates/README.md index 1fe1c80..8f66761 100644 --- a/generators/boilerplate/templates/README.md +++ b/generators/boilerplate/templates/README.md @@ -27,6 +27,11 @@ If you have cloned this repo or want to reinstall, make sure there's no `node_modules` or `Gemfile.lock` folder/file and then run `npm install` and `bundle install`. +#### Update +To update: `npm update generator-jekyllized -g`, then run `yo jekyllized:gulp` +in this directory. Note that this will overwrite any local changes, so back it +up. + ## Github For more information on how to use your new project, please refer to the [README on Github](https://github.com/sondr3/generator-jekyllized). diff --git a/package.json b/package.json index 49df8d8..5cb594c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.12", + "version": "1.0.0-beta.13", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From 8ca22fe71cdf35c58aca5395d28b17b40e4e1acc Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 13:08:20 +0200 Subject: [PATCH 120/178] max-age, not max-axe... sadly --- generators/gulp/templates/gulpfile.babel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/gulp/templates/gulpfile.babel.js b/generators/gulp/templates/gulpfile.babel.js index 0b92ac7..da22e23 100644 --- a/generators/gulp/templates/gulpfile.babel.js +++ b/generators/gulp/templates/gulpfile.babel.js @@ -200,7 +200,7 @@ gulp.task('deploy', () => { var publisher = $.awspublish.create(credentials); var headers = { - 'Cache-Control': 'max-axe=315360000, no-transform, public' + 'Cache-Control': 'max-age=315360000, no-transform, public' }; return gulp.src('dist/**/*') From 85b1a973c16640bdd51e1d1b73d5f238b2bc768a Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 13:12:49 +0200 Subject: [PATCH 121/178] New release, remove info about updating [ci skip] The updater apparently doesn't remember the choice you set for uploading so updating the gulpfile will make it remove any kind of uploading task. --- CHANGELOG.md | 9 +++++++++ README.md | 6 ------ package.json | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba6eb2d..f2ce185 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ + +## 1.0.0-beta.14 +> 2016-04-14 + +Fixed a typo in the cache-headers for Amazon S3, thanks @xHN35RQ. + +#### Changelog: +* [[`8ca22fe71c`](https://github.com/sondr3/generator-jekyllized/commit/8ca22fe71c)] - max-age, not max-axe... sadly + ## 1.0.0-beta.13 > 2016-04-14 diff --git a/README.md b/README.md index f4eb6ba..f1e3c1e 100644 --- a/README.md +++ b/README.md @@ -59,12 +59,6 @@ new/updated site is uploaded to your platform of choice. in * **Start:** Run `gulp` and watch the magic unfold -#### Update -It's recommended that you keep your `gulpfile` up to date with the generator. -First, update `generator-jekyllized`: `npm update generator-jekyllized -g`, then -run `yo jekyllized:gulp` in the directory you want to update. Note that this -will overwrite any local changes you've made, so make sure to make a backup. - ## Usage #### `gulp [--prod]` diff --git a/package.json b/package.json index 5cb594c..2d968f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.13", + "version": "1.0.0-beta.14", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From dc32d516967da26a0a0a5bb85ccce5a0c66ca483 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 13:54:39 +0200 Subject: [PATCH 122/178] Add support for updating your gulpfile You can now run `yo jekyllized:gulp --rsync` to update your gulpfile and package.json to the latest version of both with Rsync for uploading. Neat. --- README.md | 7 +++++++ generators/boilerplate/templates/README.md | 6 +++--- generators/gulp/USAGE | 12 ++++++++++++ generators/gulp/index.js | 13 +++++++++++++ package.json | 1 + 5 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 generators/gulp/USAGE diff --git a/README.md b/README.md index f1e3c1e..aa82325 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,13 @@ new/updated site is uploaded to your platform of choice. in * **Start:** Run `gulp` and watch the magic unfold +#### Update +It's recommended that you keep your `gulpfile` up to date with the generator. +First, update `generator-jekyllized`: `npm update generator-jekyllized -g` and +then run `yo jekyllized:gulp [--rsync|amazon|pages]`, or see the help: `yo +jekyllized:gulp --help`. Note that this will overwrite any local changes you've +made, so make sure to make a backup. + ## Usage #### `gulp [--prod]` diff --git a/generators/boilerplate/templates/README.md b/generators/boilerplate/templates/README.md index 8f66761..bed6816 100644 --- a/generators/boilerplate/templates/README.md +++ b/generators/boilerplate/templates/README.md @@ -28,9 +28,9 @@ If you have cloned this repo or want to reinstall, make sure there's no `bundle install`. #### Update -To update: `npm update generator-jekyllized -g`, then run `yo jekyllized:gulp` -in this directory. Note that this will overwrite any local changes, so back it -up. +To update: `npm update generator-jekyllized -g`, then run `yo jekyllized:gulp +[--rsync|amazon|pages]` in this directory. Note that this will overwrite any +local changes, so back it up. ## Github For more information on how to use your new project, please refer to the [README diff --git a/generators/gulp/USAGE b/generators/gulp/USAGE new file mode 100644 index 0000000..8579276 --- /dev/null +++ b/generators/gulp/USAGE @@ -0,0 +1,12 @@ +Updating: + When updating your gulpfile and packages you need to include a command line + flag specifying how you want to upload your site, if no flag is specified it + will generate a gulpfile without any uploading task. For example: + + yo jekyllized:gulp + yo jekyllized:gulp --rsync + + Options: + --amazon + --rsync + --pages diff --git a/generators/gulp/index.js b/generators/gulp/index.js index 8461a8a..0df8078 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -2,6 +2,7 @@ var _ = require('lodash'); var generators = require('yeoman-generator'); +var argv = require('yargs').argv; module.exports = generators.Base.extend({ constructor: function () { @@ -14,6 +15,18 @@ module.exports = generators.Base.extend({ message: 'How do you want to upload your site?', choices: ['Amazon S3', 'Rsync', 'Github Pages', 'None'] }); + + if (argv.amazon) { + this.options.uploading = 'Amazon S3'; + } + + if (argv.rsync) { + this.options.uploading = 'Rsync'; + } + + if (argv.pages) { + this.options.uploading = 'Github Pages'; + } }, writing: { diff --git a/package.json b/package.json index 2d968f5..c9cf17b 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "istanbul": "^0.4.2", "mocha": "^2.4.5", "mocha-lcov-reporter": "^1.2.0", + "yargs": "^4.6.0", "yeoman-assert": "^2.1.1", "yeoman-test": "^1.1.0", "yo": "^1.7.0" From 87f4462df75dd6117f9901e12317602dfb7f3e87 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 13:58:27 +0200 Subject: [PATCH 123/178] New release [ci skip] --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2ce185..94e19ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## 1.0.0-beta.15 +> 2016-04-15 + +Added support for updating your gulpfile and package.json with your specified +uploading settings, so you can now stay up to date pretty easily! Neat. + +#### Changelog: +* [[`dc32d51696`](https://github.com/sondr3/generator-jekyllized/commit/dc32d51696)] - Add support for updating your gulpfile + ## 1.0.0-beta.14 > 2016-04-14 diff --git a/package.json b/package.json index c9cf17b..ab61960 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.14", + "version": "1.0.0-beta.15", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From abb65bdca19b2b9a84767f5b8dff67487a38e53e Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Thu, 14 Apr 2016 14:03:00 +0200 Subject: [PATCH 124/178] Add missing link [ci skip] --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index aa82325..894db4e 100644 --- a/README.md +++ b/README.md @@ -270,6 +270,7 @@ See the [contribution][contribute] docs. MIT © Sondre Nilsen (https://github.com/sondr3) [awspublish]: https://github.com/pgherveou/gulp-awspublish +[bower]: http://bower.io [browsersync]: https://github.com/shakyShane/browser-sync [browsersync-open]: https://browsersync.io/docs/options/#option-open [contribute]: https://github.com/sondr3/generator-jekyllized/blob/beta/CONTRIBUTING.md From 94d0c54b42a2c32d34a9723bf39b0fdf128317ff Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 15 Apr 2016 00:53:45 +0200 Subject: [PATCH 125/178] Fix not installing properly Major oversight by me, added yargs to devdependencies instead of regular dependencies, and therefore everything stopped working. Whoops. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ab61960..b9b2b6d 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "globule": "^0.2.0", "lodash": "^4.6.1", "shelljs": "^0.6.0", + "yargs": "^4.6.0", "yeoman-generator": "^0.22.5", "yosay": "^1.1.0" }, @@ -47,7 +48,6 @@ "istanbul": "^0.4.2", "mocha": "^2.4.5", "mocha-lcov-reporter": "^1.2.0", - "yargs": "^4.6.0", "yeoman-assert": "^2.1.1", "yeoman-test": "^1.1.0", "yo": "^1.7.0" From 4d083d369085df18735fdf4a33ded7f7c79e01d3 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 15 Apr 2016 01:05:51 +0200 Subject: [PATCH 126/178] New beta release [ci skip] --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94e19ce..96de75d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## 1.0.0-beta.16 +> 2016-04-15 + +Fixed the issue where the generator would refuse to install because it couldn't +resolve the dependency on `yargs` because I didn't add it as a dependency but +added it as a devdependency instead. Whoops. + +#### Changelog: +* [[`94d0c54b42`](https://github.com/sondr3/generator-jekyllized/commit/94d0c54b42)] - Fix not installing properly + ## 1.0.0-beta.15 > 2016-04-15 diff --git a/package.json b/package.json index b9b2b6d..33a4669 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.15", + "version": "1.0.0-beta.16", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From 6365af133095bac7fb78b982f940cd4fdc611515 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 15 Apr 2016 04:17:52 +0200 Subject: [PATCH 127/178] Update to latest BrowserSync config --- generators/gulp/templates/gulpfile.babel.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/generators/gulp/templates/gulpfile.babel.js b/generators/gulp/templates/gulpfile.babel.js index da22e23..3609e81 100644 --- a/generators/gulp/templates/gulpfile.babel.js +++ b/generators/gulp/templates/gulpfile.babel.js @@ -18,7 +18,7 @@ import fs from 'fs'; import parallelize from 'concurrent-transform'; <% } -%> // BrowserSync is used to live-reload your website -import browserSync from 'browser-sync'; +const browserSync = require('browser-sync').create(); const reload = browserSync.reload; // AutoPrefixer import autoprefixer from 'autoprefixer'; @@ -251,12 +251,10 @@ gulp.task('lint', () => // 'gulp serve' -- open up your website in your browser and watch for changes // in all your files and update them when needed gulp.task('serve', () => { - browserSync({ + browserSync.init({ // tunnel: true, // open: false, - server: { - baseDir: ['.tmp', 'dist'] - } + server: ['.tmp', 'dist'] }); // Watch various files for changes and do the needful From a4b7e24216718c20229a9767c2ee74fd14bf7586 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 15 Apr 2016 04:20:35 +0200 Subject: [PATCH 128/178] New release [ci skip] --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96de75d..b1181f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ + +## 1.0.0-beta.17 +> 2016-04-15 + +Updated the BrowserSync config in the gulpfile to the newer syntax. + +#### Changelog: +* [[`6365af1330`](https://github.com/sondre/generator-jekyllized/commit/6365af1330)] - Update to latest BrowserSync config + ## 1.0.0-beta.16 > 2016-04-15 diff --git a/package.json b/package.json index 33a4669..ba35e98 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.16", + "version": "1.0.0-beta.17", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From 153f780df30801a282ccf067cb4a6d517559178b Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Fri, 15 Apr 2016 04:22:06 +0200 Subject: [PATCH 129/178] Fix URL [ci skip] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1181f8..93e9784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ Updated the BrowserSync config in the gulpfile to the newer syntax. #### Changelog: -* [[`6365af1330`](https://github.com/sondre/generator-jekyllized/commit/6365af1330)] - Update to latest BrowserSync config +* [[`6365af1330`](https://github.com/sondr3/generator-jekyllized/commit/6365af1330)] - Update to latest BrowserSync config ## 1.0.0-beta.16 From 62c4255b0ae09d1e2a5f76e0d90b6113db20c09a Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 17 Apr 2016 22:37:05 +0200 Subject: [PATCH 130/178] Fix error with jekyll-feed for now --- generators/jekyll/templates/Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/jekyll/templates/Gemfile b/generators/jekyll/templates/Gemfile index aeb0d35..61bcc03 100644 --- a/generators/jekyll/templates/Gemfile +++ b/generators/jekyll/templates/Gemfile @@ -5,7 +5,7 @@ gem 'redcarpet' # jekyll plugins gem 'jekyll-archives' -gem 'jekyll-feed' +gem 'jekyll-feed', '0.4.0' gem 'jekyll-gist' gem 'jekyll-paginate' gem 'jekyll-sitemap' From 48c6cf9c2e5907e357a6a4634bafeae6d02207d2 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 17 Apr 2016 22:40:49 +0200 Subject: [PATCH 131/178] New release [ci skip] --- CHANGELOG.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e9784..5d25df1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ + +## 1.0.0-beta.18 +> 2016-04-17 + +Downgrade the version of `jekyll-feed`. Needed because Jekyll has changed how it +requires URLs to be written in `_config.yml` and doesn't support URLs without +`http://`. I'm going on vacation and don't have the time to fix it before my +flight leaves :D + +#### Changelog: +* [[`62c4255b0a`](https://github.com/sondr3/generator-jekyllized/commit/62c4255b0a)] - Fix error with jekyll-feed for now + ## 1.0.0-beta.17 > 2016-04-15 diff --git a/package.json b/package.json index ba35e98..0cd3ae3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.17", + "version": "1.0.0-beta.18", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From ee3264d1b5deaf3c4ff6fb51f5a21f344da014d1 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 23 Apr 2016 17:13:37 +0200 Subject: [PATCH 132/178] Fix URLs needing HTTP(s) This also fixes #124. --- generators/app/index.js | 7 +++++++ generators/jekyll/templates/Gemfile | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/generators/app/index.js b/generators/app/index.js index bd59ad8..f337132 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -50,6 +50,13 @@ module.exports = generators.Base.extend({ name: 'projectURL', message: chalk.yellow('If you will be using Github Pages, use username.github.io\n') + chalk.yellow('? ') + 'What will the URL for your project be?', + validate: function (input) { + if (input.startsWith('http')) { + return true; + } + + return 'URL must contain either HTTP or HTTPs'; + }, store: true }, { name: 'authorName', diff --git a/generators/jekyll/templates/Gemfile b/generators/jekyll/templates/Gemfile index 61bcc03..aeb0d35 100644 --- a/generators/jekyll/templates/Gemfile +++ b/generators/jekyll/templates/Gemfile @@ -5,7 +5,7 @@ gem 'redcarpet' # jekyll plugins gem 'jekyll-archives' -gem 'jekyll-feed', '0.4.0' +gem 'jekyll-feed' gem 'jekyll-gist' gem 'jekyll-paginate' gem 'jekyll-sitemap' From 389cfeb690710b9288476f963e7149d74fae2fdc Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 23 Apr 2016 17:16:54 +0200 Subject: [PATCH 133/178] New beta release [ci skip] --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d25df1..9763813 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## 1.0.0-beta.19 +> 2016-04-23 + +Added validation to the URL because Jekyll requires them to at least include +`//`, so now URLs must include either `HTTP` or `HTTPS`. + +#### Changelog: +* [[`ee3264d1b5`](https://github.com/sondr3/generator-jekyllized/commit/ee3264d1b5)] - Fix URLs needing HTTP(s) + + ## 1.0.0-beta.18 > 2016-04-17 diff --git a/package.json b/package.json index 0cd3ae3..a5153c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.18", + "version": "1.0.0-beta.19", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From 5892ae79e9f16bf12be026d0dbd7cdc9e07331c7 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 24 Apr 2016 18:07:28 +0200 Subject: [PATCH 134/178] Update packages --- package.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index a5153c4..3c95690 100644 --- a/package.json +++ b/package.json @@ -21,34 +21,34 @@ ], "dependencies": { "chalk": "^1.1.0", - "globule": "^0.2.0", - "lodash": "^4.6.1", + "globule": "^1.0.0", + "lodash": "^4.11.1", "shelljs": "^0.6.0", "yargs": "^4.6.0", - "yeoman-generator": "^0.22.5", - "yosay": "^1.1.0" + "yeoman-generator": "^0.22.6", + "yosay": "^1.1.1" }, "devDependencies": { - "babel-core": "^6.7.4", - "babel-eslint": "^6.0.0", + "babel-core": "^6.7.7", + "babel-eslint": "^6.0.3", "babel-preset-es2015": "^6.6.0", "codeclimate-test-reporter": "^0.3.1", "coveralls": "^2.11.6", "del": "^2.2.0", - "eslint": "^2.5.3", - "eslint-config-xo": "^0.12.0", - "eslint-config-xo-space": "^0.11.0", + "eslint": "^2.8.0", + "eslint-config-xo": "^0.13.0", + "eslint-config-xo-space": "^0.12.0", "generator-mocha": "^0.3.0", "gulp": "git://github.com/gulpjs/gulp.git#4.0", "gulp-coveralls": "^0.1.4", "gulp-eslint": "^2.0.0", - "gulp-istanbul": "^0.10.3", - "gulp-load-plugins": "^1.2.0", + "gulp-istanbul": "^0.10.4", + "gulp-load-plugins": "^1.2.2", "gulp-mocha": "^2.2.0", - "istanbul": "^0.4.2", + "istanbul": "^0.4.3", "mocha": "^2.4.5", "mocha-lcov-reporter": "^1.2.0", - "yeoman-assert": "^2.1.1", + "yeoman-assert": "^2.2.1", "yeoman-test": "^1.1.0", "yo": "^1.7.0" } From fa1852e2f87830f8b6245f4b3b977453d01a05fe Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 24 Apr 2016 18:09:21 +0200 Subject: [PATCH 135/178] Update changelog [ci skip] --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9763813..b4efcf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## HEAD + +Updated the packages for the generator. + +#### Changelog: +* [[`5892ae79e9`](https://github.com/sondr3/generator-jekyllized/commit/5892ae79e9)] - Update packages + ## 1.0.0-beta.19 > 2016-04-23 @@ -8,7 +15,6 @@ Added validation to the URL because Jekyll requires them to at least include #### Changelog: * [[`ee3264d1b5`](https://github.com/sondr3/generator-jekyllized/commit/ee3264d1b5)] - Fix URLs needing HTTP(s) - ## 1.0.0-beta.18 > 2016-04-17 From 4a6b983d646ba9a36131bffcd6e90d7f13f3868a Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 13:55:32 +0200 Subject: [PATCH 136/178] Remove jekyll-archives Closes #130. --- README.md | 4 ++-- generators/jekyll/templates/Gemfile | 1 - generators/jekyll/templates/config.yml | 19 ------------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 894db4e..ac46538 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ editing posts and pages for your website will do the same. Simple and effective. > Jekyll Built on top of Jekyll 3, you get a mature and stable base with the full power -that Jekyll brings you. You'll have sitemaps and Atom feeds generated, archives -for your posts created and SEO meta data tags added to your posts and pages. +that Jekyll brings you. You'll have sitemaps, Atom feeds generated and SEO meta +data tags added to your posts and pages. > Optimize your assets diff --git a/generators/jekyll/templates/Gemfile b/generators/jekyll/templates/Gemfile index aeb0d35..4b55c70 100644 --- a/generators/jekyll/templates/Gemfile +++ b/generators/jekyll/templates/Gemfile @@ -4,7 +4,6 @@ gem 'jekyll' gem 'redcarpet' # jekyll plugins -gem 'jekyll-archives' gem 'jekyll-feed' gem 'jekyll-gist' gem 'jekyll-paginate' diff --git a/generators/jekyll/templates/config.yml b/generators/jekyll/templates/config.yml index 14aa9c3..7ac27ce 100644 --- a/generators/jekyll/templates/config.yml +++ b/generators/jekyll/templates/config.yml @@ -44,27 +44,8 @@ highlighter: true # Extending Jekyll gems: - - jekyll-archives - jekyll-feed - jekyll-gist - jekyll-paginate - jekyll-sitemap - jekyll-seo-tag - -# Settings for archives -jekyll-archives: - enabled: - - year - - month - - categories - - tags - layouts: - year: 'year-archive' - month: 'month-archive' - category: 'category-archive' - tag: 'tag-archive' - permalinks: - year: '/archive/:year/' - month: '/archive/:year/:month/' - category: '/category/:name/' - tags: '/tag/:name/' From 96374df57f9a51288a6cbe0487037ec1bbb97b86 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 15:08:46 +0200 Subject: [PATCH 137/178] Copy to a temporary directory, ES2015 updates This is so that your git commit history isn't disturbed by tons of changes to your header and footer file, now it's all done in the temporary directory first. Also changed the file to use ES2015 syntax without having to rely on Babel, this speeds up the gulpfile quite a bit. This closes #131 and fixes #127, fixes #128 and fixes #129. --- generators/app/index.js | 13 +-- generators/gulp/index.js | 7 +- .../{gulpfile.babel.js => gulpfile.js} | 94 ++++++++++--------- generators/jekyll/templates/config.yml | 4 +- test/app.js | 2 +- test/gulp.js | 63 ++++++------- 6 files changed, 87 insertions(+), 96 deletions(-) rename generators/gulp/templates/{gulpfile.babel.js => gulpfile.js} (82%) diff --git a/generators/app/index.js b/generators/app/index.js index f337132..39a840f 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -10,11 +10,6 @@ module.exports = generators.Base.extend({ constructor: function () { generators.Base.apply(this, arguments); - this.option('skip-install', { - desc: 'Skip installing dependencies', - type: Boolean - }); - var dependencies = ['ruby', 'bundle', 'yo', 'gulp', 'node'].every(function (depend) { return shelljs.which(depend); }); @@ -163,11 +158,7 @@ module.exports = generators.Base.extend({ }, installing: function () { - if (this.options['skip-install']) { - this.log('Please run `npm install` and `bundle install`'); - } else { - this.npmInstall(); - this.spawnCommand('bundle', ['install']); - } + this.installDependencies({bower: false}); + this.spawnCommand('bundle', ['install', '--quiet']); } }); diff --git a/generators/gulp/index.js b/generators/gulp/index.js index 0df8078..0a09526 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -36,9 +36,6 @@ module.exports = generators.Base.extend({ pkg.devDependencies = pkg.devDependencies || {}; _.extend(pkg.devDependencies, { 'autoprefixer': '^6.2.3', - 'babel-core': '^6.5.0', - 'babel-eslint': '^6.0.0', - 'babel-preset-es2015': '^6.5.0', 'browser-sync': '^2.11.0', 'del': '^2.2.0', 'eslint': '^2.5.3', @@ -86,8 +83,8 @@ module.exports = generators.Base.extend({ gulpfile: function () { this.fs.copyTpl( - this.templatePath('gulpfile.babel.js'), - this.destinationPath('gulpfile.babel.js'), + this.templatePath('gulpfile.js'), + this.destinationPath('gulpfile.js'), { amazonS3: this.options.uploading === 'Amazon S3', rsync: this.options.uploading === 'Rsync', diff --git a/generators/gulp/templates/gulpfile.babel.js b/generators/gulp/templates/gulpfile.js similarity index 82% rename from generators/gulp/templates/gulpfile.babel.js rename to generators/gulp/templates/gulpfile.js index 3609e81..b7c9deb 100644 --- a/generators/gulp/templates/gulpfile.babel.js +++ b/generators/gulp/templates/gulpfile.js @@ -1,35 +1,35 @@ 'use strict'; -import gulp from 'gulp'; +const gulp = require('gulp'); // Loads the plugins without having to list all of them, but you need // to call them as $.pluginname -import gulpLoadPlugins from 'gulp-load-plugins'; +const gulpLoadPlugins = require('gulp-load-plugins'); const $ = gulpLoadPlugins(); // Delete stuff -import del from 'del'; +const del = require('del'); // Used to run shell commands -import shell from 'shelljs'; +const shell = require('shelljs'); <% if (amazonS3 || rsync) { -%> // 'fs' is used to read files from the system (used for uploading) -import fs from 'fs'; +const fs = require('fs'); <% } -%> <% if (amazonS3) { -%> // Parallelize the uploads when uploading to Amazon S3 -import parallelize from 'concurrent-transform'; +const parallelize = require('concurrent-transform'); <% } -%> // BrowserSync is used to live-reload your website const browserSync = require('browser-sync').create(); const reload = browserSync.reload; // AutoPrefixer -import autoprefixer from 'autoprefixer'; +const autoprefixer = require('autoprefixer'); // Yargs for command line arguments -import {argv} from 'yargs'; +const argv = require('yargs').argv; // 'gulp clean:assets' -- deletes all assets except for images // 'gulp clean:images' -- deletes your images -// 'gulp clean:dist' -- erases the dist folder +// 'gulp clean:dist' -- erases the dist directory // 'gulp clean:gzip' -- erases all the gzipped files -// 'gulp clean:metadata' -- deletes the metadata file for Jekyll +// 'gulp clean:jekyll' -- deletes the temporary Jekyll site gulp.task('clean:assets', () => { return del(['.tmp/**/*', '!.tmp/assets', '!.tmp/assets/images', '!.tmp/assets/images/**/*', 'dist/assets']); }); @@ -37,15 +37,23 @@ gulp.task('clean:images', () => { return del(['.tmp/assets/images', 'dist/assets/images']); }); gulp.task('clean:dist', () => { - return del(['dist/']); + return del(['dist/', '.tmp/dist']); }); gulp.task('clean:gzip', () => { return del(['dist/**/*.gz']); }); -gulp.task('clean:metadata', () => { - return del(['src/.jekyll-metadata']); +gulp.task('clean:jekyll', () => { + return del(['.tmp/jekyll']); }); +// 'gulp jekyll:tmp' -- copies your Jekyll site to a temporary directory +// to be processed +gulp.task('jekyll:tmp', () => + gulp.src(['src/**/*', '!src/assets/**/*', '!src/assets']) + .pipe(gulp.dest('.tmp/jekyll')) + .pipe($.size({title: 'Jekyll'})) +); + // 'gulp jekyll' -- builds your site with development settings // 'gulp jekyll --prod' -- builds your site with production settings gulp.task('jekyll', done => { @@ -139,18 +147,18 @@ gulp.task('scripts', () => // 'gulp inject:head' -- injects our style.css file into the head of our HTML gulp.task('inject:head', () => - gulp.src('src/_includes/head.html') + gulp.src('.tmp/jekyll/_includes/head.html') .pipe($.inject(gulp.src('.tmp/assets/stylesheets/*.css', {read: false}), {ignorePath: '.tmp'})) - .pipe(gulp.dest('src/_includes')) + .pipe(gulp.dest('.tmp/jekyll/_includes')) ); // 'gulp inject:footer' -- injects our index.js file into the end of our HTML gulp.task('inject:footer', () => - gulp.src('src/_layouts/default.html') + gulp.src('.tmp/jekyll/_layouts/default.html') .pipe($.inject(gulp.src('.tmp/assets/javascript/*.js', {read: false}), {ignorePath: '.tmp'})) - .pipe(gulp.dest('src/_layouts')) + .pipe(gulp.dest('.tmp/jekyll/_layouts')) ); // 'gulp images' -- optimizes and caches your images @@ -164,7 +172,7 @@ gulp.task('images', () => .pipe($.size({title: 'images'})) ); -// 'gulp fonts' -- copies your fonts to the temporary assets folder +// 'gulp fonts' -- copies your fonts to the temporary assets directory gulp.task('fonts', () => gulp.src('src/assets/fonts/**/*') .pipe(gulp.dest('.tmp/assets/fonts')) @@ -273,39 +281,35 @@ gulp.task('assets', gulp.series( gulp.parallel('styles', 'scripts', 'fonts', 'images') )); -// 'gulp assets:copy' -- copies the assets into the dist folder, needs to be -// done this way because Jekyll overwrites the whole folder otherwise -gulp.task('assets:copy', () => +// 'gulp assets:copy' -- copies the assets into the dist directory, needs to be +// done this way because Jekyll overwrites the whole directory otherwise +gulp.task('copy:assets', () => gulp.src('.tmp/assets/**/*') .pipe(gulp.dest('dist/assets')) ); -// 'gulp' -- cleans your assets and gzipped files, creates your assets and -// injects them into the templates, then builds your site, copied the assets -// into their directory and serves the site -// 'gulp --prod' -- same as above but with production settings -gulp.task('default', gulp.series( - gulp.series('clean:assets', 'clean:gzip'), - gulp.series('assets', 'inject:head', 'inject:footer'), - gulp.series('jekyll', 'assets:copy', 'html'), - gulp.series('serve') -)); - -// 'gulp build' -- same as 'gulp' but doesn't serve your site in your browser -// 'gulp build --prod' -- same as above but with production settings -gulp.task('build', gulp.series( - gulp.series('clean:assets', 'clean:gzip'), - gulp.series('assets', 'inject:head', 'inject:footer'), - gulp.series('jekyll', 'assets:copy', 'html') -)); +// gulp jekyll:copy' -- copies your processed Jekyll site to the dist directory +gulp.task('copy:jekyll', () => + gulp.src('.tmp/dist/**/*') + .pipe(gulp.dest('dist')) +); // 'gulp clean' -- erases your assets and gzipped files -gulp.task('clean', gulp.series('clean:assets', 'clean:gzip')); - -// 'gulp rebuild' -- WARNING: Erases your assets and built site, use only when -// you need to do a complete rebuild -gulp.task('rebuild', gulp.series('clean:dist', 'clean:assets', -'clean:images', 'clean:metadata')); +gulp.task('clean', gulp.series('clean:assets', 'clean:dist', 'clean:jekyll')); // 'gulp check' -- checks your Jekyll configuration for errors and lint your JS gulp.task('check', gulp.series('jekyll:doctor', 'lint')); + +// 'gulp build' -- cleans out temporary files, injects your JS and CSS and generates your site, and then your assets +// 'gulp build --prod' -- same as above, but with production settings +gulp.task('build', gulp.series( + gulp.series('clean', 'assets', 'jekyll:tmp', 'inject:head', 'inject:footer', 'jekyll'), + gulp.parallel('copy:assets', 'copy:jekyll'), + gulp.series('html') +)); + +// 'gulp' -- runs the 'build' task and then serves your site +gulp.task('default', gulp.series( + gulp.series('build', 'serve') +)); + diff --git a/generators/jekyll/templates/config.yml b/generators/jekyll/templates/config.yml index 7ac27ce..8ecbff2 100644 --- a/generators/jekyll/templates/config.yml +++ b/generators/jekyll/templates/config.yml @@ -5,8 +5,8 @@ description: <%= projectDescription %> url: <%= projectURL %> # Used so Jekyll outputs the site correctly so Gulp can do what it wants -source: src -destination: dist +source: .tmp/jekyll +destination: .tmp/dist exclude: ['assets'] # Same as the title etc for your site but can instead be diff --git a/test/app.js b/test/app.js index bb1c5c6..bc1973f 100644 --- a/test/app.js +++ b/test/app.js @@ -48,7 +48,7 @@ describe('jekyllized:app', function () { '.gitattributes', '.babelrc', 'package.json', - 'gulpfile.babel.js', + 'gulpfile.js', 'README.md', '_config.yml', '_config.build.yml', diff --git a/test/gulp.js b/test/gulp.js index 66766e5..6861aad 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -14,7 +14,7 @@ describe('jekyllized:gulp', function () { }); it('creates gulpfile', function () { - assert.file('gulpfile.babel.js'); + assert.file('gulpfile.js'); }); it('creates package.json file', function () { @@ -24,9 +24,6 @@ describe('jekyllized:gulp', function () { it('package.json contains correct packages', function () { [ '"autoprefixer": "^6.2.3"', - '"babel-core": "^6.5.0"', - '"babel-eslint": "^6.0.0"', - '"babel-preset-es2015": "^6.5.0"', '"browser-sync": "^2.11.0"', '"del": "^2.2.0"', '"eslint": "^2.5.3"', @@ -83,7 +80,8 @@ describe('jekyllized:gulp', function () { 'clean:images', 'clean:dist', 'clean:gzip', - 'clean:metadata', + 'clean:jekyll', + 'jekyll:tmp', 'jekyll', 'jekyll:doctor', 'styles', @@ -96,18 +94,19 @@ describe('jekyllized:gulp', function () { 'lint', 'serve', 'assets', - 'assets:copy', - 'default', + 'copy:assets', + 'copy:jekyll', + 'clean', + 'check', 'build', - 'rebuild', - 'check' + 'default' ].forEach(function (task) { - assert.fileContent('gulpfile.babel.js', 'gulp.task(\'' + task); + assert.fileContent('gulpfile.js', 'gulp.task(\'' + task); }); }); it('does not contain deploy task', function () { - assert.noFileContent('gulpfile.babel.js', 'gulp.task(\'deploy\''); + assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); }); @@ -120,7 +119,7 @@ describe('jekyllized:gulp', function () { }); it('creates gulpfile', function () { - assert.file('gulpfile.babel.js'); + assert.file('gulpfile.js'); }); it('creates package.json file', function () { @@ -146,15 +145,15 @@ describe('jekyllized:gulp', function () { }); it('contains deploy task', function () { - assert.fileContent('gulpfile.babel.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); - assert.fileContent('gulpfile.babel.js', '// headers for your files and uploads them to S3'); - assert.fileContent('gulpfile.babel.js', 'gulp.task(\'deploy\''); + assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); + assert.fileContent('gulpfile.js', '// headers for your files and uploads them to S3'); + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); it('does not contain wrong uploading tasks', function () { - assert.noFileContent('gulpfile.babel.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); - assert.noFileContent('gulpfile.babel.js', '// uploads your site to your server'); - assert.noFileContent('gulpfile.babel.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); + assert.noFileContent('gulpfile.js', '// uploads your site to your server'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); }); it('creates credentials file', function () { @@ -171,7 +170,7 @@ describe('jekyllized:gulp', function () { }); it('creates gulpfile', function () { - assert.file('gulpfile.babel.js'); + assert.file('gulpfile.js'); }); it('creates package.json file', function () { @@ -193,15 +192,15 @@ describe('jekyllized:gulp', function () { }); it('contains deploy function', function () { - assert.fileContent('gulpfile.babel.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); - assert.fileContent('gulpfile.babel.js', '// uploads your site to your server'); - assert.fileContent('gulpfile.babel.js', 'gulp.task(\'deploy\''); + assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); + assert.fileContent('gulpfile.js', '// uploads your site to your server'); + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); it('does not contain the wrong uploading task', function () { - assert.noFileContent('gulpfile.babel.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); - assert.noFileContent('gulpfile.babel.js', '// headers for your files and uploads them to S3'); - assert.noFileContent('gulpfile.babel.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); + assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); }); it('creates credentials file', function () { @@ -218,7 +217,7 @@ describe('jekyllized:gulp', function () { }); it('creates gulpfile', function () { - assert.file('gulpfile.babel.js'); + assert.file('gulpfile.js'); }); it('creates package.json file', function () { @@ -240,15 +239,15 @@ describe('jekyllized:gulp', function () { }); it('contains deploy function', function () { - assert.fileContent('gulpfile.babel.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); - assert.fileContent('gulpfile.babel.js', 'gulp.task(\'deploy\''); + assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); it('does not contain the wrong uploading task', function () { - assert.noFileContent('gulpfile.babel.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); - assert.noFileContent('gulpfile.babel.js', '// headers for your files and uploads them to S3'); - assert.noFileContent('gulpfile.babel.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); - assert.noFileContent('gulpfile.babel.js', '// uploads your site to your server'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); + assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); + assert.noFileContent('gulpfile.js', '// uploads your site to your server'); }); }); }); From 3a2cc2665925e39b50db6a4f79a3169f2c982f37 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 15:54:02 +0200 Subject: [PATCH 138/178] ES2015, Travis and Syntax changes Updates a few things to be ES2015 and removed the dependency for Babel for the gulpfile, removed ESlint and moved to XO as we already used their settings, renamed the Gulpfile back to good ol' gulpfile.js and fixed some warnings for the JS. Also updated what versions to use for Travis. --- .travis.yml | 9 +++------ generators/gulp/templates/gulpfile.js | 8 ++++---- gulpfile.babel.js => gulpfile.js | 27 +++++++-------------------- package.json | 24 ++++++++++++++++-------- test/app.js | 2 +- 5 files changed, 31 insertions(+), 39 deletions(-) rename gulpfile.babel.js => gulpfile.js (57%) diff --git a/.travis.yml b/.travis.yml index f75197c..21d44bc 100755 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,9 @@ language: node_js sudo: false node_js: -- "4" -- "stable" + - "6" + - "5" + - "4" after_script: - CODECLIMATE_REPO_TOKEN=7b0cbee1382c968a036868d26ec04d0ddc7b7aeef25ceead5ff9ff50a3c2ae8b codeclimate < coverage/lcov.info - rm -rf ./coverage -notifications: - email: - on_success: change - on_failure: change diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index b7c9deb..236f7a0 100644 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -1,5 +1,9 @@ 'use strict'; +<% if (amazonS3 || rsync) { -%> +// 'fs' is used to read files from the system (used for uploading) +const fs = require('fs'); +<% } -%> const gulp = require('gulp'); // Loads the plugins without having to list all of them, but you need // to call them as $.pluginname @@ -9,10 +13,6 @@ const $ = gulpLoadPlugins(); const del = require('del'); // Used to run shell commands const shell = require('shelljs'); -<% if (amazonS3 || rsync) { -%> -// 'fs' is used to read files from the system (used for uploading) -const fs = require('fs'); -<% } -%> <% if (amazonS3) { -%> // Parallelize the uploads when uploading to Amazon S3 const parallelize = require('concurrent-transform'); diff --git a/gulpfile.babel.js b/gulpfile.js similarity index 57% rename from gulpfile.babel.js rename to gulpfile.js index 23256e2..83608a9 100644 --- a/gulpfile.babel.js +++ b/gulpfile.js @@ -1,24 +1,11 @@ 'use strict'; -import coveralls from 'gulp-coveralls'; -import gulp from 'gulp'; -import istanbul from 'gulp-istanbul'; -import eslint from 'gulp-eslint'; -import mocha from 'gulp-mocha'; -import path from 'path'; -import del from 'del'; - -gulp.task('check', () => - gulp.src([ - 'gulpfile.babel.js', - 'test/*.js', - 'test/tmp/**/gulpfile.babel.js', - 'generators/**/index.js' - ]) - .pipe(eslint()) - .pipe(eslint.formatEach()) - .pipe(eslint.failOnError()) -); +const path = require('path'); +const gulp = require('gulp'); +const coveralls = require('gulp-coveralls'); +const istanbul = require('gulp-istanbul'); +const mocha = require('gulp-mocha'); +const del = require('del'); gulp.task('istanbul', done => gulp.src([ @@ -48,4 +35,4 @@ gulp.task('coveralls', () => { }); gulp.task('test', gulp.series('clean', 'istanbul')); -gulp.task('default', gulp.series('check', 'coveralls')); +gulp.task('default', gulp.series('coveralls')); diff --git a/package.json b/package.json index 3c95690..c4edddd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "repository": "sondr3/generator-jekyllized", "license": "MIT", "scripts": { - "test": "gulp test && gulp" + "test": "xo && gulp test && gulp" }, "files": [ "index.js", @@ -29,27 +29,35 @@ "yosay": "^1.1.1" }, "devDependencies": { - "babel-core": "^6.7.7", - "babel-eslint": "^6.0.3", - "babel-preset-es2015": "^6.6.0", "codeclimate-test-reporter": "^0.3.1", "coveralls": "^2.11.6", "del": "^2.2.0", - "eslint": "^2.8.0", - "eslint-config-xo": "^0.13.0", - "eslint-config-xo-space": "^0.12.0", "generator-mocha": "^0.3.0", "gulp": "git://github.com/gulpjs/gulp.git#4.0", "gulp-coveralls": "^0.1.4", - "gulp-eslint": "^2.0.0", "gulp-istanbul": "^0.10.4", "gulp-load-plugins": "^1.2.2", "gulp-mocha": "^2.2.0", "istanbul": "^0.4.3", "mocha": "^2.4.5", "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.15.1", "yeoman-assert": "^2.2.1", "yeoman-test": "^1.1.0", "yo": "^1.7.0" + }, + "xo": { + "space": true, + "globals": [ + "describe", + "before", + "it" + ], + "ignores": [ + "generators/app/templates/**", + "generators/boilerplate/templates/**", + "generators/gulp/templates/**", + "generators/jekyll/templates/**" + ] } } diff --git a/test/app.js b/test/app.js index bc1973f..c522798 100644 --- a/test/app.js +++ b/test/app.js @@ -1,7 +1,7 @@ 'use strict'; -var _ = require('lodash'); var path = require('path'); +var _ = require('lodash'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); From cfc3eb17f17c8c737ad1ccdc27127fcf66db6f57 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 16:01:03 +0200 Subject: [PATCH 139/178] Make it properly skip install when testing --- generators/app/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generators/app/index.js b/generators/app/index.js index 39a840f..50351dc 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -158,7 +158,10 @@ module.exports = generators.Base.extend({ }, installing: function () { - this.installDependencies({bower: false}); + this.installDependencies({ + bower: false, + skipInstall: this.options['skip-install'] + }); this.spawnCommand('bundle', ['install', '--quiet']); } }); From a28a5eaf30fca0df00679d3488dbb6a337adc923 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 16:38:55 +0200 Subject: [PATCH 140/178] Fix regeneration of sites This closes #132. --- generators/gulp/index.js | 3 - generators/gulp/templates/gulpfile.js | 82 ++++++++++++++------------- test/gulp.js | 13 ++--- 3 files changed, 50 insertions(+), 48 deletions(-) diff --git a/generators/gulp/index.js b/generators/gulp/index.js index 0a09526..0faf4b7 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -38,9 +38,6 @@ module.exports = generators.Base.extend({ 'autoprefixer': '^6.2.3', 'browser-sync': '^2.11.0', 'del': '^2.2.0', - 'eslint': '^2.5.3', - 'eslint-config-xo': '^0.12.0', - 'eslint-config-xo-space': '^0.11.0', 'gulp': 'git://github.com/gulpjs/gulp.git#4.0', 'gulp-cache': '^0.4.1', 'gulp-concat': '^2.6.0', diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index 236f7a0..4c65350 100644 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -19,7 +19,6 @@ const parallelize = require('concurrent-transform'); <% } -%> // BrowserSync is used to live-reload your website const browserSync = require('browser-sync').create(); -const reload = browserSync.reload; // AutoPrefixer const autoprefixer = require('autoprefixer'); // Yargs for command line arguments @@ -244,29 +243,42 @@ gulp.task('deploy', () => { <% } -%> <% if (noUpload) { -%><% } -%> -// 'gulp lint' -- check your JS for formatting errors using XO Space -gulp.task('lint', () => - gulp.src([ - 'gulpfile.babel.js', - '.tmp/assets/javascript/*.js', - '!.tmp/assets/javascript/*.min.js' - ]) - .pipe($.eslint()) - .pipe($.eslint.formatEach()) - .pipe($.eslint.failOnError()) +// 'gulp assets:copy' -- copies the assets into the dist directory, needs to be +// done this way because Jekyll overwrites the whole directory otherwise +gulp.task('copy:assets', () => + gulp.src('.tmp/assets/**/*') + .pipe(gulp.dest('dist/assets')) ); +// 'gulp jekyll:copy' -- copies your processed Jekyll site to the dist directory +gulp.task('copy:jekyll', () => + gulp.src('.tmp/dist/**/*') + .pipe(gulp.dest('dist')) +); + +// 'gulp inject' -- injects your CSS and JS into either the header or the footer +gulp.task('inject', gulp.parallel('inject:head', 'inject:footer')); + +// 'gulp build:jekyll' -- copies, builds, and then copies it again +gulp.task('build:jekyll', gulp.series('jekyll:tmp', 'inject', 'jekyll', 'copy:jekyll')); + +// Function to properly reload your browser +function reload(done) { + browserSync.reload(); + done(); +} // 'gulp serve' -- open up your website in your browser and watch for changes // in all your files and update them when needed -gulp.task('serve', () => { +gulp.task('serve', (done) => { browserSync.init({ // tunnel: true, // open: false, server: ['.tmp', 'dist'] }); + done(); // Watch various files for changes and do the needful - gulp.watch(['src/**/*.md', 'src/**/*.html', 'src/**/*.yml'], gulp.series('jekyll', reload)); + gulp.watch(['src/**/*.md', 'src/**/*.html', 'src/**/*.yml'], gulp.series('build:jekyll', reload)); gulp.watch(['src/**/*.xml', 'src/**/*.txt'], gulp.series('jekyll')); gulp.watch('src/assets/javascript/**/*.js', gulp.series('scripts')); gulp.watch('src/assets/scss/**/*.scss', gulp.series('styles')); @@ -277,39 +289,33 @@ gulp.task('serve', () => { // 'gulp assets --prod' -- cleans out your assets and rebuilds them with // production settings gulp.task('assets', gulp.series( - gulp.series('clean:assets'), - gulp.parallel('styles', 'scripts', 'fonts', 'images') + gulp.parallel('styles', 'scripts', 'fonts', 'images'), + gulp.series('copy:assets') )); -// 'gulp assets:copy' -- copies the assets into the dist directory, needs to be -// done this way because Jekyll overwrites the whole directory otherwise -gulp.task('copy:assets', () => - gulp.src('.tmp/assets/**/*') - .pipe(gulp.dest('dist/assets')) -); - -// gulp jekyll:copy' -- copies your processed Jekyll site to the dist directory -gulp.task('copy:jekyll', () => - gulp.src('.tmp/dist/**/*') - .pipe(gulp.dest('dist')) -); - // 'gulp clean' -- erases your assets and gzipped files -gulp.task('clean', gulp.series('clean:assets', 'clean:dist', 'clean:jekyll')); - -// 'gulp check' -- checks your Jekyll configuration for errors and lint your JS -gulp.task('check', gulp.series('jekyll:doctor', 'lint')); +gulp.task('clean', gulp.series('clean:assets', 'clean:gzip', 'clean:dist', 'clean:jekyll')); -// 'gulp build' -- cleans out temporary files, injects your JS and CSS and generates your site, and then your assets -// 'gulp build --prod' -- same as above, but with production settings +// 'gulp build' -- same as 'gulp' but doesn't serve your site in your browser +// 'gulp build --prod' -- same as above but with production settings gulp.task('build', gulp.series( - gulp.series('clean', 'assets', 'jekyll:tmp', 'inject:head', 'inject:footer', 'jekyll'), - gulp.parallel('copy:assets', 'copy:jekyll'), + gulp.series('clean:assets', 'clean:gzip'), + gulp.series('clean', 'assets', 'build:jekyll'), gulp.series('html') )); -// 'gulp' -- runs the 'build' task and then serves your site +// 'gulp rebuild' -- WARNING: Erases your assets and built site, use only when +// you need to do a complete rebuild +gulp.task('rebuild', gulp.series('clean:dist', 'clean:assets', +'clean:images', 'clean:metadata')); + +// 'gulp check' -- checks your Jekyll configuration for errors and lint your JS +gulp.task('check', gulp.series('jekyll:doctor')); + +// 'gulp' -- cleans your assets and gzipped files, creates your assets and +// injects them into the templates, then builds your site, copied the assets +// into their directory and serves the site +// 'gulp --prod' -- same as above but with production settings gulp.task('default', gulp.series( gulp.series('build', 'serve') )); - diff --git a/test/gulp.js b/test/gulp.js index 6861aad..3a3006d 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -26,9 +26,6 @@ describe('jekyllized:gulp', function () { '"autoprefixer": "^6.2.3"', '"browser-sync": "^2.11.0"', '"del": "^2.2.0"', - '"eslint": "^2.5.3"', - '"eslint-config-xo": "^0.12.0"', - '"eslint-config-xo-space": "^0.11.0"', '"gulp": "git://github.com/gulpjs/gulp.git#4.0"', '"gulp-cache": "^0.4.1"', '"gulp-concat": "^2.6.0"', @@ -91,14 +88,16 @@ describe('jekyllized:gulp', function () { 'images', 'fonts', 'html', - 'lint', - 'serve', - 'assets', 'copy:assets', 'copy:jekyll', + 'inject', + 'build:jekyll', + 'serve', + 'assets', 'clean', - 'check', + 'rebuild', 'build', + 'check', 'default' ].forEach(function (task) { assert.fileContent('gulpfile.js', 'gulp.task(\'' + task); From f27129fa5bcedf295807df0e9fb9b78fcc1f5925 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 16:43:40 +0200 Subject: [PATCH 141/178] Remove asking for Github and Twitter The social stuff you can add later in my opinion. --- generators/app/index.js | 11 ----------- generators/boilerplate/templates/README.md | 4 ++++ generators/jekyll/templates/config.yml | 4 ++-- generators/jekyll/templates/humans.txt | 2 +- test/jekyll.js | 10 +++------- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index 50351dc..0e031b9 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -70,15 +70,6 @@ module.exports = generators.Base.extend({ name: 'authorBio', message: 'Write a short description about yourself', store: true - }, { - name: 'authorTwitter', - message: chalk.blue('You can leave these blank if they are not going to be used\n') + - chalk.yellow('? ') + 'Your Twitter handle ' + chalk.yellow('(without the @):'), - store: true - }, { - name: 'authorGithub', - message: 'Your Github username:', - store: true }, { name: 'uploading', type: 'list', @@ -148,8 +139,6 @@ module.exports = generators.Base.extend({ authorEmail: this.props.authorEmail, authorURI: this.props.authorURI, authorBio: this.props.authorBio, - authorTwitter: this.props.authorTwitter, - authorGithub: this.props.authorGithub, jekyllPermalinks: this.props.jekyllPermalinks } }, { diff --git a/generators/boilerplate/templates/README.md b/generators/boilerplate/templates/README.md index bed6816..73c0b09 100644 --- a/generators/boilerplate/templates/README.md +++ b/generators/boilerplate/templates/README.md @@ -12,6 +12,10 @@ And you'll have a new Jekyll site generated for you and displayed in your browser. Neato. If you want to run it with production settings, just add `--prod`. +#### Settings +In your `_config.yml` and `humans.txt` you should add your Github and Twitter +profile if you want to. + ## Usage ```sh diff --git a/generators/jekyll/templates/config.yml b/generators/jekyll/templates/config.yml index 8ecbff2..86231bf 100644 --- a/generators/jekyll/templates/config.yml +++ b/generators/jekyll/templates/config.yml @@ -17,8 +17,8 @@ author: email: <%= authorEmail %> uri: <%= authorURI %> bio: <%= authorBio %> - twitter: <%= authorTwitter %> - github: <%= authorGithub %> + twitter: + github: # _config.build.yml overwrites these options when you run `gulp build` # Enables future posts (posts with dates in the future) and drafts diff --git a/generators/jekyll/templates/humans.txt b/generators/jekyll/templates/humans.txt index 9955e38..12ebe80 100644 --- a/generators/jekyll/templates/humans.txt +++ b/generators/jekyll/templates/humans.txt @@ -3,7 +3,7 @@ # TEAM - <%= authorName %> -- -- @<%= authorTwitter %> + <%= authorName %> -- -- @ # THANKS diff --git a/test/jekyll.js b/test/jekyll.js index ccc3db1..e3cb770 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -14,9 +14,7 @@ describe('jekyllized:jekyll', function () { authorName: 'Ola Nordmann', authorEmail: 'ola.nordmann@email.com', authorURI: 'homepage.com', - authorBio: 'I am a tester for tests', - authorTwitter: '0lanordmann', - authorGithub: '0lanordmann' + authorBio: 'I am a tester for tests' }; helpers.run(path.join(__dirname, '../generators/jekyll')) .inDir(path.join(__dirname, 'tmp/jekyll')) @@ -54,9 +52,7 @@ describe('jekyllized:jekyll', function () { 'name: Ola Nordmann', 'email: ola.nordmann@email.com', 'uri: homepage.com', - 'bio: I am a tester for tests', - 'twitter: 0lanordmann', - 'github: 0lanordmann' + 'bio: I am a tester for tests' ].forEach(function (config) { assert.fileContent('_config.yml', config); }); @@ -73,7 +69,7 @@ describe('jekyllized:jekyll', function () { }); it('fills out humans.txt correctly', function () { - assert.fileContent('src/humans.txt', 'Ola Nordmann -- -- @0lanordmann'); + assert.fileContent('src/humans.txt', 'Ola Nordmann -- -- @'); }); }); From d2c50a647c67644c03737f83c8c05deaa75bb7d4 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 16:49:46 +0200 Subject: [PATCH 142/178] New release [ci skip] --- CHANGELOG.md | 18 ++++++++++++++++-- package.json | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4efcf2..f8be797 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,22 @@ -## HEAD + +## 1.0.0-beta.20 +> 2016-05-22 -Updated the packages for the generator. +Big bugfix release, fixed how `jekyllized` processes the Jekyll site. It now +copies the `src` of your Jekyll site to `.tmp` and does it's processing there so +it doesn't infect your git history. It will also now properly reload your site +when changing your posts. + +Also removed the `jekyll-archives` gem because it wasn't being used for anything +nor is it being updated. And, finally, updated the packages for the generator. #### Changelog: +* [[`f27129fa5b`](https://github.com/sondr3/generator-jekyllized/commit/f27129fa5b)] - Remove asking for Github and Twitter +* [[`a28a5eaf30`](https://github.com/sondr3/generator-jekyllized/commit/a28a5eaf30)] - Fix regeneration of sites +* [[`cfc3eb17f1`](https://github.com/sondr3/generator-jekyllized/commit/cfc3eb17f1)] - Make it properly skip install when testing +* [[`3a2cc26659`](https://github.com/sondr3/generator-jekyllized/commit/3a2cc26659)] - ES2015, Travis and Syntax changes +* [[`96374df57f`](https://github.com/sondr3/generator-jekyllized/commit/96374df57f)] - Copy to a temporary directory, ES2015 updates +* [[`4a6b983d64`](https://github.com/sondr3/generator-jekyllized/commit/4a6b983d64)] - Remove jekyll-archives * [[`5892ae79e9`](https://github.com/sondr3/generator-jekyllized/commit/5892ae79e9)] - Update packages diff --git a/package.json b/package.json index c4edddd..6bebd45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.19", + "version": "1.0.0-beta.20", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From b46b1e57f8bbc5dd33674c0d1ee46a2c0d73a25d Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 16:54:18 +0200 Subject: [PATCH 143/178] Remove mention of clean:metadata --- generators/gulp/templates/gulpfile.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index 4c65350..ca9d01d 100644 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -306,8 +306,7 @@ gulp.task('build', gulp.series( // 'gulp rebuild' -- WARNING: Erases your assets and built site, use only when // you need to do a complete rebuild -gulp.task('rebuild', gulp.series('clean:dist', 'clean:assets', -'clean:images', 'clean:metadata')); +gulp.task('rebuild', gulp.series('clean:dist', 'clean:assets', 'clean:images')); // 'gulp check' -- checks your Jekyll configuration for errors and lint your JS gulp.task('check', gulp.series('jekyll:doctor')); From 586915d74291a94edf1255f6b88681c8e9b170d4 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 22 May 2016 16:57:21 +0200 Subject: [PATCH 144/178] New release [ci skip] --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8be797..27d9506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ + +## 1.0.0-beta.21 +> 2016-05-22 + +Forgot to remove a mention of a old gulp task. + +#### Changelog: +* [[`b46b1e57f8`](https://github.com/sondr3/generator-jekyllized/commit/b46b1e57f8)] - Remove mention of clean:metadata + ## 1.0.0-beta.20 > 2016-05-22 diff --git a/package.json b/package.json index 6bebd45..0c6d7e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.20", + "version": "1.0.0-beta.21", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From e77a1e5d502ec512726427e9ed5431060bbab140 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:22:09 +0200 Subject: [PATCH 145/178] Move to using AVA for tests --- .gitignore | 1 + .travis.yml | 6 +- generators/app/index.js | 3 +- package.json | 17 +- test/app.js | 129 +++++---------- test/aws.js | 53 ++++++ test/boilerplate.js | 81 ++++----- test/ghpages.js | 45 +++++ test/gulp.js | 327 +++++++++++-------------------------- test/jekyll.js | 184 +++++++-------------- test/permalinks/date.js | 15 ++ test/permalinks/none.js | 15 ++ test/permalinks/ordinal.js | 16 ++ test/permalinks/pretty.js | 15 ++ test/rsync.js | 49 ++++++ 15 files changed, 434 insertions(+), 522 deletions(-) create mode 100644 test/aws.js create mode 100644 test/ghpages.js create mode 100644 test/permalinks/date.js create mode 100644 test/permalinks/none.js create mode 100644 test/permalinks/ordinal.js create mode 100644 test/permalinks/pretty.js create mode 100644 test/rsync.js diff --git a/.gitignore b/.gitignore index 66b6fc7..11e932c 100755 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ coverage/ .coveralls.yml test/tmp/ npm-shrinkwrap.json +.nyc_output # Ignore hidden folders # This takes care of .tmp, .sass-cache, and many others diff --git a/.travis.yml b/.travis.yml index 21d44bc..577a90b 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,5 @@ sudo: false node_js: - "6" - "5" - - "4" -after_script: -- CODECLIMATE_REPO_TOKEN=7b0cbee1382c968a036868d26ec04d0ddc7b7aeef25ceead5ff9ff50a3c2ae8b codeclimate < coverage/lcov.info -- rm -rf ./coverage +after_success: + - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' - "4" diff --git a/generators/app/index.js b/generators/app/index.js index 0e031b9..dc3cc0a 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -148,8 +148,7 @@ module.exports = generators.Base.extend({ installing: function () { this.installDependencies({ - bower: false, - skipInstall: this.options['skip-install'] + bower: false }); this.spawnCommand('bundle', ['install', '--quiet']); } diff --git a/package.json b/package.json index 0c6d7e6..58a384f 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "repository": "sondr3/generator-jekyllized", "license": "MIT", "scripts": { - "test": "xo && gulp test && gulp" + "test": "xo && nyc ava" }, "files": [ "index.js", @@ -29,18 +29,9 @@ "yosay": "^1.1.1" }, "devDependencies": { - "codeclimate-test-reporter": "^0.3.1", - "coveralls": "^2.11.6", - "del": "^2.2.0", - "generator-mocha": "^0.3.0", - "gulp": "git://github.com/gulpjs/gulp.git#4.0", - "gulp-coveralls": "^0.1.4", - "gulp-istanbul": "^0.10.4", - "gulp-load-plugins": "^1.2.2", - "gulp-mocha": "^2.2.0", - "istanbul": "^0.4.3", - "mocha": "^2.4.5", - "mocha-lcov-reporter": "^1.2.0", + "ava": "^0.14.0", + "coveralls": "^2.11.9", + "nyc": "^6.4.4", "xo": "^0.15.1", "yeoman-assert": "^2.2.1", "yeoman-test": "^1.1.0", diff --git a/test/app.js b/test/app.js index c522798..be1fc0d 100644 --- a/test/app.js +++ b/test/app.js @@ -1,100 +1,47 @@ 'use strict'; - var path = require('path'); -var _ = require('lodash'); +var test = require('ava'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); -describe('jekyllized:app', function () { - describe('running on new project', function () { - before(function (done) { - this.answers = { - projectName: 'jekyllized', - projectDescription: 'Test site for Jekyllized', - projectURL: 'www.test.com', - authorName: 'Ola Nordmann', - authorEmail: 'ola.nordmann@gmail.com', - authorBio: 'A norwegian dude', - authorTwitter: '0lanordmann', - authorGithub: '0lanordmann', - uploading: 'None', - jekyllPermalinks: 'pretty', - jekyllPaginate: '10' - }; - this.deps = [ - [helpers.createDummyGenerator(), 'jekyllized:boilerplate'], - [helpers.createDummyGenerator(), 'jekyllized:gulp'], - [helpers.createDummyGenerator(), 'jekyllized:jekyll'] - ]; - helpers.run(path.join(__dirname, '../generators/app')) - .inDir(path.join(__dirname, 'tmp/app')) - .withOptions({ - 'skip-install': true - }) - .withPrompts(this.answers) - .withGenerators(this.deps) - .on('end', done); - }); - - it('can be required without throwing', function () { - this.app = require('../generators/app'); //eslint-disable-line - }); - - it('creates files', function () { - assert.file([ - '.editorconfig', - '.eslintrc', - '.gitignore', - '.gitattributes', - '.babelrc', - 'package.json', - 'gulpfile.js', - 'README.md', - '_config.yml', - '_config.build.yml', - 'Gemfile' - ]); - }); - - it('creates package.json', function () { - assert.file('package.json'); - assert.JSONFileContent('package.json', { //eslint-disable-line - name: this.answers.projectName, - version: '0.0.0', - description: this.answers.projectDescription, - homepage: this.answers.projectURL, - author: { - name: this.answers.authorName, - email: this.answers.authorEmail - } - }); - }); - }); +test.before(() => { + return helpers.run(path.join(__dirname, '../generators/app')) + .withPrompts({ + projectName: 'jekyllized', + projectDescription: 'Test site for Jekyllized', + projectURL: 'www.test.com', + authorName: 'Ola Nordmann', + authorEmail: 'ola.nordmann@gmail.com', + authorBio: 'A norwegian dude', + uploading: 'None', + jekyllPermalinks: 'pretty' + }) + .toPromise(); +}); - describe('running on existing project', function () { - before(function (done) { - this.pkg = { - version: '3.1.4', - description: '404 not found', - homepage: 'ulv.no', - author: 'Kari Nordmann' - }; - helpers.run(path.join(__dirname, '../generators/app')) - .withOptions({ - 'skip-install': true - }) - .withPrompts({ - projectName: 'jekyllized' - }) - .on('ready', function (gen) { - gen.fs.writeJSON(gen.destinationPath('package.json'), this.pkg); - }.bind(this)) - .on('end', done); - }); +test('generates expected files', () => { + assert.file([ + '.editorconfig', + '.gitignore', + '.gitattributes', + 'package.json', + 'gulpfile.js', + 'README.md', + '_config.yml', + '_config.build.yml', + 'Gemfile' + ]); +}); - it('extends package.json', function () { - var pkg = _.extend({name: 'jekyllized'}, this.pkg); - assert.JSONFileContent('package.json', pkg); //eslint-disable-line - }); +test('creates package.json correctly', () => { + assert.file('package.json'); + [ + '"name": "jekyllized"', + '"description": "Test site for Jekyllized"', + '"homepage": "www.test.com', + '"name": "Ola Nordmann"', + '"email": "ola.nordmann@gmail.com"' + ].forEach(field => { + assert.fileContent('package.json', field); }); }); diff --git a/test/aws.js b/test/aws.js new file mode 100644 index 0000000..d4d428d --- /dev/null +++ b/test/aws.js @@ -0,0 +1,53 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../generators/gulp')) + .withOptions({uploading: 'Amazon S3'}) + .toPromise(); +}); + +test('creates gulpfile', () => { + assert.file('gulpfile.js'); +}); + +test('creates package.json file', () => { + assert.file('package.json'); +}); + +test('contain correct uploading packages', () => { + [ + '"gulp-awspublish": "^3.0.1"', + '"concurrent-transform": "^1.0.0"' + ].forEach(pack => { + assert.fileContent('package.json', pack); + }); +}); + +test('does not contain wrong uploading packages', () => { + [ + '"gulp-rsync"', + '"gulp-gh-pages"' + ].forEach(pack => { + assert.noFileContent('package.json', pack); + }); +}); + +test('contains deploy task', () => { + assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); + assert.fileContent('gulpfile.js', '// headers for your files and uploads them to S3'); + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); +}); + +test('does not contain wrong uploading tasks', () => { + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); + assert.noFileContent('gulpfile.js', '// uploads your site to your server'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); +}); + +test('creates credentials file', () => { + assert.file('aws-credentials.json'); +}); diff --git a/test/boilerplate.js b/test/boilerplate.js index 189ead3..43d3a1a 100644 --- a/test/boilerplate.js +++ b/test/boilerplate.js @@ -1,61 +1,46 @@ 'use strict'; - var path = require('path'); +var test = require('ava'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); -describe('jekyllized:boilerplate', function () { - before(function (done) { - helpers.run(path.join(__dirname, '../generators/boilerplate')) - .on('end', done); - }); - - it('creates .editorconfig', function () { - assert.file('.editorconfig'); - }); - - it('creates .eslintrc', function () { - assert.file('.eslintrc'); - }); +test.before(() => { + return helpers.run(path.join(__dirname, '../generators/boilerplate')) + .withOptions({ + projectName: 'README', + projectDescription: 'This is a great README', + projectURL: 'hello-world.com', + authorName: 'Ola Nordmann' + }) + .toPromise(); +}); - it('creates .gitignore', function () { - assert.file('.gitignore'); - }); +test('creates .editorconfig', () => { + assert.file('.editorconfig'); +}); - it('creates .gitattributes', function () { - assert.file('.gitattributes'); - }); +test('creates .gitignore', () => { + assert.file('.gitignore'); +}); - it('creates .babelrc', function () { - assert.file('.babelrc'); - }); +test('creates .gitattributes', () => { + assert.file('.gitattributes'); +}); - describe('README', function () { - before(function (done) { - this.options = { - projectName: 'README', - projectDescription: 'This is a great README', - projectURL: 'hello-world.com', - authorName: 'Ola Nordmann' - }; - helpers.run(path.join(__dirname, '../generators/boilerplate')) - .inDir(path.join(__dirname, 'tmp/readme')) - .withOptions(this.options) - .on('end', done); - }); +test('creates .babelrc', () => { + assert.file('.babelrc'); +}); - it('creates README.md', function () { - assert.file('README.md'); - }); +test('creates README.md', () => { + assert.file('README.md'); +}); - it('contains correct info', function () { - [ - '# README', - '> This is a great README', - '[Ola Nordmann](hello-world.com)' - ].forEach(function (text) { - assert.fileContent('README.md', text); - }); - }); +test('README is correct', () => { + [ + '# README', + '> This is a great README', + '[Ola Nordmann](hello-world.com)' + ].forEach(field => { + assert.fileContent('README.md', field); }); }); diff --git a/test/ghpages.js b/test/ghpages.js new file mode 100644 index 0000000..0d7d658 --- /dev/null +++ b/test/ghpages.js @@ -0,0 +1,45 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../generators/gulp')) + .withOptions({uploading: 'Github Pages'}) + .toPromise(); +}); + +test('creates gulpfile', () => { + assert.file('gulpfile.js'); +}); + +test('creates package.json file', () => { + assert.file('package.json'); +}); + +test('contain correct uploading packages', () => { + assert.fileContent('package.json', '"gulp-gh-pages": "^0.5.2"'); +}); + +test('does not contain wrong uploading packages', () => { + [ + '"gulp-awspublish"', + '"concurrent-transform"', + '"gulp-rsync"' + ].forEach(pack => { + assert.noFileContent('package.json', pack); + }); +}); + +test('contains deploy function', () => { + assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); +}); + +test('does not contain the wrong uploading task', () => { + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); + assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); + assert.noFileContent('gulpfile.js', '// uploads your site to your server'); +}); diff --git a/test/gulp.js b/test/gulp.js index 3a3006d..14d95a2 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -1,252 +1,107 @@ 'use strict'; - var path = require('path'); +var test = require('ava'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); -describe('jekyllized:gulp', function () { - describe('no uploading', function () { - before(function (done) { - helpers.run(path.join(__dirname, '../generators/gulp')) - .inDir(path.join(__dirname, 'tmp/gulp')) - .withOptions({uploading: 'None'}) - .on('end', done); - }); - - it('creates gulpfile', function () { - assert.file('gulpfile.js'); - }); - - it('creates package.json file', function () { - assert.file('package.json'); - }); - - it('package.json contains correct packages', function () { - [ - '"autoprefixer": "^6.2.3"', - '"browser-sync": "^2.11.0"', - '"del": "^2.2.0"', - '"gulp": "git://github.com/gulpjs/gulp.git#4.0"', - '"gulp-cache": "^0.4.1"', - '"gulp-concat": "^2.6.0"', - '"gulp-cssnano": "^2.1.0"', - '"gulp-eslint": "^2.0.0"', - '"gulp-gzip": "^1.1.0"', - '"gulp-htmlmin": "^1.3.0"', - '"gulp-if": "^2.0.0"', - '"gulp-imagemin": "^2.1.0"', - '"gulp-inject": "^4.0.0"', - '"gulp-load-plugins": "^1.2.0"', - '"gulp-newer": "^1.1.0"', - '"gulp-postcss": "^6.0.0"', - '"gulp-rename": "^1.2.2"', - '"gulp-rev": "^7.0.0"', - '"gulp-sass": "^2.1.1"', - '"gulp-size": "^2.0.0"', - '"gulp-sourcemaps": "^1.3.0"', - '"gulp-uglify": "^1.5.1"', - '"gulp-uncss": "^1.0.0"', - '"shelljs": "^0.6.0"', - '"yargs": "^4.3.2"' - ].forEach(function (pack) { - assert.fileContent('package.json', pack); - }); - }); - - it('does not create credentials files', function () { - assert.noFile([ - 'aws-credentials.json', - 'rsync-credentials.json' - ]); - }); +test.before(() => { + return helpers.run(path.join(__dirname, '../generators/gulp')) + .withOptions({uploading: 'None'}) + .toPromise(); +}); - it('does not contain uploading packages', function () { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-rsync"', - '"gulp-gh-pages"' - ].forEach(function (pack) { - assert.noFileContent('package.json', pack); - }); - }); +test('creates gulpfile', () => { + assert.file('gulpfile.js'); +}); - it('contains default gulp tasks', function () { - [ - 'clean:assets', - 'clean:images', - 'clean:dist', - 'clean:gzip', - 'clean:jekyll', - 'jekyll:tmp', - 'jekyll', - 'jekyll:doctor', - 'styles', - 'scripts', - 'inject:head', - 'inject:footer', - 'images', - 'fonts', - 'html', - 'copy:assets', - 'copy:jekyll', - 'inject', - 'build:jekyll', - 'serve', - 'assets', - 'clean', - 'rebuild', - 'build', - 'check', - 'default' - ].forEach(function (task) { - assert.fileContent('gulpfile.js', 'gulp.task(\'' + task); - }); - }); +test('creates package.json', () => { + assert.file('package.json'); +}); - it('does not contain deploy task', function () { - assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); - }); +test('package.json contains correct packages', () => { + [ + '"autoprefixer": "^6.2.3"', + '"browser-sync": "^2.11.0"', + '"del": "^2.2.0"', + '"gulp": "git://github.com/gulpjs/gulp.git#4.0"', + '"gulp-cache": "^0.4.1"', + '"gulp-concat": "^2.6.0"', + '"gulp-cssnano": "^2.1.0"', + '"gulp-eslint": "^2.0.0"', + '"gulp-gzip": "^1.1.0"', + '"gulp-htmlmin": "^1.3.0"', + '"gulp-if": "^2.0.0"', + '"gulp-imagemin": "^2.1.0"', + '"gulp-inject": "^4.0.0"', + '"gulp-load-plugins": "^1.2.0"', + '"gulp-newer": "^1.1.0"', + '"gulp-postcss": "^6.0.0"', + '"gulp-rename": "^1.2.2"', + '"gulp-rev": "^7.0.0"', + '"gulp-sass": "^2.1.1"', + '"gulp-size": "^2.0.0"', + '"gulp-sourcemaps": "^1.3.0"', + '"gulp-uglify": "^1.5.1"', + '"gulp-uncss": "^1.0.0"', + '"shelljs": "^0.6.0"', + '"yargs": "^4.3.2"' + ].forEach(pack => { + assert.fileContent('package.json', pack); }); +}); - describe('Amazon S3', function () { - before(function (done) { - helpers.run(path.join(__dirname, '../generators/gulp')) - .inDir(path.join(__dirname, 'tmp/gulp-aws')) - .withOptions({uploading: 'Amazon S3'}) - .on('end', done); - }); - - it('creates gulpfile', function () { - assert.file('gulpfile.js'); - }); - - it('creates package.json file', function () { - assert.file('package.json'); - }); - - it('contain correct uploading packages', function () { - [ - '"gulp-awspublish": "^3.0.1"', - '"concurrent-transform": "^1.0.0"' - ].forEach(function (pack) { - assert.fileContent('package.json', pack); - }); - }); - - it('does not contain wrong uploading packages', function () { - [ - '"gulp-rsync"', - '"gulp-gh-pages"' - ].forEach(function (pack) { - assert.noFileContent('package.json', pack); - }); - }); - - it('contains deploy task', function () { - assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); - assert.fileContent('gulpfile.js', '// headers for your files and uploads them to S3'); - assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); - }); - - it('does not contain wrong uploading tasks', function () { - assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); - assert.noFileContent('gulpfile.js', '// uploads your site to your server'); - assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); - }); +test('does not create credentials files', () => { + assert.noFile([ + 'aws-credentials.json', + 'rsync-credentials.json' + ]); +}); - it('creates credentials file', function () { - assert.file('aws-credentials.json'); - }); +test('does not contain uploading packages', () => { + [ + '"gulp-awspublish"', + '"concurrent-transform"', + '"gulp-rsync"', + '"gulp-gh-pages"' + ].forEach(pack => { + assert.noFileContent('package.json', pack); }); +}); - describe('Rsync', function () { - before(function (done) { - helpers.run(path.join(__dirname, '../generators/gulp')) - .inDir(path.join(__dirname, 'tmp/gulp-rsync')) - .withOptions({uploading: 'Rsync'}) - .on('end', done); - }); - - it('creates gulpfile', function () { - assert.file('gulpfile.js'); - }); - - it('creates package.json file', function () { - assert.file('package.json'); - }); - - it('contain correct uploading packages', function () { - assert.fileContent('package.json', '"gulp-rsync": "^0.0.5"'); - }); - - it('does not contain wrong uploading packages', function () { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-gh-pages"' - ].forEach(function (pack) { - assert.noFileContent('package.json', pack); - }); - }); - - it('contains deploy function', function () { - assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); - assert.fileContent('gulpfile.js', '// uploads your site to your server'); - assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); - }); - - it('does not contain the wrong uploading task', function () { - assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); - assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); - assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); - }); - - it('creates credentials file', function () { - assert.file('rsync-credentials.json'); - }); +test('contains default gulp tasks', () => { + [ + 'clean:assets', + 'clean:images', + 'clean:dist', + 'clean:gzip', + 'clean:jekyll', + 'jekyll:tmp', + 'jekyll', + 'jekyll:doctor', + 'styles', + 'scripts', + 'inject:head', + 'inject:footer', + 'images', + 'fonts', + 'html', + 'copy:assets', + 'copy:jekyll', + 'inject', + 'build:jekyll', + 'serve', + 'assets', + 'clean', + 'rebuild', + 'build', + 'check', + 'default' + ].forEach(function (task) { + assert.fileContent('gulpfile.js', 'gulp.task(\'' + task); }); +}); - describe('GitHub pages', function () { - before(function (done) { - helpers.run(path.join(__dirname, '../generators/gulp')) - .inDir(path.join(__dirname, 'tmp/gulp-pages')) - .withOptions({uploading: 'Github Pages'}) - .on('end', done); - }); - - it('creates gulpfile', function () { - assert.file('gulpfile.js'); - }); - - it('creates package.json file', function () { - assert.file('package.json'); - }); - - it('contain correct uploading packages', function () { - assert.fileContent('package.json', '"gulp-gh-pages": "^0.5.2"'); - }); - - it('does not contain wrong uploading packages', function () { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-rsync"' - ].forEach(function (pack) { - assert.noFileContent('package.json', pack); - }); - }); - - it('contains deploy function', function () { - assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); - assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); - }); - - it('does not contain the wrong uploading task', function () { - assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); - assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); - assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); - assert.noFileContent('gulpfile.js', '// uploads your site to your server'); - }); - }); +test('does not contain deploy task', () => { + assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); + diff --git a/test/jekyll.js b/test/jekyll.js index e3cb770..e506f01 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -1,141 +1,69 @@ 'use strict'; - var path = require('path'); +var test = require('ava'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); -describe('jekyllized:jekyll', function () { - describe('default settings', function () { - before(function (done) { - this.options = { - projectName: 'jekyllized', - projectDescription: 'Tests for Jekyllized', - projectURL: 'example.org', - authorName: 'Ola Nordmann', - authorEmail: 'ola.nordmann@email.com', - authorURI: 'homepage.com', - authorBio: 'I am a tester for tests' - }; - helpers.run(path.join(__dirname, '../generators/jekyll')) - .inDir(path.join(__dirname, 'tmp/jekyll')) - .withOptions(this.options) - .on('end', done); - }); - - it('creates Gemfile', function () { - assert.file('Gemfile'); - }); - - it('creates _config.yml files', function () { - assert.file([ - '_config.yml', - '_config.build.yml' - ]); - }); +test.before(() => { + return helpers.run(path.join(__dirname, '../generators/jekyll')) + .withOptions({ + projectName: 'jekyllized', + projectDescription: 'Tests for Jekyllized', + projectURL: 'example.org', + authorName: 'Ola Nordmann', + authorEmail: 'ola.nordmann@email.com', + authorURI: 'homepage.com', + authorBio: 'I am a tester for tests' + }) + .toPromise(); +}); - it('creates src directory', function () { - assert.file([ - 'src/404.html', - 'src/about.md', - 'src/crossdomain.xml', - 'src/humans.txt', - 'src/index.html', - 'src/robots.txt' - ]); - }); +test('creates Gemfile', () => { + assert.file('Gemfile'); +}); - it('_config.yml contains the correct settings', function () { - [ - 'title: jekyllized', - 'description: Tests for Jekyllized', - 'url: example.org', - 'name: Ola Nordmann', - 'email: ola.nordmann@email.com', - 'uri: homepage.com', - 'bio: I am a tester for tests' - ].forEach(function (config) { - assert.fileContent('_config.yml', config); - }); - }); +test('creates _config.yml files', () => { + assert.file([ + '_config.yml', + '_config.build.yml' + ]); +}); - it('_config.build.yml contains the correct settings', function () { - [ - 'future: false', - 'show_drafts: false', - 'limit_posts: 0' - ].forEach(function (config) { - assert.fileContent('_config.build.yml', config); - }); - }); +test('creates src directory', () => { + assert.file([ + 'src/404.html', + 'src/about.md', + 'src/crossdomain.xml', + 'src/humans.txt', + 'src/index.html', + 'src/robots.txt' + ]); +}); - it('fills out humans.txt correctly', function () { - assert.fileContent('src/humans.txt', 'Ola Nordmann -- -- @'); - }); +test('_config.yml contains the correct settings', () => { + [ + 'title: jekyllized', + 'description: Tests for Jekyllized', + 'url: example.org', + 'name: Ola Nordmann', + 'email: ola.nordmann@email.com', + 'uri: homepage.com', + 'bio: I am a tester for tests' + ].forEach(function (config) { + assert.fileContent('_config.yml', config); }); +}); - describe('different permalink settings', function () { - describe('date permalinks', function () { - before(function (done) { - this.options = { - jekyllPermalinks: 'date' - }; - helpers.run(path.join(__dirname, '../generators/jekyll')) - .inDir(path.join(__dirname, 'tmp/jekyll-date')) - .withOptions(this.options) - .on('end', done); - }); - - it('sets date permalinks', function () { - assert.fileContent('_config.yml', 'permalink: date'); - }); - }); - - describe('pretty permalinks', function () { - before(function (done) { - this.options = { - jekyllPermalinks: 'pretty' - }; - helpers.run(path.join(__dirname, '../generators/jekyll')) - .inDir(path.join(__dirname, 'tmp/jekyll-pretty')) - .withOptions(this.options) - .on('end', done); - }); - - it('sets pretty permalinks', function () { - assert.fileContent('_config.yml', 'permalink: pretty'); - }); - }); - - describe('ordinal permalinks', function () { - before(function (done) { - this.options = { - jekyllPermalinks: 'ordinal' - }; - helpers.run(path.join(__dirname, '../generators/jekyll')) - .inDir(path.join(__dirname, 'tmp/jekyll-ordinal')) - .withOptions(this.options) - .on('end', done); - }); - - it('sets ordinal permalinks', function () { - assert.fileContent('_config.yml', 'permalink: ordinal'); - }); - }); - - describe('"none" permalinks', function () { - before(function (done) { - this.options = { - jekyllPermalinks: 'none' - }; - helpers.run(path.join(__dirname, '../generators/jekyll')) - .inDir(path.join(__dirname, 'tmp/jekyll-none')) - .withOptions(this.options) - .on('end', done); - }); - - it('sets "none" permalinks', function () { - assert.fileContent('_config.yml', 'permalink: none'); - }); - }); +test('_config.build.yml contains the correct settings', () => { + [ + 'future: false', + 'show_drafts: false', + 'limit_posts: 0' + ].forEach(function (config) { + assert.fileContent('_config.build.yml', config); }); }); + +test('fills out humans.txt correctly', () => { + assert.fileContent('src/humans.txt', 'Ola Nordmann -- -- @'); +}); diff --git a/test/permalinks/date.js b/test/permalinks/date.js new file mode 100644 index 0000000..87e1031 --- /dev/null +++ b/test/permalinks/date.js @@ -0,0 +1,15 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../../generators/jekyll')) + .withOptions({jekyllPermalinks: 'date'}) + .toPromise(); +}); + +test('sets date permalinks', () => { + assert.fileContent('_config.yml', 'permalink: date'); +}); diff --git a/test/permalinks/none.js b/test/permalinks/none.js new file mode 100644 index 0000000..33178c6 --- /dev/null +++ b/test/permalinks/none.js @@ -0,0 +1,15 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../../generators/jekyll')) + .withOptions({jekyllPermalinks: 'none'}) + .toPromise(); +}); + +test('sets none permalinks', () => { + assert.fileContent('_config.yml', 'permalink: none'); +}); diff --git a/test/permalinks/ordinal.js b/test/permalinks/ordinal.js new file mode 100644 index 0000000..cd835c9 --- /dev/null +++ b/test/permalinks/ordinal.js @@ -0,0 +1,16 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../../generators/jekyll')) + .withOptions({jekyllPermalinks: 'ordinal'}) + .toPromise(); +}); + +test('sets ordinal permalinks', () => { + assert.fileContent('_config.yml', 'permalink: ordinal'); +}); + diff --git a/test/permalinks/pretty.js b/test/permalinks/pretty.js new file mode 100644 index 0000000..71fbcb1 --- /dev/null +++ b/test/permalinks/pretty.js @@ -0,0 +1,15 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../../generators/jekyll')) + .withOptions({jekyllPermalinks: 'pretty'}) + .toPromise(); +}); + +test('sets pretty permalinks', () => { + assert.fileContent('_config.yml', 'permalink: pretty'); +}); diff --git a/test/rsync.js b/test/rsync.js new file mode 100644 index 0000000..c6f2fed --- /dev/null +++ b/test/rsync.js @@ -0,0 +1,49 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../generators/gulp')) + .withOptions({uploading: 'Rsync'}) + .toPromise(); +}); + +test('creates gulpfile', () => { + assert.file('gulpfile.js'); +}); + +test('creates package.json file', () => { + assert.file('package.json'); +}); + +test('contain correct uploading packages', () => { + assert.fileContent('package.json', '"gulp-rsync": "^0.0.5"'); +}); + +test('does not contain wrong uploading packages', () => { + [ + '"gulp-awspublish"', + '"concurrent-transform"', + '"gulp-gh-pages"' + ].forEach(pack => { + assert.noFileContent('package.json', pack); + }); +}); + +test('contains deploy function', () => { + assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); + assert.fileContent('gulpfile.js', '// uploads your site to your server'); + assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); +}); + +test('does not contain the wrong uploading task', () => { + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); + assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); + assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); +}); + +test('creates credentials file', () => { + assert.file('rsync-credentials.json'); +}); From b7103007493d4f3784e5bb3c8e669ea836936e94 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:22:34 +0200 Subject: [PATCH 146/178] Removed node v4 by accident --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 577a90b..3536b4b 100755 --- a/.travis.yml +++ b/.travis.yml @@ -3,5 +3,6 @@ sudo: false node_js: - "6" - "5" + - "4" after_success: - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' - "4" From 830b5dfee6464321266b93b6876aaa427510000c Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:24:51 +0200 Subject: [PATCH 147/178] I dun goofed --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3536b4b..9c6c22e 100755 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,4 @@ node_js: - "5" - "4" after_success: - - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' - "4" + - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' From a78b9cc6a1c90d21522aa9a66aa67271ca304a12 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:28:49 +0200 Subject: [PATCH 148/178] Remove unused files We don't use ESlint anymore, nor do we need Babel either because of the new changes to our gulpfile. --- generators/boilerplate/index.js | 10 ---------- generators/boilerplate/templates/babelrc | 3 --- generators/boilerplate/templates/eslintrc | 14 -------------- package.json | 5 ----- test/boilerplate.js | 4 ---- 5 files changed, 36 deletions(-) delete mode 100644 generators/boilerplate/templates/babelrc delete mode 100644 generators/boilerplate/templates/eslintrc diff --git a/generators/boilerplate/index.js b/generators/boilerplate/index.js index bbb6e3f..19a865d 100644 --- a/generators/boilerplate/index.js +++ b/generators/boilerplate/index.js @@ -57,15 +57,5 @@ module.exports = generators.Base.extend({ this.templatePath('gitignore'), this.destinationPath('.gitignore') ); - - this.fs.copy( - this.templatePath('eslintrc'), - this.destinationPath('.eslintrc') - ); - - this.fs.copy( - this.templatePath('babelrc'), - this.destinationPath('.babelrc') - ); } }); diff --git a/generators/boilerplate/templates/babelrc b/generators/boilerplate/templates/babelrc deleted file mode 100644 index c13c5f6..0000000 --- a/generators/boilerplate/templates/babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015"] -} diff --git a/generators/boilerplate/templates/eslintrc b/generators/boilerplate/templates/eslintrc deleted file mode 100644 index f4af500..0000000 --- a/generators/boilerplate/templates/eslintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "parser": "babel-eslint", - "globals": { - "describe": true, - "before": true, - "it": true - }, - "env": { - "es6": true, - "node": true, - "mocha": true - }, - "extends": "xo-space" -} diff --git a/package.json b/package.json index 58a384f..19dd9be 100644 --- a/package.json +++ b/package.json @@ -39,11 +39,6 @@ }, "xo": { "space": true, - "globals": [ - "describe", - "before", - "it" - ], "ignores": [ "generators/app/templates/**", "generators/boilerplate/templates/**", diff --git a/test/boilerplate.js b/test/boilerplate.js index 43d3a1a..8af4274 100644 --- a/test/boilerplate.js +++ b/test/boilerplate.js @@ -27,10 +27,6 @@ test('creates .gitattributes', () => { assert.file('.gitattributes'); }); -test('creates .babelrc', () => { - assert.file('.babelrc'); -}); - test('creates README.md', () => { assert.file('README.md'); }); From 1ac45b380fe09e093883146006cdde9340eaad90 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:35:57 +0200 Subject: [PATCH 149/178] Remove gulpfile and unused files from root as well --- .babelrc | 3 --- .eslintrc | 14 -------------- gulpfile.js | 38 -------------------------------------- 3 files changed, 55 deletions(-) delete mode 100644 .babelrc delete mode 100644 .eslintrc delete mode 100644 gulpfile.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index c13c5f6..0000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015"] -} diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index f4af500..0000000 --- a/.eslintrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "parser": "babel-eslint", - "globals": { - "describe": true, - "before": true, - "it": true - }, - "env": { - "es6": true, - "node": true, - "mocha": true - }, - "extends": "xo-space" -} diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 83608a9..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,38 +0,0 @@ -'use strict'; - -const path = require('path'); -const gulp = require('gulp'); -const coveralls = require('gulp-coveralls'); -const istanbul = require('gulp-istanbul'); -const mocha = require('gulp-mocha'); -const del = require('del'); - -gulp.task('istanbul', done => - gulp.src([ - 'generators/**/index.js' - ]) - .pipe(istanbul()) - .pipe(istanbul.hookRequire()) - .on('finish', () => { - gulp.src(['test/*.js']) - .pipe(mocha({reporter: 'spec'})) - .pipe(istanbul.writeReports()) - .pipe(istanbul.enforceThresholds({thresholds: {global: 70}})) - .on('end', done); - }) -); - -gulp.task('clean', done => - del(['test/tmp'], {dot: true}, done) -); - -gulp.task('coveralls', () => { - if (!process.env.CI) { - return; - } - return gulp.src(path.join(__dirname, 'coverage/lcov.info')) //eslint-disable-line - .pipe(coveralls()); -}); - -gulp.task('test', gulp.series('clean', 'istanbul')); -gulp.task('default', gulp.series('coveralls')); From fa3b95c81851ba80b98bc3ef3aee704922e765f6 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:39:39 +0200 Subject: [PATCH 150/178] Add gitter badge, remove some other badges --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ac46538..eb08add 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # generator-jekyllized [![Build Status](https://travis-ci.org/sondr3/generator-jekyllized.png?branch=master)](https://travis-ci.org/sondr3/generator-jekyllized) -[![NPM version](https://badge.fury.io/js/generator-jekyllized.png)](http://badge.fury.io/js/generator-jekyllized) [![Coverage Status](https://coveralls.io/repos/sondr3/generator-jekyllized/badge.png)](https://coveralls.io/r/sondr3/generator-jekyllized) [![Code Climate](https://codeclimate.com/github/sondr3/generator-jekyllized/badges/gpa.svg)](https://codeclimate.com/github/sondr3/generator-jekyllized) +[![Coverage Status](https://coveralls.io/repos/sondr3/generator-jekyllized/badge.png)](https://coveralls.io/r/sondr3/generator-jekyllized) [![Gitter](https://badges.gitter.im/sondr3/generator-jekyllized.svg)](https://gitter.im/sondr3/generator-jekyllized?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) *Waiting on Gulp 4.0 to be released for the beta to go back to being the main version of Jekyllized. If you want to try it as it is right now you can install From 6c9b516adb9b80e3580a77e6a36c7900227f22b2 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:46:15 +0200 Subject: [PATCH 151/178] Refactor testing of uploading a bit --- test/{ => uploading}/aws.js | 2 +- test/{ => uploading}/ghpages.js | 2 +- test/uploading/none.js | 41 +++++++++++++++++++++++++++++++++ test/{ => uploading}/rsync.js | 2 +- 4 files changed, 44 insertions(+), 3 deletions(-) rename test/{ => uploading}/aws.js (95%) rename test/{ => uploading}/ghpages.js (95%) create mode 100644 test/uploading/none.js rename test/{ => uploading}/rsync.js (95%) diff --git a/test/aws.js b/test/uploading/aws.js similarity index 95% rename from test/aws.js rename to test/uploading/aws.js index d4d428d..a4c6c0c 100644 --- a/test/aws.js +++ b/test/uploading/aws.js @@ -5,7 +5,7 @@ var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); test.before(() => { - return helpers.run(path.join(__dirname, '../generators/gulp')) + return helpers.run(path.join(__dirname, '../../generators/gulp')) .withOptions({uploading: 'Amazon S3'}) .toPromise(); }); diff --git a/test/ghpages.js b/test/uploading/ghpages.js similarity index 95% rename from test/ghpages.js rename to test/uploading/ghpages.js index 0d7d658..582b6e0 100644 --- a/test/ghpages.js +++ b/test/uploading/ghpages.js @@ -5,7 +5,7 @@ var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); test.before(() => { - return helpers.run(path.join(__dirname, '../generators/gulp')) + return helpers.run(path.join(__dirname, '../../generators/gulp')) .withOptions({uploading: 'Github Pages'}) .toPromise(); }); diff --git a/test/uploading/none.js b/test/uploading/none.js new file mode 100644 index 0000000..4f2f20e --- /dev/null +++ b/test/uploading/none.js @@ -0,0 +1,41 @@ +'use strict'; +var path = require('path'); +var test = require('ava'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +test.before(() => { + return helpers.run(path.join(__dirname, '../../generators/gulp')) + .withOptions({uploading: 'None'}) + .toPromise(); +}); + +test('creates gulpfile', () => { + assert.file('gulpfile.js'); +}); + +test('creates package.json file', () => { + assert.file('package.json'); +}); + +test('does not create credentials files', () => { + assert.noFile([ + 'aws-credentials.json', + 'rsync-credentials.json' + ]); +}); + +test('does not contain uploading packages', () => { + [ + '"gulp-awspublish"', + '"concurrent-transform"', + '"gulp-rsync"', + '"gulp-gh-pages"' + ].forEach(pack => { + assert.noFileContent('package.json', pack); + }); +}); + +test('does not contain deploy task', () => { + assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); +}); diff --git a/test/rsync.js b/test/uploading/rsync.js similarity index 95% rename from test/rsync.js rename to test/uploading/rsync.js index c6f2fed..2c61034 100644 --- a/test/rsync.js +++ b/test/uploading/rsync.js @@ -5,7 +5,7 @@ var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); test.before(() => { - return helpers.run(path.join(__dirname, '../generators/gulp')) + return helpers.run(path.join(__dirname, '../../generators/gulp')) .withOptions({uploading: 'Rsync'}) .toPromise(); }); From b8db04b189210921221cc7e2e0590810ab3793d0 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 22:53:58 +0200 Subject: [PATCH 152/178] Give me Travis updates on Gitter --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9c6c22e..1c5ed03 100755 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,11 @@ node_js: - "4" after_success: - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' +notifications: + email: false + webhooks: + urls: + - https://webhooks.gitter.im/e/82537018be323f7b8a08 + on_success: change + on_failure: always + on_start: never From 4a85a4f7e7250e1ac3021f5f4857c836e1c1eb17 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 23:07:16 +0200 Subject: [PATCH 153/178] Update packages --- package.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 19dd9be..1dfa523 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,10 @@ ], "dependencies": { "chalk": "^1.1.0", - "globule": "^1.0.0", "lodash": "^4.11.1", - "shelljs": "^0.6.0", + "shelljs": "^0.7.0", "yargs": "^4.6.0", - "yeoman-generator": "^0.22.6", + "yeoman-generator": "^0.23.3", "yosay": "^1.1.1" }, "devDependencies": { From e5463ac2d6c171d3a91caa29a35c1b0d8cf7b569 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 23:11:06 +0200 Subject: [PATCH 154/178] Try running AVA in serial --- test/app.js | 4 ++-- test/boilerplate.js | 10 +++++----- test/gulp.js | 31 ++++--------------------------- test/jekyll.js | 12 ++++++------ test/permalinks/date.js | 2 +- test/permalinks/none.js | 2 +- test/permalinks/ordinal.js | 2 +- test/permalinks/pretty.js | 2 +- test/uploading/aws.js | 14 +++++++------- test/uploading/ghpages.js | 12 ++++++------ test/uploading/none.js | 10 +++++----- test/uploading/rsync.js | 14 +++++++------- 12 files changed, 46 insertions(+), 69 deletions(-) diff --git a/test/app.js b/test/app.js index be1fc0d..0a97f57 100644 --- a/test/app.js +++ b/test/app.js @@ -19,7 +19,7 @@ test.before(() => { .toPromise(); }); -test('generates expected files', () => { +test.serial('generates expected files', () => { assert.file([ '.editorconfig', '.gitignore', @@ -33,7 +33,7 @@ test('generates expected files', () => { ]); }); -test('creates package.json correctly', () => { +test.serial('creates package.json correctly', () => { assert.file('package.json'); [ '"name": "jekyllized"', diff --git a/test/boilerplate.js b/test/boilerplate.js index 8af4274..882ed0e 100644 --- a/test/boilerplate.js +++ b/test/boilerplate.js @@ -15,23 +15,23 @@ test.before(() => { .toPromise(); }); -test('creates .editorconfig', () => { +test.serial('creates .editorconfig', () => { assert.file('.editorconfig'); }); -test('creates .gitignore', () => { +test.serial('creates .gitignore', () => { assert.file('.gitignore'); }); -test('creates .gitattributes', () => { +test.serial('creates .gitattributes', () => { assert.file('.gitattributes'); }); -test('creates README.md', () => { +test.serial('creates README.md', () => { assert.file('README.md'); }); -test('README is correct', () => { +test.serial('README is correct', () => { [ '# README', '> This is a great README', diff --git a/test/gulp.js b/test/gulp.js index 14d95a2..54e9247 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -10,15 +10,15 @@ test.before(() => { .toPromise(); }); -test('creates gulpfile', () => { +test.serial('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test('creates package.json', () => { +test.serial('creates package.json', () => { assert.file('package.json'); }); -test('package.json contains correct packages', () => { +test.serial('package.json contains correct packages', () => { [ '"autoprefixer": "^6.2.3"', '"browser-sync": "^2.11.0"', @@ -50,25 +50,7 @@ test('package.json contains correct packages', () => { }); }); -test('does not create credentials files', () => { - assert.noFile([ - 'aws-credentials.json', - 'rsync-credentials.json' - ]); -}); - -test('does not contain uploading packages', () => { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-rsync"', - '"gulp-gh-pages"' - ].forEach(pack => { - assert.noFileContent('package.json', pack); - }); -}); - -test('contains default gulp tasks', () => { +test.serial('contains default gulp tasks', () => { [ 'clean:assets', 'clean:images', @@ -100,8 +82,3 @@ test('contains default gulp tasks', () => { assert.fileContent('gulpfile.js', 'gulp.task(\'' + task); }); }); - -test('does not contain deploy task', () => { - assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); -}); - diff --git a/test/jekyll.js b/test/jekyll.js index e506f01..4596066 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -18,18 +18,18 @@ test.before(() => { .toPromise(); }); -test('creates Gemfile', () => { +test.serial('creates Gemfile', () => { assert.file('Gemfile'); }); -test('creates _config.yml files', () => { +test.serial('creates _config.yml files', () => { assert.file([ '_config.yml', '_config.build.yml' ]); }); -test('creates src directory', () => { +test.serial('creates src directory', () => { assert.file([ 'src/404.html', 'src/about.md', @@ -40,7 +40,7 @@ test('creates src directory', () => { ]); }); -test('_config.yml contains the correct settings', () => { +test.serial('_config.yml contains the correct settings', () => { [ 'title: jekyllized', 'description: Tests for Jekyllized', @@ -54,7 +54,7 @@ test('_config.yml contains the correct settings', () => { }); }); -test('_config.build.yml contains the correct settings', () => { +test.serial('_config.build.yml contains the correct settings', () => { [ 'future: false', 'show_drafts: false', @@ -64,6 +64,6 @@ test('_config.build.yml contains the correct settings', () => { }); }); -test('fills out humans.txt correctly', () => { +test.serial('fills out humans.txt correctly', () => { assert.fileContent('src/humans.txt', 'Ola Nordmann -- -- @'); }); diff --git a/test/permalinks/date.js b/test/permalinks/date.js index 87e1031..9dd68cd 100644 --- a/test/permalinks/date.js +++ b/test/permalinks/date.js @@ -10,6 +10,6 @@ test.before(() => { .toPromise(); }); -test('sets date permalinks', () => { +test.serial('sets date permalinks', () => { assert.fileContent('_config.yml', 'permalink: date'); }); diff --git a/test/permalinks/none.js b/test/permalinks/none.js index 33178c6..a312283 100644 --- a/test/permalinks/none.js +++ b/test/permalinks/none.js @@ -10,6 +10,6 @@ test.before(() => { .toPromise(); }); -test('sets none permalinks', () => { +test.serial('sets none permalinks', () => { assert.fileContent('_config.yml', 'permalink: none'); }); diff --git a/test/permalinks/ordinal.js b/test/permalinks/ordinal.js index cd835c9..38802ea 100644 --- a/test/permalinks/ordinal.js +++ b/test/permalinks/ordinal.js @@ -10,7 +10,7 @@ test.before(() => { .toPromise(); }); -test('sets ordinal permalinks', () => { +test.serial('sets ordinal permalinks', () => { assert.fileContent('_config.yml', 'permalink: ordinal'); }); diff --git a/test/permalinks/pretty.js b/test/permalinks/pretty.js index 71fbcb1..1a93149 100644 --- a/test/permalinks/pretty.js +++ b/test/permalinks/pretty.js @@ -10,6 +10,6 @@ test.before(() => { .toPromise(); }); -test('sets pretty permalinks', () => { +test.serial('sets pretty permalinks', () => { assert.fileContent('_config.yml', 'permalink: pretty'); }); diff --git a/test/uploading/aws.js b/test/uploading/aws.js index a4c6c0c..a998780 100644 --- a/test/uploading/aws.js +++ b/test/uploading/aws.js @@ -10,15 +10,15 @@ test.before(() => { .toPromise(); }); -test('creates gulpfile', () => { +test.serial('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test('creates package.json file', () => { +test.serial('creates package.json file', () => { assert.file('package.json'); }); -test('contain correct uploading packages', () => { +test.serial('contain correct uploading packages', () => { [ '"gulp-awspublish": "^3.0.1"', '"concurrent-transform": "^1.0.0"' @@ -27,7 +27,7 @@ test('contain correct uploading packages', () => { }); }); -test('does not contain wrong uploading packages', () => { +test.serial('does not contain wrong uploading packages', () => { [ '"gulp-rsync"', '"gulp-gh-pages"' @@ -36,18 +36,18 @@ test('does not contain wrong uploading packages', () => { }); }); -test('contains deploy task', () => { +test.serial('contains deploy task', () => { assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); assert.fileContent('gulpfile.js', '// headers for your files and uploads them to S3'); assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); -test('does not contain wrong uploading tasks', () => { +test.serial('does not contain wrong uploading tasks', () => { assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); assert.noFileContent('gulpfile.js', '// uploads your site to your server'); assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); }); -test('creates credentials file', () => { +test.serial('creates credentials file', () => { assert.file('aws-credentials.json'); }); diff --git a/test/uploading/ghpages.js b/test/uploading/ghpages.js index 582b6e0..79d62d1 100644 --- a/test/uploading/ghpages.js +++ b/test/uploading/ghpages.js @@ -10,19 +10,19 @@ test.before(() => { .toPromise(); }); -test('creates gulpfile', () => { +test.serial('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test('creates package.json file', () => { +test.serial('creates package.json file', () => { assert.file('package.json'); }); -test('contain correct uploading packages', () => { +test.serial('contain correct uploading packages', () => { assert.fileContent('package.json', '"gulp-gh-pages": "^0.5.2"'); }); -test('does not contain wrong uploading packages', () => { +test.serial('does not contain wrong uploading packages', () => { [ '"gulp-awspublish"', '"concurrent-transform"', @@ -32,12 +32,12 @@ test('does not contain wrong uploading packages', () => { }); }); -test('contains deploy function', () => { +test.serial('contains deploy function', () => { assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); -test('does not contain the wrong uploading task', () => { +test.serial('does not contain the wrong uploading task', () => { assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); diff --git a/test/uploading/none.js b/test/uploading/none.js index 4f2f20e..31e9651 100644 --- a/test/uploading/none.js +++ b/test/uploading/none.js @@ -10,22 +10,22 @@ test.before(() => { .toPromise(); }); -test('creates gulpfile', () => { +test.serial('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test('creates package.json file', () => { +test.serial('creates package.json file', () => { assert.file('package.json'); }); -test('does not create credentials files', () => { +test.serial('does not create credentials files', () => { assert.noFile([ 'aws-credentials.json', 'rsync-credentials.json' ]); }); -test('does not contain uploading packages', () => { +test.serial('does not contain uploading packages', () => { [ '"gulp-awspublish"', '"concurrent-transform"', @@ -36,6 +36,6 @@ test('does not contain uploading packages', () => { }); }); -test('does not contain deploy task', () => { +test.serial('does not contain deploy task', () => { assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); diff --git a/test/uploading/rsync.js b/test/uploading/rsync.js index 2c61034..b683e0b 100644 --- a/test/uploading/rsync.js +++ b/test/uploading/rsync.js @@ -10,19 +10,19 @@ test.before(() => { .toPromise(); }); -test('creates gulpfile', () => { +test.serial('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test('creates package.json file', () => { +test.serial('creates package.json file', () => { assert.file('package.json'); }); -test('contain correct uploading packages', () => { +test.serial('contain correct uploading packages', () => { assert.fileContent('package.json', '"gulp-rsync": "^0.0.5"'); }); -test('does not contain wrong uploading packages', () => { +test.serial('does not contain wrong uploading packages', () => { [ '"gulp-awspublish"', '"concurrent-transform"', @@ -32,18 +32,18 @@ test('does not contain wrong uploading packages', () => { }); }); -test('contains deploy function', () => { +test.serial('contains deploy function', () => { assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); assert.fileContent('gulpfile.js', '// uploads your site to your server'); assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); -test('does not contain the wrong uploading task', () => { +test.serial('does not contain the wrong uploading task', () => { assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); }); -test('creates credentials file', () => { +test.serial('creates credentials file', () => { assert.file('rsync-credentials.json'); }); From 069ba32849233a150d9c044f24d3e9b89b285f57 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 23:30:15 +0200 Subject: [PATCH 155/178] Rename a test because having two of them got confusing --- test/uploading/{none.js => no-uploading.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/uploading/{none.js => no-uploading.js} (100%) diff --git a/test/uploading/none.js b/test/uploading/no-uploading.js similarity index 100% rename from test/uploading/none.js rename to test/uploading/no-uploading.js From 9b180fa433d9776bebb1e40bd05a030b39017f45 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Mon, 23 May 2016 23:52:04 +0200 Subject: [PATCH 156/178] Try using --serial for AVA on Travis --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1dfa523..c1a16a1 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "repository": "sondr3/generator-jekyllized", "license": "MIT", "scripts": { - "test": "xo && nyc ava" + "test": "xo && nyc ava --serial" }, "files": [ "index.js", From 64425a14975a2861355d8de2a8f80fb7dd5c5348 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:04:53 +0200 Subject: [PATCH 157/178] Test testing --- package.json | 2 +- temp-test.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 temp-test.js diff --git a/package.json b/package.json index c1a16a1..789b44b 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "repository": "sondr3/generator-jekyllized", "license": "MIT", "scripts": { - "test": "xo && nyc ava --serial" + "test": "node temp-test.js" }, "files": [ "index.js", diff --git a/temp-test.js b/temp-test.js new file mode 100644 index 0000000..55c7348 --- /dev/null +++ b/temp-test.js @@ -0,0 +1,45 @@ +'use strict'; +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +helpers.run(path.join(__dirname, 'generators/app')) + .withPrompts({ + projectName: 'jekyllized', + projectDescription: 'Test site for Jekyllized', + projectURL: 'www.test.com', + authorName: 'Ola Nordmann', + authorEmail: 'ola.nordmann\@gmail.com', + authorBio: 'A norwegian dude', + uploading: 'None', + jekyllPermalinks: 'pretty' + }) + .toPromise() + .then(function () { + test.serial('generates expected files', () => { + assert.file([ + '.editorconfig', + '.gitignore', + '.gitattributes', + 'package.json', + 'gulpfile.js', + 'README.md', + '_config.yml', + '_config.build.yml', + 'Gemfile' + ]); + }); + + test.serial('creates package.json correctly', () => { + assert.file('package.json'); + [ + '"name": "jekyllized"', + '"description": "Test site for Jekyllized"', + '"homepage": "www.test.com', + '"name": "Ola Nordmann"', + '"email": "ola.nordmann@gmail.com"' + ].forEach(field => { + assert.fileContent('package.json', field); + }); + }); + }); From 0971a893c83174b5a4360691629f1f966268fb48 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:12:29 +0200 Subject: [PATCH 158/178] Even more testing the tests --- temp-test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/temp-test.js b/temp-test.js index 55c7348..87030ee 100644 --- a/temp-test.js +++ b/temp-test.js @@ -1,4 +1,11 @@ 'use strict'; + +var oldExit = process.exit; +process.exit = function () { + console.error(new Error(‘OH NO!!!’)); + oldExit.apply(process, arguments); +} + var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); From a3c1dd3ce4f304e52817a8742b6b14243bdcf2b9 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:13:09 +0200 Subject: [PATCH 159/178] Fix syntax error --- temp-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/temp-test.js b/temp-test.js index 87030ee..dcb5c68 100644 --- a/temp-test.js +++ b/temp-test.js @@ -2,7 +2,7 @@ var oldExit = process.exit; process.exit = function () { - console.error(new Error(‘OH NO!!!’)); + console.error(new Error('OH NO!!!')); oldExit.apply(process, arguments); } From abe14895745b5bafecc1f2de800501ff888967d8 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:20:14 +0200 Subject: [PATCH 160/178] Revert "Try using --serial for AVA on Travis" This reverts commit 9b180fa433d9776bebb1e40bd05a030b39017f45. --- package.json | 2 +- temp-test.js | 52 ---------------------------------------------------- 2 files changed, 1 insertion(+), 53 deletions(-) delete mode 100644 temp-test.js diff --git a/package.json b/package.json index 789b44b..1dfa523 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "repository": "sondr3/generator-jekyllized", "license": "MIT", "scripts": { - "test": "node temp-test.js" + "test": "xo && nyc ava" }, "files": [ "index.js", diff --git a/temp-test.js b/temp-test.js deleted file mode 100644 index dcb5c68..0000000 --- a/temp-test.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -var oldExit = process.exit; -process.exit = function () { - console.error(new Error('OH NO!!!')); - oldExit.apply(process, arguments); -} - -var path = require('path'); -var assert = require('yeoman-assert'); -var helpers = require('yeoman-test'); - -helpers.run(path.join(__dirname, 'generators/app')) - .withPrompts({ - projectName: 'jekyllized', - projectDescription: 'Test site for Jekyllized', - projectURL: 'www.test.com', - authorName: 'Ola Nordmann', - authorEmail: 'ola.nordmann\@gmail.com', - authorBio: 'A norwegian dude', - uploading: 'None', - jekyllPermalinks: 'pretty' - }) - .toPromise() - .then(function () { - test.serial('generates expected files', () => { - assert.file([ - '.editorconfig', - '.gitignore', - '.gitattributes', - 'package.json', - 'gulpfile.js', - 'README.md', - '_config.yml', - '_config.build.yml', - 'Gemfile' - ]); - }); - - test.serial('creates package.json correctly', () => { - assert.file('package.json'); - [ - '"name": "jekyllized"', - '"description": "Test site for Jekyllized"', - '"homepage": "www.test.com', - '"name": "Ola Nordmann"', - '"email": "ola.nordmann@gmail.com"' - ].forEach(field => { - assert.fileContent('package.json', field); - }); - }); - }); From 7e5b80a8f1081214204bbbc6c8f6bf4d4b9a40a4 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:21:54 +0200 Subject: [PATCH 161/178] Revert back from all the testing of the tests --- test/app.js | 4 +-- test/boilerplate.js | 10 +++---- test/gulp.js | 31 ++++++++++++++++++--- test/jekyll.js | 12 ++++---- test/permalinks/date.js | 2 +- test/permalinks/none.js | 2 +- test/permalinks/ordinal.js | 2 +- test/permalinks/pretty.js | 2 +- test/uploading/aws.js | 14 +++++----- test/uploading/ghpages.js | 12 ++++---- test/uploading/{no-uploading.js => none.js} | 10 +++---- test/uploading/rsync.js | 14 +++++----- 12 files changed, 69 insertions(+), 46 deletions(-) rename test/uploading/{no-uploading.js => none.js} (73%) diff --git a/test/app.js b/test/app.js index 0a97f57..be1fc0d 100644 --- a/test/app.js +++ b/test/app.js @@ -19,7 +19,7 @@ test.before(() => { .toPromise(); }); -test.serial('generates expected files', () => { +test('generates expected files', () => { assert.file([ '.editorconfig', '.gitignore', @@ -33,7 +33,7 @@ test.serial('generates expected files', () => { ]); }); -test.serial('creates package.json correctly', () => { +test('creates package.json correctly', () => { assert.file('package.json'); [ '"name": "jekyllized"', diff --git a/test/boilerplate.js b/test/boilerplate.js index 882ed0e..8af4274 100644 --- a/test/boilerplate.js +++ b/test/boilerplate.js @@ -15,23 +15,23 @@ test.before(() => { .toPromise(); }); -test.serial('creates .editorconfig', () => { +test('creates .editorconfig', () => { assert.file('.editorconfig'); }); -test.serial('creates .gitignore', () => { +test('creates .gitignore', () => { assert.file('.gitignore'); }); -test.serial('creates .gitattributes', () => { +test('creates .gitattributes', () => { assert.file('.gitattributes'); }); -test.serial('creates README.md', () => { +test('creates README.md', () => { assert.file('README.md'); }); -test.serial('README is correct', () => { +test('README is correct', () => { [ '# README', '> This is a great README', diff --git a/test/gulp.js b/test/gulp.js index 54e9247..14d95a2 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -10,15 +10,15 @@ test.before(() => { .toPromise(); }); -test.serial('creates gulpfile', () => { +test('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test.serial('creates package.json', () => { +test('creates package.json', () => { assert.file('package.json'); }); -test.serial('package.json contains correct packages', () => { +test('package.json contains correct packages', () => { [ '"autoprefixer": "^6.2.3"', '"browser-sync": "^2.11.0"', @@ -50,7 +50,25 @@ test.serial('package.json contains correct packages', () => { }); }); -test.serial('contains default gulp tasks', () => { +test('does not create credentials files', () => { + assert.noFile([ + 'aws-credentials.json', + 'rsync-credentials.json' + ]); +}); + +test('does not contain uploading packages', () => { + [ + '"gulp-awspublish"', + '"concurrent-transform"', + '"gulp-rsync"', + '"gulp-gh-pages"' + ].forEach(pack => { + assert.noFileContent('package.json', pack); + }); +}); + +test('contains default gulp tasks', () => { [ 'clean:assets', 'clean:images', @@ -82,3 +100,8 @@ test.serial('contains default gulp tasks', () => { assert.fileContent('gulpfile.js', 'gulp.task(\'' + task); }); }); + +test('does not contain deploy task', () => { + assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); +}); + diff --git a/test/jekyll.js b/test/jekyll.js index 4596066..e506f01 100644 --- a/test/jekyll.js +++ b/test/jekyll.js @@ -18,18 +18,18 @@ test.before(() => { .toPromise(); }); -test.serial('creates Gemfile', () => { +test('creates Gemfile', () => { assert.file('Gemfile'); }); -test.serial('creates _config.yml files', () => { +test('creates _config.yml files', () => { assert.file([ '_config.yml', '_config.build.yml' ]); }); -test.serial('creates src directory', () => { +test('creates src directory', () => { assert.file([ 'src/404.html', 'src/about.md', @@ -40,7 +40,7 @@ test.serial('creates src directory', () => { ]); }); -test.serial('_config.yml contains the correct settings', () => { +test('_config.yml contains the correct settings', () => { [ 'title: jekyllized', 'description: Tests for Jekyllized', @@ -54,7 +54,7 @@ test.serial('_config.yml contains the correct settings', () => { }); }); -test.serial('_config.build.yml contains the correct settings', () => { +test('_config.build.yml contains the correct settings', () => { [ 'future: false', 'show_drafts: false', @@ -64,6 +64,6 @@ test.serial('_config.build.yml contains the correct settings', () => { }); }); -test.serial('fills out humans.txt correctly', () => { +test('fills out humans.txt correctly', () => { assert.fileContent('src/humans.txt', 'Ola Nordmann -- -- @'); }); diff --git a/test/permalinks/date.js b/test/permalinks/date.js index 9dd68cd..87e1031 100644 --- a/test/permalinks/date.js +++ b/test/permalinks/date.js @@ -10,6 +10,6 @@ test.before(() => { .toPromise(); }); -test.serial('sets date permalinks', () => { +test('sets date permalinks', () => { assert.fileContent('_config.yml', 'permalink: date'); }); diff --git a/test/permalinks/none.js b/test/permalinks/none.js index a312283..33178c6 100644 --- a/test/permalinks/none.js +++ b/test/permalinks/none.js @@ -10,6 +10,6 @@ test.before(() => { .toPromise(); }); -test.serial('sets none permalinks', () => { +test('sets none permalinks', () => { assert.fileContent('_config.yml', 'permalink: none'); }); diff --git a/test/permalinks/ordinal.js b/test/permalinks/ordinal.js index 38802ea..cd835c9 100644 --- a/test/permalinks/ordinal.js +++ b/test/permalinks/ordinal.js @@ -10,7 +10,7 @@ test.before(() => { .toPromise(); }); -test.serial('sets ordinal permalinks', () => { +test('sets ordinal permalinks', () => { assert.fileContent('_config.yml', 'permalink: ordinal'); }); diff --git a/test/permalinks/pretty.js b/test/permalinks/pretty.js index 1a93149..71fbcb1 100644 --- a/test/permalinks/pretty.js +++ b/test/permalinks/pretty.js @@ -10,6 +10,6 @@ test.before(() => { .toPromise(); }); -test.serial('sets pretty permalinks', () => { +test('sets pretty permalinks', () => { assert.fileContent('_config.yml', 'permalink: pretty'); }); diff --git a/test/uploading/aws.js b/test/uploading/aws.js index a998780..a4c6c0c 100644 --- a/test/uploading/aws.js +++ b/test/uploading/aws.js @@ -10,15 +10,15 @@ test.before(() => { .toPromise(); }); -test.serial('creates gulpfile', () => { +test('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test.serial('creates package.json file', () => { +test('creates package.json file', () => { assert.file('package.json'); }); -test.serial('contain correct uploading packages', () => { +test('contain correct uploading packages', () => { [ '"gulp-awspublish": "^3.0.1"', '"concurrent-transform": "^1.0.0"' @@ -27,7 +27,7 @@ test.serial('contain correct uploading packages', () => { }); }); -test.serial('does not contain wrong uploading packages', () => { +test('does not contain wrong uploading packages', () => { [ '"gulp-rsync"', '"gulp-gh-pages"' @@ -36,18 +36,18 @@ test.serial('does not contain wrong uploading packages', () => { }); }); -test.serial('contains deploy task', () => { +test('contains deploy task', () => { assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); assert.fileContent('gulpfile.js', '// headers for your files and uploads them to S3'); assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); -test.serial('does not contain wrong uploading tasks', () => { +test('does not contain wrong uploading tasks', () => { assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); assert.noFileContent('gulpfile.js', '// uploads your site to your server'); assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); }); -test.serial('creates credentials file', () => { +test('creates credentials file', () => { assert.file('aws-credentials.json'); }); diff --git a/test/uploading/ghpages.js b/test/uploading/ghpages.js index 79d62d1..582b6e0 100644 --- a/test/uploading/ghpages.js +++ b/test/uploading/ghpages.js @@ -10,19 +10,19 @@ test.before(() => { .toPromise(); }); -test.serial('creates gulpfile', () => { +test('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test.serial('creates package.json file', () => { +test('creates package.json file', () => { assert.file('package.json'); }); -test.serial('contain correct uploading packages', () => { +test('contain correct uploading packages', () => { assert.fileContent('package.json', '"gulp-gh-pages": "^0.5.2"'); }); -test.serial('does not contain wrong uploading packages', () => { +test('does not contain wrong uploading packages', () => { [ '"gulp-awspublish"', '"concurrent-transform"', @@ -32,12 +32,12 @@ test.serial('does not contain wrong uploading packages', () => { }); }); -test.serial('contains deploy function', () => { +test('contains deploy function', () => { assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); -test.serial('does not contain the wrong uploading task', () => { +test('does not contain the wrong uploading task', () => { assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); diff --git a/test/uploading/no-uploading.js b/test/uploading/none.js similarity index 73% rename from test/uploading/no-uploading.js rename to test/uploading/none.js index 31e9651..4f2f20e 100644 --- a/test/uploading/no-uploading.js +++ b/test/uploading/none.js @@ -10,22 +10,22 @@ test.before(() => { .toPromise(); }); -test.serial('creates gulpfile', () => { +test('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test.serial('creates package.json file', () => { +test('creates package.json file', () => { assert.file('package.json'); }); -test.serial('does not create credentials files', () => { +test('does not create credentials files', () => { assert.noFile([ 'aws-credentials.json', 'rsync-credentials.json' ]); }); -test.serial('does not contain uploading packages', () => { +test('does not contain uploading packages', () => { [ '"gulp-awspublish"', '"concurrent-transform"', @@ -36,6 +36,6 @@ test.serial('does not contain uploading packages', () => { }); }); -test.serial('does not contain deploy task', () => { +test('does not contain deploy task', () => { assert.noFileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); diff --git a/test/uploading/rsync.js b/test/uploading/rsync.js index b683e0b..2c61034 100644 --- a/test/uploading/rsync.js +++ b/test/uploading/rsync.js @@ -10,19 +10,19 @@ test.before(() => { .toPromise(); }); -test.serial('creates gulpfile', () => { +test('creates gulpfile', () => { assert.file('gulpfile.js'); }); -test.serial('creates package.json file', () => { +test('creates package.json file', () => { assert.file('package.json'); }); -test.serial('contain correct uploading packages', () => { +test('contain correct uploading packages', () => { assert.fileContent('package.json', '"gulp-rsync": "^0.0.5"'); }); -test.serial('does not contain wrong uploading packages', () => { +test('does not contain wrong uploading packages', () => { [ '"gulp-awspublish"', '"concurrent-transform"', @@ -32,18 +32,18 @@ test.serial('does not contain wrong uploading packages', () => { }); }); -test.serial('contains deploy function', () => { +test('contains deploy function', () => { assert.fileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your Rsync credentials file and incrementally'); assert.fileContent('gulpfile.js', '// uploads your site to your server'); assert.fileContent('gulpfile.js', 'gulp.task(\'deploy\''); }); -test.serial('does not contain the wrong uploading task', () => { +test('does not contain the wrong uploading task', () => { assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- reads from your AWS Credentials file, creates the correct'); assert.noFileContent('gulpfile.js', '// headers for your files and uploads them to S3'); assert.noFileContent('gulpfile.js', '// \'gulp deploy\' -- pushes your dist folder to Github'); }); -test.serial('creates credentials file', () => { +test('creates credentials file', () => { assert.file('rsync-credentials.json'); }); From deac0babc5ba5d0f12c1e29cc7b30c7ef8329802 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:40:10 +0200 Subject: [PATCH 162/178] Don't install dependencies --- generators/app/index.js | 15 +++++++++++---- test/app.js | 1 + test/uploading/{none.js => no-uploading.js} | 0 3 files changed, 12 insertions(+), 4 deletions(-) rename test/uploading/{none.js => no-uploading.js} (100%) diff --git a/generators/app/index.js b/generators/app/index.js index dc3cc0a..746b9ad 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -10,6 +10,11 @@ module.exports = generators.Base.extend({ constructor: function () { generators.Base.apply(this, arguments); + this.option('skip-install', { + desc: 'Skip installing dependencies', + type: Boolean + }); + var dependencies = ['ruby', 'bundle', 'yo', 'gulp', 'node'].every(function (depend) { return shelljs.which(depend); }); @@ -147,9 +152,11 @@ module.exports = generators.Base.extend({ }, installing: function () { - this.installDependencies({ - bower: false - }); - this.spawnCommand('bundle', ['install', '--quiet']); + if (this.options['skip-install']) { + this.log('Please run "npm install" and "bundle install" to install dependencies'); + } else { + this.npmInstall(); + this.spawnCommand('bundle', ['install', '--quiet']); + } } }); diff --git a/test/app.js b/test/app.js index be1fc0d..4e6c57a 100644 --- a/test/app.js +++ b/test/app.js @@ -16,6 +16,7 @@ test.before(() => { uploading: 'None', jekyllPermalinks: 'pretty' }) + .withOptions({'skip-install': true}) .toPromise(); }); diff --git a/test/uploading/none.js b/test/uploading/no-uploading.js similarity index 100% rename from test/uploading/none.js rename to test/uploading/no-uploading.js From 3c201a7f45d473f04f131e8feeef50ad4339aee7 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:43:20 +0200 Subject: [PATCH 163/178] Install bundler when testing --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1c5ed03..8e59faa 100755 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ node_js: - "6" - "5" - "4" +install: + - gem install bundler after_success: - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' notifications: From 8b03cea0e32eb714df0d4cbc960d6020d6a2090b Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 00:44:43 +0200 Subject: [PATCH 164/178] Apparently you must tell it to install node packages as well --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 8e59faa..afc2f89 100755 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ node_js: - "4" install: - gem install bundler + - npm install after_success: - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' notifications: From c3eab364a58adc54cc315fb6ff09e82e384085a3 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 02:16:22 +0200 Subject: [PATCH 165/178] Second try --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index afc2f89..fe944ba 100755 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ node_js: - "5" - "4" install: - - gem install bundler + - gem install bundler jekyll - npm install after_success: - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' From 07658812f46c339c1388a5707124556ec3170dbc Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 02:24:22 +0200 Subject: [PATCH 166/178] Third time's the charm --- .travis.yml | 3 --- generators/app/index.js | 1 - 2 files changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index fe944ba..1c5ed03 100755 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,6 @@ node_js: - "6" - "5" - "4" -install: - - gem install bundler jekyll - - npm install after_success: - './node_modules/.bin/nyc report --reporter=text-lcov | ./node_modules/.bin/coveralls' notifications: diff --git a/generators/app/index.js b/generators/app/index.js index 746b9ad..7e6fe9a 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -22,7 +22,6 @@ module.exports = generators.Base.extend({ if (!dependencies) { this.log(chalk.red('You are missing one or more dependencies!')); this.log(chalk.yellow('Make sure you have the required dependencies, or that they are in $PATH')); - shelljs.exit(1); } }, From fa9e6b166a12dab48f8b88c4b04eda7fcf7ad050 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 24 May 2016 14:44:16 +0200 Subject: [PATCH 167/178] Nope, not working still... --- generators/app/index.js | 1 + test/app.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/generators/app/index.js b/generators/app/index.js index 7e6fe9a..746b9ad 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -22,6 +22,7 @@ module.exports = generators.Base.extend({ if (!dependencies) { this.log(chalk.red('You are missing one or more dependencies!')); this.log(chalk.yellow('Make sure you have the required dependencies, or that they are in $PATH')); + shelljs.exit(1); } }, diff --git a/test/app.js b/test/app.js index 4e6c57a..9a452b3 100644 --- a/test/app.js +++ b/test/app.js @@ -5,6 +5,12 @@ var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); test.before(() => { + var deps = [ + [helpers.createDummyGenerator(), 'jekyllized:boilerplate'], + [helpers.createDummyGenerator(), 'jekyllized:jekyll'], + [helpers.createDummyGenerator(), 'jekyllized:gulp'] + ]; + return helpers.run(path.join(__dirname, '../generators/app')) .withPrompts({ projectName: 'jekyllized', @@ -17,6 +23,7 @@ test.before(() => { jekyllPermalinks: 'pretty' }) .withOptions({'skip-install': true}) + .withGenerators(deps) .toPromise(); }); From 19ea9665c3fa2df8bbf2ea1699faff4d7995aeec Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 01:09:45 +0200 Subject: [PATCH 168/178] Fix tests, update yeoman-generator Updated to use the JSONFileContent function in yeoman-assert for checking package.json. Also updated the syntax in the default generator so it works with the new version of yeoman-generator. --- generators/app/index.js | 15 ++------ package.json | 6 ++- test/gulp.js | 70 +++++++++++++++++----------------- test/uploading/aws.js | 20 +++++----- test/uploading/ghpages.js | 18 +++++---- test/uploading/no-uploading.js | 14 +++---- test/uploading/rsync.js | 18 +++++---- 7 files changed, 81 insertions(+), 80 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index 746b9ad..530d1cf 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -3,7 +3,6 @@ var _ = require('lodash'); var chalk = require('chalk'); var generators = require('yeoman-generator'); -var yosay = require('yosay'); var shelljs = require('shelljs'); module.exports = generators.Base.extend({ @@ -32,13 +31,7 @@ module.exports = generators.Base.extend({ }, prompting: function () { - var done = this.async(); - - if (!this.options['skip-welcome-message']) { - this.log(yosay('\'Allo \'allo!')); - } - - var prompts = [{ + var questions = [{ name: 'projectName', message: 'What is the name of your project?', store: true @@ -93,10 +86,8 @@ module.exports = generators.Base.extend({ store: true }]; - this.prompt(prompts, function (props) { - this.props = _.extend(this.props, props); - - done(); + return this.prompt(questions).then(function (props) { + this.props = props; }.bind(this)); }, diff --git a/package.json b/package.json index 1dfa523..75b5367 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,7 @@ "lodash": "^4.11.1", "shelljs": "^0.7.0", "yargs": "^4.6.0", - "yeoman-generator": "^0.23.3", - "yosay": "^1.1.1" + "yeoman-generator": "^0.23.3" }, "devDependencies": { "ava": "^0.14.0", @@ -38,6 +37,9 @@ }, "xo": { "space": true, + "rules": { + "new-cap": 0 + }, "ignores": [ "generators/app/templates/**", "generators/boilerplate/templates/**", diff --git a/test/gulp.js b/test/gulp.js index 14d95a2..254e3ec 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -19,34 +19,34 @@ test('creates package.json', () => { }); test('package.json contains correct packages', () => { - [ - '"autoprefixer": "^6.2.3"', - '"browser-sync": "^2.11.0"', - '"del": "^2.2.0"', - '"gulp": "git://github.com/gulpjs/gulp.git#4.0"', - '"gulp-cache": "^0.4.1"', - '"gulp-concat": "^2.6.0"', - '"gulp-cssnano": "^2.1.0"', - '"gulp-eslint": "^2.0.0"', - '"gulp-gzip": "^1.1.0"', - '"gulp-htmlmin": "^1.3.0"', - '"gulp-if": "^2.0.0"', - '"gulp-imagemin": "^2.1.0"', - '"gulp-inject": "^4.0.0"', - '"gulp-load-plugins": "^1.2.0"', - '"gulp-newer": "^1.1.0"', - '"gulp-postcss": "^6.0.0"', - '"gulp-rename": "^1.2.2"', - '"gulp-rev": "^7.0.0"', - '"gulp-sass": "^2.1.1"', - '"gulp-size": "^2.0.0"', - '"gulp-sourcemaps": "^1.3.0"', - '"gulp-uglify": "^1.5.1"', - '"gulp-uncss": "^1.0.0"', - '"shelljs": "^0.6.0"', - '"yargs": "^4.3.2"' - ].forEach(pack => { - assert.fileContent('package.json', pack); + assert.JSONFileContent('package.json', { + devDependencies: { + 'autoprefixer': '^6.2.3', + 'browser-sync': '^2.11.0', + 'del': '^2.2.0', + 'gulp': 'git://github.com/gulpjs/gulp.git#4.0', + 'gulp-cache': '^0.4.1', + 'gulp-concat': '^2.6.0', + 'gulp-cssnano': '^2.1.0', + 'gulp-eslint': '^2.0.0', + 'gulp-gzip': '^1.1.0', + 'gulp-htmlmin': '^1.3.0', + 'gulp-if': '^2.0.0', + 'gulp-imagemin': '^2.1.0', + 'gulp-inject': '^4.0.0', + 'gulp-load-plugins': '^1.2.0', + 'gulp-newer': '^1.1.0', + 'gulp-postcss': '^6.0.0', + 'gulp-rename': '^1.2.2', + 'gulp-rev': '^7.0.0', + 'gulp-sass': '^2.1.1', + 'gulp-size': '^2.0.0', + 'gulp-sourcemaps': '^1.3.0', + 'gulp-uglify': '^1.5.1', + 'gulp-uncss': '^1.0.0', + 'shelljs': '^0.6.0', + 'yargs': '^4.3.2' + } }); }); @@ -58,13 +58,13 @@ test('does not create credentials files', () => { }); test('does not contain uploading packages', () => { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-rsync"', - '"gulp-gh-pages"' - ].forEach(pack => { - assert.noFileContent('package.json', pack); + assert.noJSONFileContent('package.json', { + devDependencies: { + 'gulp-awspublish': '^3.0.1', + 'concurrent-transform': '^1.0.0', + 'gulp-rsync': '^0.0.5', + 'gulp-gh-pages': '^0.5.2' + } }); }); diff --git a/test/uploading/aws.js b/test/uploading/aws.js index a4c6c0c..312e3ec 100644 --- a/test/uploading/aws.js +++ b/test/uploading/aws.js @@ -19,20 +19,20 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - [ - '"gulp-awspublish": "^3.0.1"', - '"concurrent-transform": "^1.0.0"' - ].forEach(pack => { - assert.fileContent('package.json', pack); + assert.JSONFileContent('package.json', { + devDependencies: { + 'gulp-awspublish': '^3.0.1', + 'concurrent-transform': '^1.0.0' + } }); }); test('does not contain wrong uploading packages', () => { - [ - '"gulp-rsync"', - '"gulp-gh-pages"' - ].forEach(pack => { - assert.noFileContent('package.json', pack); + assert.noJSONFileContent('package.json', { + devDependencies: { + 'gulp-rsync': '^0.0.5', + 'gulp-gh-pages': '^0.5.2' + } }); }); diff --git a/test/uploading/ghpages.js b/test/uploading/ghpages.js index 582b6e0..9337a2f 100644 --- a/test/uploading/ghpages.js +++ b/test/uploading/ghpages.js @@ -19,16 +19,20 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - assert.fileContent('package.json', '"gulp-gh-pages": "^0.5.2"'); + assert.JSONFileContent('package.json', { // eslint-disable-line + devDependencies: { + 'gulp-gh-pages': '^0.5.2' + } + }); }); test('does not contain wrong uploading packages', () => { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-rsync"' - ].forEach(pack => { - assert.noFileContent('package.json', pack); + assert.noJSONFileContent('package.json', { + devDependencies: { + 'gulp-awspublish': '^3.0.1', + 'concurrent-transform': '^1.0.0', + 'gulp-rsync': '^0.0.5' + } }); }); diff --git a/test/uploading/no-uploading.js b/test/uploading/no-uploading.js index 4f2f20e..450d4cb 100644 --- a/test/uploading/no-uploading.js +++ b/test/uploading/no-uploading.js @@ -26,13 +26,13 @@ test('does not create credentials files', () => { }); test('does not contain uploading packages', () => { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-rsync"', - '"gulp-gh-pages"' - ].forEach(pack => { - assert.noFileContent('package.json', pack); + assert.noJSONFileContent('package.json', { + devDependencies: { + 'gulp-awspublish': '^3.0.1', + 'concurrent-transform': '^1.0.0', + 'gulp-rsync': '^0.0.5', + 'gulp-gh-pages': '^0.5.2' + } }); }); diff --git a/test/uploading/rsync.js b/test/uploading/rsync.js index 2c61034..9dd861e 100644 --- a/test/uploading/rsync.js +++ b/test/uploading/rsync.js @@ -19,16 +19,20 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - assert.fileContent('package.json', '"gulp-rsync": "^0.0.5"'); + assert.JSONFileContent('package.json', { + devDependencies: { + 'gulp-rsync': '^0.0.5' + } + }); }); test('does not contain wrong uploading packages', () => { - [ - '"gulp-awspublish"', - '"concurrent-transform"', - '"gulp-gh-pages"' - ].forEach(pack => { - assert.noFileContent('package.json', pack); + assert.noJSONFileContent('package.json', { + devDependencies: { + 'gulp-awspublish': '^3.0.1', + 'concurrent-transform': '^1.0.0', + 'gulp-gh-pages': '^0.5.2' + } }); }); From 0415f99ef5f7ae650398bad3b797ad29beb9f258 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 01:14:47 +0200 Subject: [PATCH 169/178] Fix checking dependencies, update AVA --- generators/app/index.js | 16 +++++++++------- package.json | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index 530d1cf..53e38af 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -14,14 +14,16 @@ module.exports = generators.Base.extend({ type: Boolean }); - var dependencies = ['ruby', 'bundle', 'yo', 'gulp', 'node'].every(function (depend) { - return shelljs.which(depend); - }); + if (!this.options['skip-install']) { + var dependencies = ['ruby', 'bundle', 'yo', 'gulp', 'node'].every(function (depend) { + return shelljs.which(depend); + }); - if (!dependencies) { - this.log(chalk.red('You are missing one or more dependencies!')); - this.log(chalk.yellow('Make sure you have the required dependencies, or that they are in $PATH')); - shelljs.exit(1); + if (!dependencies) { + this.log(chalk.red('You are missing one or more dependencies!')); + this.log(chalk.yellow('Make sure you have the required dependencies, or that they are in $PATH')); + shelljs.exit(1); + } } }, diff --git a/package.json b/package.json index 75b5367..130af4a 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "yeoman-generator": "^0.23.3" }, "devDependencies": { - "ava": "^0.14.0", + "ava": "^0.15.1", "coveralls": "^2.11.9", "nyc": "^6.4.4", "xo": "^0.15.1", From 5acea649c9ffd0d43477dabae418061b2722f511 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 01:30:23 +0200 Subject: [PATCH 170/178] Update packages, fix testing for versions When checking that a package isn't installed you don't need a to check for a version, only that the package doesn't exist. Also helps making upading packages and their tests a lot easier. --- generators/gulp/index.js | 12 ++++++------ generators/gulp/templates/gulpfile.js | 4 ++-- test/gulp.js | 16 ++++++++-------- test/uploading/aws.js | 6 +++--- test/uploading/ghpages.js | 6 +++--- test/uploading/no-uploading.js | 8 ++++---- test/uploading/rsync.js | 8 ++++---- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/generators/gulp/index.js b/generators/gulp/index.js index 0faf4b7..359e2e9 100644 --- a/generators/gulp/index.js +++ b/generators/gulp/index.js @@ -44,9 +44,9 @@ module.exports = generators.Base.extend({ 'gulp-cssnano': '^2.1.0', 'gulp-eslint': '^2.0.0', 'gulp-gzip': '^1.1.0', - 'gulp-htmlmin': '^1.3.0', + 'gulp-htmlmin': '^2.0.0', 'gulp-if': '^2.0.0', - 'gulp-imagemin': '^2.1.0', + 'gulp-imagemin': '^3.0.0', 'gulp-inject': '^4.0.0', 'gulp-load-plugins': '^1.2.0', 'gulp-newer': '^1.1.0', @@ -58,17 +58,17 @@ module.exports = generators.Base.extend({ 'gulp-sourcemaps': '^1.3.0', 'gulp-uglify': '^1.5.1', 'gulp-uncss': '^1.0.0', - 'shelljs': '^0.6.0', - 'yargs': '^4.3.2' + 'shelljs': '^0.7.0', + 'yargs': '^4.7.0' }); if (this.options.uploading === 'Amazon S3') { - pkg.devDependencies['gulp-awspublish'] = '^3.0.1'; + pkg.devDependencies['gulp-awspublish'] = '^3.2.0'; pkg.devDependencies['concurrent-transform'] = '^1.0.0'; } if (this.options.uploading === 'Rsync') { - pkg.devDependencies['gulp-rsync'] = '^0.0.5'; + pkg.devDependencies['gulp-rsync'] = '^0.0.6'; } if (this.options.uploading === 'Github Pages') { diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index ca9d01d..adee49e 100644 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -164,8 +164,8 @@ gulp.task('inject:footer', () => gulp.task('images', () => gulp.src('src/assets/images/**/*') .pipe($.cache($.imagemin({ - progressive: true, - interlaced: true + imagemin.gifsicle({interlaced: true}), + imagemin.mozjpeg({progressive: true}) }))) .pipe(gulp.dest('.tmp/assets/images')) .pipe($.size({title: 'images'})) diff --git a/test/gulp.js b/test/gulp.js index 254e3ec..6299070 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -30,9 +30,9 @@ test('package.json contains correct packages', () => { 'gulp-cssnano': '^2.1.0', 'gulp-eslint': '^2.0.0', 'gulp-gzip': '^1.1.0', - 'gulp-htmlmin': '^1.3.0', + 'gulp-htmlmin': '^2.0.0', 'gulp-if': '^2.0.0', - 'gulp-imagemin': '^2.1.0', + 'gulp-imagemin': '^3.0.0', 'gulp-inject': '^4.0.0', 'gulp-load-plugins': '^1.2.0', 'gulp-newer': '^1.1.0', @@ -44,8 +44,8 @@ test('package.json contains correct packages', () => { 'gulp-sourcemaps': '^1.3.0', 'gulp-uglify': '^1.5.1', 'gulp-uncss': '^1.0.0', - 'shelljs': '^0.6.0', - 'yargs': '^4.3.2' + 'shelljs': '^0.7.0', + 'yargs': '^4.7.0' } }); }); @@ -60,10 +60,10 @@ test('does not create credentials files', () => { test('does not contain uploading packages', () => { assert.noJSONFileContent('package.json', { devDependencies: { - 'gulp-awspublish': '^3.0.1', - 'concurrent-transform': '^1.0.0', - 'gulp-rsync': '^0.0.5', - 'gulp-gh-pages': '^0.5.2' + 'gulp-awspublish': '', + 'concurrent-transform': '', + 'gulp-rsync': '', + 'gulp-gh-pages': '' } }); }); diff --git a/test/uploading/aws.js b/test/uploading/aws.js index 312e3ec..1ae9ac1 100644 --- a/test/uploading/aws.js +++ b/test/uploading/aws.js @@ -21,7 +21,7 @@ test('creates package.json file', () => { test('contain correct uploading packages', () => { assert.JSONFileContent('package.json', { devDependencies: { - 'gulp-awspublish': '^3.0.1', + 'gulp-awspublish': '^3.2.0', 'concurrent-transform': '^1.0.0' } }); @@ -30,8 +30,8 @@ test('contain correct uploading packages', () => { test('does not contain wrong uploading packages', () => { assert.noJSONFileContent('package.json', { devDependencies: { - 'gulp-rsync': '^0.0.5', - 'gulp-gh-pages': '^0.5.2' + 'gulp-rsync': '', + 'gulp-gh-pages': '' } }); }); diff --git a/test/uploading/ghpages.js b/test/uploading/ghpages.js index 9337a2f..62516a1 100644 --- a/test/uploading/ghpages.js +++ b/test/uploading/ghpages.js @@ -29,9 +29,9 @@ test('contain correct uploading packages', () => { test('does not contain wrong uploading packages', () => { assert.noJSONFileContent('package.json', { devDependencies: { - 'gulp-awspublish': '^3.0.1', - 'concurrent-transform': '^1.0.0', - 'gulp-rsync': '^0.0.5' + 'gulp-awspublish': '', + 'concurrent-transform': '', + 'gulp-rsync': '' } }); }); diff --git a/test/uploading/no-uploading.js b/test/uploading/no-uploading.js index 450d4cb..2e02792 100644 --- a/test/uploading/no-uploading.js +++ b/test/uploading/no-uploading.js @@ -28,10 +28,10 @@ test('does not create credentials files', () => { test('does not contain uploading packages', () => { assert.noJSONFileContent('package.json', { devDependencies: { - 'gulp-awspublish': '^3.0.1', - 'concurrent-transform': '^1.0.0', - 'gulp-rsync': '^0.0.5', - 'gulp-gh-pages': '^0.5.2' + 'gulp-awspublish': '', + 'concurrent-transform': '', + 'gulp-rsync': '', + 'gulp-gh-pages': '' } }); }); diff --git a/test/uploading/rsync.js b/test/uploading/rsync.js index 9dd861e..9ab4f7a 100644 --- a/test/uploading/rsync.js +++ b/test/uploading/rsync.js @@ -21,7 +21,7 @@ test('creates package.json file', () => { test('contain correct uploading packages', () => { assert.JSONFileContent('package.json', { devDependencies: { - 'gulp-rsync': '^0.0.5' + 'gulp-rsync': '^0.0.6' } }); }); @@ -29,9 +29,9 @@ test('contain correct uploading packages', () => { test('does not contain wrong uploading packages', () => { assert.noJSONFileContent('package.json', { devDependencies: { - 'gulp-awspublish': '^3.0.1', - 'concurrent-transform': '^1.0.0', - 'gulp-gh-pages': '^0.5.2' + 'gulp-awspublish': '', + 'concurrent-transform': '', + 'gulp-gh-pages': '' } }); }); From 63f97fbadcc1f8cbfb39ef549e4b6b88e58df740 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 01:36:22 +0200 Subject: [PATCH 171/178] Ignore some assert functions --- package.json | 3 --- test/gulp.js | 2 +- test/uploading/aws.js | 2 +- test/uploading/rsync.js | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 130af4a..8c24273 100644 --- a/package.json +++ b/package.json @@ -37,9 +37,6 @@ }, "xo": { "space": true, - "rules": { - "new-cap": 0 - }, "ignores": [ "generators/app/templates/**", "generators/boilerplate/templates/**", diff --git a/test/gulp.js b/test/gulp.js index 6299070..55fca11 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -19,7 +19,7 @@ test('creates package.json', () => { }); test('package.json contains correct packages', () => { - assert.JSONFileContent('package.json', { + assert.JSONFileContent('package.json', { // eslint-disable-line devDependencies: { 'autoprefixer': '^6.2.3', 'browser-sync': '^2.11.0', diff --git a/test/uploading/aws.js b/test/uploading/aws.js index 1ae9ac1..1fab39e 100644 --- a/test/uploading/aws.js +++ b/test/uploading/aws.js @@ -19,7 +19,7 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - assert.JSONFileContent('package.json', { + assert.JSONFileContent('package.json', { // eslint-disable-line devDependencies: { 'gulp-awspublish': '^3.2.0', 'concurrent-transform': '^1.0.0' diff --git a/test/uploading/rsync.js b/test/uploading/rsync.js index 9ab4f7a..fc26927 100644 --- a/test/uploading/rsync.js +++ b/test/uploading/rsync.js @@ -19,7 +19,7 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - assert.JSONFileContent('package.json', { + assert.JSONFileContent('package.json', { // eslint-disable-line devDependencies: { 'gulp-rsync': '^0.0.6' } From ca13406b2d8bcdbccd0058128b51303588536b53 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 02:04:43 +0200 Subject: [PATCH 172/178] Readd welcome message, update skip-install message --- generators/app/index.js | 27 +++++++++++++++++++++++++-- package.json | 3 ++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index 53e38af..d6d0ac1 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -4,6 +4,7 @@ var _ = require('lodash'); var chalk = require('chalk'); var generators = require('yeoman-generator'); var shelljs = require('shelljs'); +var yosay = require('yosay'); module.exports = generators.Base.extend({ constructor: function () { @@ -14,6 +15,11 @@ module.exports = generators.Base.extend({ type: Boolean }); + this.option('skip-welcome-message', { + desc: 'Skips the welcome message', + type: Boolean + }); + if (!this.options['skip-install']) { var dependencies = ['ruby', 'bundle', 'yo', 'gulp', 'node'].every(function (depend) { return shelljs.which(depend); @@ -33,6 +39,10 @@ module.exports = generators.Base.extend({ }, prompting: function () { + if (!this.options['skip-welcome-message']) { + this.log(yosay(`'Allo 'allo`)); + } + var questions = [{ name: 'projectName', message: 'What is the name of your project?', @@ -145,11 +155,24 @@ module.exports = generators.Base.extend({ }, installing: function () { + this.installDependencies({ + skipInstall: this.options['skip-install'] + }); if (this.options['skip-install']) { - this.log('Please run "npm install" and "bundle install" to install dependencies'); + this.log('Please run bundle install to '); } else { - this.npmInstall(); this.spawnCommand('bundle', ['install', '--quiet']); } + }, + + end: function () { + var skipInstallMessage = + '\nPlease run ' + chalk.blue('npm install') + ' and ' + + chalk.blue('bundle install') + ' to install dependencies'; + + if (this.options['skip-install']) { + this.log(skipInstallMessage); + return; + } } }); diff --git a/package.json b/package.json index 8c24273..7cf182f 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "lodash": "^4.11.1", "shelljs": "^0.7.0", "yargs": "^4.6.0", - "yeoman-generator": "^0.23.3" + "yeoman-generator": "^0.23.3", + "yosay": "^1.1.1" }, "devDependencies": { "ava": "^0.15.1", From d2479127ea36e0f97a08844a1aac115945d34a1c Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 02:08:14 +0200 Subject: [PATCH 173/178] Didn't read the documentation... --- test/gulp.js | 4 ++-- test/uploading/aws.js | 4 ++-- test/uploading/ghpages.js | 4 ++-- test/uploading/no-uploading.js | 2 +- test/uploading/rsync.js | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/gulp.js b/test/gulp.js index 55fca11..529fa48 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -19,7 +19,7 @@ test('creates package.json', () => { }); test('package.json contains correct packages', () => { - assert.JSONFileContent('package.json', { // eslint-disable-line + assert.jsonFileContent('package.json', { devDependencies: { 'autoprefixer': '^6.2.3', 'browser-sync': '^2.11.0', @@ -58,7 +58,7 @@ test('does not create credentials files', () => { }); test('does not contain uploading packages', () => { - assert.noJSONFileContent('package.json', { + assert.noJsonFileContent('package.json', { devDependencies: { 'gulp-awspublish': '', 'concurrent-transform': '', diff --git a/test/uploading/aws.js b/test/uploading/aws.js index 1fab39e..dd99e70 100644 --- a/test/uploading/aws.js +++ b/test/uploading/aws.js @@ -19,7 +19,7 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - assert.JSONFileContent('package.json', { // eslint-disable-line + assert.jsonFileContent('package.json', { devDependencies: { 'gulp-awspublish': '^3.2.0', 'concurrent-transform': '^1.0.0' @@ -28,7 +28,7 @@ test('contain correct uploading packages', () => { }); test('does not contain wrong uploading packages', () => { - assert.noJSONFileContent('package.json', { + assert.noJsonFileContent('package.json', { devDependencies: { 'gulp-rsync': '', 'gulp-gh-pages': '' diff --git a/test/uploading/ghpages.js b/test/uploading/ghpages.js index 62516a1..65e7bf2 100644 --- a/test/uploading/ghpages.js +++ b/test/uploading/ghpages.js @@ -19,7 +19,7 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - assert.JSONFileContent('package.json', { // eslint-disable-line + assert.jsonFileContent('package.json', { devDependencies: { 'gulp-gh-pages': '^0.5.2' } @@ -27,7 +27,7 @@ test('contain correct uploading packages', () => { }); test('does not contain wrong uploading packages', () => { - assert.noJSONFileContent('package.json', { + assert.noJsonFileContent('package.json', { devDependencies: { 'gulp-awspublish': '', 'concurrent-transform': '', diff --git a/test/uploading/no-uploading.js b/test/uploading/no-uploading.js index 2e02792..a2d2ece 100644 --- a/test/uploading/no-uploading.js +++ b/test/uploading/no-uploading.js @@ -26,7 +26,7 @@ test('does not create credentials files', () => { }); test('does not contain uploading packages', () => { - assert.noJSONFileContent('package.json', { + assert.noJsonFileContent('package.json', { devDependencies: { 'gulp-awspublish': '', 'concurrent-transform': '', diff --git a/test/uploading/rsync.js b/test/uploading/rsync.js index fc26927..4318977 100644 --- a/test/uploading/rsync.js +++ b/test/uploading/rsync.js @@ -19,7 +19,7 @@ test('creates package.json file', () => { }); test('contain correct uploading packages', () => { - assert.JSONFileContent('package.json', { // eslint-disable-line + assert.jsonFileContent('package.json', { devDependencies: { 'gulp-rsync': '^0.0.6' } @@ -27,7 +27,7 @@ test('contain correct uploading packages', () => { }); test('does not contain wrong uploading packages', () => { - assert.noJSONFileContent('package.json', { + assert.noJsonFileContent('package.json', { devDependencies: { 'gulp-awspublish': '', 'concurrent-transform': '', From 65a05d6050b808b0f354120e8a03ecf644d9141f Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 02:14:43 +0200 Subject: [PATCH 174/178] Update license year [ci skip] --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index e075555..4498e35 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2015 Sondre Nilsen +Copyright (c) 2014-2016 Sondre Nilsen Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From ee1914e8d1807f8c7c96931e4a6f90247206a68f Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sat, 28 May 2016 02:20:07 +0200 Subject: [PATCH 175/178] New release [ci skip] --- CHANGELOG.md | 42 ++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27d9506..032c4ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,45 @@ + +## 1.0.0-beta.22 +> 2016-05-28 + +This is for the most part a pure backend update release and nothing too major +happened to the generator itself besides updating a few packages. Other than +that I moved to using AVA instead of Mocha for testing and had a heyday trying +to get that to work, it was quite the party. But it all works well, and quite a +lot faster as well. + +#### Changelog: +* [[`65a05d6050`](https://github.com/sondr3/generator-jekyllized/commit/65a05d6050)] - Update license year \[ci skip\] +* [[`d2479127ea`](https://github.com/sondr3/generator-jekyllized/commit/d2479127ea)] - Didn't read the documentation... +* [[`ca13406b2d`](https://github.com/sondr3/generator-jekyllized/commit/ca13406b2d)] - Readd welcome message, update skip-install message +* [[`63f97fbadc`](https://github.com/sondr3/generator-jekyllized/commit/63f97fbadc)] - Ignore some assert functions +* [[`5acea649c9`](https://github.com/sondr3/generator-jekyllized/commit/5acea649c9)] - Update packages, fix testing for versions +* [[`0415f99ef5`](https://github.com/sondr3/generator-jekyllized/commit/0415f99ef5)] - Fix checking dependencies, update AVA +* [[`19ea9665c3`](https://github.com/sondr3/generator-jekyllized/commit/19ea9665c3)] - Fix tests, update yeoman-generator +* [[`fa9e6b166a`](https://github.com/sondr3/generator-jekyllized/commit/fa9e6b166a)] - Nope, not working still... +* [[`07658812f4`](https://github.com/sondr3/generator-jekyllized/commit/07658812f4)] - Third time's the charm +* [[`c3eab364a5`](https://github.com/sondr3/generator-jekyllized/commit/c3eab364a5)] - Second try +* [[`8b03cea0e3`](https://github.com/sondr3/generator-jekyllized/commit/8b03cea0e3)] - Apparently you must tell it to install node packages as well +* [[`3c201a7f45`](https://github.com/sondr3/generator-jekyllized/commit/3c201a7f45)] - Install bundler when testing +* [[`deac0babc5`](https://github.com/sondr3/generator-jekyllized/commit/deac0babc5)] - Don't install dependencies +* [[`7e5b80a8f1`](https://github.com/sondr3/generator-jekyllized/commit/7e5b80a8f1)] - ***Revert*** "back from all the testing of the tests" +* [[`abe1489574`](https://github.com/sondr3/generator-jekyllized/commit/abe1489574)] - ***Revert*** "Try using --serial for AVA on Travis" +* [[`a3c1dd3ce4`](https://github.com/sondr3/generator-jekyllized/commit/a3c1dd3ce4)] - Fix syntax error +* [[`0971a893c8`](https://github.com/sondr3/generator-jekyllized/commit/0971a893c8)] - Even more testing the tests +* [[`64425a1497`](https://github.com/sondr3/generator-jekyllized/commit/64425a1497)] - Test testing +* [[`9b180fa433`](https://github.com/sondr3/generator-jekyllized/commit/9b180fa433)] - Try using --serial for AVA on Travis +* [[`069ba32849`](https://github.com/sondr3/generator-jekyllized/commit/069ba32849)] - Rename a test because having two of them got confusing +* [[`e5463ac2d6`](https://github.com/sondr3/generator-jekyllized/commit/e5463ac2d6)] - Try running AVA in serial +* [[`4a85a4f7e7`](https://github.com/sondr3/generator-jekyllized/commit/4a85a4f7e7)] - Update packages +* [[`b8db04b189`](https://github.com/sondr3/generator-jekyllized/commit/b8db04b189)] - Give me Travis updates on Gitter +* [[`6c9b516adb`](https://github.com/sondr3/generator-jekyllized/commit/6c9b516adb)] - Refactor testing of uploading a bit +* [[`fa3b95c818`](https://github.com/sondr3/generator-jekyllized/commit/fa3b95c818)] - Add gitter badge, remove some other badges +* [[`1ac45b380f`](https://github.com/sondr3/generator-jekyllized/commit/1ac45b380f)] - Remove gulpfile and unused files from root as well +* [[`a78b9cc6a1`](https://github.com/sondr3/generator-jekyllized/commit/a78b9cc6a1)] - Remove unused files +* [[`830b5dfee6`](https://github.com/sondr3/generator-jekyllized/commit/830b5dfee6)] - I dun goofed +* [[`b710300749`](https://github.com/sondr3/generator-jekyllized/commit/b710300749)] - Removed node v4 by accident +* [[`e77a1e5d50`](https://github.com/sondr3/generator-jekyllized/commit/e77a1e5d50)] - Move to using AVA for tests + ## 1.0.0-beta.21 > 2016-05-22 diff --git a/package.json b/package.json index 7cf182f..02b7c56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.21", + "version": "1.0.0-beta.22", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [ From 3a39933bccdeff78a43e63f10aab419511e157aa Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 29 May 2016 03:02:37 +0200 Subject: [PATCH 176/178] Simplify validate function --- generators/app/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/generators/app/index.js b/generators/app/index.js index d6d0ac1..f29f768 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -55,13 +55,7 @@ module.exports = generators.Base.extend({ name: 'projectURL', message: chalk.yellow('If you will be using Github Pages, use username.github.io\n') + chalk.yellow('? ') + 'What will the URL for your project be?', - validate: function (input) { - if (input.startsWith('http')) { - return true; - } - - return 'URL must contain either HTTP or HTTPs'; - }, + validate: i => i.startsWith('http') ? true : 'URL must contain either HTTP or HTTPs', store: true }, { name: 'authorName', From 3a142ef021fb61439e686b8e7a63e7d2ede32b72 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 29 May 2016 14:21:53 +0200 Subject: [PATCH 177/178] Fix syntax for gulp-imagemin --- generators/gulp/templates/gulpfile.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/generators/gulp/templates/gulpfile.js b/generators/gulp/templates/gulpfile.js index adee49e..6551e2f 100644 --- a/generators/gulp/templates/gulpfile.js +++ b/generators/gulp/templates/gulpfile.js @@ -163,10 +163,12 @@ gulp.task('inject:footer', () => // 'gulp images' -- optimizes and caches your images gulp.task('images', () => gulp.src('src/assets/images/**/*') - .pipe($.cache($.imagemin({ - imagemin.gifsicle({interlaced: true}), - imagemin.mozjpeg({progressive: true}) - }))) + .pipe($.cache($.imagemin([ + $.imagemin.gifsicle({interlaced: true}), + $.imagemin.jpegtran({progressive: true}), + $.imagemin.optipng(), + $.imagemin.svgo({plugins: [{cleanupIDs: false}]}) + ]))) .pipe(gulp.dest('.tmp/assets/images')) .pipe($.size({title: 'images'})) ); From 0ecea5fec65f3b34db92e0b1fbbf303e9c06caeb Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 29 May 2016 14:24:45 +0200 Subject: [PATCH 178/178] Beta release 1.0.0-beta.23 [ci skip] --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 032c4ff..27dd054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## 1.0.0-beta.23 +> 2016-05-29 + +Fixed the syntax for gulp-imagemin as it made the gulpfile error out, and also +updated the function to validate the URL to be smaller. + +#### Changelog: +* [[`3a142ef021`](https://github.com/sondr3/generator-jekyllized/commit/3a142ef021)] - Fix syntax for gulp-imagemin +* [[`3a39933bcc`](https://github.com/sondr3/generator-jekyllized/commit/3a39933bcc)] - Simplify validate function + ## 1.0.0-beta.22 > 2016-05-28 diff --git a/package.json b/package.json index 02b7c56..fd5984f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-jekyllized", - "version": "1.0.0-beta.22", + "version": "1.0.0-beta.23", "main": "index.js", "description": "Use Jekyll with Gulp: Sass, sourcemaps, AutoPrefixer, asset optimization and cache busting and much, much more. Can you really want more?", "keywords": [