1.0.0 Alpha Release #59

Merged
netkas merged 213 commits from v1.0.0_alpha into master 2023-01-29 23:27:58 +00:00
Showing only changes of commit f8a7e22f59 - Show all commits

View file

@ -148,8 +148,6 @@
$source_directories = []; $source_directories = [];
$static_files = []; $static_files = [];
// TODO: Implement static files handling
// Extract all the source directories // Extract all the source directories
if ($package->Autoload->Psr4 !== null && count($package->Autoload->Psr4) > 0) if ($package->Autoload->Psr4 !== null && count($package->Autoload->Psr4) > 0)
{ {
@ -221,18 +219,68 @@
if (count($static_files) > 0) if (count($static_files) > 0)
{ {
$project_configuration->Project->Options['static_files'] = $static_files; $project_configuration->Project->Options['static_files'] = $static_files;
$parsed_path = str_ireplace($package_path . DIRECTORY_SEPARATOR, '', $item->getPathName());
if (!$filesystem->exists($source_directory . DIRECTORY_SEPARATOR . $parsed_path)) foreach ($static_files as $file)
{ {
$parsed_path = str_ireplace($package_path . DIRECTORY_SEPARATOR, '', $file);
Console::outDebug(sprintf('copying file %s for package %s', $parsed_path, $package->Name)); Console::outDebug(sprintf('copying file %s for package %s', $parsed_path, $package->Name));
$filesystem->copy($item->getPathName(), $source_directory . DIRECTORY_SEPARATOR . $parsed_path); $filesystem->copy($file, $source_directory . DIRECTORY_SEPARATOR . $parsed_path);
} }
unset($file);
} }
$project_configuration->toFile($package_path . DIRECTORY_SEPARATOR . 'project.json'); $project_configuration->toFile($package_path . DIRECTORY_SEPARATOR . 'project.json');
} }
// Load the project // Load the project
$license_files = [
'LICENSE',
'license',
'LICENSE.txt',
'license.txt'
];
foreach($license_files as $license_file)
{
if($filesystem->exists($package_path . DIRECTORY_SEPARATOR . $license_file))
{
// Check configuration if composer.extension.display_licenses is set
if(Functions::cbool(Functions::getConfigurationProperty('composer.extension.display_licenses')))
{
Console::out(sprintf('License for package %s:', $package->Name));
Console::out(IO::fread($package_path . DIRECTORY_SEPARATOR . $license_file));
}
}
}
if(Functions::cbool(Functions::getConfigurationProperty('composer.extension.display_authors')))
{
if($package->Authors !== null && count($package->Authors) > 0)
{
Console::out(sprintf('Authors for package %s:', $package->Name));
foreach($package->Authors as $author)
{
Console::out(sprintf(' - %s', $author->Name));
if($author->Email !== null)
{
Console::out(sprintf(' %s', $author->Email));
}
if($author->Homepage !== null)
{
Console::out(sprintf(' %s', $author->Homepage));
}
if($author->Role !== null)
{
Console::out(sprintf(' %s', $author->Role));
}
}
}
}
$project_manager = new ProjectManager($package_path); $project_manager = new ProjectManager($package_path);
$project_manager->load(); $project_manager->load();
$built_package = $project_manager->build(); $built_package = $project_manager->build();