Skip to content

Commit

Permalink
refactoring: linting + Manager moved to core/manager
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Oct 2, 2016
1 parent f3b89d6 commit 652c217
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
21 changes: 4 additions & 17 deletions src/cli/models/Manager.js → src/cli/core/manager/Manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ import path from 'path'
import {
config,
FileParser,
fileUtils,
folderUtils,
getSelectTemplateKeys
} from '../../cli'

import * as redis from '../services/RedisClient'
} from '../../'

let singleton = Symbol()
let singletonEnforcer = Symbol()
Expand All @@ -33,27 +30,19 @@ class Manager {
}

getList() {
if(config.redis.enable){
redis.get().get('list', function(err, reply) {
this._list = JSON.parse(reply)
})
}

return this._list
}

setList(list) {
if(config.redis.enable){
redis.get().set('list', JSON.stringify(list))
}
this._list = list

return this
}

init() {
this._whereKeys = []
var p = new Promise((resolve, reject) => {
var p = new Promise((resolve) => {
const pathTemplate = path.join(config.root, config.templates.url)
getSelectTemplateKeys(pathTemplate)
.then((whereKeys) => {
Expand All @@ -75,10 +64,8 @@ class Manager {
updateList() {
this._list = FileParser.getAllFilesWithKeys(this._whereKeys)
this._list.sort(FileParser.predicatBy('date', -1))
if(config.redis.enable){
redis.get().set('list', JSON.stringify(this._list))
}

console.log('Manager updated')

return this
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
ifCond
} from './handlebars/index'

import Manager from './models/Manager'
import Manager from './core/manager/Manager'
import Page from './models/Page'
import Handlebars from 'handlebars'
import {getAttr, getEnclosingTags, escapeTextToRegex} from './helpers/regex-helper'
Expand Down

0 comments on commit 652c217

Please sign in to comment.