diff --git a/source/dub/init.d b/source/dub/init.d index f1121ee..b1a87a1 100644 --- a/source/dub/init.d +++ b/source/dub/init.d @@ -28,7 +28,7 @@ } //Make sure we do not overwrite anything accidentally - auto files = packageInfoFilenames ~ ["source/", "views/", "public/"]; + auto files = packageInfoFilenames ~ ["source/", "views/", "public/", "dub.json", ".gitignore"]; foreach (fil; files) enforce(!existsFile(root_path ~ fil), "The target directory already contains a '"~fil~"' file. Aborting."); @@ -37,6 +37,7 @@ case "minimal": initMinimalPackage(root_path); break; case "vibe.d": initVibeDPackage(root_path); break; } + writeGitignore(root_path); } void initMinimalPackage(Path root_path) @@ -107,3 +108,9 @@ if (versions.length) fil.formattedWrite(",\n\t\"versions\": [%s]", versions.map!(v => `"`~v~`"`).join(", ")); fil.write("\n}\n"); } + +void writeGitignore(Path root_path) +{ + write((root_path ~ ".gitignore").toNativeString(), + ".dub\ndocs.json\n__dummy.html\n*.o\n*.obj\n"); +} \ No newline at end of file