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

Commit 38631eb

Browse files
committed
fix: Fixed module generation
Removed double blankspace
1 parent 1352ab3 commit 38631eb

4 files changed

Lines changed: 27 additions & 9 deletions

File tree

.github/scripts/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ CURRENT_VERSION=$(cat composer.json | grep version | head -1 | awk -F= "{ print
55

66
sed -i "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"$NEXT_VERSION\"/g" composer.json
77

8-
zip -r "/tmp/extremis-core-$NEXT_VERSION.zip" composer.json README.md CHANGELOG.md src
8+
zip -r "/tmp/autoconstructor-$NEXT_VERSION.zip" composer.json README.md CHANGELOG.md src

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ jobs:
1313
with:
1414
fetch-depth: 0
1515
token: ${{ secrets.OBLAK_BOT_TOKEN }}
16+
- name: Import GPG key
17+
uses: crazy-max/ghaction-import-gpg@v5
18+
with:
19+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
20+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
21+
git_config_global: true
22+
git_user_signingkey: true
23+
git_commit_gpgsign: true
1624
- name: Setup Node.js
1725
uses: actions/setup-node@v3
1826
with:

composer.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/AutoConstructorPlugin.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private function init()
146146
/**
147147
* Returns the exclude file path.
148148
*
149-
* @return string
149+
* @return array
150150
*/
151151
private function getExcludes(): array
152152
{
@@ -158,14 +158,14 @@ private function getExcludes(): array
158158
}
159159

160160
if (isset($extra[self::KEY_EXCLUDE_FILE])) {
161-
$excludes_file = $this->cwd . '/config/excludes.php';
161+
$excludes_file = $this->cwd . $extra[self::KEY_EXCLUDE_FILE];
162162
}
163163

164164
if (file_exists($excludes_file)) {
165165
return include $excludes_file;
166166
}
167167

168-
throw new \InvalidArgumentException('No exclude file or exclude classes found');
168+
return [];
169169
}
170170

171171
/**
@@ -232,6 +232,7 @@ public function generateFile()
232232
private function createModuleFile($classnames)
233233
{
234234
$baseNamespace = $this->getBaseNamespace();
235+
$io = $this->io;
235236

236237
$output = sprintf(
237238
"<?php\n/**\n * %s Modules\n *\n * @package %s\n * @subpackage Config\n */\n\nreturn array(",
@@ -260,14 +261,23 @@ private function createModuleFile($classnames)
260261
);
261262
}
262263

263-
$output .= "\n);\n\n";
264+
$output .= "\n);\n";
264265

265-
return $this->writeFile($output);
266+
$bytes = $this->writeFile($output);
267+
268+
if (0 === $bytes) {
269+
$io->write('<error>Module file could not be created</error>');
270+
return 1;
271+
}
272+
273+
$io->write(sprintf('<info>Module file created successfully with %d classes</info>', count($classnames)));
274+
275+
return 0;
266276
}
267277

268278
private function writeFile(string $output): int
269279
{
270-
return file_put_contents($this->getModuleFile(), $output) > 0 ? 0 : 1;
280+
return file_put_contents($this->getModuleFile(), $output);
271281
}
272282

273283
private function getClassnameKey(string $classname): string

0 commit comments

Comments
 (0)