Skip to content

Prototype generator #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
37fac60
TASK: Apply migration TYPO3.FLOW3-201201261636
Apr 7, 2017
689f17b
TASK: Apply migration TYPO3.Fluid-201205031303
Apr 7, 2017
2450475
TASK: Apply migration TYPO3.FLOW3-201205292145
Apr 7, 2017
64dfaa6
TASK: Apply migration TYPO3.FLOW3-201206271128
Apr 7, 2017
114d0c8
TASK: Apply migration TYPO3.FLOW3-201209201112
Apr 7, 2017
7bf971e
TASK: Apply migration TYPO3.Flow-201209251426
Apr 7, 2017
ee0d5d6
TASK: Apply migration TYPO3.Flow-201211151101
Apr 7, 2017
bdcbcfc
TASK: Apply migration TYPO3.Flow-201212051340
Apr 7, 2017
1aee774
TASK: Apply migration TYPO3.TypoScript-130516234520
Apr 7, 2017
b962b46
TASK: Apply migration TYPO3.TypoScript-130516235550
Apr 7, 2017
e3ec772
TASK: Apply migration TYPO3.TYPO3CR-130523180140
Apr 7, 2017
e48a14f
TASK: Apply migration TYPO3.Neos.NodeTypes-201309111655
Apr 7, 2017
0a92edf
TASK: Apply migration TYPO3.Flow-201310031523
Apr 7, 2017
92a5f46
TASK: Apply migration TYPO3.Flow-201405111147
Apr 7, 2017
10af503
TASK: Apply migration TYPO3.Neos-201407061038
Apr 7, 2017
e3c5959
TASK: Apply migration TYPO3.Neos-201409071922
Apr 7, 2017
50b9e30
TASK: Apply migration TYPO3.TYPO3CR-140911160326
Apr 7, 2017
9a96a25
TASK: Apply migration TYPO3.Neos-201410010000
Apr 7, 2017
2731c37
TASK: Apply migration TYPO3.TYPO3CR-141101082142
Apr 7, 2017
f1543f1
TASK: Apply migration TYPO3.Neos-20141113115300
Apr 7, 2017
f341f54
TASK: Apply migration TYPO3.Fluid-20141113120800
Apr 7, 2017
41dd972
TASK: Apply migration TYPO3.Flow-20141113121400
Apr 7, 2017
fc9b3cf
TASK: Apply migration TYPO3.Fluid-20141121091700
Apr 7, 2017
5192bbe
TASK: Apply migration TYPO3.Neos-20141218134700
Apr 7, 2017
118a86b
TASK: Apply migration TYPO3.Fluid-20150214130800
Apr 7, 2017
4f7809a
TASK: Apply migration TYPO3.Neos-20150303231600
Apr 7, 2017
740c18e
TASK: Apply migration TYPO3.TYPO3CR-20150510103823
Apr 7, 2017
17bb848
TASK: Apply migration TYPO3.Flow-20151113161300
Apr 7, 2017
8b7e274
TASK: Apply migration TYPO3.Form-20160601101500
Apr 7, 2017
198b048
TASK: Apply migration TYPO3.Flow-20161115140400
Apr 7, 2017
a205d0e
TASK: Apply migration TYPO3.Flow-20161115140430
Apr 7, 2017
d5b7676
TASK: Apply migration Neos.Flow-20161124204700
Apr 7, 2017
99b3889
TASK: Apply migration Neos.Flow-20161124204701
Apr 7, 2017
727704c
TASK: Apply migration Neos.Twitter.Bootstrap-20161124204912
Apr 7, 2017
763b574
TASK: Apply migration Neos.Form-20161124205254
Apr 7, 2017
c4d8050
TASK: Apply migration Neos.Flow-20161124224015
Apr 7, 2017
1b4f78a
TASK: Apply migration Neos.Party-20161124225257
Apr 7, 2017
f9bb5c6
TASK: Apply migration Neos.Eel-20161124230101
Apr 7, 2017
d184aa9
TASK: Apply migration Neos.Kickstart-20161124230102
Apr 7, 2017
cb6d370
TASK: Apply migration Neos.Setup-20161124230842
Apr 7, 2017
b4cf230
TASK: Apply migration Neos.Imagine-20161124231742
Apr 7, 2017
e1394cb
TASK: Apply migration Neos.Media-20161124233100
Apr 7, 2017
2b19395
TASK: Apply migration Neos.NodeTypes-20161125002300
Apr 7, 2017
c6e04b7
TASK: Apply migration Neos.SiteKickstarter-20161125002311
Apr 7, 2017
eb1fd2f
TASK: Apply migration Neos.Neos-20161125002322
Apr 7, 2017
c588d6f
TASK: Apply migration Neos.ContentRepository-20161125012000
Apr 7, 2017
13bdb17
TASK: Apply migration Neos.Fusion-20161125013710
Apr 7, 2017
0085018
TASK: Apply migration Neos.Setup-20161125014759
Apr 7, 2017
19a87d2
TASK: Apply migration Neos.SiteKickstarter-20161125095901
Apr 7, 2017
4e414b5
TASK: Apply migration Neos.Fusion-20161125104701
Apr 7, 2017
ca1530d
TASK: Apply migration Neos.NodeTypes-20161125104800
Apr 7, 2017
957a934
TASK: Apply migration Neos.Neos-20161125104802
Apr 7, 2017
136ec97
TASK: Apply migration Neos.Kickstarter-20161125110814
Apr 7, 2017
1555cdc
TASK: Apply migration Neos.Neos-20161125122412
Apr 7, 2017
9b7754d
TASK: Apply migration Neos.Flow-20161125124112
Apr 7, 2017
b08a514
TASK: Apply migration Neos.SwiftMailer-20161130105617
Apr 7, 2017
4de6fa8
TASK: Apply migration TYPO3.FluidAdaptor-20161130112935
Apr 7, 2017
2eecf67
TASK: Apply migration Neos.Fusion-20161201202543
Apr 7, 2017
c97aa8a
TASK: Apply migration Neos.Neos-20161201222211
Apr 7, 2017
4b93f36
TASK: Apply migration Neos.Fusion-20161202215034
Apr 7, 2017
1a7f7b9
TASK: Apply migration Neos.ContentRepository.Search-20161210231100
Apr 7, 2017
df393b4
TASK: Apply migration Neos.Fusion-20161219092345
Apr 7, 2017
1d72861
TASK: Apply migration Neos.ContentRepository-20161219093512
Apr 7, 2017
ed765a2
TASK: Apply migration Neos.Media-20161219094126
Apr 7, 2017
853b06b
TASK: Apply migration Neos.Neos-20161219094403
Apr 7, 2017
214e1a9
TASK: Apply migration Neos.Neos-20161219122512
Apr 7, 2017
d9f11a2
TASK: Apply migration Neos.Fusion-20161219130100
Apr 7, 2017
d9a31ad
TASK: Apply migration Neos.Neos-20161220163741
Apr 7, 2017
c1cf9c4
TASK: Apply migration Neos.Neos-20170115114620
Apr 7, 2017
55bbc3b
TASK: Apply migration Neos.Fusion-20170120013047
Apr 7, 2017
6e127aa
TASK: Apply migration Neos.Flow-20170125103800
Apr 7, 2017
273dc0c
TASK: Apply migration Neos.Seo-20170127154600
Apr 7, 2017
a0e8458
TASK: Apply migration Neos.Flow-20170127183102
Apr 7, 2017
e98e1cb
[CGL] PSR-2 formatting, PSR-4 autoloading, readme, composer type and …
Apr 7, 2017
24614d7
[FIX] setting injections
Apr 7, 2017
d14750d
[FIX] handle fallback CR nodeType
Apr 7, 2017
be1c7c1
[FIX] superTypes yaml scheme
Apr 7, 2017
b6335b5
[TASK] implement a fusion prototype generator that can prepare JSON+L…
Apr 7, 2017
b2ebb47
[TASK] change fusion prototype naming schema
Apr 7, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in('Classes')
->in('Tests')
;

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'single_quote' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'phpdoc_align' => true,
'phpdoc_order' => true,
'phpdoc_scalar' => true,
'pre_increment' => true,
'short_scalar_cast' => true,
'space_after_semicolon' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'semicolon_after_instruction' => true,
'trim_array_spaces' => true,
'whitespace_after_comma_in_array' => true,
'phpdoc_add_missing_param_annotation' => true,
'binary_operator_spaces' => ['align_equals' => false, 'align_double_arrow' => true],
'concat_space' => ['spacing' => 'one'],
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder)
;
121 changes: 121 additions & 0 deletions Classes/Command/SchemaCommandController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php

namespace Flowpack\SchemaOrg\NodeTypes\Command;

/* *
* This script belongs to the Neos Flow package "Flowpack.SchemaOrg.NodeTypes". *
* */

use Flowpack\SchemaOrg\NodeTypes\Domain\Model\NodeType;
use Flowpack\SchemaOrg\NodeTypes\Service\ConfigurationService;
use Flowpack\SchemaOrg\NodeTypes\Service\NodeTypeBuilder;
use Flowpack\SchemaOrg\NodeTypes\Service\SchemaParserService;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use Neos\ContentRepository\Domain\Service\NodeTypeManager;
use Neos\ContentRepository\Exception\NodeTypeNotFoundException;

/**
* Schema.org Schema Extraction CLI
*/
class SchemaCommandController extends CommandController
{

/**
* @Flow\Inject
* @var SchemaParserService
*/
protected $schemaParserService;

/**
* @Flow\Inject
* @var NodeTypeManager
*/
protected $nodeTypeManager;

/**
* @Flow\Inject
* @var NodeTypeBuilder
*/
protected $nodeTypeBuilder;

/**
* @Flow\Inject
* @var ConfigurationService
*/
protected $configurationService;

/**
* @Flow\InjectConfiguration("schemas.jsonFilename")
* @var string
*/
protected $jsonSchema;
/**
* @Flow\InjectConfiguration(path="fallbackNodeType",package="Neos.ContentRepository")
* @var string
*/
protected $fallbackNodeTypeName;

/**
* Extract Schema.org to build NodeTypes configuration
*
* @param string $name The name of the file
* @param string $packageKey The package key
* @param string $type The Type from schema.org
*/
public function extractCommand($name = null, $packageKey = null, $type = null)
{
try {
$name = $name ?: 'Default';
$this->configurationService->setPackageKey($packageKey);
$this->outputLine();
$this->outputFormatted('# Extracting schema.org ...');

$this->schemaParserService->setAllSchemaJsonFilename($this->jsonSchema);

if ($type !== null) {
$nodeTypes = $this->schemaParserService->parseByTypes(explode(',', $type));
} else {
$nodeTypes = $this->schemaParserService->parseAll();
}

$filename = 'NodeTypes.SchemaOrg.' . $name . '.yaml';

$this->nodeTypeBuilder
->setFilename($filename)
->unlinkExistingFile();

$success = $error = 0;
foreach ($nodeTypes as $nodeType) {
/** @var NodeType $nodeType */
$this->outputLine('+ <b>' . $nodeType->getName() . '</b>');

try {
$existingNodeType = $this->nodeTypeManager->getNodeType($nodeType->getName());
if ($existingNodeType->getName() === $this->fallbackNodeTypeName) {
throw new NodeTypeNotFoundException();
}
$this->outputFormatted(' - <b>NodeType "%s" skipped</b>, update is not supported ...', [$existingNodeType->getName()]);
++$error;
} catch (NodeTypeNotFoundException $exception) {
$filename = $this->nodeTypeBuilder->dump($nodeType);
++$success;
}
}

$this->outputLine();
if ($success > 0) {
$this->outputFormatted('The following file contain your new NodeType: ' . $filename);
} else {
$this->outputFormatted('Nothing to do ...');
}

$this->outputLine();
$this->outputFormatted('We are on Github, Pull request welcome or open an issue if you have trouble ...');
} catch (\InvalidArgumentException $exception) {
$this->outputLine();
$this->outputFormatted($exception->getMessage());
$this->sendAndExit(1);
}
}
}
37 changes: 37 additions & 0 deletions Classes/Domain/Model/FallbackNodeDataLabelGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
namespace Flowpack\SchemaOrg\NodeTypes\Domain\Model;

/* *
* This script belongs to the Neos Flow package "Flowpack.SchemaOrg.NodeTypes". *
* */

use Neos\Flow\Annotations as Flow;
use Neos\ContentRepository\Domain\Model\NodeInterface;
use Neos\ContentRepository\Domain\Model\NodeLabelGeneratorInterface;

/**
* The default node label generator; used if no-other is configured
*
* @Flow\Scope("singleton")
*/
class FallbackNodeDataLabelGenerator implements NodeLabelGeneratorInterface
{

/**
* Render a node label
*
* @param NodeInterface $node
* @param bool $crop
* @return string
*/
public function getLabel(NodeInterface $node, $crop = true)
{
if ($node->hasProperty('name') === true && $node->getProperty('name') !== '') {
$label = strip_tags($node->getProperty('name'));
} else {
$label = ($node->getNodeType()->getLabel() ?: $node->getNodeType()->getName()) . ' (' . $node->getName() . ')';
}

return $label;
}
}
Loading