Skip to content
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

2.0.0 issue297 dev #312

Merged
merged 91 commits into from
Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
db10c4e
Setting up for issue
carbontwelve Feb 23, 2018
d7dbbe7
(#302) preparation of abstract source for implementing #297
carbontwelve Feb 23, 2018
adaee7c
Working on abstraction methods
carbontwelve Feb 23, 2018
85b2e25
Working on abstraction methods
carbontwelve Feb 23, 2018
3e79039
Test added for SplFileSource
carbontwelve Feb 23, 2018
e6e8bbe
Finalised abstraction from ProjectFile
carbontwelve Feb 23, 2018
d58856d
Created Memory source as proof of abstraction.
carbontwelve Feb 23, 2018
474f113
Swapped out ProjectFile for SplFileSource
carbontwelve Feb 23, 2018
78d6d04
Removed weird spacing
carbontwelve Feb 23, 2018
0beeed3
(#302) Disabling failing test until bootstrapping for #297 is complete
carbontwelve Feb 23, 2018
af28822
(#302) Moved getRenderedContent method to AbstractSource
carbontwelve Feb 23, 2018
a25830a
(#302) Boilerplating collectors. These are a refactoring of the LoadS…
carbontwelve Feb 24, 2018
103d402
Adding todo
carbontwelve Feb 24, 2018
7b6f1e7
Boilerplating Collection Mutators
carbontwelve Feb 24, 2018
2245275
Refactoring LoadSourceTreeFile into Collectors and Mutators... needs …
carbontwelve Feb 24, 2018
a473728
Added todo item
carbontwelve Feb 24, 2018
e9995f0
Moved mutator loop into AbstractCollector
carbontwelve Feb 24, 2018
4772328
Include available mutators for testing
carbontwelve Feb 24, 2018
903958a
Testing date from filename Mutator - passes
carbontwelve Feb 24, 2018
7e530da
Boilerplating some collector filters
carbontwelve Feb 24, 2018
531a318
Created mockSplFileSource method to keep things DRY
carbontwelve Feb 24, 2018
6f16ef4
Created mockMemorySource method to keep things DRY
carbontwelve Feb 24, 2018
f11d44c
Testing Drafts Exclusion
carbontwelve Feb 24, 2018
2ba657c
Swap output bool
carbontwelve Feb 27, 2018
f617024
Path exclusion complete (using strpos)
carbontwelve Feb 27, 2018
2e33a3d
Remove todo, test has 100% coverage of unit
carbontwelve Feb 27, 2018
4f22f50
Tidy
carbontwelve Feb 27, 2018
1b57f70
IsScheduled mutator 100% coverage of unit
carbontwelve Feb 27, 2018
2dd6077
Front Matter mutator 100% coverage of unit
carbontwelve Feb 27, 2018
1ce05b8
Ignored mutator 100% coverage of unit
carbontwelve Feb 27, 2018
b047ac5
Boilerplate filter collection
carbontwelve Feb 27, 2018
67c7969
Tinkering
carbontwelve Feb 27, 2018
e82e13c
(#302) added filtering to filesystem collector
carbontwelve Feb 28, 2018
0de5a64
(#302) added collector collection...
carbontwelve Feb 28, 2018
3a3fc6f
(#302) boilerplating collector's loader step
carbontwelve Feb 28, 2018
0494719
Added a memory collector for testing
carbontwelve Feb 28, 2018
7d359d1
Test for memory collector
carbontwelve Feb 28, 2018
38d3a6d
Remove reflection as its not needed
carbontwelve Feb 28, 2018
00776a7
Fluff
carbontwelve Feb 28, 2018
c5010c3
Adding default content collector configuration
carbontwelve Feb 28, 2018
a714377
Created service provider for mutator/exclusions factories
carbontwelve Feb 28, 2018
fcf70c0
Unfinished work on loading of content collectors from config
carbontwelve Feb 28, 2018
3efd99c
Fix typo
carbontwelve Feb 28, 2018
eb9c124
Added array path exclusion, not currently used but may be useful
carbontwelve Mar 1, 2018
e6cb569
Extended array path exclusion that takes the array input from configu…
carbontwelve Mar 1, 2018
3ba6ea1
Unfinished work on loading of content collectors from config
carbontwelve Mar 1, 2018
44aa674
Completing functionality
carbontwelve Mar 1, 2018
2bca11e
Now return true
carbontwelve Mar 1, 2018
564cd1c
Rename ContentTypeFactory to ContentTypeCollection
carbontwelve Mar 1, 2018
80907e1
Refactoring
carbontwelve Mar 1, 2018
b7d5e17
Added Tree data structure for holding the AST
carbontwelve Mar 7, 2018
fff628e
Expanding Tree data type for AST
carbontwelve Mar 8, 2018
c03add0
Misc formatting
carbontwelve Mar 8, 2018
c464b98
Adding traverse count
carbontwelve Mar 8, 2018
232dbec
Adding attribution
carbontwelve Mar 8, 2018
3f1ed78
Removed lines
carbontwelve Mar 8, 2018
0fce469
Documenting ast tree
carbontwelve Mar 8, 2018
a9d8c05
Formatting
carbontwelve Mar 9, 2018
ea093b0
Tree reduce written
carbontwelve Mar 9, 2018
e711c16
Apply fixes from StyleCI (#306)
carbontwelve Mar 9, 2018
0ca1056
Use new ContentTypeCollection
carbontwelve Mar 9, 2018
46ac526
ContentTypeTest now passes
carbontwelve Mar 9, 2018
1a333f7
Refactoring for SourceInterface
carbontwelve Mar 9, 2018
1012246
Begin building AST
carbontwelve Mar 9, 2018
f1cfd47
Add content types to the ast
carbontwelve Mar 15, 2018
89b850a
Add AST helper method
carbontwelve Mar 15, 2018
6186d61
Added mTime
carbontwelve Mar 15, 2018
a231cbf
Not sure why hash was missing from the constructor
carbontwelve Mar 15, 2018
e405eff
Added short description
carbontwelve Mar 15, 2018
9104262
Building out AST some more
carbontwelve Mar 15, 2018
27ceb29
Building out AST some more
carbontwelve Mar 15, 2018
12dd4b8
Added RunGenerators step boilerplate
carbontwelve Mar 15, 2018
0dc7590
Add helper method to get all Files
carbontwelve Mar 16, 2018
a981176
Refactoring and AST work
carbontwelve Mar 17, 2018
47cd9dd
Leaf Children should be unique by id?
carbontwelve Mar 22, 2018
cc075fb
Add ASCII debuging helper
carbontwelve Mar 22, 2018
3f472aa
Several improvements to the Tree
carbontwelve Mar 22, 2018
74842a8
Working on Tree
carbontwelve Mar 22, 2018
ee0e602
Working on Tree
carbontwelve Mar 23, 2018
bf606f0
Amending test to pass
carbontwelve Aug 10, 2018
a13692e
Adding parameter types
carbontwelve Aug 10, 2018
d2583b1
Added missing Project
carbontwelve Aug 10, 2018
1c04bf0
Added Dependency Resolution
carbontwelve Aug 10, 2018
9b5089a
Fixed test, doh!
carbontwelve Aug 13, 2018
9fb2bc8
Replaced Tree for Graph
carbontwelve Aug 13, 2018
5a623c2
Fixed bug with missing configured ignored exclusions
carbontwelve Aug 14, 2018
3384796
Using graphviz to visually debug
carbontwelve Aug 14, 2018
e825f29
General Tidy
carbontwelve Aug 14, 2018
349f360
Removed done todo
carbontwelve Aug 14, 2018
2d5c2f7
Reduce whitespace
carbontwelve Aug 15, 2018
ff46a28
Apply fixes from StyleCI (#313)
carbontwelve Aug 15, 2018
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
48 changes: 24 additions & 24 deletions composer.lock

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

4 changes: 4 additions & 0 deletions src/Entities/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
use Tapestry\Entities\Collections\FlatCollection;
use Tapestry\Modules\Renderers\ContentRendererFactory;

/**
* Class ContentType.
* @deprecated use Tapestry\Modules\ContentTypes\ContentType
*/
class ContentType
{
/**
Expand Down
61 changes: 61 additions & 0 deletions src/Entities/DependencyGraph/Debug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace Tapestry\Entities\DependencyGraph;

class Debug
{
/**
* @var Graph
*/
private $graph;

/**
* Debug constructor.
* @param Graph $graph
*/
public function __construct(Graph $graph)
{
$this->graph = $graph;
}

/**
* @param string $edge
* @param array|null $arr
* @return string
* @throws \Tapestry\Exceptions\GraphException
*/
public function graphViz(string $edge, $arr = null): String
{
if (is_null($arr)) {
$arr = [
'digraph Tapestry {',
' rankdir=LR;',
' bgcolor="0 0 .91";',
' node [shape=circle];',
];
}
$arr = array_merge($arr, $this->walkGraph($edge, []));
$arr[] = '}';

return implode(PHP_EOL, $arr);
}

/**
* @param string $edge
* @param array $arr
* @return array
* @throws \Tapestry\Exceptions\GraphException
*/
private function walkGraph(string $edge, array $arr): array
{
$node = $this->graph->getEdge($edge);
foreach ($node->getEdges() as $edge) {
$arr[] = sprintf(' "%s" -> "%s"', $node->getUid(), $edge->getUid());
if (count($edge->getEdges()) > 0) {
$arr = $this->walkGraph($edge->getUid(), $arr);
}
}

return $arr;
}
}
72 changes: 72 additions & 0 deletions src/Entities/DependencyGraph/Graph.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace Tapestry\Entities\DependencyGraph;

use Tapestry\Exceptions\GraphException;

class Graph
{
/**
* @var Node
*/
private $root;

/**
* uid -> obj node lookup table.
*
* @var Node[]
*/
private $table = [];

/**
* Graph constructor.
* @param Node|null $root
*/
public function __construct(Node $root = null)
{
if (! is_null($root)) {
$this->setRoot($root);
}
}

/**
* This method acts to reset the Graph before
* setting the root node.
*
* @param Node $node
*/
public function setRoot(Node $node)
{
$this->table = [];
$this->root = $node;
$this->table[$node->getUid()] = $node;
}

/**
* @param string $uid
* @param Node $node
* @throws GraphException
*/
public function addEdge(string $uid, Node $node)
{
if (! isset($this->table[$uid])) {
throw new GraphException('The edge ['.$uid.'] is not found in graph.');
}
$this->table[$uid]->addEdge($node);
$this->table[$node->getUid()] = $node;
}

/**
* @param string $uid
* @return Node
* @throws GraphException
*/
public function getEdge(string $uid): Node
{
if (! isset($this->table[$uid])) {
throw new GraphException('The edge ['.$uid.'] is not found in graph.');
}

return $this->table[$uid];
}
}
41 changes: 41 additions & 0 deletions src/Entities/DependencyGraph/Node.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Tapestry\Entities\DependencyGraph;

interface Node
{
/**
* Get this nodes uid.
*
* @return string
*/
public function getUid(): string;

/**
* Add a source that depends upon this source.
*
* @param Node $node
*/
public function addEdge(Node $node);

/**
* @return Node[]|array
*/
public function getEdges(): array;

/**
* Compare a node (from cache) to see if it is valid.
*
* Useful for reducing the node graph to just those that have
* been modified.
*
* Will return false if the node being compared is newer or different.
*
* Must be used against nodes of the same id, will throw an exception
* if the id is different.
*
* @param Node $node
* @return bool
*/
public function isSame(Node $node): bool;
}
Loading