1 | # generate-license [![NPM version](https://img.shields.io/npm/v/generate-license.svg?style=flat)](https://www.npmjs.com/package/generate-license) [![NPM downloads](https://img.shields.io/npm/dm/generate-license.svg?style=flat)](https://npmjs.org/package/generate-license) [![Build Status](https://img.shields.io/travis/generate/generate-license.svg?style=flat)](https://travis-ci.org/generate/generate-license)
|
2 |
|
3 | Generate a license file for a GitHub project.
|
4 |
|
5 | ![generate-license demo](https://raw.githubusercontent.com/generate/generate-license/master/demo.gif)
|
6 |
|
7 | ## Table of Contents
|
8 |
|
9 | - [What is "Generate"?](#what-is-generate)
|
10 | - [Command line usage](#command-line-usage)
|
11 | * [Install](#install)
|
12 | * [Run](#run)
|
13 | * [Help](#help)
|
14 | * [Running tasks](#running-tasks)
|
15 | - [Available tasks](#available-tasks)
|
16 | - [API usage](#api-usage)
|
17 | * [Install locally](#install-locally)
|
18 | * [Use as a plugin](#use-as-a-plugin)
|
19 | * [Register as a generator](#register-as-a-generator)
|
20 | - [Customization](#customization)
|
21 | * [Destination directory](#destination-directory)
|
22 | * [Overriding templates](#overriding-templates)
|
23 | - [About](#about)
|
24 | * [Related projects](#related-projects)
|
25 | * [Contributing](#contributing)
|
26 | * [Running tests](#running-tests)
|
27 | * [Author](#author)
|
28 | * [License](#license)
|
29 |
|
30 | _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
|
31 |
|
32 | ## What is "Generate"?
|
33 |
|
34 | Generate is a command line tool and developer framework for scaffolding out new GitHub projects using [generators](https://github.com/generate/generate/blob/master/docs/generators.md) and [tasks](https://github.com/generate/generate/blob/master/docs/tasks.md).
|
35 |
|
36 | Answers to prompts and the user's environment can be used to determine the templates, directories, files and contents to build. Support for [gulp](http://gulpjs.com), [base](https://github.com/node-base/base) and [assemble](https://github.com/assemble/assemble) plugins, and much more.
|
37 |
|
38 | **For more information**:
|
39 |
|
40 | * Visit the [generate project](https://github.com/generate/generate/)
|
41 | * Visit the [generate documentation](https://github.com/generate/generate/blob/master/docs/)
|
42 | * Find [generators on npm](https://www.npmjs.com/browse/keyword/generate-generator) (help us [author generators](https://github.com/generate/generate/blob/master/docs/micro-generators.md))
|
43 |
|
44 | ## Command line usage
|
45 |
|
46 | ### Install
|
47 |
|
48 | **Installing the CLI**
|
49 |
|
50 | To run the `license` generator from the command line, you'll need to install [Generate](https://github.com/generate/generate) globally first. You can do that now with the following command:
|
51 |
|
52 | ```sh
|
53 | $ npm install --global generate
|
54 | ```
|
55 |
|
56 | This adds the `gen` command to your system path, allowing it to be run from any directory.
|
57 |
|
58 | **Install generate-license**
|
59 |
|
60 | Install this module with the following command:
|
61 |
|
62 | ```sh
|
63 | $ npm install --global generate-license
|
64 | ```
|
65 |
|
66 | ### Run
|
67 |
|
68 | You should now be able to run `generate-license` with the following command:
|
69 |
|
70 | ```sh
|
71 | $ gen license
|
72 | ```
|
73 |
|
74 | **What will happen?**
|
75 |
|
76 | Running `$ gen license` will run the generator's [default task](#default), which will:
|
77 |
|
78 | 1. prompt you to choose a license to generate
|
79 | 2. prompt you for any information that's missing, if applicable (like author name, etc.)
|
80 | 3. render the necessary template(s) using your answers
|
81 | 4. write [the resulting files](#available-tasks) to the current working directory
|
82 |
|
83 | **What you should see in the terminal**
|
84 |
|
85 | If completed successfully, you should see both `starting` and `finished` events in the terminal, like the following:
|
86 |
|
87 | ```sh
|
88 | [00:44:21] starting ...
|
89 | ...
|
90 | [00:44:22] finished ✔
|
91 | ```
|
92 |
|
93 | If you do not see one or both of those events, please [let us know about it](../../issues).
|
94 |
|
95 | ### Help
|
96 |
|
97 | To see a general help menu and available commands for Generate's CLI, run:
|
98 |
|
99 | ```sh
|
100 | $ gen help
|
101 | ```
|
102 |
|
103 | ### Running tasks
|
104 |
|
105 | Tasks on `generate-license` are run by passing the name of the task to run after the generator name, delimited by a comma:
|
106 |
|
107 | ```sh
|
108 | $ gen license:foo
|
109 | ^ ^
|
110 | generator task
|
111 | ```
|
112 |
|
113 | **Example**
|
114 |
|
115 | The following will run generator `foo`, task `bar`:
|
116 |
|
117 | ```sh
|
118 | $ gen foo:bar
|
119 | ```
|
120 |
|
121 | **Default task**
|
122 |
|
123 | When a task name is not explicitly passed on the command line, Generate's CLI will run the [default](#default) task.
|
124 |
|
125 | ## Available tasks
|
126 |
|
127 | ### [agpl-3.0](generator.js#L27)
|
128 |
|
129 | Generate a GNU Affero General Public License v3.0 `LICENSE` file in the current working directory.
|
130 |
|
131 | **Example**
|
132 |
|
133 | ```sh
|
134 | $ gen license:agpl-3.0
|
135 | $ gen license:agpl-3.0 --dest ./docs
|
136 | $ gen dest license:agpl-3.0
|
137 | ```
|
138 |
|
139 | ### [apache-2.0](generator.js#L44)
|
140 |
|
141 | Generate an Apache License 2.0 `LICENSE` file in the current working directory.
|
142 |
|
143 | **Example**
|
144 |
|
145 | ```sh
|
146 | $ gen license:apache-2.0
|
147 | $ gen license:apache-2.0 --dest ./docs
|
148 | $ gen dest license:apache-2.0
|
149 | ```
|
150 |
|
151 | ### [artistic-2.0](generator.js#L61)
|
152 |
|
153 | Generate an Artistic License 2.0 `LICENSE` file in the current working directory.
|
154 |
|
155 | **Example**
|
156 |
|
157 | ```sh
|
158 | $ gen license:artistic-2.0
|
159 | $ gen license:artistic-2.0 --dest ./docs
|
160 | $ gen dest license:artistic-2.0
|
161 | ```
|
162 |
|
163 | ### [bsd-2-clause](generator.js#L78)
|
164 |
|
165 | Generate a BSD 2-clause "Simplified" License `LICENSE` file in the current working directory.
|
166 |
|
167 | **Example**
|
168 |
|
169 | ```sh
|
170 | $ gen license:bsd-2-clause
|
171 | $ gen license:bsd-2-clause --dest ./docs
|
172 | $ gen dest license:bsd-2-clause
|
173 | ```
|
174 |
|
175 | ### [bsd-3-clause](generator.js#L95)
|
176 |
|
177 | Generate a BSD 3-clause "New" or "Revised" License `LICENSE` file in the current working directory.
|
178 |
|
179 | **Example**
|
180 |
|
181 | ```sh
|
182 | $ gen license:bsd-3-clause
|
183 | $ gen license:bsd-3-clause --dest ./docs
|
184 | $ gen dest license:bsd-3-clause
|
185 | ```
|
186 |
|
187 | ### [cc0-1.0](generator.js#L112)
|
188 |
|
189 | Generate a Creative Commons Zero v1.0 Universal `LICENSE` file in the current working directory.
|
190 |
|
191 | **Example**
|
192 |
|
193 | ```sh
|
194 | $ gen license:cc0-1.0
|
195 | $ gen license:cc0-1.0 --dest ./docs
|
196 | $ gen dest license:cc0-1.0
|
197 | ```
|
198 |
|
199 | ### [epl-1.0](generator.js#L129)
|
200 |
|
201 | Generate an Eclipse Public License 1.0 `LICENSE` file in the current working directory.
|
202 |
|
203 | **Example**
|
204 |
|
205 | ```sh
|
206 | $ gen license:epl-1.0
|
207 | $ gen license:epl-1.0 --dest ./docs
|
208 | $ gen dest license:epl-1.0
|
209 | ```
|
210 |
|
211 | ### [gpl-2.0](generator.js#L146)
|
212 |
|
213 | Generate a GNU General Public License v2.0 `LICENSE` file in the current working directory.
|
214 |
|
215 | **Example**
|
216 |
|
217 | ```sh
|
218 | $ gen license:gpl-2.0
|
219 | $ gen license:gpl-2.0 --dest ./docs
|
220 | $ gen dest license:gpl-2.0
|
221 | ```
|
222 |
|
223 | ### [gpl-3.0](generator.js#L163)
|
224 |
|
225 | Generate a GNU General Public License v3.0 `LICENSE` file in the current working directory.
|
226 |
|
227 | **Example**
|
228 |
|
229 | ```sh
|
230 | $ gen license:gpl-3.0
|
231 | $ gen license:gpl-3.0 --dest ./docs
|
232 | $ gen dest license:gpl-3.0
|
233 | ```
|
234 |
|
235 | ### [isc](generator.js#L180)
|
236 |
|
237 | Generate a ISC License `LICENSE` file in the current working directory.
|
238 |
|
239 | **Example**
|
240 |
|
241 | ```sh
|
242 | $ gen license:isc
|
243 | $ gen license:isc --dest ./docs
|
244 | $ gen dest license:isc
|
245 | ```
|
246 |
|
247 | ### [lgpl-2.1](generator.js#L197)
|
248 |
|
249 | Generate a GNU Lesser General Public License v2.1 `LICENSE` file in the current working directory.
|
250 |
|
251 | **Example**
|
252 |
|
253 | ```sh
|
254 | $ gen license:lgpl-2.1
|
255 | $ gen license:lgpl-2.1 --dest ./docs
|
256 | $ gen dest license:lgpl-2.1
|
257 | ```
|
258 |
|
259 | ### [lgpl-3.0](generator.js#L217)
|
260 |
|
261 | Generate a GNU Lesser General Public License v3.0 `LICENSE.lesser` file in the current working directory.
|
262 |
|
263 | This will also generate a GNU General Public License v3.0 `LICENSE`
|
264 | file in the current working directory.
|
265 |
|
266 | **Example**
|
267 |
|
268 | ```sh
|
269 | $ gen license:lgpl-3.0
|
270 | $ gen license:lgpl-3.0 --dest ./docs
|
271 | $ gen dest license:lgpl-3.0
|
272 | ```
|
273 |
|
274 | ### [mit](generator.js#L234)
|
275 |
|
276 | Generate a MIT License `LICENSE` file in the current working directory.
|
277 |
|
278 | **Example**
|
279 |
|
280 | ```sh
|
281 | $ gen license:mit
|
282 | $ gen license:mit --dest ./docs
|
283 | $ gen dest license:mit
|
284 | ```
|
285 |
|
286 | ### [mpl-2.0](generator.js#L251)
|
287 |
|
288 | Generate a Mozilla Public License 2.0 `LICENSE` file in the current working directory.
|
289 |
|
290 | **Example**
|
291 |
|
292 | ```sh
|
293 | $ gen license:mpl-2.0
|
294 | $ gen license:mpl-2.0 --dest ./docs
|
295 | $ gen dest license:mpl-2.0
|
296 | ```
|
297 |
|
298 | ### [unlicense](generator.js#L268)
|
299 |
|
300 | Generate a The Unlicense `UNLICENSE` file in the current working directory.
|
301 |
|
302 | **Example**
|
303 |
|
304 | ```sh
|
305 | $ gen license:unlicense
|
306 | $ gen license:unlicense --dest ./docs
|
307 | $ gen dest license:unlicense
|
308 | ```
|
309 |
|
310 | ### [license](generator.js#L290)
|
311 |
|
312 | Prompts the user to choose the template to use for generating a `LICENSE` file in the current working directory. This task is also aliased as `choose-license` to provide a semantic name for API usage (e.g. `app.generate('choose-license', cb)`).
|
313 |
|
314 | **Example**
|
315 |
|
316 | ```sh
|
317 | $ gen license
|
318 | $ gen license --dest ./docs
|
319 | $ gen dest license
|
320 | # or
|
321 | $ gen license:choose
|
322 | $ gen license:choose --dest ./docs
|
323 | $ gen dest license:choose
|
324 | ```
|
325 |
|
326 | ### [default](generator.js#L331)
|
327 |
|
328 | Alias for the [license](#license) task, to allow this generator to be run with the following command:
|
329 |
|
330 | **Example**
|
331 |
|
332 | ```sh
|
333 | $ gen license
|
334 | ```
|
335 |
|
336 | Visit Generate's [documentation for tasks](https://github.com/generate/generate/blob/master/docs/tasks.md).
|
337 |
|
338 | ## API usage
|
339 |
|
340 | Use `generate-license` as a [plugin](https://github.com/generate/generate/blob/master/docs/plugins.md) in your own [generator](https://github.com/generate/generate/blob/master/docs/generators.md).
|
341 |
|
342 | ### Install locally
|
343 |
|
344 | Install with [npm](https://www.npmjs.com/):
|
345 |
|
346 | ```sh
|
347 | $ npm install --save generate-license
|
348 | ```
|
349 |
|
350 | ### Use as a plugin
|
351 |
|
352 | When used as a plugin, tasks from `generate-license` are added to your generator's instance.
|
353 |
|
354 | ```js
|
355 | module.exports = function(app) {
|
356 | app.use(require('generate-license'));
|
357 | // do generator stuff
|
358 | };
|
359 | ```
|
360 |
|
361 | **Running tasks**
|
362 |
|
363 | You can now run any tasks from `generate-license` as if they were part of your own generator.
|
364 |
|
365 | ```js
|
366 | module.exports = function(app) {
|
367 | app.use(require('generate-license'));
|
368 |
|
369 | app.task('foo', function(cb) {
|
370 | // do task stuff
|
371 | cb();
|
372 | });
|
373 |
|
374 | // run the `mit` task from `generate-license`
|
375 | app.task('default', ['foo', 'mit']);
|
376 | };
|
377 | ```
|
378 |
|
379 | ### Register as a generator
|
380 |
|
381 | When registered as a generator, tasks from `generate-license` are added to the "namespace" you give to the generator.
|
382 |
|
383 | ```js
|
384 | module.exports = function(app) {
|
385 | app.register('foo', require('generate-license'));
|
386 | // generate
|
387 | };
|
388 | ```
|
389 |
|
390 | **Running tasks**
|
391 |
|
392 | Pass the names of one or more tasks to run to the `.generate` method, prefixed with the namespace of the sub-generator (`foo`, in our example):
|
393 |
|
394 | **Examples**
|
395 |
|
396 | Run the [mit](#mit) task from `generate-license`:
|
397 |
|
398 | ```js
|
399 | module.exports = function(app) {
|
400 | app.register('foo', require('generate-license'));
|
401 |
|
402 | app.generate('foo:mit', function(err) {
|
403 | if (err) console.log(err);
|
404 | });
|
405 | };
|
406 | ```
|
407 |
|
408 | Wrap the call to `.generate` in a task, so it can be called on demand:
|
409 |
|
410 | ```js
|
411 | module.exports = function(app) {
|
412 | app.register('foo', require('generate-license'));
|
413 |
|
414 | app.task('mit-license', function(cb) {
|
415 | app.generate('foo:mit', cb);
|
416 | });
|
417 | };
|
418 | ```
|
419 |
|
420 | **More information**
|
421 |
|
422 | Visit the [generator docs](https://github.com/generate/generate/blob/master/docs/generators.md) to learn more about creating, installing, using and publishing generators.
|
423 |
|
424 | ## Customization
|
425 |
|
426 | ### Destination directory
|
427 |
|
428 | To customize the destination directory, install [generate-dest](https://github.com/generate/generate-dest) globally, then in the command line prefix `dest` before any other generator names.
|
429 |
|
430 | For example, the following will prompt you for the destination path to use, then pass the result to `generate-license`:
|
431 |
|
432 | ```sh
|
433 | $ gen dest license
|
434 | ```
|
435 |
|
436 | ### Overriding templates
|
437 |
|
438 | You can override a template by adding a template of the same name to the `templates` directory in user home.
|
439 |
|
440 | For example, to override the `foo.tmpl` template, add a template at the following path `~/generate/templates/foo.tmpl`, where `~/` is the user-home directory that `os.homedir()` resolves to on your system.
|
441 |
|
442 | ## About
|
443 |
|
444 | ### Related projects
|
445 |
|
446 | * [generate-eslint](https://www.npmjs.com/package/generate-eslint): Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be… [more](https://github.com/generate/generate-eslint) | [homepage](https://github.com/generate/generate-eslint "Generate a new `.eslintrc.json` or `.eslintignore` file from a pre-defined or user-defined template. Can be used from the command line when installed globally, or as a plugin in your own generator.")
|
447 | * [generate-install](https://www.npmjs.com/package/generate-install): Generator that automatically detects the dependencies or devDependencies to install based on the templates or… [more](https://github.com/generate/generate-install) | [homepage](https://github.com/generate/generate-install "Generator that automatically detects the dependencies or devDependencies to install based on the templates or includes that are dynamically used by your generator. This can be used as a sub-generator or plugin in your own generator.")
|
448 | * [generate-package](https://www.npmjs.com/package/generate-package): Generate] a package.json from a pre-defined or user-defined template. This generator can be used from… [more](https://github.com/generate/generate-package) | [homepage](https://github.com/generate/generate-package "[Generate] a package.json from a pre-defined or user-defined template. This generator can be used from the command line when globally installed, or as a plugin or sub-generator in your own generator.")
|
449 |
|
450 | ### Contributing
|
451 |
|
452 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
453 |
|
454 | ### Running tests
|
455 |
|
456 | Install dev dependencies:
|
457 |
|
458 | ```sh
|
459 | $ npm install -d && npm test
|
460 | ```
|
461 |
|
462 | ### Author
|
463 |
|
464 | **Jon Schlinkert**
|
465 |
|
466 | * [github/jonschlinkert](https://github.com/jonschlinkert)
|
467 | * [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
468 |
|
469 | ### License
|
470 |
|
471 | Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
|
472 | Released under the [MIT license](https://github.com/generate/generate-license/blob/master/LICENSE).
|
473 |
|
474 | ***
|
475 |
|
476 | _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.29, on August 09, 2016._ |
\ | No newline at end of file |