Skip to content

Commit

Permalink
Merge branch 'master' of github.com:wejs/we
Browse files Browse the repository at this point in the history
  • Loading branch information
albertosouza committed Sep 27, 2017
2 parents 3b96927 + 63c0993 commit 65f6f08
Show file tree
Hide file tree
Showing 33 changed files with 1,142 additions and 483 deletions.
7 changes: 3 additions & 4 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{ "asi": true
{ "asi": false
, "boss": true
, "browser": true
, "camelcase": false
, "curly": false
, "devel": false
, "devel": true
, "eqeqeq": false
, "eqnull": true
, "es5": false
, "esversion": 6
, "evil": false
, "immed": false
, "indent": 2
Expand Down Expand Up @@ -38,4 +37,4 @@
, "trailing": false
, "undef": true
, "unused": true
}
}
54 changes: 37 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,46 @@

[![Join the chat at https://gitter.im/wejs/we](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/wejs/we?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

For information and documentation see: http://wejs.org
We.js is a extensible node.js MVC framework

Examples are avaible in https://github.com/wejs-examples github organization
For information and documentation see: http://wejs.org

**This repository (wejs/we) have the We.js CLI code**

Status: **maintained**

[**Changelog**](https://github.com/wejs/we-core/blob/master/CHANGELOG.md)

## About
## Examples:

We.js is a extensible node.js MVC framework

## We.js features:

Link: http://wejs.org/#features
- We.js + Vue.js: https://github.com/albertosouza/twitter-prizewinner
- We.js with views and heroku configuration example: https://github.com/wejs-examples/blog-heroku
- Events portal example: https://github.com/wejs-examples/events.wejs.org

## How to install?

Link: http://wejs.org/docs/we/getstarted
Link: https://wejs.org/docs/we/getstarted.installation

## Test one simple blog project with heroku deploy:

[![Deploy to Heroku](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy?template=https://github.com/wejs-examples/blog-heroku/tree/master)

## Roadmap:
- Push we-core, we and generator-wejs to 100% code coverage
- Create new examples for:
- Angular.js + We.js
- Ember.js + We.js
- React + We.js
- Vue.js + We.js (improve)
- Improve the documentation
- Improve plugins:
- we-plugin-file
- we-plugin-passport-jwt
- Research and develop the We.js CMF with one client side framework. ref https://github.com/wejs/we/issues/158
- Create new examples of deploy in many hosting providers
- Improve we-core, we and generator-wejs
- Build one online course about We.js with text, images and gifs.

## Contributing

**Have a question, found an error or wants to help?**
Expand All @@ -38,22 +52,20 @@ Link: http://wejs.org/docs/we/getstarted
> * **Hack it!** and give feedback, we fix and then we.js becomes more secure ;)
> * Or spread to the world!
> And see the [CONTRIBUTING.md](CONTRIBUTING.md) file
> And see the [CONTRIBUTING.md](CONTRIBUTING.md) file
***If want see or test a We.js live example access: http://wejs.org/ *** :eyes:

## Suport
## Get suport and help

- Google groups and email newsletter: https://groups.google.com/forum/#!forum/we-js
- We.js twitter: https://twitter.com/we_js
- Gitter chat: https://gitter.im/wejs/we
- Github repo: https://github.com/wejs/we
- Github repo: https://github.com/wejs/we

## Avaible plugins
## Donate and help

```sh
npm search we-plugin-
```
Link: https://wejs.org/suport

## How to Test

Expand All @@ -69,10 +81,18 @@ npm test
mocha test/bootstrap.js test/\*\*/\*.test.js -g '/auth/1/change-password'
```

## How to test we.js cli?

Example:
```sh
DATABASE_NAME='we_test' DATABASE_USERNAME='root' DATABASE_PASSWORD='project' npm test
```


## Build with:
* Node.js - http://nodejs.org/
* Express.js
* Sequelize
* Sequelize
* [Love](http://www.lovecalculator.com/)

## Security Vulnerabilities
Expand Down
1 change: 0 additions & 1 deletion backers.md

This file was deleted.

8 changes: 4 additions & 4 deletions bin/_commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Module dependencies
*/

var _ = require('lodash');
var program = require('commander');
const _ = require('lodash'),
program = require('commander');


//
Expand All @@ -14,7 +14,7 @@ var program = require('commander');

// Allow us to display help(), but omit the wildcard (*) command.
program.Command.prototype.usageMinusWildcard =
program.usageMinusWildcard = function() {
program.usageMinusWildcard = function usageMinusWildcard() {
program.commands = _.reject(program.commands, {
_name: '*'
});
Expand All @@ -24,7 +24,7 @@ program.Command.prototype.usageMinusWildcard =
// Force commander to display version information.
program.Command.prototype.versionInformation =
program.versionInformation =
function() {
function versionInformation() {
program.emit('version');
};

Expand Down
14 changes: 7 additions & 7 deletions bin/we
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/

// Module dependencies
var _ = require('lodash');
var program = require('./_commander');
var package = require('../package.json');
var helpers = require('../lib/helpers.js');
const _ = require('lodash'),
program = require('./_commander'),
package = require('../package.json'),
helpers = require('../lib/helpers.js');

program.version(package.version, '-v, --version');
//
Expand All @@ -20,7 +20,7 @@ program.version(package.version, '-v, --version');
// $ we version
//
// make `-v` option case-insensitive
process.argv = _.map(process.argv, function(arg) {
process.argv = _.map(process.argv, (arg)=> {
return (arg === '-V') ? '-v' : arg;
});
// $ we version (--version synonym)
Expand All @@ -39,7 +39,7 @@ program
}
);

var commands = {
const commands = {
cli: helpers.loadCLICommands(),
project: helpers.loadProjectCommands(),
plugins: helpers.loadProjectPluginsCommands()
Expand All @@ -49,7 +49,7 @@ helpers.runCommandFNs(commands, program);

program.parse(process.argv);

var NO_COMMAND_SPECIFIED = program.args.length === 0;
let NO_COMMAND_SPECIFIED = program.args.length === 0;
if (NO_COMMAND_SPECIFIED) {
program.usageMinusWildcard();
}
24 changes: 12 additions & 12 deletions lib/commands/console.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* Load all we.js features and start node.js console.
* see: https://nodejs.org/api/repl.html
*/
module.exports = function consoleCommand(program) {
/**
* Load all we.js features and start node.js console.
* see: https://nodejs.org/api/repl.html
*/
const repl = require('repl'),
helpers = require('../helpers');

var repl = require('repl');
var helpers = require('../helpers');
var we;
let we;

program
.command('console')
Expand All @@ -15,20 +15,20 @@ module.exports = function consoleCommand(program) {
.action(function run() {
we = helpers.getWe();

we.bootstrap(function (err, we) {
we.bootstrap( (err, we)=> {
if (err) return doneAll(err);

console.log('Starting we.js console, We.js object is avaible as we variable\n');

var r = repl.start({
const r = repl.start({
prompt: 'We.js ;> ',
input: process.stdin,
output: process.stdout
});
// set we object
r.context.we = we;
// one exit ...
r.on('exit', function () {
r.on('exit', ()=> {
console.log('Exit from we.js console.');
doneAll();
});
Expand All @@ -39,10 +39,10 @@ module.exports = function consoleCommand(program) {
we.log.error('Error in we.js CLI:', err);
}

we.exit(function () {
we.exit( ()=> {
// end / exit
process.exit();
});
}
});
}
};
16 changes: 8 additions & 8 deletions lib/commands/cron.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/**
* Run all we.js plugins and project cron tasks
*/
module.exports = function cronCommand(program) {
/**
* Run all we.js plugins and project cron tasks
*/

var helpers = require('../helpers');
var we;
const helpers = require('../helpers');
let we;

program
.command('cron')
.description('Run project and plugin cron tasks')
.action(function run() {
we = helpers.getWe();

we.bootstrap(function (err) {
we.bootstrap( (err)=> {
if (err) return doneAll(err);
we.runCron(doneAll);
});
Expand All @@ -22,7 +22,7 @@ module.exports = function cronCommand(program) {
we.log.error('Error on run we.js cron tasks:', err);
}
// end / exit
we.exit(function () { process.exit(); });
we.exit(process.exit);
}
});
}
};
20 changes: 10 additions & 10 deletions lib/commands/dropDB.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
/**
* Drop project database
*/
module.exports = function dropDBCommand(program) {
/**
* Drop and recreate project database
*
*/

var helpers = require('../helpers');
var we;
const helpers = require('../helpers');
let we;

program
.command('dropDB')
.description('Drop and recreate the database')
.description('Drop project database')
.action( function run() {
we = helpers.getWe();

we.bootstrap({
skipInstall: true
}, function(err) {
}, (err)=> {
if (err) return doneAll(err);
drop();
});

function drop() {
we.db.defaultConnection.queryInterface.dropAllTables()
we.db.defaultConnection.queryInterface
.dropAllTables()
.nodeify(doneAll);

// // old dropdb
Expand Down Expand Up @@ -53,4 +53,4 @@ module.exports = function dropDBCommand(program) {
process.exit();
}
});
}
};
Loading

0 comments on commit 65f6f08

Please sign in to comment.