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 d568ba7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- `whippet generate app` generates an app which can be deployed by Whippet.

### Added
- Support for PHP 8

Expand Down
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 d568ba7

Please sign in to comment.