Ejemplo n.º 1
0
Archivo: fstk.js Proyecto: sackio/fstk
      , function(cb){
          if (a.o.optimistic){
            if (!globals.error) return cb();
            var err_code = Belt._get(globals, 'error.code');
            if (err_code && err_code.match(/^EEXIST$|^ENOENT$/)) return cb();
            if (!err_code || !err_code.match(/^ENOTEMPTY$/)) return cb(globals.error);
          }

          return Async.waterfall([
            function(_cb){
              return F.dirPart(path, a.o, Belt.callset(_cb, globals, 'contents', 1, 0));
            }
          , function(_cb){
              return Async.eachSeries(globals.contents.files, function(f, __cb){
                return FS.unlink(f.path, Belt.cw(__cb, 0));
              }, Belt.cw(_cb, 0));
            }
          , function(_cb){
              var dirs = globals.contents.directories;
              dirs.unshift({'path': path});
              dirs = dirs.reverse();
              return Async.eachSeries(dirs, function(d, __cb){
                return FS.rmdir(d.path, Belt.cw(__cb, 0));
              }, Belt.cw(_cb, 0));
            }
          ], Belt.callwrap(cb, 0));
        }
Ejemplo n.º 2
0
Archivo: fstk.js Proyecto: sackio/fstk
      , function(cb){
          if (!globals.error) return cb();
          var err_code = Belt._get(globals, 'error.code');
          if (err_code && err_code.match(/^ENOENT$/)) return cb();
          if (!err_code || !err_code.match(/^EISDIR$/)) return cb(globals.error);

          return F.rmdir(path, Belt.callwrap(cb, 0));
        }
Ejemplo n.º 3
0
  schema.method('unwatch_file', function(path){
    var self = this;

    if (!Belt._get(self.get(path), a.o.virtual_prefix + 'watcher')) return false;

    Belt._call(self.get(path)[a.o.virtual_prefix + 'watcher.watcher'], 'close');
    self.get(path)[a.o.virtual_prefix + 'watcher'] = null;

    return true;
  });
Ejemplo n.º 4
0
Archivo: fstk.js Proyecto: sackio/fstk
      , function(cb){
          if (a.o.optimistic){
            if (!globals.error) return cb();
            var err_code = Belt._get(globals, 'error.code');
            if (err_code && err_code.match(/^EEXIST$/)) return cb();
            if (!err_code || !err_code.match(/^ENOENT$/)) return cb(globals.error);
          }

          var subpaths = F.subPaths(path);

          return Async.eachSeries(subpaths, function(p, _cb){
            return FS.mkdir(p, a.o, function(err){
              if (!err) return _cb();
              var err_code = Belt._get(err, 'code');
              if (err_code && err_code.match(/^EEXIST$/)) return _cb();
              if (!err_code || !err_code.match(/^ENOENT$/)) return _cb(err);
            });
          }, Belt.callwrap(cb, 0));
        }
Ejemplo n.º 5
0
Archivo: fstk.js Proyecto: sackio/fstk
 return FS.mkdir(p, a.o, function(err){
   if (!err) return _cb();
   var err_code = Belt._get(err, 'code');
   if (err_code && err_code.match(/^EEXIST$/)) return _cb();
   if (!err_code || !err_code.match(/^ENOENT$/)) return _cb(err);
 });
Ejemplo n.º 6
0
Archivo: fstk.js Proyecto: sackio/fstk
 , function(cb){
     return Async.eachSeries(Belt._get(globals, 'contents.files'), function(f, _cb){
       return FS.unlink(f.path, Belt.callwrap(_cb, 0));
     }, Belt.callwrap(cb, 0));
   }
Ejemplo n.º 7
0
Archivo: fstk.js Proyecto: sackio/fstk
 , function(cb){
     return Async.eachSeries(Belt._get(globals, 'contents.directories'), function(f, _cb){
       return F.rm(f.path, Belt.callwrap(_cb, 0));
     }, Belt.callwrap(cb, 0));
   }
Ejemplo n.º 8
0
Archivo: fstk.js Proyecto: sackio/fstk
 , function(cb){
     return Async.eachSeries(Belt._get(globals, 'contents.files'), function(f, _cb){
       return FS.rename(f.path, Path.join(path, '/' + Path.basename(f.path)), Belt.callwrap(_cb, 0));
     }, Belt.callwrap(cb, 0));
   }
Ejemplo n.º 9
0
 , function(cb){
     return Seme.services.google_places.photo(Belt._get(globals, 'place_details.photos.0.photo_reference')
     , Belt.cs(cb, globals, 'photo_path', 1, 0));
   }
Ejemplo n.º 10
0
 return Seme.services.google_places.placeSearch(parameters, function(err, response){
   //console.log(response.results);
   globals.place = Belt._get(response, 'results.0');
   return cb();
 });
Ejemplo n.º 11
0
 }, function(err, response, body){
   return a.cb(err, Belt._get(body, 'result'));
 });
Ejemplo n.º 12
0
 }, 'callback': function(err, resp, body){
   if (err) return a.cb(err);
   if (Belt._get(body, 'status') !== 'OK')
     return a.cb(new Error(Belt.get(body, 'status') || 'Non-OK status occured'));
   return a.cb(null, Belt.deArray(Belt.get(body, 'results')));
 }});