From b74a88b72d215d64eede6596ce9d0587d93f55a0 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Tue, 19 May 2015 23:27:00 +0200 Subject: [PATCH] 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); + }); + }); +});