Skip to content

Commit

Permalink
Merge branch 'release/v1.1.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
d3v2a committed Dec 29, 2018
2 parents 9e53d69 + 9289370 commit 7d21177
Show file tree
Hide file tree
Showing 30 changed files with 1,251 additions and 5,478 deletions.
419 changes: 196 additions & 223 deletions .eslintrc

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var askLaravelFolder = function askLaravelFolder() {

var checkArtisan = function checkArtisan(cmdRes) {
return new Promise(function promiseCheckArtisan(resolve, reject) {
var test = cmdRes.match(/\s*Laravel\s+Framework\s+version\s+(.*)/);
var test = cmdRes.match(/\s*Laravel\s+Framework\s+(version)?\s+(.*)/);
if (test) {
return resolve(test);
}
Expand Down Expand Up @@ -147,7 +147,7 @@ module.exports = {
return checkArtisan(result);
})
.then(function artisanChecked(result) {
res.green('install command on laravel v' + result[1]).ln();
res.green('install command on laravel v' + result[2]).ln();
return askCommandFolder();
})
.then(function commandFolderAsked(cmdPath) {
Expand All @@ -164,9 +164,9 @@ module.exports = {

})

.catch(function catchError(error) {
utils.displayError(error, res);
});
.catch(function catchError(error) {
utils.displayError(error, res);
});

}
};
Expand Down
10 changes: 5 additions & 5 deletions Commands/laravelConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var prepareTmpFolder = function prepareTmpFolder() {
unsafeCleanup: true
}, function tmpDirCallback(err, name) {
if (err) {
reject(err);
return reject(err);
}
fs.mkdir(name + '/Config-laravel')
.then(function tmpdirOk() {
Expand Down Expand Up @@ -149,7 +149,7 @@ var nodeConfig = function nodeConfig() {
transformer = require(appdir + '/lib/Config/' + toTransform);
loaded = true;
} catch (errorInUserLoad) {
error = 'cant find /lib/Config/' + toTransform + '.js';
error = `can't find /lib/Config/${toTransform}.js`;
}
if (loaded) {
try {
Expand All @@ -166,10 +166,10 @@ var nodeConfig = function nodeConfig() {
loaded = true;

} catch (errorCoreload) {
if (!error || error === 'cant find /lib/Config/' + toTransform + '.js') {
if (!error || error === `can't find /lib/Config/${toTransform}.js`) {
/* istanbul ignore else */
if (errorCoreload.code) {
error = 'cant find /lib/Config/' + toTransform + '.js';
error = `can't find /lib/Config/${toTransform}.js`;
} else {
error = errorCoreload.message;
}
Expand All @@ -179,7 +179,7 @@ var nodeConfig = function nodeConfig() {
}
if (!loaded) {
conf = laravelConfig[toTransform];
response.red('config ' + toTransform + ' not trandformed').ln();
response.red('config ' + toTransform + ' not transformed').ln();
response.red(error).ln();
}
var content = utils.formatConfig(conf);
Expand Down
13 changes: 8 additions & 5 deletions bootstrap/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use strict';
/* global app,appdir,bug */
/* global appdir,bug */
var raven = require('raven');
var defaults = require('lodash/defaults');
var Config = require('../lib/Config');
var Shell = require('../lib/shell');

app.logger = require('debug-logger');
app.config = new Config(appdir);

var logger = Shell.prototype.logger = require('debug-logger');
Shell.prototype.config = new Config(appdir, logger);
let app = global.app = new Shell();
var logPrefix = app.config('core.log.prefix');
var console = app.logger(logPrefix + ':app');

Expand All @@ -14,8 +17,8 @@ app.logger.inspectOptions = {
};
/* istanbul ignore else*/
if (app.config('app.debug')) {
process.env.DEBUG = logPrefix + '*';
console.log('set env.debug to ' + logPrefix + '*');
process.env.DEBUG = logPrefix + ':*';
console.log('set env.debug to ' + logPrefix + ':*');
}

app.trans = require('i18n');
Expand Down
Empty file added data/base/.env
Empty file.
4 changes: 2 additions & 2 deletions lib/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var fs = require('fs');
var dotenv = require('dotenv');
var console;

var Config = function Config(appdir) {
var Config = function Config(appdir, logger) {
this.config = include({
dirname: appdir + '/Config',
filter: /(.+)\.js$/
Expand All @@ -15,7 +15,7 @@ var Config = function Config(appdir) {
Object.keys(envConfig).forEach(function eachKey(key) {
this.set(key, envConfig[key]);
}, this);
console = app.logger(this.config.core.log.prefix + ':config');
console = logger(this.config.core.log.prefix + ':config');
console.debug('config loaded');
var self = this;

Expand Down
1 change: 1 addition & 0 deletions lib/Config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module.exports = function compileDatabaseConfig(db) {
var conf = {};
conf.connections = db.connections[db.default];
conf.connections.adapter = db.default;
conf.connections.dialect = db.default;
conf.connections.options = {
logging: false
};
Expand Down
5 changes: 1 addition & 4 deletions lib/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ if (app.config('database')) {
}

app.db = new Sequelize(
app.config('database.connections.database'),
app.config('database.connections.username'),
app.config('database.connections.password'),
app.config('database.connections.options')
app.config('database.connections')
);

app.models = includeAll({
Expand Down
24 changes: 10 additions & 14 deletions lib/shell/lib/Response.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
'use strict';
var styles = require('./Styles');
var Styles = require('./Styles');
var pad = require('pad');
var util = require('util');
var response = (function exportResponse(_super) {

var Response = function Response(settings) {
class Response extends Styles {
constructor(settings) {
super(settings);
this.shell = settings.shell;
Response.super_.call(this, settings);
};
util.inherits(Response, _super);
}

Response.prototype.pad = pad;

Response.prototype.prompt = function prompt() {
prompt() {
return this.shell.prompt();
};
}
}

return Response;
Response.prototype.pad = pad;

})(styles);

module.exports = response;
module.exports = Response;

16 changes: 8 additions & 8 deletions lib/shell/lib/Shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/* global app */
/*eslint no-magic-numbers: 0 */

var EventEmitter, Interface, Request, Response, shell, events, readline, styles;
var EventEmitter, Interface, Request, Response, shell, events, readline;

readline = require('readline');
events = require('events');
EventEmitter = events.EventEmitter;
var utils = require('../../utils');
var util = require('util');
styles = require('./Styles');
var Styles = require('./Styles');
Request = require('./Request');
Response = require('./Response');
Interface = require('readline').Interface;
Expand All @@ -19,7 +19,7 @@ Interface.prototype.setPrompt = (function setPrompt(parent) {
return function returnSetPromt() {
var args = Array.prototype.slice.call(arguments);
if (!args[1]) {
args[1] = styles.unstyle(args[0]).length;
args[1] = Styles.unstyle(args[0]).length;
}
return parent.apply(this, args);
};
Expand All @@ -44,7 +44,7 @@ shell = (function exportShell(_super) {

Shell.prototype.init = function init(settings) {
var self = this;
console = app.logger(this.config('core.log.prefix') + ':shell');
console = this.logger(this.config('core.log.prefix') + ':shell');

this.tmp = {};
this.settings = settings;
Expand All @@ -65,7 +65,7 @@ shell = (function exportShell(_super) {

this.set('env', this.settings.env);

this.styles = styles({
this.styles = new Styles({
stdout: this.settings.stdout
});
process.on('beforeExit', function beforeExit() {
Expand Down Expand Up @@ -95,13 +95,13 @@ shell = (function exportShell(_super) {
process.chdir(settings.chdir);
}
console.log('init completed');
this.initialised = true;
this.initialized = true;
return this;
};

Shell.prototype.start = function start() {
if (!this.initialised) {
throw new Error('app not initialised run Shell.init()');
if (!this.initialized) {
throw new Error('app not initialized run Shell.init()');
}
console.debug('start app');
var command, noPrompt;
Expand Down
Loading

0 comments on commit 7d21177

Please sign in to comment.