Merge pull request #612 from D-Programming-Language/sdl-init
Add SDL support to "dub init".
commit 00f59eb63dcf922e1ad77ede13cbfdcf0a09084f
2 parents d39552b + 1332f16
@Sönke Ludwig Sönke Ludwig authored on 1 Jul 2015
Showing 9 changed files
View
7
source/dub/commandline.d
 
class InitCommand : Command {
private{
string m_buildType = "minimal";
PackageFormat m_format = PackageFormat.sdl;
}
this()
{
this.name = "init";
"",
"minimal - simple \"hello world\" project (default)",
"vibe.d - minimal HTTP server based on vibe.d",
"deimos - skeleton for C header bindings",
]);
args.getopt("f|format", &m_format, [
"Sets the format to use for the package description file. Possible values:",
" sdl, json"
]);
}
 
override int execute(Dub dub, string[] free_args, string[] app_args)
free_args = free_args[1 .. $];
logInfo("Deprecated use of init type. Use --type=[vibe.d | deimos | minimal] in future.");
}
}
dub.createEmptyPackage(Path(dir), free_args, m_buildType);
dub.createEmptyPackage(Path(dir), free_args, m_buildType, m_format);
return 0;
}
}
 
View
12
source/dub/dub.d
if (m_dryRun) return;
m_packageManager.removeSearchPath(makeAbsolute(path), system ? LocalPackageType.system : LocalPackageType.user);
}
 
void createEmptyPackage(Path path, string[] deps, string type)
void createEmptyPackage(Path path, string[] deps, string type, PackageFormat format = PackageFormat.sdl)
{
if (!path.absolute) path = m_rootPath ~ path;
path.normalize();
 
}
}
}
if(notFound.length > 1){
throw new Exception(format("Couldn't find packages: %-(%s, %).", notFound));
throw new Exception(.format("Couldn't find packages: %-(%s, %).", notFound));
}
else if(notFound.length == 1){
throw new Exception(format("Couldn't find package: %-(%s, %).", notFound));
}
 
initPackage(path, depVers, type);
throw new Exception(.format("Couldn't find package: %-(%s, %).", notFound));
}
 
initPackage(path, depVers, type, format);
 
//Act smug to the user.
logInfo("Successfully created an empty project in '%s'.", path.toNativeString());
}
View
source/dub/init.d
View
test/0-init-fail-json.sh 0 → 100755
View
test/0-init-fail.sh
View
test/0-init-multi-json.sh 0 → 100755
View
test/0-init-multi.sh
View
test/0-init-simple-json.sh 0 → 100755
View
test/0-init-simple.sh