Add --init option to Daemon to initialize site on daemon start.

The --init option will also upgrade an already existing site and
is processed in non-interactive (batch) mode.

This is a rework of the automatic schema upgrade feature that was
introduced with de980a4ddd and is
reverted with this change. Running init is more generic and also
supports initialization of a new site on daemon start.

Besides automatic upgrade, this feature also makes developers work
more comfortable as it can eliminate running init as a separate
step before running the daemon.

Change-Id: I6a245172529812e42e573413f41424a0497e9539
This commit is contained in:
Sasa Zivkov
2013-05-10 11:15:53 +02:00
parent 383041f948
commit ebd0498956
6 changed files with 32 additions and 130 deletions

View File

@@ -51,6 +51,13 @@ public abstract class SiteProgram extends AbstractProgram {
@Option(name = "--site-path", aliases = {"-d"}, usage = "Local directory containing site data")
private File sitePath = new File(".");
protected SiteProgram() {
}
protected SiteProgram(File sitePath) {
this.sitePath = sitePath;
}
/** @return the site path specified on the command line. */
protected File getSitePath() {
File path = sitePath.getAbsoluteFile();