-
Notifications
You must be signed in to change notification settings - Fork 27
Manifest file strategy #15
base: master
Are you sure you want to change the base?
Conversation
ff7c53a
to
2ec6c44
Compare
2ec6c44
to
a35b4c1
Compare
@pjcdawkins Thanks for the PR! I'll review over the next week time allowing. On your two questions:
|
Apparently the review stage took longer than expected. |
Ah yes... I also have extended this a bit where I'm using it (in the Platform.sh CLI), to add support for timeouts, for upgrade notes, and for PHP version requirements: I'll roll that into an update for this PR, if there is still interest. |
👍 |
Sorry for the delay folks - my review times suck recently 😁 We'll work around to this much faster this time. |
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 not very familiar with the codebase yet so the technical review is somewhat lacking, but you'll find some comments still :)
use Humbug\SelfUpdate\Updater; | ||
use Humbug\SelfUpdate\VersionParser; | ||
|
||
class ManifestStrategy implements StrategyInterface |
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 would make this class final
private $allowUnstable = false; | ||
|
||
/** | ||
* ManifestStrategy constructor. |
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 personally not very found of noisy comments (i.e. comment not providing any value), so I would remove that line unless @padraic prefer to keep it for consistency. Although I would argue in favour of changing that practice and fixing that inconsistency later :)
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.
Opinions can vary, but I'm fairly verbose myself in comments. I just find it a PITA, esp. in open source projects, to spend too time familiarising myself with how something works so a bit of hand holding can be welcome.
Also, easy to copy/paste to a README and THEN delete the comments ;).
private $localVersion; | ||
/** @var bool */ | ||
private $allowMajor = false; | ||
/** @var bool */ |
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.
let's keep it like:
/**
* @var bool
*/
private $allowUnstable = false;
if ($version === false) { | ||
throw new \RuntimeException('No remote versions found'); | ||
} | ||
$versionInfo = $this->getAvailableVersions(); |
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.
missing blank line between L63-L64
} | ||
|
||
/** | ||
* Get available versions to update to. |
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.
Gets
|
||
class UpdaterManifestStrategyTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
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.
unnecessary blank line
throw new \RuntimeException(sprintf('Failed to download manifest: %s', $this->manifestUrl)); | ||
} | ||
|
||
$this->manifest = (array) json_decode($manifestContents, true); |
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.
$this->manifest = json_decode($manifestContents, true, 512, JSON_OBJECT_AS_ARRAY);
} | ||
} | ||
|
||
return $this->manifest; |
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 would rather return a $manifest
property and do $this->manifest = $this->retrieveManifest()
class UpdaterManifestStrategyTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
private $files; |
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.
missing phpdoc for the props
chdir($cwd); | ||
} | ||
|
||
public function teardown() |
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 would move it just under setUp()
, they go together :)
and also there's a missing @inheritdoc
for both setUp()
and tearDown()
Note: Will complete a refresh PR over the weekend - we don't have write access back to the originating branch so will be a basic merge, resolve review pts, and check the additional work noted in comments. |
@pjcdawkins I've updated this PR in #37 and it should be compatible with your final version. The API has been altered to prefer setters, and SHA1 has been moved to an optional downgrade from a SHA-256 default, but otherwise the overall internals are unchanged. If/When #37 is merged, this PR will be closed. Thanks again for opening this PR! |
As described in #13
Minor todos, not sure if you'd want them: