Added Base files for Makefile and Php Utilities

This commit is contained in:
Netkas 2022-09-22 16:41:54 -04:00
parent 6ec4f247ea
commit a1ce77a455
5 changed files with 104 additions and 10 deletions

View file

@ -1,3 +1,6 @@
PHPCC=/usr/bin/php
$(PHPAB)=$(PHPAB)
autoload:
# Generates/creates all the autoloader files
make src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php
@ -11,35 +14,35 @@ autoload:
cp src/autoload/autoload.php src/ncc/autoload.php
src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php:
/usr/bin/env phpab --output src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php \
$(PHPCC) $($(PHPAB)) --output src/ncc/ThirdParty/defuse/php-encryption/autoload_spl.php \
src/ncc/ThirdParty/defuse/php-encryption
src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php:
/usr/bin/env phpab --output src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php \
$(PHPCC) $(PHPAB) --output src/ncc/ThirdParty/Symfony/polyfill-ctype/autoload_spl.php \
src/ncc/ThirdParty/Symfony/polyfill-ctype
src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php:
/usr/bin/env phpab --output src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php \
$(PHPCC) $(PHPAB) --output src/ncc/ThirdParty/Symfony/polyfill-mbstring/autoload_spl.php \
src/ncc/ThirdParty/Symfony/polyfill-mbstring
src/ncc/ThirdParty/Symfony/Process/autoload_spl.php:
/usr/bin/env phpab --output src/ncc/ThirdParty/Symfony/Process/autoload_spl.php \
$(PHPCC) $(PHPAB) --output src/ncc/ThirdParty/Symfony/Process/autoload_spl.php \
src/ncc/ThirdParty/Symfony/Process
src/ncc/ThirdParty/Symfony/Uid/autoload_spl.php:
phpab --output src/ncc/ThirdParty/Symfony/Uid/autoload_spl.php \
$(PHPAB) --output src/ncc/ThirdParty/Symfony/Uid/autoload_spl.php \
src/ncc/ThirdParty/Symfony/Uid
src/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php:
/usr/bin/env phpab --output src/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php \
$(PHPCC) $(PHPAB) --output src/ncc/ThirdParty/Symfony/Filesystem/autoload_spl.php \
src/ncc/ThirdParty/Symfony/Filesystem
src/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php:
/usr/bin/env phpab --output src/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php \
$(PHPCC) $(PHPAB) --output src/ncc/ThirdParty/Symfony/Yaml/autoload_spl.php \
src/ncc/ThirdParty/Symfony/Yaml
src/ncc/autoload_spl.php:
/usr/bin/env phpab --output src/ncc/autoload_spl.php \
$(PHPCC) $(PHPAB) --output src/ncc/autoload_spl.php \
src/ncc/Abstracts \
src/ncc/Classes \
src/ncc/CLI \
@ -62,8 +65,8 @@ redist: autoload
chmod +x build/src/INSTALL
cp LICENSE build/src/LICENSE
cp README.md build/src/README.md
cp src/installer/hash_check.php build/src/hash_check.php; /usr/bin/env php build/src/hash_check.php; rm build/src/hash_check.php
cp src/installer/generate_build_files.php build/src/generate_build_files.php; /usr/bin/env php build/src/generate_build_files.php; rm build/src/generate_build_files.php
cp src/installer/hash_check.php build/src/hash_check.php; $(PHPCC) php build/src/hash_check.php; rm build/src/hash_check.php
cp src/installer/generate_build_files.php build/src/generate_build_files.php; $(PHPCC) php build/src/generate_build_files.php; rm build/src/generate_build_files.php
tar: redist
cd build/src; tar -czvf ../ncc.tar.gz *

59
src/ncc/CLI/PhpMenu.php Normal file
View file

@ -0,0 +1,59 @@
<?php
namespace ncc\CLI;
use ncc\Objects\CliHelpSection;
use ncc\Utilities\Console;
class PhpMenu
{
/**
* Displays the main help menu
*
* @param $args
* @return void
*/
public static function start($args): void
{
if(isset($args['create']))
{
self::createProject($args);
}
self::displayOptions();
exit(0);
}
/**
* Generates a new Autoloader file for the project
*
* @param $args
* @return void
*/
private static function generateAutoload($args): void
{
}
/**
* Displays the main options section
*
* @return void
*/
private static function displayOptions(): void
{
$options = [
new CliHelpSection(['help'], 'Displays this help menu about the PHP command'),
new CliHelpSection(['build', '--autoload'], 'Builds a new Autoload file for the project (Development purposes only)')
];
$options_padding = \ncc\Utilities\Functions::detectParametersPadding($options) + 4;
Console::out('Usage: ncc php {command} [options]');
Console::out('Options:' . PHP_EOL);
foreach($options as $option)
{
Console::out(' ' . $option->toString($options_padding));
}
}
}

View file

@ -112,6 +112,7 @@
$options = [
new CliHelpSection(['help'], 'Displays this help menu about the value command'),
new CliHelpSection(['create', '--src', '--package', '--name'], 'Creates a new NCC project'),
new CliHelpSection(['create', '--makefile'], 'Generates a Makefile for the project'),
];
$options_padding = \ncc\Utilities\Functions::detectParametersPadding($options) + 4;

View file

@ -0,0 +1,25 @@
<?php
namespace ncc\Classes;
use ncc\Objects\ProjectConfiguration;
class MakefileGenerator
{
/**
* @var ProjectConfiguration
*/
private ProjectConfiguration $project;
/**
* MakefileGenerator constructor.
* @param ProjectConfiguration $project
*/
public function __construct(ProjectConfiguration $project)
{
$this->project = $project;
}
}

View file

@ -0,0 +1,6 @@
PHPCC=%PHP_BIN_PATH%
NCC_SOURCE_PATH=%NCC_SOURCE_PATH%
NCC_BUILD_CONFIG=%NCC_BUILD_DEFAULT%
autoload: