diff --git a/source/dub/init.d b/source/dub/init.d index ec09a9a..d2ee8f2 100644 --- a/source/dub/init.d +++ b/source/dub/init.d @@ -1,7 +1,7 @@ /** - Empty package initialization code. + Package skeleton initialization code. - Copyright: © 2013-2015 rejectedsoftware e.K. + Copyright: © 2013-2016 rejectedsoftware e.K. License: Subject to the terms of the MIT license, as written in the included LICENSE.txt file. Authors: Sönke Ludwig */ @@ -20,7 +20,27 @@ import std.process; import std.string; -void initPackage(Path root_path, string[string] deps, string type, PackageFormat format, scope void delegate(ref PackageRecipe, ref PackageFormat) recipe_callback = null) + +/** Intializes a new package in the given directory. + + The given `root_path` will be checked for any of the files that will be + created by this function. If any exist, an exception will be thrown before + altering the directory. + + Params: + root_path = Directory in which to create the new package. If the + directory doesn't exist, a new one will be created. + deps = A set of extra dependencies to add to the package recipe. The + associative array is expected to map from package name to package + version. + type = The type of package skeleton to create. Can currently be + "minimal", "vibe.d" or "deimos" + recipe_callback = Optional callback that can be used to customize the + package recipe and the file format used to store it prior to + writing it to disk. +*/ +void initPackage(Path root_path, string[string] deps, string type, + PackageFormat format, scope void delegate(ref PackageRecipe, ref PackageFormat) recipe_callback = null) { import std.conv : to; import dub.recipe.io : writePackageRecipe; @@ -123,7 +143,7 @@ createDirectory(root_path ~ "deimos"); } -void writeGitignore(Path root_path) +private void writeGitignore(Path root_path) { write((root_path ~ ".gitignore").toNativeString(), ".dub\ndocs.json\n__dummy.html\n*.o\n*.obj\n");