Skip to content
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

SemVer 2.0 and npm semver support #2596

Merged
merged 6 commits into from Dec 8, 2014
Merged

Conversation

Seldaek
Copy link
Member

@Seldaek Seldaek commented Jan 15, 2014

This brings composer in line with npm's semver package + follows some more semver rules.

  • Adds ^ operator for stricter semver ranges
  • Adds 1.0 - 2.0 ranges
  • Adds support for +build.metadata suffixes
  • Spaces are now equivalent to commas for AND
  • || is now equivalent to | for OR

array('>2.0 <=3.0'),
array('>2.0, <=3.0'),
array('>2.0 ,<=3.0'),
array('>2.0 , <=3.0'),
Copy link
Contributor

Choose a reason for hiding this comment

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

would it work with a space between <= and 3.0 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah it's covered above, but I'll still add a few more cases just to
bulletproof it.

@dzuelke
Copy link
Contributor

dzuelke commented Jan 15, 2014

Let's do the whole https://npmjs.org/doc/misc/semver.html#Ranges syntax though and not just one part of it I'd say. Can help with it later this week.

@naderman
Copy link
Member

Yeah, but this is a first step and looks fine to me to merge :)

@dzuelke
Copy link
Contributor

dzuelke commented Jan 15, 2014

I disagree, @naderman. Let's do a full implementation with enough tests to make sure that there are no conflicts with existing syntax. There is little point in ending up with only a half baked implementation in case of incompatibilities, which will give no benefit for the future, but instead just more code to maintain :)

@Seldaek Seldaek added this to the Backwards Compatible milestone Mar 29, 2014
@Seldaek Seldaek changed the title Spaces are now equivalent to comma in constraints and mean AND [WIP] Spaces are now equivalent to comma in constraints and mean AND Mar 29, 2014
@Seldaek Seldaek changed the title [WIP] Spaces are now equivalent to comma in constraints and mean AND SemVer 2.0 and npm semver support Dec 8, 2014
@Seldaek
Copy link
Member Author

Seldaek commented Dec 8, 2014

Just pushed complete support and updated the PR description. I'd appreciate if someone can sanity-check the new tests before I merge this.

@naderman
Copy link
Member

naderman commented Dec 8, 2014

Looks perfect to me.

@Seldaek
Copy link
Member Author

Seldaek commented Dec 8, 2014

Alright then merging and let's hope I didn't miss anything :)

Seldaek added a commit that referenced this pull request Dec 8, 2014
SemVer 2.0 and npm semver support
@Seldaek Seldaek merged commit 72a3526 into composer:master Dec 8, 2014
@dzuelke
Copy link
Contributor

dzuelke commented Dec 8, 2014

🚀

@@ -178,10 +183,10 @@ public function normalizeBranch($name)
return $this->normalize($name);
}

if (preg_match('#^v?(\d+)(\.(?:\d+|[x*]))?(\.(?:\d+|[x*]))?(\.(?:\d+|[x*]))?$#i', $name, $matches)) {
if (preg_match('#^v?(\d+)(\.(?:\d+|[xX*]))?(\.(?:\d+|[xX*]))?(\.(?:\d+|[xX*]))?$#i', $name, $matches)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This change seems unnecessary as you already have the insensitive flag.

Same goes for below, except 370.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes you're right I just applied it to all the x's

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

Successfully merging this pull request may close these issues.

None yet

5 participants