Skip to content

Commit

Permalink
v1.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v2a committed Jan 3, 2019
2 parents 7d21177 + f9d7e05 commit cca208c
Show file tree
Hide file tree
Showing 31 changed files with 83 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"accessor-pairs": 2,
"block-scoped-var": 2,
"complexity": [2, 15],
"consistent-return": 0,
"consistent-return": 2,
"curly": 2,
"default-case": 1,
"dot-location": 0,
Expand Down
5 changes: 3 additions & 2 deletions Commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ var checkArtisan = function checkArtisan(cmdRes) {
return new Promise(function promiseCheckArtisan(resolve, reject) {
var test = cmdRes.match(/\s*Laravel\s+Framework\s+(version)?\s+(.*)/);
if (test) {
return resolve(test);
resolve(test);
return;
}
reject(new Error('not a laravel framework'));
});
Expand Down Expand Up @@ -100,7 +101,7 @@ var writeConf = function writeConf() {
comment += "*\n";
comment += "* config:\n";
comment += "* key: name of the config in laravel\n";
comment += "* inport: - true import without ask\n";
comment += "* import: - true import without ask\n";
comment += "* - false don't import\n";
comment += "* asis: true same as laravel\n";
comment += "* false look for a file with the key name in lib/config folder\n";
Expand Down
4 changes: 2 additions & 2 deletions Commands/laravelConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* global app,appdir */
/* eslint global-require: 0 */

var Promise = require('bluebird');
var shelljs = require('shelljs');
var utils = require('../lib/utilsCmd');
var fs = require('fs-promise');
Expand All @@ -20,7 +19,8 @@ var prepareTmpFolder = function prepareTmpFolder() {
unsafeCleanup: true
}, function tmpDirCallback(err, name) {
if (err) {
return reject(err);
reject(err);
return;
}
fs.mkdir(name + '/Config-laravel')
.then(function tmpdirOk() {
Expand Down
6 changes: 4 additions & 2 deletions Commands/missingJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ module.exports = {
if (!app.config('app')) {
res.red('app config missing').ln();
res.yellow('see manual for setup config from laravel').ln();
return res.prompt();
res.prompt();
return;
}
if (Object.keys(app.config('app.job', [])).length === 0) {
res.yellow('no job in Config/app.js').ln();
return res.prompt();
res.prompt();
return;
}
global.queueOption = {};
Job = includeAll({
Expand Down
3 changes: 2 additions & 1 deletion Commands/modelsCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ module.exports = {
function: function run(req, res) {
if (app.config('core.modelsCreator.models').length === 0) {
res.yellow('Please add models to import in Config/core.js').ln();
return res.prompt();
res.prompt();
return;
}
var dbModels = require('../lib/db-models');
dbModels()
Expand Down
2 changes: 1 addition & 1 deletion data/base/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint global-require: 0 */
try {
require('laravel-queue/bootstrap/app');
require('laravel-queue/bootstrap/app')();
} catch(e) {
console.log(e.message);
}
3 changes: 1 addition & 2 deletions lib/Config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
/* global app */

var include = require('include-all');
var fs = require('fs');
Expand Down Expand Up @@ -30,7 +29,7 @@ var Config = function Config(appdir, logger) {
Config.prototype.get = function get(key, def) {
var reduce = function reduce(obj, index) {
if (!obj) {
return;
return null;
}
return obj[index];
};
Expand Down
10 changes: 6 additions & 4 deletions lib/Mail.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* global appdir,app */
// var console = app.logger(config('core.log.prefix') + ':mail');

var Promise = require('bluebird');
var ect = require('ect');
var defaults = require('lodash/defaults');
var nodemailer = require('nodemailer');
Expand Down Expand Up @@ -71,12 +70,15 @@ Mail.prototype.send = function sendMail(callback) {
self.mailer.sendMail(mailOptions, function mailerSendMail(err, info) {
if (err) {
if (callback) {
return callback(err);
callback(err);
return;
}
return reject(err);
reject(err);
return;
}
if (callback) {
return callback(null, info);
callback(null, info);
return;
}
resolve(info);
});
Expand Down
12 changes: 7 additions & 5 deletions lib/db-models/lib/Model-export.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
/* global app */
/* eslint new-cap: 0*/
var Promise = require('bluebird');
var console = app.logger(app.config('core.log.prefix') + ':model-export');
var _ = require('lodash');
_.mixin(require('lodash-inflection'));
Expand Down Expand Up @@ -29,13 +28,16 @@ ModelExport.prototype.createOutputDir = function createOutputDir() {
return new Promise(function PromiseCreateOutputDir(resolve) {
fs.stat(self.dir, function statDir(err, stats) {
if (err || !stats.isDirectory()) {
return fs.mkdir(self.dir, function mkdir(mkdirErr) {
fs.mkdir(self.dir, function mkdir(mkdirErr) {
if (!mkdirErr) {
return resolve(true);
resolve(true);
return;
}
});
return;
}
return resolve(true);
resolve(true);
return;
});
});
};
Expand Down Expand Up @@ -105,7 +107,7 @@ ModelExport.prototype.createModels = function createModels() {
}
//for future association
self.associate[lowerName] = modelName;
return generatePromises.push(self.generateTemps({
generatePromises.push(self.generateTemps({
tableName: table,
modelName: modelName,
fields: results[1][table]
Expand Down
5 changes: 2 additions & 3 deletions lib/shell/lib/Shell.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
/* global app */
/*eslint no-magic-numbers: 0 */

var EventEmitter, Interface, Request, Response, shell, events, readline;
Expand All @@ -16,7 +15,7 @@ Interface = require('readline').Interface;
var console;

Interface.prototype.setPrompt = (function setPrompt(parent) {
return function returnSetPromt() {
return function returnSetPrompt() {
var args = Array.prototype.slice.call(arguments);
if (!args[1]) {
args[1] = Styles.unstyle(args[0]).length;
Expand Down Expand Up @@ -219,7 +218,7 @@ shell = (function exportShell(_super) {
} else if (this.parent) {
return this.parent.set(setting);
}

return this;
};

Shell.prototype.prompt = function prompt() {
Expand Down
12 changes: 8 additions & 4 deletions lib/shell/lib/plugins/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ module.exports = function help(settings) {
var route = routes[shell.routeName[command]];
if (!route) {
res.red('command ' + command + ' not found');
return res.prompt();
res.prompt();
return;
}
res.yellow('Help:').ln();
res.print(pad('', firstPad)).white(route.description).ln().ln();
Expand Down Expand Up @@ -90,7 +91,8 @@ module.exports = function help(settings) {
res.ln();
});

return res.prompt();
res.prompt();
return;
}
var routeText;
res.yellow('Available commands:');
Expand All @@ -102,14 +104,16 @@ module.exports = function help(settings) {
res.print(pad('', firstPad)).green(routeText).white(rte.description).ln();
}
});
return res.prompt();
res.prompt();
return;
};
console.log('add routes');
shell.cmd('help {command(([\\w\\:])*)?}', 'Show this message', shell.help.bind(shell));
shell.cmd('', shell.help.bind(shell));
if (shell.isShell && settings.introduction) {
text = typeof settings.introduction === 'string' ? settings.introduction : introduction;
return shell.styles.println(text);
shell.styles.println(text);
return;
}
};

4 changes: 2 additions & 2 deletions lib/shell/lib/plugins/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ History plugin
Persistent command history over multiple sessions. Options passed during creation are:
- `shell` , (required) A reference to your shell application.
- `name` , Identify your project history file, default to the hash of the exectuted file
- `name` , Identify your project history file, default to the hash of the executed file
- `dir` , Location of the history files, defaults to `"#{process.env['HOME']}/.node_shell"`
*/

Expand Down Expand Up @@ -56,6 +56,6 @@ module.exports = function history(settings) {
return parent.apply(this, arguments);
};
})(Interface.prototype._addHistory);
return null;
return;
};

8 changes: 4 additions & 4 deletions lib/shell/lib/plugins/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ var match = function match(req, routes) {
if ((/^\-\-/).test(arg)) {
arg = arg.replace('--', '');
route.options[arg] = true;
return;
return ;
}
if (keyArg >= keys.length) {
return;
return ;
}
param = keys.shift();
key = param.key;
Expand All @@ -83,7 +83,7 @@ var match = function match(req, routes) {
req._route_index = routeKey;
// throw new Error('missing parameter');
routeOk = route;
return false;
return;
}
});
// console.debug('routes:',routes);
Expand Down Expand Up @@ -121,7 +121,7 @@ module.exports = function router(settings) {
var args, route;
args = Array.prototype.slice.call(arguments);
if (!args[0]) {
return;
return this;
}
route = {};
route.command = args.shift();
Expand Down
2 changes: 1 addition & 1 deletion lib/shell/lib/routes/shellOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ module.exports = function shellOnly(req, res, next) {
res.prompt();
return;
}
return next();
next();
};
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = {
return path.normalize(dir + '/..');
}
}
throw new Error('Workspace not found');
}
};

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "laravel-queue",
"version": "1.1.7",
"version": "1.1.8",
"description": "run job from laravel",
"main": "index.js",
"homepage": "https://github.com/icfr/laravel-node-queue",
Expand Down Expand Up @@ -30,7 +30,6 @@
"license": "MIT",
"dependencies": {
"bee-queue": "^0.3.0",
"bluebird": "~3.5.3",
"colors": "~1.3.3",
"debug-logger": "^0.4.1",
"diff": "~3.5.0",
Expand Down
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/83770719db9d4480a1f2162c3399c325)](https://www.codacy.com/app/icfr/laravel-node-queue_2?utm_source=github.com&utm_medium=referral&utm_content=artis-auxilium/laravel-node-queue&utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/83770719db9d4480a1f2162c3399c325)](https://www.codacy.com/app/icfr/laravel-node-queue_2?utm_source=github.com&utm_medium=referral&utm_content=artis-auxilium/laravel-node-queue&utm_campaign=Badge_Coverage)

# node server for Laravel queue

Expand All @@ -22,7 +23,7 @@ Install laravel-queue
npm install --save laravel-queue
```

After init the apllication
After init the application

```
./artisan init
Expand All @@ -31,7 +32,7 @@ After init the apllication
It ask for laravel project path then ask for command path
(relative to laravel project path)
then when asked add this to Console/kernel.php
> if your commands folder is not standart(e.g app/Console/Commands),
> if your commands folder is not standard(e.g app/Console/Commands),
dont forget to change namespace of the class

```php
Expand Down
3 changes: 3 additions & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
MODULE_DIR=$(pwd)
BIN_DIR="${MODULE_DIR}/bin"
PROJECT_DIR=$(realpath ../..)
if [ -f "${PROJECT_DIR}/.env"]; then
touch "${PROJECT_DIR}/.env"
fi
if [ -d "${PROJECT_DIR}/Config" ]; then
echo "app allready installed"
exit 0
Expand Down
1 change: 1 addition & 0 deletions test/Commands/testInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ module.exports = {
if (typeof txt === 'string') {
stdout.push(txt.replace(/\u001b\[.*?m/g, ''));
}
return '';
});
app.init({
chdir: appdir + '/'
Expand Down
Loading

0 comments on commit cca208c

Please sign in to comment.