-
Notifications
You must be signed in to change notification settings - Fork 114
Improve the installation of -dev and -BETA versions #185
Conversation
I'd like to merge this change soon because I want to test it well before we enter into the most intense release period in Symfony history (including a major version change). Please add any comment or review that you may have. Thanks! |
return $this; | ||
} | ||
|
||
// validate semver syntax | ||
if (!preg_match('/^2\.\d(?:\.\d{1,2})?$/', $this->version)) { | ||
throw new \RuntimeException('The Symfony version should be 2.N or 2.N.M, where N = 0..9 and M = 0..99'); | ||
if (!preg_match('/^2\.\d(?:\.\d{1,2})?(-(dev|BETA)\d*)?$/', $this->version)) { |
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.
Numbers don't make sense after dev
, do they? And what about lowercased beta
strings?
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.
In 9b3cdc1 we no longer allow numbers after the dev
version.
Regarding the BETA
uppercase/lowercase issue, I thought about that but I decided to leave it untouched. If we silently fix beta
as BETA
, we should also fix DEV
to dev
. Honestly, I don't know if this is right for user experience or it's bad because we are supporting wrong version names.
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.
Composer actually makes no difference here. So we would be consistent with its behaviour.
@javiereguiluz SO we can now download archives of all beta versions? Does this include all beta versions that have been released in the past? |
@xabbuh yes, we can download any past beta package. For example: $ symfony new my_project 2.6.0-BETA1 |
👍 as is - it'll be great to be able to show people how to create a new beta project for testing when the beta's are released. |
…ate 'BETA1' from 'beta1'
After @xabbuh's comments, I can confirm that Composer is case insensitive at least on Mac OS. These commands result in the same installation:
That's why in 31765ca I've changed all |
it is on all systems. It normalizes the case of stability specifiers: https://github.com/composer/composer/blob/15face5432d7b7334db6ac69fac0190971cafa6e/src/Composer/Package/Version/VersionParser.php#L49 |
return $this; | ||
} | ||
|
||
// validate semver syntax | ||
if (!preg_match('/^2\.\d(?:\.\d{1,2})?$/', $this->version)) { | ||
throw new \RuntimeException('The Symfony version should be 2.N or 2.N.M, where N = 0..9 and M = 0..99'); | ||
if (!preg_match('/^2\.\d(?:\.\d{1,2})?(-(dev|BETA\d*))?$/i', $this->version)) { |
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.
you should use non-capturing groups 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've changed it by this: '/^2\.\d(?:\.\d{1,2})?(?:-(?:dev|BETA\d*))?$/i'
@javiereguiluz what about |
@javiereguiluz shouldn't you normalize the case of |
In b26b217 I've added support for RC versions and I've normalized the version names before downloading them from the server. |
return $this; | ||
} | ||
|
||
// validate semver syntax | ||
if (!preg_match('/^2\.\d(?:\.\d{1,2})?$/', $this->version)) { | ||
throw new \RuntimeException('The Symfony version should be 2.N or 2.N.M, where N = 0..9 and M = 0..99'); | ||
if (!preg_match('/^2\.\d(?:\.\d{1,2})?(?:-(?:dev|BETA\d*|RC\d*))?$/i', $this->version)) { |
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.
You could now pass a patch version and a dev suffix. I think both parts should be exclusive.
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.
dev suffixes are all rejected just later, so this is not a big deal IMO
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, but this does not only apply to the -dev
suffix but also to -BETA
and -RC
.
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.
and beta versions are named 2.1.0-beta, not 2.1-beta
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.
Hm indeed, then we can move that part of the regex.
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've changed this regular expression by:
if (!preg_match('/^2\.\d(?:\.\d{1,2})?|2\.\d(?:-(?:dev|BETA\d*|RC\d*))$/i', $this->version))
Please review it. Thanks!
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.
Did you forget to push the changes?
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've pushed it .... and then reverted it. The correct beta version is x.y.z-BETAn
, not x.y-BETAn
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.
There would still be some versions that pass the regex but are not valid. Though actually the installer will fail with a meaningful message anyway later on. So I think it's okay if we just stick with this solution.
@@ -106,6 +106,12 @@ public function provideSymfonyInstallationData() | |||
'/.*Symfony 2\.5\.6 was successfully installed.*/', | |||
'/Symfony version 2\.5\.6 - app\/dev\/debug/', | |||
), | |||
|
|||
array( | |||
'2.7-BETA1', |
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 version should fail while 2.7.0-BETA1
should succeed (I think it would be good to have tests for both versions).
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.
Indeed. Fixed. Thanks.
array( | ||
'2.7.0-BETA1', | ||
'/.*Symfony 2\.7\.0\-BETA1 was successfully installed.*/', | ||
'/Symfony version 2\.7\-BETA1 - app\/dev\/debug/', |
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 seems to need an update too, doesn't it?
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 trying to do things fast ... but I do everything wrong :( Thanks for reviweing this!
👍 |
@xabbuh thanks for the review. I'm gonna merge it now, so we have time to test it well before the 2.8.0-BETA1 release. Thanks! |
…oni, javiereguiluz) This PR was merged into the 1.0-dev branch. Discussion ---------- Improve the installation of -dev and -BETA versions This finishes #159, which is related to #144 and #143. The new behavior of the installer: 1) When installing a regular Symfony version, nothing changes from the previous installer. 2) When you install a `beta` version, you see a warning message:  3) When you try to install a `dev` version, you get a better error message and a link to the article that will solve your problem:  Commits ------- 6751701 Fixed again one test 3ea393a Fixed one test f45a29a Fixed again the version parser regexp 165813c Added new tests for BETA and RC versions 9e41335 Updated the version parser regular expression b26b217 Added support for RC versions and normalized version names 31765ca Made comparisons case insensitive because Composer doesn't differentiate 'BETA1' from 'beta1' 9b3cdc1 The trailing number is only available for BETA versions not for 'dev' versions d03938f Fixed syntax issues d67b4ad Improved the error message for "-dev" versions 4c26d2b Warn the user when downloading an unstable version 94a1f98 Simplified the new feature a bit d58812a Installation dev/beta versions (143)
This finishes #159, which is related to #144 and #143.
The new behavior of the installer:
When installing a regular Symfony version, nothing changes from the previous installer.
When you install a
beta
version, you see a warning message:dev
version, you get a better error message and a link to the article that will solve your problem: