Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 6b273bf

Browse files
committed
Executing create-project on initial install using Composer plugin.
1 parent 7cadb4f commit 6b273bf

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/Composer/Plugin.php

+27-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,12 @@ protected function getBltPackage($operation) {
128128
*/
129129
protected function executeBltUpdate($version) {
130130
$options = $this->getOptions();
131-
if ($options['blt']['update']) {
131+
132+
if ($this->isInitialInstall()) {
133+
$this->io->write('<info>Creating BLT templated files...</info>');
134+
$success = $this->executeCommand('blt create-project', [], TRUE);
135+
}
136+
elseif ($options['blt']['update']) {
132137
$this->io->write('<info>Updating BLT templated files...</info>');
133138

134139
// Rsyncs, updates composer.json, project.yml, executes scripted updates for version delta.
@@ -148,6 +153,27 @@ protected function executeBltUpdate($version) {
148153
}
149154
}
150155

156+
/**
157+
* Determine if BLT is being installed for the first time on this project.
158+
*
159+
* This would execute in the context of `composer create-project`.
160+
*
161+
* @return bool
162+
* TRUE if this is the initial install of BLT.
163+
*/
164+
protected function isInitialInstall() {
165+
if (!file_exists($this->getRepoRoot() . '/blt/project.yml')
166+
&& !file_exists($this->getRepoRoot() . '/blt/.schema-version')
167+
&& file_exists($this->getRepoRoot() . '/.travis.yml')
168+
&& file_exists($this->getRepoRoot() . '/LICENSE.txt')
169+
&& file_exists($this->getRepoRoot() . '/README.md')
170+
) {
171+
return TRUE;
172+
}
173+
174+
return FALSE;
175+
}
176+
151177
/**
152178
* Returns the repo root's filepath, assumed to be one dir above vendor dir.
153179
*

0 commit comments

Comments
 (0)