Ejemplo n.º 1
0
exports.prototype.save = function (state) {
  if (this.verbose) {
    log.info('saving state')
  }
  this.data = state
  return fs.writeJSONAsync(path.join(this.path, this.filename), state, { mkdirp: true })
    .then(() => {
      return state
    })
}
Ejemplo n.º 2
0
 .then(function () {
   var regex = new RegExp(path.sep, 'g')
   var projectHash = projectPath.replace(regex, '__')
   var projectFile = path.join(Config.basePath, 'projects', projectHash) + '.json'
   var obj = _.clone(project)
   delete obj.pkg
   delete obj.httpServer
   return fs.writeJSONAsync(projectFile, obj, {space: 2, mkdirp: true})
     .then(function () {
       return project
     })
 })
Ejemplo n.º 3
0
 .then(function (exists) {
   if (!exists) {
     fs.writeJSONAsync(configPath, initialConfig, { space: 2, mkdirp: true })
   }
 })