Separate the concern of getting groupedEndpoints by creating different strategies#263
Separate the concern of getting groupedEndpoints by creating different strategies#263shalvah merged 2 commits intoknuckleswtf:masterfrom
Conversation
…t strategies for getting groupedEndpoints
|
Well, that was fast. |
|
Hmmm, makes sense. I'll need to do a bit of testing though. Sadly there aren't enough (or any) automated tests around this part of the code yet. |
|
@shalvah Sure. Thanks! I'm excited about this. 😄 |
|
@shalvah I created another refactoring and started some POC, ajcastro#1 |
|
I've added some more tests, so I'm taking a look at this now, and it's good.👍 However, I'm not so sure about the full-fledged tests approach yet. Two major reasons:
On the other hand, thanks to the whole Camel thing + the factory approach you just added, it's easier to do this in userland. Since the GroupedEndpoints factory is injected into the So here's what I recommend—let's make it a plugin. You can get this to work and publish it, and in the docs, I'll point people to it if they prefer that approach. Over time, if it does well, and I take a liking to it, we can then bundle it with Scribe out of the box. 👍 |
|
Thanks @shalvah . I like the idea of making it a plugin. I'll let you know if it is ready, currently, I am still working on it. |
Separate the concern of getting groupedEndpoints by creating different strategies for getting groupedEndpoints.
Before, the command class
GenerateDocumentationcontains all the helper methods in getting the groupedEndpoints.In this PR, I refactor it by creating different strategies in getting the groupedEndpoints.
When I read the code, currently there are two ways of getting the groupedEndpoints:
GroupedEndpointsFromAppGroupedEndpointsFromCamelDir.So first there is
GroupedEndpointsFactorythat will return the appropriate strategy, eitherGroupedEndpointsFromAppif itisForcingorshouldExtractis true. Otherwise, it will useGroupedEndpointsFromCamelDir.This PR is important because later on we can add another strategy on getting the groupedEndpoints which is I plan to do next,
GroupedEndpointsFromTests, which returns the groupedEndpoints from the performed phpunit tests which I mention in TDD or Test-Driven Documentation, #260This PR seems to have a lot of file changes but basically what I just did here is just moved the helper methods together for the
GroupedEndpointsFromApp. Then I created another strategy forGroupedEndpointsFromCamelDirand createGroupedEndpointsFactory