Skip to content

Commit

Permalink
Integrated phar builds
Browse files Browse the repository at this point in the history
  • Loading branch information
gplanchat committed Oct 21, 2019
1 parent a9cd244 commit 6320353
Show file tree
Hide file tree
Showing 10 changed files with 301 additions and 55 deletions.
5 changes: 5 additions & 0 deletions .docker/[email protected]/cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,9 @@ RUN apk del \
sqlite-libs \
&& rm -rf /tmp/* /var/cache/apk/*

RUN pwd && curl -LSs https://box-project.github.io/box2/installer.php | php \
&& mv box.phar /usr/local/bin/box \
&& chmod 0755 /usr/local/bin/box \
&& echo "phar.readonly=0" >> /usr/local/etc/php/conf.d/phar.ini

WORKDIR /var/www/html
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/.env
/bin/bisous.phar
/bisous-phar-private.pem
/bisous-phar-private-nopassphrase.pem
21 changes: 13 additions & 8 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env php
<?php

use App\Infrastructure\Command\CommandBus;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Logger\ConsoleLogger;
Expand Down Expand Up @@ -50,20 +52,23 @@ $factory = new class($output) {
$this->logger = new ConsoleLogger($output);
}

public function __invoke(string $className)
public function __invoke(Application $application, string $className)
{
return function () use ($className) {
return new $className(null, $this->logger);
return function () use ($className, $application) {
/** @var Command $command */
$command = new $className(null, $this->logger);
$command->setApplication($application);
return $command;
};
}
};

$application = new Application('Bisous', '1.0.0');
$application->setCommandLoader(new FactoryCommandLoader([
'init' => $factory(\App\Infrastructure\Console\Command\InitializeCommand::class),
'magento' => $factory(\App\Infrastructure\Console\Command\MagentoCommand::class),
'test' => $factory(\App\Infrastructure\Console\Command\TestCommand::class),
// 'categories' => function(){},
'products' => $factory(\App\Infrastructure\Console\Command\ProductCommand::class),
'init' => $factory($application, \App\Infrastructure\Console\Command\InitializeCommand::class),
'magento' => $factory($application, \App\Infrastructure\Console\Command\MagentoCommand::class),
'self-update' => $factory($application, \App\Infrastructure\Console\Command\SelfUpdateCommand::class),
'test' => $factory($application, \App\Infrastructure\Console\Command\TestCommand::class),
'products' => $factory($application, \App\Infrastructure\Console\Command\ProductCommand::class),
]));
$application->run($input, $output);
44 changes: 0 additions & 44 deletions bin/sql-to-csv

This file was deleted.

20 changes: 20 additions & 0 deletions box.json.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chmod": "0755",
"main": "bin/console",
"output": "bin/bisous.phar",
"directories": ["src"],
"finder": [
{
"name": "*.php",
"in": "config"
},
{
"name": "*.php",
"exclude": ["test", "tests"],
"in": "vendor"
}
],
"algorithm": "OPENSSL",
"key": "bisous-phar-private-nopassphrase.pem",
"stub": true
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"ext-PDO": "^7.2",
"ext-ctype": "*",
"ext-iconv": "*",
"padraic/phar-updater": "^1.0",
"psr/log": "^1.1",
"symfony/cache": "4.3.*",
"symfony/config": "4.3.*",
Expand Down
179 changes: 178 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__).'/.env.local.php')) {
if (is_array($env = @include getcwd().'/.env.local.php')) {
foreach ($env as $k => $v) {
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v);
}
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__) . '/.env');
(new Dotenv(false))->loadEnv(getcwd() . '/.env');
}

$_SERVER += $_ENV;
Expand Down
Loading

0 comments on commit 6320353

Please sign in to comment.