├── .gitignore ├── bin └── grunt-gruntplugin-example ├── grunt.js ├── package.json ├── tasks └── gruntplugin-example.js ├── test └── gruntplugin-example_test.js ├── LICENSE-MIT └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | -------------------------------------------------------------------------------- /bin/grunt-gruntplugin-example: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('grunt').npmTasks('grunt-gruntplugin-example').cli(); 3 | -------------------------------------------------------------------------------- /grunt.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | // Project configuration. 4 | grunt.initConfig({ 5 | test: { 6 | files: ['test/**/*.js'] 7 | }, 8 | lint: { 9 | files: ['grunt.js', 'tasks/**/*.js', 'test/**/*.js'] 10 | }, 11 | watch: { 12 | files: '', 13 | tasks: 'default' 14 | }, 15 | jshint: { 16 | options: { 17 | curly: true, 18 | eqeqeq: true, 19 | immed: true, 20 | latedef: true, 21 | newcap: true, 22 | noarg: true, 23 | sub: true, 24 | undef: true, 25 | boss: true, 26 | eqnull: true, 27 | node: true, 28 | es5: true 29 | }, 30 | globals: {} 31 | } 32 | }); 33 | 34 | // Load local tasks. 35 | grunt.loadTasks('tasks'); 36 | 37 | // Default task. 38 | grunt.registerTask('default', 'lint test'); 39 | 40 | }; 41 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-gruntplugin-example", 3 | "description": "This is example output generated by the \"grunt init:gruntplugin\" task.", 4 | "version": "0.1.0", 5 | "homepage": "https://github.com/cowboy/grunt-gruntplugin-example", 6 | "author": { 7 | "name": "\"Cowboy\" Ben Alman", 8 | "url": "http://benalman.com/" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git://github.com/cowboy/grunt-gruntplugin-example.git" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/cowboy/grunt-gruntplugin-example/issues" 16 | }, 17 | "licenses": [ 18 | { 19 | "type": "MIT", 20 | "url": "https://github.com/cowboy/grunt-gruntplugin-example/blob/master/LICENSE-MIT" 21 | } 22 | ], 23 | "main": "grunt.js", 24 | "bin": "bin/grunt-gruntplugin-example", 25 | "engines": { 26 | "node": "*" 27 | }, 28 | "scripts": { 29 | "test": "grunt test" 30 | }, 31 | "dependencies": { 32 | "grunt": "~0.3.8" 33 | }, 34 | "devDependencies": { 35 | "grunt": "~0.3.8" 36 | }, 37 | "keywords": [ 38 | "gruntplugin" 39 | ] 40 | } -------------------------------------------------------------------------------- /tasks/gruntplugin-example.js: -------------------------------------------------------------------------------- 1 | /* 2 | * grunt-gruntplugin-example 3 | * https://github.com/cowboy/grunt-gruntplugin-example 4 | * 5 | * Copyright (c) 2012 "Cowboy" Ben Alman 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | module.exports = function(grunt) { 10 | 11 | // Please see the grunt documentation for more information regarding task and 12 | // helper creation: https://github.com/cowboy/grunt/blob/master/docs/toc.md 13 | 14 | // ========================================================================== 15 | // TASKS 16 | // ========================================================================== 17 | 18 | grunt.registerTask('gruntplugin-example', 'Your task description goes here.', function() { 19 | grunt.log.write(grunt.helper('gruntplugin-example')); 20 | }); 21 | 22 | // ========================================================================== 23 | // HELPERS 24 | // ========================================================================== 25 | 26 | grunt.registerHelper('gruntplugin-example', function() { 27 | return 'gruntplugin-example!!!'; 28 | }); 29 | 30 | }; 31 | -------------------------------------------------------------------------------- /test/gruntplugin-example_test.js: -------------------------------------------------------------------------------- 1 | var grunt = require('grunt'); 2 | 3 | /* 4 | ======== A Handy Little Nodeunit Reference ======== 5 | https://github.com/caolan/nodeunit 6 | 7 | Test methods: 8 | test.expect(numAssertions) 9 | test.done() 10 | Test assertions: 11 | test.ok(value, [message]) 12 | test.equal(actual, expected, [message]) 13 | test.notEqual(actual, expected, [message]) 14 | test.deepEqual(actual, expected, [message]) 15 | test.notDeepEqual(actual, expected, [message]) 16 | test.strictEqual(actual, expected, [message]) 17 | test.notStrictEqual(actual, expected, [message]) 18 | test.throws(block, [error], [message]) 19 | test.doesNotThrow(block, [error], [message]) 20 | test.ifError(value) 21 | */ 22 | 23 | exports['gruntplugin-example'] = { 24 | setUp: function(done) { 25 | // setup here 26 | done(); 27 | }, 28 | 'helper': function(test) { 29 | test.expect(1); 30 | // tests here 31 | test.equal(grunt.helper('gruntplugin-example'), 'gruntplugin-example!!!', 'should return the correct value.'); 32 | test.done(); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 "Cowboy" Ben Alman 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Grunt "init:gruntplugin" example 2 | 3 | This is example output generated by the "grunt init:gruntplugin" task. 4 | 5 | _Note: this repository was generated dynamically using grunt v0.3.8. Instead of 6 | reporting issues here, please report any issues with this repository as 7 | [grunt issues][issues]. Instead of watching or forking this repository, 8 | watch [grunt][grunt] and use the grunt [init task][init]._ 9 | 10 | ## Project Creation Transcript 11 | The following is a transcript of the session in which this project and 12 | repository were created. This is not actually a part of the [grunt][grunt] 13 | "init:gruntplugin" template, this session transcript was added afterwards. The 14 | text after the `$` are the commands that were executed, and everything else is 15 | program output. If you want to see the repository exactly as it was created by 16 | grunt, view [the previous commit][prev]. 17 | 18 | Want to learn more? Check [grunt][grunt] out. 19 | 20 | [grunt]: https://github.com/cowboy/grunt 21 | [issues]: https://github.com/cowboy/grunt/issues 22 | [init]: https://github.com/cowboy/grunt/blob/master/docs/task_init.md 23 | [expect]: https://github.com/cowboy/grunt/blob/master/dev/init.exp 24 | [prev]: https://github.com/cowboy/grunt-gruntplugin-example/tree/HEAD~1 25 | 26 | Note that this entire build process is automated by a rather complex [expect 27 | script][expect], which is used to automate grunt in order to facilitate the 28 | creation of this and other [init task][init] example repositories. 29 | 30 | ``` 31 | $ mkdir grunt-gruntplugin-example && cd grunt-gruntplugin-example 32 | 33 | $ git init 34 | git remote add origin git@github.com:cowboy/grunt-gruntplugin-example.git 35 | Initialized empty Git repository in /private/tmp/grunt-gruntplugin-example/.git/ 36 | 37 | $ git remote add origin git@github.com:cowboy/grunt-gruntplugin-example.git 38 | 39 | $ grunt init:gruntplugin 40 | Running "init:gruntplugin" (init) task 41 | This task will create one or more files in the current directory, based on the 42 | environment and the answers to a few questions. Note that answering "?" to any 43 | question will show question-specific help and answering "none" to most questions 44 | will leave its value blank. 45 | 46 | "gruntplugin" template notes: 47 | The grunt plugin system is still under development. For more information, see 48 | the docs at https://github.com/cowboy/grunt/blob/master/docs/plugins.md 49 | 50 | Please answer the following: 51 | [?] Project name (grunt-gruntplugin-example) 52 | [?] Description (The best sample grunt tasks ever.) This is example output generated by the "grunt init:gruntplugin" task. 53 | [?] Version (0.1.0) 54 | [?] Project git repository (git://github.com/cowboy/grunt-gruntplugin-example.git) 55 | [?] Project homepage (https://github.com/cowboy/grunt-gruntplugin-example) 56 | [?] Project issues tracker (https://github.com/cowboy/grunt-gruntplugin-example/issues) 57 | [?] Licenses (MIT) 58 | [?] Author name ("Cowboy" Ben Alman) 59 | [?] Author email (none) 60 | [?] Author url (http://benalman.com/) 61 | [?] What versions of grunt does it require? (~0.3.8) 62 | [?] What versions of node does it run on? (*) 63 | [?] Do you need to make any changes to the above before continuing? (y/N) 64 | 65 | Writing .DS_Store...OK 66 | Writing .gitignore...OK 67 | Writing bin/grunt-gruntplugin-example...OK 68 | Writing grunt.js...OK 69 | Writing README.md...OK 70 | Writing tasks/gruntplugin-example.js...OK 71 | Writing test/gruntplugin-example_test.js...OK 72 | Writing LICENSE-MIT...OK 73 | 74 | Initialized from template "gruntplugin". 75 | 76 | Done, without errors. 77 | 78 | $ tree 79 | . 80 | ├── LICENSE-MIT 81 | ├── README.md 82 | ├── bin 83 | │   └── grunt-gruntplugin-example 84 | ├── grunt.js 85 | ├── package.json 86 | ├── tasks 87 | │   └── gruntplugin-example.js 88 | └── test 89 | └── gruntplugin-example_test.js 90 | 91 | 3 directories, 7 files 92 | 93 | $ grunt 94 | Running "lint:files" (lint) task 95 | Lint free. 96 | 97 | Running "test:files" (test) task 98 | 99 | module.js:311 100 | throw err; 101 | ^ 102 | Error: Cannot find module 'grunt' 103 | at Function._resolveFilename (module.js:332:11) 104 | at Function._load (module.js:279:25) 105 | at Module.require (module.js:354:17) 106 | at require (module.js:370:17) 107 | at Object. (/private/tmp/grunt-gruntplugin-example/test/gruntplugin-example_test.js:1:75) 108 | at Module._compile (module.js:441:26) 109 | at Object..js (module.js:459:10) 110 | at Module.load (module.js:348:31) 111 | at Function._load (module.js:308:12) 112 | at Module.require (module.js:354:17) 113 | 114 | $ tree 115 | . 116 | ├── LICENSE-MIT 117 | ├── README.md 118 | ├── bin 119 | │   └── grunt-gruntplugin-example 120 | ├── grunt.js 121 | ├── package.json 122 | ├── tasks 123 | │   └── gruntplugin-example.js 124 | └── test 125 | └── gruntplugin-example_test.js 126 | 127 | 3 directories, 7 files 128 | 129 | $ git add . 130 | 131 | $ git commit -m 'Committing example "grunt init:gruntplugin" task output.' 132 | [master (root-commit) 53b00d2] Committing example "grunt init:gruntplugin" task output. 133 | 8 files changed, 197 insertions(+), 0 deletions(-) 134 | create mode 100644 .gitignore 135 | create mode 100644 LICENSE-MIT 136 | create mode 100644 README.md 137 | create mode 100644 bin/grunt-gruntplugin-example 138 | create mode 100644 grunt.js 139 | create mode 100644 package.json 140 | create mode 100644 tasks/gruntplugin-example.js 141 | create mode 100644 test/gruntplugin-example_test.js 142 | 143 | ``` 144 | 145 | ## License 146 | Copyright (c) 2012 "Cowboy" Ben Alman 147 | Licensed under the MIT license. 148 | --------------------------------------------------------------------------------