Skip to content

Commit

Permalink
Generated app can be deployed
Browse files Browse the repository at this point in the history
Whippet expects that a deployable app is a Git repo, with
at least one commit. Previously, an app generated by Whippet
was a Git repo, but did not have any commits, and so could
not be deployed.

This commit adds a single commit to generated apps, to fix that.

Fixes #47
  • Loading branch information
snim2 committed Sep 18, 2023
1 parent 90d4462 commit 501b5ee
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion generators/app/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function generate() {
}

// Make the target dir a git repo, if it isn't already
if(!(new \Dxw\Whippet\Git\Git($this->target_dir))->is_repo()) {
$target_repo = new \Dxw\Whippet\Git\Git($this->target_dir);
if(!$target_repo->is_repo()) {
\Dxw\Whippet\Git\Git::init($this->target_dir);
}

Expand All @@ -35,6 +36,12 @@ function generate() {

$this->unzipAndRemoveTemplateZip();

// Whippet deploy requires at least one commit in the repo.
if (!$target_repo->current_commit()) {
$target_repo->add("--all");
$target_repo->commit("Initial commit from Whippet");
}

if(isset($this->options->repository)) {
$this->setWPRepository();
}
Expand Down

0 comments on commit 501b5ee

Please sign in to comment.