Permalink
Browse files

completely refactored to only generate a single helper file

  • Loading branch information...
jonschlinkert committed Jul 4, 2013
1 parent b064afd commit e94e747a1892a569bc5b8306b4a6ed540aef1174
Showing with 9 additions and 265 deletions.
  1. +1 −15 .gitignore
  2. +1 −0 README.md
  3. +0 −25 lib/mixins.js
  4. +1 −1 package.json
  5. +1 −2 rename.json
  6. +0 −9 root/.gitattributes
  7. +0 −8 root/.gitignore
  8. +0 −13 root/.jshintrc
  9. +0 −6 root/.travis.yml
  10. +0 −46 root/Gruntfile.js
  11. +0 −11 root/README.md
  12. +0 −8 root/bower.json
  13. +0 −25 root/test/example.hbs
  14. +0 −9 root/test/example.json
  15. +0 −14 root/test/helper-example.js
  16. +5 −73 template.js
View
@@ -1,17 +1,3 @@
-lib-cov
-*.seed
-*.log
-*.csv
-*.dat
-*.out
-*.pid
-*.gz
-
-pids
-logs
-results
-
-npm-debug.log
node_modules
-
+npm-debug.log
*.sublime-*
View
@@ -49,6 +49,7 @@ In the the `test` directory you will find the following files:
## Related info
+* [grunt-init-assemble](https://github.com/assemble/grunt-init-assemble)
* [handlebars-helpers](https://github.com/assemble/handlebars-helpers)
* [Assemble's documentation](http://assemble.io)
* [assemble-less](https://github.com/assemble/assemble-less)
View
@@ -1,25 +0,0 @@
-/*
- * assemble-manifest
- * https://github.com/assemble/assemble-manifest
- *
- * Copyright (c) 2013 Jon Schlinkert, Brian Woodward, contributors.
- * Licensed under the MIT license.
- */
-
-'use strict';
-
-
-exports.init = function(grunt) {
- var _ = grunt.util._; // lodash
- var exports = {};
-
- _.mixin({
-
- // Fix path in sublime-project file.
- sublimePath: function(urlString) {
- return urlString.replace(/\\/g, '/').replace(/\:/, '');
- }
-
- });
- return exports;
-};
View
@@ -25,7 +25,7 @@
],
"repository": {
"type": "git",
- "url": "git://github.com/assemble/grunt-init-helper.git"
+ "url": "https://github.com/assemble/grunt-init-helper.git"
},
"bugs": {
"url": "https://github.com/assemble/grunt-init-helper/issues"
View
@@ -1,4 +1,3 @@
{
- "name.js": "helper-{%= helper_name %}.js",
- "name.sublime-project": "{%= name %}.sublime-project"
+ "name.js": "helper-{%= name %}.js"
}
View
@@ -1,9 +0,0 @@
-# Set default behaviour, in case users don't have core.autocrlf set.
-* text=lf
-* text eol=lf
-*.* eol=lf
-
-*.jpg binary
-*.gif binary
-*.png binary
-*.jpeg binary
View
@@ -1,8 +0,0 @@
-node_modules
-npm-debug.log
-
-tmp
-temp
-TODO.md
-
-*.sublime-*
View
@@ -1,13 +0,0 @@
-{
- "curly": true,
- "eqeqeq": true,
- "immed": true,
- "latedef": true,
- "newcap": true,
- "noarg": true,
- "sub": true,
- "undef": true,
- "boss": true,
- "eqnull": true,
- "node": true
-}
View
@@ -1,6 +0,0 @@
-language: node_js
-node_js:
- - "0.8"
-before_script:
- - npm install -g grunt-cli
- - npm install grunt
View
@@ -1,46 +0,0 @@
-/*
- * {%= name %}
- * https://github.com/{%= author_name %}/{%= name %}
- * Copyright (c) {%= grunt.template.today('yyyy') %}
- * Licensed under the {%= licenses.join(', ') %} license{%= licenses.length === 1 ? '' : 's' %}.
- */
-
-'use strict';
-
-module.exports = function(grunt) {
-
- // Project configuration.
- grunt.initConfig({
-
- jshint: {
- all: [
- 'Gruntfile.js',
- 'helper*.js',
- 'test/*.js'
- ],
- options: {
- jshintrc: '.jshintrc'
- }
- },
- assemble: {
- pages: {
- options: {
- flatten: true,
- helpers: ['test/helper-example.js', 'helper-{%= helper_name %}.js'],
- data: 'test/example.json'
- },
- files: {
- 'test/': ['test/example.hbs']
- }
- }
- }
- });
-
- // Load npm plugins to provide necessary tasks.
- grunt.loadNpmTasks('assemble');
- grunt.loadNpmTasks('grunt-contrib-jshint');
-
- // Default tasks to be run.
- grunt.registerTask('default', ['jshint', 'assemble']);
-};
-
View
@@ -1,11 +0,0 @@
-# {%= name %}
-
-> {%= description %}
-
-To learn more about Assemble and registering custom helpers, visit [assemble.io/docs/custom-helpers](http://assemble.io/docs/Custom-Helpers.html).
-
-## Contributing
-In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt][].
-
-## Release History
-_(Nothing yet)_
View
@@ -1,8 +0,0 @@
-{
- "name": "{%= name %}",
- "dependencies": {
- "grunt-contrib-jshint": "~0.6.0",
- "assemble": "~0.4.0",
- "grunt": "~0.4.1"
- }
-}
View
@@ -1,25 +0,0 @@
-<!doctype html>
-<html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Example helper usage</title>
- <link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet">
- </head>
- <body>
- <div class="page-header">
- <h1>Example helper usage</h1>
- </div>
-
- <h2>Example "track" helper</h2>
- <p>This helper was included to demonstrate how helpers work.</p>
- <ul>
- <li> {{#example}} <a class="nav-link" href="{{url}}" {{track navbar}}>{{text}}</a> {{/example}} </li>
- </ul>
-
- <h2>{%= helper_name %} helper</h2>
- <p>{%= description %}.</p>
- {{{%= helper_name %} "This is your helper."}}
-
- </body>
-</html>
-
View
@@ -1,9 +0,0 @@
-{
- "text": "Assemble Docs",
- "url": "http://assemble.io",
- "navbar": {
- "category": "Docs",
- "action": "Downloaded",
- "label": "Assemble package"
- }
-}
@@ -1,14 +0,0 @@
-(function() {
- module.exports.register = function(Handlebars, options) {
-
- // Add tracking codes for Google Analytics. Of course, you must have
- // event tracking setup with google analytics first:
- // https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide?hl=pt-PT
- Handlebars.registerHelper('track', function(obj) {
- var code = 'onclick="_gaq.push([\'_trackEvent\', \'' + obj.category + '\', \'' + obj.action + '\', \'' + obj.label + '\']);"';
- return new Handlebars.SafeString(code);
- });
-
-
- };
-}).call(this);
View
@@ -1,5 +1,5 @@
/*
- * grunt-init-assemble
+ * grunt-init-helper
* https://github.com/assemble/assemble
*
* Copyright (c) 2013 Jon Schlinkert, Brian Woodward, contributors
@@ -8,8 +8,6 @@
'use strict';
-var path = require('path');
-
// Basic template description.
exports.description = 'Grunt init template for creating Assemble helpers.';
@@ -18,87 +16,21 @@ exports.notes = 'For more information about creating Assemble projects, ' +
'please see the docs at http://assemble.io/docs/';
// Template-specific notes to be displayed after question prompts.
-exports.after = 'Now install project dependencies with "npm install".' +
- 'After that, you may execute project tasks with "grunt assemble". For ' +
- 'more information about installing and configuring Assemble, please ' +
- 'visit:' +
- '\n\n' +
- 'http://assemble.io/docs/';
-
-// Any existing file or directory matching this wildcard will cause a warning.
-exports.warnOn = ['*'];
+exports.after = 'Visit http://assemble.io/docs/Helpers for more information ' +
+ 'about creating, installing and using helpers.';
// The actual init template.
exports.template = function(grunt, init, done) {
-
- var _ = grunt.util._; // lodash
-
- // Use lodash mixin to create sublime text project file
- // when a new project is created. Delete them if you don't
- // need them ;-)
- _.mixin(require('./lib/mixins').init(grunt));
-
init.process({type: 'assemble'}, [
// Prompt for these values.
- init.prompt('helper_name'),
- {
- name: 'description',
- message: 'Description',
- default: 'Handlebars helper for Assemble.',
- warning: 'May consist of any characters.'
- },
- init.prompt('version'),
- init.prompt('author_name'),
- init.prompt('repository'),
- init.prompt('homepage'),
- init.prompt('author_email'),
- init.prompt('author_url'),
- init.prompt('bugs'),
- init.prompt('licenses'),
- init.prompt('grunt_version'),
- {
- name: 'assemble_version',
- message: 'What versions of Assemble does it require?',
- default: '~0.4.0',
- warning: 'Must be a valid semantic version range descriptor.'
- },
- {
- name: 'travis',
- message: 'Will this project be tested with Travis CI?',
- default: 'Y/n',
- warning: 'If selected, you must enable Travis support for this project in https://travis-ci.org/profile'
- },
+ init.prompt('name')
], function(err, props) {
- // Set a few grunt-plugin-specific properties.
- props.name = 'assemble-helpers-' + props.helper_name;
- props.repository = 'git://github.com/' + props.author_name + '/' + props.name + '.git';
- props.hompage = 'https://github.com/' + props.author_name + '/' + props.name + '/';
- props.main = 'Gruntfile.js';
- props.npm_test = 'grunt assemble';
- props.keywords = ['gruntplugin', 'build', 'site generator', 'component generator', 'blog generator', 'handlebars', 'templates'];
- props.devDependencies = {
- 'grunt-contrib-jshint': '~0.6.0',
- 'assemble': props.assemble_version
- };
- props.travis = /y/i.test(props.travis);
- props.travis_node_version = '0.8';
-
- // Files to copy (and process).
- var files = init.filesToCopy(props);
- if (!props.travis) { delete files['.travis.yml']; }
-
- // Add properly-named license files.
- init.addLicenseFiles(files, props.licenses);
-
// Actually copy (and process) files.
+ var files = init.filesToCopy(props);
init.copyAndProcess(files, props);
- // Generate package.json and bower.json files.
- init.writePackageJSON('package.json', props);
-
// All done!
done();
});
-
};

0 comments on commit e94e747

Please sign in to comment.