Initialize a boilerplate CouchApp in the specified directory.

@param {string} directory
@param {function} callback (err)
166855
function init (directory, callback) {
  var source = path.join(__dirname, 'template');
  ncp(source, directory, callback);
}
1212406
function init ( cb ) {
    if (my.args.length > 0) {
      console.log('ignoring extra arguments')
    }
    stats(process.cwd(), 'isDirectory', function (err, currentbin) {
      if (err) return cb(err)
      var newbin = currentbin.name
      if (my.state.bins.hasOwnProperty(newbin)) {
        return cb( erf( 'A bin with name ' + path.basename(newbin)
                        + ' has already been initialized') )
      }
      my.state.bins = setActiveBin(my.state.bins, newbin)
      cb(null, my.state)

    })
  }
650661
def init(directory=None, multidb=False):
    """"""
    if directory is None:
        directory = current_app.extensions['migrate'].directory
    config = Config()
    config.set_main_option('script_location', directory)
    config.config_file_name = os.path.join(directory, 'alembic.ini')
    config = current_app.extensions['migrate'].\
        migrate.call_configure_callbacks(config)
    if multidb:
        command.init(config, directory, 'flask-multidb')
    else:
        command.init(config, directory, 'flask')
619546
function walkTree(directory, callback) {
    callback(directory);
    directory.directories.forEach(childDirectory => walkTree(childDirectory, callback));
}
740872
function createDirectory(directory) {
  if (!directory) {
    throw new Error('A directory must be passed to be created.');
  }
  const statObject = getStatObject(directory);
  if (statObject && statObject.isFile()) {
    throw new Error(`The directory to create '${directory}' is a file.`);
  }
  fse.ensureDirSync(directory);
}
37526
public function initializeTemplate($directory = null)
	{
		if (empty($directory)) {
			$directory = $this->config->resolvePath('views');
		}

		$this->template = new Template($directory);
	}
1181231
function serveapp (directory) {
	/* istanbul ignore next */
	return async function serveEmberAPP (ctx, next) {
		await next();
		if (!ctx.body) {
			await ctx.render(directory);
		}
	};
}
463208
function(callback) {
    async.waterfall([
      // Make root directory.
      maybeMkdir.bind(null, this.root),

      // Make tmp directory.
      function(done) {
        this.tempdir = path.join(this.root, '.tmp');
        maybeMkdir(this.tempdir, { purge: true }, done);
      }.bind(this),

      // Make directories for each package, package version.
      function(done) {
        var dirs = [];
        for (var package in this.packageToVersions) {
          dirs.push(path.resolve(this.tempdir, package));
          var versions = this.packageToVersions[package];
          for (var version in versions) {
            dirs.push(path.resolve(this.tempdir, package, version));
          }
        }

        async.parallel(dirs.map(function(dir) {
          return maybeMkdir.bind(null, dir);
        }), function(err) {
          return done && done(err);
        });
      }.bind(this)
    ], callback);
  }
1286024
function(directoryName, cbUpload, cbError) {
    this.directory = directoryName;
    this.name = '';
    this.localPath = '';
    this.virtualPath = '';
    this.onUpload = cbUpload;
    this.onError = cbError;
}
1006383
function (path, callback) {
    var mkdir = child_process.spawn('mkdir', ['-p', path]);
    mkdir.on('error', function (err) {
        callback(err);
        callback = function(){};
    });
    mkdir.on('exit', function (code) {
        if (code === 0) callback();
        else callback(new Error('mkdir exited with code: ' + code));
    });
}
836934
public static function init($data_directory = null)
	{
		$coverage_tool = new self($data_directory);
		$mode = isset($_GET['rct_mode']) ? $_GET['rct_mode'] : '';

		if ( $mode == 'output' ) {
			echo $coverage_tool->aggregateCoverageInformation();
		}
		else {
			$coverage_tool->startCollection();
			register_shutdown_function(array($coverage_tool, 'stopCollection'));
		}
	}
917630
function(dirPath, callback) {

            if (!dirPath || typeof dirPath !== 'string') {
                callback("dirPath must be a string");
            } else {
                fs.readdir(dirPath, function(err, list) {
                    var dir = [];

                    if (err) {
                        callback(err, null);
                    } else {
                        list.forEach(function(item) {
                            dir.push(readNode(path.join(dirPath, item)));
                        });

                        callback(null, dir);
                    }

                });
            }

        }
1026186
function (context, path, callback) {
  path = normalize(path);
  var name = basename(path);
  var parentPath = dirname(path);

  var directoryNode;
  var directoryData;
  var parentDirectoryNode;
  var parentDirectoryData;

  function read_parent_directory_data(error, result) {
    if(error) {
      callback(error);
    } else {
      parentDirectoryNode = result;
      context.getObject(parentDirectoryNode.data, check_if_node_exists);
    }
  }

  function check_if_node_exists(error, result) {
    if(error) {
      callback(error);
    } else if(ROOT_DIRECTORY_NAME === name) {
      callback(new Errors.EBUSY(null, path));
    } else if(!result.hasOwnProperty(name)) {
      callback(new Errors.ENOENT(null, path));
    } else {
      parentDirectoryData = result;
      directoryNode = parentDirectoryData[name].id;
      context.getObject(directoryNode, check_if_node_is_directory);
    }
  }

  function check_if_node_is_directory(error, result) {
    if(error) {
      callback(error);
    } else if(result.type !== NODE_TYPE_DIRECTORY) {
      callback(new Errors.ENOTDIR(null, path));
    } else {
      directoryNode = result;
      context.getObject(directoryNode.data, check_if_directory_is_empty);
    }
  }

  function check_if_directory_is_empty(error, result) {
    if(error) {
      callback(error);
    } else {
      directoryData = result;
      if(Object.keys(directoryData).length > 0) {
        callback(new Errors.ENOTEMPTY(null, path));
      } else {
        _entry_from_parent_directory_node();
      }
    }
  }

  function update_time(error) {
    if(error) {
      callback(error);
    } else {
      var now = Date.now();
      update_node_times(context, parentPath, parentDirectoryNode, { mtime: now, ctime: now }, _node);
    }
  }

  function _entry_from_parent_directory_node() {
    delete parentDirectoryData[name];
    context.putObject(parentDirectoryNode.data, parentDirectoryData, update_time);
  }

  function _node(error) {
    if(error) {
      callback(error);
    } else {
      context.delete(directoryNode.id, _data);
    }
  }

  function _data(error) {
    if(error) {
      callback(error);
    } else {
      context.delete(directoryNode.data, callback);
    }
  }

  find_node(context, parentPath, read_parent_directory_data);
}
301347
def init_app(self, app):
        """"""
        self.init_config(app)
        if hasattr(app, 'cli'):
            app.cli.add_command(files_cmd)
        app.extensions['invenio-files-rest'] = _FilesRESTState(app)
1117881
function _onBuildApp(app) {
    let proto = Object.getPrototypeOf(app);
    if (proto.constructor && proto.constructor.name === 'ShellApp') {
        app.once('post-init', function() {
            this.build();
            this.listen();
        });
    }
}
344091
function init(opts) {
	if (!opts || !opts.appData) throw new Error(path.basename(__filename)+ ':' + arguments.callee.name + ': bad opts argument')

	var apiOpts = opts.apiOpts || {}
	state.apiConfigs = apiOpts.apiMap || {}
	if (Array.isArray(apiOpts.path)) state.apiPath = apiOpts.path

	state.deployFolder = opts.appData.launchFolder
}
764601
public function directory($path, Closure $callback = null)
    {
        try
        {
            $path = $this->finder->setWorkingDirectory($path);

            $this->directories[$path] = new Directory($this->factory, $this->finder, $path);

            // Once we've set the working directory we'll fire the callback so that any added assets
            // are relative to the working directory. After the callback we can revert the working
            // directory.
            is_callable($callback) and call_user_func($callback, $this->directories[$path]);

            $this->finder->resetWorkingDirectory();

            return $this->directories[$path];
        }
        catch (DirectoryNotFoundException $e)
        {
            $this->getLogger()->error(sprintf('Directory "%s" could not be found in "%s"', $path, $this->path));

            return new Directory($this->factory, $this->finder, null);
        }
    }