Skip to content

Commit

Permalink
Merge pull request #5 from PackageFactory/release-1.0
Browse files Browse the repository at this point in the history
Release 1.0
  • Loading branch information
grebaldi authored Oct 13, 2020
2 parents ac2c1ab + e767782 commit 75fc792
Show file tree
Hide file tree
Showing 95 changed files with 6,309 additions and 239 deletions.
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_size = 2

[{package.json,.babelrc,.eslintrc,.stylelintrc}]
indent_size = 2

[*.{css,js,ts}]
indent_style = tab

[Makefile]
indent_style = tab

[*.makefile]
indent_style = tab

[*.md]
trim_trailing_whitespace = false
98 changes: 98 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CI

on: [push]

jobs:
coding-standard:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl
tools: phpcs

- name: Run PHP Code Sniffer
run: |
phpcs \
--standard=PSR2 \
--extensions=php \
--exclude=Generic.Files.LineLength \
Classes/ Tests/
static-analysis:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install composer dependencies
run: |
composer install
- name: Run phpstan on Tests/
run: |
bin/phpstan analyse \
--autoload-file Build/BuildEssentials/PhpUnit/UnitTestBootstrap.php \
--level 8 \
Tests/Unit
- name: Run phpstan on Classes/
run: |
bin/phpstan analyse --level 8 Classes
unit-tests:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl
coverage: xdebug

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install composer dependencies
run: |
composer install
- name: Run unit tests
run: |
bin/phpunit -c phpunit.xml \
--enforce-time-limit \
--coverage-text \
Tests
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bin/
Build/
Packages/
Web/
Data/
vendor/
composer.lock
.phpunit.result.cache
82 changes: 82 additions & 0 deletions Classes/Command/ComponentCommandController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php declare(strict_types=1);
namespace PackageFactory\AtomicFusion\PresentationObjects\Command;

/*
* This file is part of the PackageFactory.AtomicFusion.PresentationObjects package
*/

use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Component\ComponentGenerator;
use PackageFactory\AtomicFusion\PresentationObjects\Domain\Value\ValueGenerator;

/**
* The command controller for kickstarting PresentationObject components
*/
class ComponentCommandController extends CommandController
{
/**
* @Flow\Inject
* @var ComponentGenerator
*/
protected $componentGenerator;

/**
* @Flow\Inject
* @var ValueGenerator
*/
protected $valueGenerator;

/**
* Create a new PresentationObject component and factory
*
* This command will create an <b>interface</b>, a <b>value object</b> and a
* <b>factory</b> under in the chosen component namespace. It'll also register
* the factory for later use in Fusion.
*
* The remaining arguments of this command are interpreted as a list of
* <b>property descriptors</b> which consist of a property name and a type name
* separated by a colon (e.g.: "title:string").
*
* The following values are allowed for types:
*
* * string, int, float, bool
* * Value class names created with <u>component:kickstartvalue</u> in the same
* component namespace
* * Component class names created with <u>component:kickstart</u> in the same
* package
* * ImageSource
* * Uri
*
* @param string $name The name of the new component
* @param null|string $packageKey Package key of an optional target package, if not set the configured default package or the first available site package will be used
* @return void
*/
public function kickStartCommand(string $name, ?string $packageKey = null): void
{
$this->componentGenerator->generateComponent($name, $this->request->getExceedingArguments(), $packageKey);
}

/**
* Create a new pseudo-enum value object
*
* This command will create a <b>value object</b> for a pseudo-enum under in the
* chosen component namespace and under the provided name. It'll also create a
* co-located <b>exception</b> class that will be used when validation for the
* pseudo-enum fails.
*
* Additionally, a <b>datasource</b> for use in SelectBoxEditors will be created
* in the Application namespace of your chosen package.
*
* @param string $componentName The name of the component the new pseudo-enum belongs to
* @param string $name The name of the new pseudo-enum
* @param string $type The type of the new pseudo-enum (must be one of: "string", "int")
* @param array|string[] $values A comma-separated list of values for the new pseudo-enum
* @param null|string $packageKey Package key of an optional target package, if not set the configured default package or the first available site package will be used
* @return void
*/
public function kickStartValueCommand(string $componentName, string $name, string $type, array $values = [], ?string $packageKey = null): void
{
$this->valueGenerator->generateValue($componentName, $name, $type, $values, $packageKey);
}
}
Loading

0 comments on commit 75fc792

Please sign in to comment.