Skip to content

Commit

Permalink
Version 0.1.0
Browse files Browse the repository at this point in the history
See changelog
  • Loading branch information
q2s2t committed Aug 14, 2014
1 parent 5424371 commit d195a36
Show file tree
Hide file tree
Showing 33 changed files with 3,205 additions and 112 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

### `v0.1.0` 2014-08-14

* API: remove `prompt` in favor of `promptLicense` and `promptInfo`
* Dependencies: use *Inquirer.js* instead of home-made functions.
* Licenses: Add Apache-2.0, BSD-2-Clause, BSD-3-Clause, GPL-2.0, GPL-3.0,
CDDL-1.0, EPL-1.0, LGPL-2.1, LGPL-3.0 and MPL-2.0.

### `v0.0.1` 2014-08-13

* Initial release.
Expand Down
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Licensr

License your projects with a nice CLI tool!

[![Dependencies Status][gemnasium-image]][gemnasium-url] [![Build Status][travis-image]][travis-url] [![Code quality][codeclimate-image]][codeclimate-url] [![Code coverage][coveralls-image]][coveralls-url] [![Release][npm-image]][npm-url]
[![Dependencies Status][gemnasium-image]][gemnasium-url] [![Build Status][travis-image]][travis-url] [![Code quality][codeclimate-image]][codeclimate-url] [![Release][npm-image]][npm-url]

[![ruche logo](https://raw.githubusercontent.com/quentinrossetti/licensr/master//assets/animated.gif)](https://github.com/quentinrossetti/licensr)

Expand All @@ -12,8 +12,8 @@ Usage

Just run `licensr` an follow the guide!

You can also use *Licensr* as a node module. You can use super greats
*Promises* or you can stick with the node's callbacks.
If you choose to use *Licensr* as a node module you can use super greats
*Promises* or you can stick with the node's callbacks, it is you choice.

```js
var licensr = require('licensr');
Expand Down Expand Up @@ -41,6 +41,8 @@ Installation

Configure your git environement and install *Licensr* as global node module.

> *Git* is not a requirement but it will autocomplete fields for you!
```bash
git config --global user.name "John Doe"
git config --global user.email [email protected]
Expand All @@ -50,33 +52,39 @@ npm install -g licensr
API
---

### Intro `licensr.intro`
### Intro `lincensr.intro`
Displays the introduction header.

__Return values__
* `intro` The introduction text.

### Prompt `licensr.prompt`
Ask user about the license they want.
### Command
Run a command in the shell and get the result.

__Arguments__
* `topic` Question text.
* `default` A fallback value.
* `cmd` The command to run.

__Return values__
* `data` What the user gets.
* `stdout` The result of the command.
* `err` The error as issued by `child_process.exec`.

### Command `licensr.command`
Run a command in the shell and get the result.
### Prompt License `lincensr.promptLicense`
Ask user about the license they want.

__Return values__
* `licence` A license's name.

### Prompt Info `lincensr.promptInfo`
Ask user about information required by the license.

__Arguments__
* `cmd` The command to run.
* `license` A license's name.
* `infoDefault` Default values issued by a previous command.

__Return values__
* `err` The error as issued by `child_process.exec`.
* `stdout` The result of the command.
* `answers` Information about the user.

### Write `licensr.write`
### Write
Write the license.

__Arguments__
Expand Down
Binary file modified assets/animated.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/export-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/source.psd
Binary file not shown.
98 changes: 57 additions & 41 deletions bin.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,67 @@
#!/usr/bin/env node
'use strict';
var api = require('./index');

// ## Runtime
var data = {
name : 'John Doe',
email : '[email protected]',
license: 'ISC',
years : new Date().getFullYear(),
file : './LICENSE'
};
require('colors');
var api = require('./index');
var path = require('path');
var _ = require('underscore');

var data = {};
var infoDefault = {};

api.intro()
.then(function (o) {
console.log(o);
return api.command('git config --get user.name');
})
.then(function (o) {
data.name = o;
return api.command('git config --get user.email');
})
.then(function (o) {
data.email = o;
return api.prompt('What\'s your name?', data.name);
})
.then(function (name) {
data.name = name;
return api.prompt('What\'s your email?', data.email);
})
.then(function (email) {
data.email = email;
return api.prompt('Which license do you want?', data.license);
})
.then(function (license) {
data.license = license;
return api.prompt('On which years?', data.years);

.then(function (intro) {
console.log(intro);

// Get defaults
api.command('git config --get user.name')
.then(function (name) {
infoDefault.name = name;
return api.command('git config --get user.email');
})
.then(function (email) {
infoDefault.email = email;
})
.catch(function (err) {
infoDefault.name = null;
infoDefault.email = null;
console.error('Warning: '.yellow + 'You should install git!');
});

return api.promptLicense();
})
.then(function (years) {
data.years = years;
return api.prompt('Where do you want your file?', data.file);

.then(function (answer) {
data.license = answer.license;
return api.promptInfo(answer.license, infoDefault);
})
.then(function (file) {
data.file = file;

.then(function (info) {
data.name = info.name;
data.email = info.email;
data.software = info.software;
data.description = info.description;
data.years = info.years;
data.file = info.file;
return api.write(data);
})
.then(function (content) {
console.log(content);

.then(function (license) {
if (license.split('\n').length < 35) {
console.log('\n--------\n'.grey);
console.log(license);
console.log('--------\n'.grey);
}

var warns = [ 'LGPL-2.1' ];
if (_.contains(warns, data.license)) {
console.error('Warning: '.yellow + 'More informations are required by\
the license. You should check them at the bottom of the file.');
}

console.log('License saved to: %s', path.resolve(data.file).green);
})

.catch(function (err) {
console.log('Error: '.red + err.message);
});
});
Loading

0 comments on commit d195a36

Please sign in to comment.