Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Improve the installation of -dev and -BETA versions #185

Merged
merged 13 commits into from
Sep 28, 2015

Conversation

javiereguiluz
Copy link
Member

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:

symfony-unstable-warning

  1. 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:

symfony-dev-version

@javiereguiluz
Copy link
Member Author

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)) {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

@xabbuh
Copy link
Member

xabbuh commented Sep 23, 2015

@javiereguiluz SO we can now download archives of all beta versions? Does this include all beta versions that have been released in the past?

@javiereguiluz
Copy link
Member Author

@xabbuh yes, we can download any past beta package. For example:

$ symfony new my_project 2.6.0-BETA1

@weaverryan
Copy link
Member

👍 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.

@javiereguiluz
Copy link
Member Author

After @xabbuh's comments, I can confirm that Composer is case insensitive at least on Mac OS. These commands result in the same installation:

$ composer create-project symfony/framework-standard-edition my_project 2.7.0-BETA1
$ composer create-project symfony/framework-standard-edition my_project 2.7.0-beta1

That's why in 31765ca I've changed all dev and BETA comparisons to case insentivity. I'll merge this last version unless someone tells me not to. Thanks!

@stof
Copy link
Member

stof commented Sep 24, 2015

I can confirm that Composer is case insensitive at least on Mac OS

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)) {
Copy link
Member

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

Copy link
Member Author

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'

@stof
Copy link
Member

stof commented Sep 24, 2015

@javiereguiluz what about RC versions ?

@stof
Copy link
Member

stof commented Sep 24, 2015

@javiereguiluz shouldn't you normalize the case of BETA for the generated archive URL though ? Or is it case insensitive on the server too ?

@javiereguiluz
Copy link
Member Author

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)) {
Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Member Author

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!

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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',
Copy link
Member

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).

Copy link
Member Author

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/',
Copy link
Member

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?

Copy link
Member Author

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
Copy link
Member

xabbuh commented Sep 28, 2015

👍

@javiereguiluz
Copy link
Member Author

@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!

@javiereguiluz javiereguiluz merged commit 6751701 into symfony:master Sep 28, 2015
javiereguiluz added a commit that referenced this pull request Sep 28, 2015
…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:

![symfony-unstable-warning](https://cloud.githubusercontent.com/assets/73419/9811676/f14b6d02-5878-11e5-9220-301fcb671c8c.png)

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:

![symfony-dev-version](https://cloud.githubusercontent.com/assets/73419/9811642/c0bdc194-5878-11e5-9ee8-9af5e194f80b.png)

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)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants