Skip to content

Commit

Permalink
refactoring: removing abe-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Oct 2, 2016
1 parent 865d41b commit c1ee8c3
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 184 deletions.
2 changes: 0 additions & 2 deletions src/cli/controllers/Save.js
Expand Up @@ -13,7 +13,6 @@ import {
,config
,fileUtils
,fileAttr
,log
,dateSlug
,Page
,getTemplate
Expand Down Expand Up @@ -170,7 +169,6 @@ export function save(url, tplPath, json = null, text = '', type = '', previousSa
}
}

log.duration('save: ' + url.replace(config.root, '') + ' (' + type + ')', ((new Date().getTime() - dateStart.getTime()) / 1000))
resolve(res)
}).catch(function(e) {
console.error('Save.js', e)
Expand Down
41 changes: 22 additions & 19 deletions src/cli/core/config/config.js
Expand Up @@ -10,28 +10,31 @@ var hintAbeJson = false

var loadLocalConfig = (result) => {
var website = result.root.replace(/\/$/, '')
try{
var stat = fse.statSync(website)
if (stat && stat.isDirectory()) {
try{
stat = fse.statSync(website + '/abe.json')
if (stat) {
var json = fse.readJsonSync(website + '/abe.json')
result = extend(true, result, json)
}
}catch(e) {
if (!hintAbeJson) {
hintAbeJson = true
console.log(
clc.green('[ Hint ]'),
'create abe.json to config',
clc.cyan.underline('https://github.com/AdFabConnect/abejs/blob/master/docs/abe-config.md')
)
if(website !==''){
try{
var stat = fse.statSync(website)
if (stat && stat.isDirectory()) {
try{
stat = fse.statSync(website + '/abe.json')
if (stat) {
var json = fse.readJsonSync(website + '/abe.json')
result = extend(true, result, json)
}
}catch(e) {
if (!hintAbeJson) {
hintAbeJson = true
console.log(
clc.green('[ Hint ]'),
'create abe.json to config',
clc.cyan.underline('https://github.com/AdFabConnect/abejs/blob/master/docs/abe-config.md')
)
}
}
}
}catch(e){
console.log('LoadConfig Error')
console.log(e)
}
}catch(e){
console.log('LoadConfig Error')
}
}

Expand Down
1 change: 0 additions & 1 deletion src/cli/helpers/abe-create.js
Expand Up @@ -7,7 +7,6 @@ import {
getTemplate,
save,
config,
log,
Hooks,
removeDuplicateAttr,
Manager
Expand Down
3 changes: 1 addition & 2 deletions src/cli/helpers/abe-duplicate.js
Expand Up @@ -10,8 +10,7 @@ import {
getTemplate,
config,
save,
abeCreate,
log
abeCreate
} from '../../cli'

var duplicate = function(oldFilePath, template, newPath, name, req, isUpdate = false) {
Expand Down
1 change: 0 additions & 1 deletion src/cli/helpers/abe-get-select-template-keys.js
Expand Up @@ -10,7 +10,6 @@ import {
getTemplate,
save,
config,
log,
Hooks,
removeDuplicateAttr,
Manager
Expand Down
2 changes: 0 additions & 2 deletions src/cli/helpers/abe-hooks.js
Expand Up @@ -10,9 +10,7 @@ import {
,FileParser
,config
,fileUtils
,cli
,Plugins
,log
} from '../'

import * as abe from '../'
Expand Down
4 changes: 1 addition & 3 deletions src/cli/helpers/abe-locales.js
Expand Up @@ -3,9 +3,7 @@ import clc from 'cli-color'
import path from 'path'

import {
cli
,log
,config
config
,fileUtils
,FileParser
} from '../'
Expand Down
126 changes: 0 additions & 126 deletions src/cli/helpers/abe-logs.js

This file was deleted.

3 changes: 1 addition & 2 deletions src/cli/helpers/abe-plugins.js
Expand Up @@ -7,8 +7,7 @@ import {
FileParser,
config,
fileUtils,
folderUtils,
log
folderUtils
} from '../'

let singleton = Symbol()
Expand Down
2 changes: 0 additions & 2 deletions src/cli/helpers/abe-template.js
Expand Up @@ -7,8 +7,6 @@ import {
,Util
,config
,fileUtils
,cli
,log
,FileParser
,escapeTextToRegex
,Hooks
Expand Down
2 changes: 0 additions & 2 deletions src/cli/helpers/abe-utils.js
Expand Up @@ -10,8 +10,6 @@ import path from 'path'

import {
config
,cli
,log
,Sql
,folderUtils
,fileUtils
Expand Down
4 changes: 1 addition & 3 deletions src/cli/helpers/file-parser.js
Expand Up @@ -6,9 +6,7 @@ import moment from 'moment'
import path from 'path'

import {
cli
,log
,save
save
,folderUtils
,fileUtils
,fileAttr
Expand Down
2 changes: 0 additions & 2 deletions src/cli/helpers/folder-utils.js
Expand Up @@ -4,8 +4,6 @@ import mkdirp from 'mkdirp'
import moment from 'moment'

import {
cli,
log,
fileUtils,
fileAttr,
config
Expand Down
Empty file removed src/cli/helpers/untitled
Empty file.
2 changes: 0 additions & 2 deletions src/cli/index.js
Expand Up @@ -40,7 +40,6 @@ import FileParser from './helpers/file-parser'
import Create from './Create'
import fileUtils from './helpers/file-utils'
import config from './core/config/config'
import log from './helpers/abe-logs'
import removeDuplicateAttr from './helpers/abe-remove-duplicate-attr'
import abeCreate from './helpers/abe-create'
import abeDuplicate from './helpers/abe-duplicate'
Expand Down Expand Up @@ -94,7 +93,6 @@ export {
,escapeTextToRegex
,config
,getTemplate
,log
,removeDuplicateAttr
,save
,Hooks
Expand Down
4 changes: 0 additions & 4 deletions src/cli/process/publish-all.js
Expand Up @@ -68,9 +68,7 @@ function publishNext(published, tt, cb, i = 0) {
msg: e + ''
, json:json
})
// log.write('publish-all', e)
console.log(clc.red(e))
// log.write('publish-all', 'ERROR on ' + pub.path .replace(config.root, ''))
console.log('publish-all', 'ERROR on ' + pub.path.replace(config.root, '').replace(config.data.url, ''))
resolve()
})
Expand Down Expand Up @@ -143,12 +141,10 @@ if(typeof pConfig.ABE_WEBSITE !== 'undefined' && pConfig.ABE_WEBSITE !== null) {
})
})
.catch((e) => {
// log.write('publish-all', e)
console.log('publish-all', e)
})

} catch(e) {
// log.write('publish-all', e)
console.log('publish-all', e)
}

Expand Down
1 change: 0 additions & 1 deletion src/cli/process/update-json.js
Expand Up @@ -7,7 +7,6 @@ import {
,fileUtils
,folderUtils
,save
,log
,Hooks
} from '../../cli'

Expand Down
1 change: 0 additions & 1 deletion src/server/controllers/index.js
Expand Up @@ -39,7 +39,6 @@ import {
fileUtils,
folderUtils,
config,
log,
Page,
Locales,
abeProcess,
Expand Down
3 changes: 1 addition & 2 deletions src/server/helpers/abe-locale.js
Expand Up @@ -6,8 +6,7 @@ import path from 'path'
import {
FileParser,
fileUtils,
config,
log
config
} from '../../cli'

var result = {}
Expand Down
1 change: 0 additions & 1 deletion src/server/middlewares/website.js
Expand Up @@ -18,7 +18,6 @@ import {
fileUtils,
folderUtils,
config,
log,
Page,
Locales,
abeProcess,
Expand Down
1 change: 0 additions & 1 deletion src/server/routes/get-create.js
Expand Up @@ -6,7 +6,6 @@ import {
getTemplate,
config,
save,
log,
abeCreate,
Hooks
} from '../../cli'
Expand Down
1 change: 0 additions & 1 deletion src/server/routes/get-duplicate.js
@@ -1,6 +1,5 @@
import {
abeDuplicate,
log,
Hooks
} from '../../cli'

Expand Down
1 change: 0 additions & 1 deletion src/server/routes/get-list-hooks.js
Expand Up @@ -9,7 +9,6 @@ import {
getTemplate,
config,
save,
log,
abeCreate,
Hooks,
Plugins
Expand Down
1 change: 0 additions & 1 deletion src/server/routes/get-list-url.js
Expand Up @@ -8,7 +8,6 @@ import {
getTemplate,
config,
save,
log,
abeCreate,
Hooks
} from '../../cli'
Expand Down

0 comments on commit c1ee8c3

Please sign in to comment.