-
Notifications
You must be signed in to change notification settings - Fork 19
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
Cache combined puli.json files of all installed packages #47
base: master
Are you sure you want to change the base?
Conversation
use Puli\Manager\Api\Package\PackageFile; | ||
use Puli\Manager\Assert\Assert; | ||
|
||
class CacheFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can add a small description about the class (and a author tag for you if you want :) ). In other classes as well.
This is a good start already! :) Let's extract an interface |
Hi @msojda :) I refactored the JSON conversion a bit which should make it easier for you to implement this. Basically, you can implement |
|
||
foreach ($cacheFile->getModuleFiles() as $moduleFile) { | ||
$jsonData->modules[] = $this->moduleFileConverter->toJson($moduleFile, array( | ||
'targetVersion' => $moduleFile->getVersion(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetVersion
is not supported here, since this is not a MigratingConverter
. You can simply store it in the latest version.
This looks good already :) With some more work we should be able to finish this. |
fba432f
to
0ec12b1
Compare
Ping @tgalopin @webmozart :) PS. If this is good and we can progress with it I remember there was other issue we were talking about and it was related to this one. |
Hey @msojda! What's the current status and what is needed to finish this? This PR looks good and I'd like to merge it soon. |
b94e615
to
d3dab6e
Compare
Hi @webmozart. Just updated it with the latest repository changes. Ready to go for me! 😄 |
@@ -625,7 +638,7 @@ public function getFactoryManager() | |||
/** | |||
* Returns the configuration file manager. | |||
* | |||
* @return ConfigFileManager The configuration file manager. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently you changed all the doc blocks to remove the dots. On purpose?
While we can do this, I wouldn't do it in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I just did that cause StyleCI was failing 😞
That was fast! :) Thanks for the quick update. Apart from my remarks, the cached modules should actually be used in the |
I'll update the PR tonight. Shall I update the PS. Will you be available on Gitter? We could prioritise next tasks then 😄 |
@webmozart I've done the refactoring regarding caching module list in |
Cool thanks :) Yes I think it would be good if you could update the |
@@ -1,3 +1,4 @@ | |||
{ | |||
"name": "vendor/module1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@webmozart Added this along with tests/Api/Fixtures/root/module2/puli.json:2 cause cache file serialization was failing because of missing names. Is that the behaviour what we want? Will we have any cases where names are missing? Should we handle it another way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me
Updated the PR @webmozart 😄 |
*/ | ||
public function getModuleFile($moduleName) | ||
{ | ||
Assert::ModuleName($moduleName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @webmozart - can't see any typo here..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm talking about the capital "M". I got the feeling you did a search-replace for "Package" → "Module" without checking the "case sensitive" checkbox ;)
ping @msojda |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now apart from a minor issues!
*/ | ||
public function getModuleFile($moduleName) | ||
{ | ||
Assert::ModuleName($moduleName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case typo here, should be moduleName(
$path = $this->getContext()->getConfig()->get(Config::CACHE_FILE); | ||
$path = Path::makeAbsolute($path, $this->rootDir); | ||
|
||
if ($this->storage->fileExists($path) && false === $this->isRootModuleFileModified()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if you used !
over false ===
(also in line 133)
Hey @webmozart - requested changes have been done 😄 |
Fixes puli/issues#148.