Skip to content
This repository has been archived by the owner on May 4, 2020. It is now read-only.

Documentation packages refactoring #19

Merged
merged 44 commits into from
Jan 5, 2015

Conversation

everzet
Copy link
Member

@everzet everzet commented Jan 4, 2015

This PR is a direct answer to the discussion in #7.

It separates notions of package and repository into separate domain concepts and basically builds thing discussed in #7 (comment) on top of it.

This should essentially fix issues 1, 4 and 5 of #7 and enable easy resolution of 2 and 3, which will come with a separate PR.

@everzet everzet mentioned this pull request Jan 4, 2015
everzet added 29 commits January 5, 2015 07:54
…ights

Based on discussion in #7 we discovered that GitHub name and actual
package name are two distinct concepts and should be modeled
distinctively. Updated feature reflects this change.
Rename Release\Package to Release\Repository

$meta = json_decode(file_get_contents($download->getFilePath('composer.json')), true);

return new ComposerPackage($meta['name']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not handle the case insensitivity properly (it is needed either here on in ComposerPackage)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added strtolower() call to ComposerPackage

@stof
Copy link
Member

stof commented Jan 5, 2015

I see an issue currently: the package name validation in the domain and the package name requirement in routes are not consistent (the routing is stricter by allowing only some chars in the names). And the routing requirements are not compatible with Composer package names (which are allowing dots as well)

@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

I see an issue currently: the package name validation in the domain and the package name requirement in routes are not consistent (the routing is stricter by allowing only some chars in the names). And the routing requirements are not compatible with Composer package names (which are allowing dots as well)

I think we can actually make route requirements much more liberating now. Lets just make sure there are no security tricks allowed, other than that - trying to get wrong documentation should just result us in being unable to find that documentation.

@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

@stof "more liberating" = [^\/]++\/[^\/]++

@stof
Copy link
Member

stof commented Jan 5, 2015

IMO, this will create other issues. If someone names its package v3.0/foo.html, it might create an issue for the foo.html page of the behat doc because of the URL patterns

@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

@stof such a package will not get into the system because of the name constraints in *Package VOs.

@stof
Copy link
Member

stof commented Jan 5, 2015

@everzet this is a valid composer package name

@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

oh wait. No it will. v3.0/foo.html is a valid package name, is it :D

@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

that's a very-very good point. Should we mount extensions documentation under different prefix (/extensions)? That should sort it out.

@stof
Copy link
Member

stof commented Jan 5, 2015

anyway, let's discuss the URL patterns separately. They are not part of this domain refactoring.
But yes, I think a prefix might help

@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

@stof opened separate issue for that. Ok back to this refactoring. What else?

*/
final class DocumentationPackage implements Package
{
const PACKAGE_NAME_REGEX = '#^[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*$#u';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about moving this regex to the interface rather than duplicating it in both implementation ? Valid package names are expected to be the same in all cases. They are part of the domain.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

@stof anything else?

@stof
Copy link
Member

stof commented Jan 5, 2015

👍

everzet added a commit that referenced this pull request Jan 5, 2015
…es-and-versions

Documentation packages refactoring
@everzet everzet merged commit bf37da7 into master Jan 5, 2015
@everzet everzet deleted the optimization/documentation-packages-and-versions branch January 5, 2015 22:36
@everzet
Copy link
Member Author

everzet commented Jan 5, 2015

@stof next is support for develop, master and v2.0.x documentation versions :)

@stof
Copy link
Member

stof commented Jan 5, 2015

I have an idea for a small improvement making it easier to handle consistent routing requirements. I will send it before this refactoring.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants