Skip to content

Commit

Permalink
refactoring: save
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslabbe committed Oct 5, 2016
1 parent 9899dff commit 14cf168
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 24 deletions.
4 changes: 2 additions & 2 deletions src/cli/cms/operations/create.js
Expand Up @@ -5,7 +5,7 @@ import {
Util,
cleanSlug,
cmsTemplate,
save,
cmsOperations,
config,
Hooks,
cmsData,
Expand Down Expand Up @@ -38,7 +38,7 @@ var create = function(template, pathCreate, name, req, forceJson = {}, duplicate
text = resHook.text

Hooks.instance.trigger('afterCreate', json, text, pathCreate, name, req, forceJson)
save(filePath, template, json, text, 'draft', null, 'draft')
cmsOperations.save.save(filePath, template, json, text, 'draft', null, 'draft')
.then((resSave) => {
Manager.instance.updateList()
filePath = resSave.htmlPath
Expand Down
2 changes: 2 additions & 0 deletions src/cli/cms/operations/index.js
@@ -1,7 +1,9 @@
import create from './create'
import duplicate from './duplicate'
import * as save from './save'

export {
create
,duplicate
,save
}
4 changes: 2 additions & 2 deletions src/cli/core/utils/file-parser.js
Expand Up @@ -8,7 +8,7 @@ import path from 'path'
import {
cli
,cmsData
,save
,cmsOperations
,folderUtils
,fileUtils
,config
Expand Down Expand Up @@ -440,7 +440,7 @@ export default class FileParser {
delete json.abe_meta.publish
}

save(
cmsOperations.save.save(
fileUtils.getFilePath(json.abe_meta.link),
json.abe_meta.template,
json,
Expand Down
5 changes: 0 additions & 5 deletions src/cli/index.js
Expand Up @@ -48,8 +48,6 @@ import Create from './cms/Create'

import config from './core/config/config'

import {save, checkRequired, saveJson} from './cms/operations/save'

import abeProcess from './extend/abe-process'
import Hooks from './extend/abe-hooks'
import Plugins from './extend/abe-plugins'
Expand Down Expand Up @@ -95,12 +93,9 @@ export {
,ifIn
,ifCond
,config
,save
,Hooks
,Plugins
,Locales
,checkRequired
,saveJson
,dateSlug
,dateUnslug
,Manager
Expand Down
4 changes: 2 additions & 2 deletions src/cli/process/publish-all.js
Expand Up @@ -43,7 +43,7 @@ function publishNext(published, tt, cb, i = 0) {
var p = new Promise((resolve, reject) => {
try {

save(
cmsOperations.save.save(
pub.path,
json.abe_meta.template,
null,
Expand Down Expand Up @@ -104,7 +104,7 @@ if(typeof pConfig.ABE_WEBSITE !== 'undefined' && pConfig.ABE_WEBSITE !== null) {
var FileParser = require('../../cli').FileParser
var fileUtils = require('../../cli').fileUtils
var folderUtils = require('../../cli').folderUtils
var save = require('../../cli').save
var cmsOperations = require('../../cli').cmsOperations
var Manager = require('../../cli').Manager

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

Expand Down
1 change: 0 additions & 1 deletion src/server/controllers/index.js
Expand Up @@ -29,7 +29,6 @@ import {
} from '../routes'

import {
save,
Util,
FileParser,
fileUtils,
Expand Down
1 change: 0 additions & 1 deletion src/server/middlewares/website.js
Expand Up @@ -10,7 +10,6 @@ import xss from 'xss'
import pkg from '../../../package'

import {
save,
Util,
FileParser,
fileUtils,
Expand Down
1 change: 0 additions & 1 deletion src/server/routes/get-create.js
Expand Up @@ -4,7 +4,6 @@ import {
Util,
cleanSlug,
config,
save,
cmsOperations,
Hooks
} from '../../cli'
Expand Down
1 change: 0 additions & 1 deletion src/server/routes/get-list-hooks.js
Expand Up @@ -7,7 +7,6 @@ import {
Util,
cleanSlug,
config,
save,
Hooks,
Plugins
} from '../../cli'
Expand Down
4 changes: 2 additions & 2 deletions src/server/routes/post-draft.js
@@ -1,5 +1,5 @@
import {
save,
cmsOperations,
fileUtils,
Hooks,
Manager
Expand All @@ -8,7 +8,7 @@ import {
var route = function(req, res, next){
Hooks.instance.trigger('beforeRoute', req, res, next)
if(typeof res._header !== 'undefined' && res._header !== null) return
save(
cmsOperations.save.save(
fileUtils.getFilePath(req.body.filePath),
req.body.tplPath,
req.body.json,
Expand Down
6 changes: 3 additions & 3 deletions src/server/routes/post-publish.js
@@ -1,6 +1,6 @@
import {
fileUtils,
save,
cmsOperations,
cleanSlug,
Hooks,
Manager
Expand All @@ -12,7 +12,7 @@ var route = function(req, res, next){

var filePath = cleanSlug(req.body.filePath)
var p = new Promise((resolve) => {
save(
cmsOperations.save.save(
fileUtils.getFilePath(filePath),
req.body.tplPath,
req.body.json,
Expand All @@ -28,7 +28,7 @@ var route = function(req, res, next){
})

p.then((resSave) => {
save(
cmsOperations.save.save(
fileUtils.getFilePath(req.body.filePath),
req.body.tplPath,
req.body.json,
Expand Down
6 changes: 3 additions & 3 deletions src/server/routes/post-reject.js
@@ -1,5 +1,5 @@
import {
save,
cmsOperations,
fileUtils,
Hooks,
Manager
Expand All @@ -10,7 +10,7 @@ var route = function(req, res, next){
if(typeof res._header !== 'undefined' && res._header !== null) return

var p = new Promise((resolve) => {
save(
cmsOperations.save.save(
fileUtils.getFilePath(req.body.filePath),
req.body.tplPath,
req.body.json,
Expand All @@ -26,7 +26,7 @@ var route = function(req, res, next){
})

p.then((resSave) => {
save(
cmsOperations.save.save(
fileUtils.getFilePath(req.body.filePath),
req.body.tplPath,
req.body.json,
Expand Down

0 comments on commit 14cf168

Please sign in to comment.