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

Mark release as beta #73

Merged
merged 2 commits into from
Jul 15, 2014
Merged

Mark release as beta #73

merged 2 commits into from
Jul 15, 2014

Conversation

ahilles107
Copy link
Contributor

Fix for #71.

How it work?

  • new option is added - label. It have 3 choices (RC, beta, alpha, none). If none is choosen then new version will be without label.

example workflow:

Current version: 0.0.0
type: p
label: a
Next Version: 0.0.1-alpha

Current version: 0.0.1-alpha
type: p
label: a
Next Version: 0.0.1-alpha2

Current version: 0.0.1-alpha2
type: p
label: b
Next Version: 0.0.1-beta

Current version: 0.0.1-beta
type: p
label: n
Next Version: 0.0.1

Current version: 0.0.1
type: p
label: n
Next Version: 0.0.2

Current version: 0.0.b
type: m
label: b
Next Version: 1.0.0-beta

Any help with this is welcome.

if (isset($options['beta'])) {
$beta = $options['beta'];
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

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

else should be on the previous line

@lsmith77
Copy link
Contributor

@jeanmonod can you have a look?

@ahilles107
Copy link
Contributor Author

I'm working on better solution discussed in in issue #71, and about else in new - i did it like this because this is standard in current library code.

@ahilles107
Copy link
Contributor Author

@acrobat, @jeanmonod, @lsmith77 - this should be much better, i don't know if it's easy to understand for every one. Help with code organization (if(){}else{}) would be great.

@acrobat
Copy link
Contributor

acrobat commented Jul 12, 2014

Looks good! 👍

But with this change it should be different

Current version: 0.0.1-alpha
type: p
label: a
Next Version: 0.0.1-alpha1

In this case you should go from 0.0.1-alpha to 0.0.1-alpha2 because a label with no digit behind it, is always -_label_1

I'm going to take a look at the if/else code for label checking!

@ahilles107
Copy link
Contributor Author

@acrobat and this works like you said. My description was wrong.

@ahilles107
Copy link
Contributor Author

Test It in action please.

@acrobat
Copy link
Contributor

acrobat commented Jul 12, 2014

oh ok, great! Yes i'm going to take a checkout of this branch and test it!

@acrobat
Copy link
Contributor

acrobat commented Jul 12, 2014

I've just use this branch version of RMT and it works good, alpha and beta get the correct numbers behind it if multiple versions of label!

But there is are some problems with the RC label.

  • if you create a 0.0.1-RC version and you want to create a 0.0.1-RC2 you get the error that the tag 0.0.1-RC already exists, so it does not increment the RC label number
  • After a RC release the command RMT current still gives the previous version (version before the RC release)

Maybe it's a good idea to add some tests for the new label option and versions with labels

@ahilles107
Copy link
Contributor Author

Looks like wrong regex for version. I will look at It. I will try also with tests.

if (isset($options['label'])) {
$label = $options['label'];
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

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

else needs to be on the previous line :)

@lsmith77
Copy link
Contributor

can't you also use https://github.com/vierbergenlars/php-semver for parsing?

@ahilles107
Copy link
Contributor Author

@lsmith77 i will fix cs with next commit + missing test, I use vierbergenlars/php-semver for versions comparison.

About rc label problem - it must be wiath small letters, vierbergenlars/php-semver don't recognize 'RC' properly - works perfectly with 'rc' - so question is - should i leave it with small letters or try to find how to fix it with big letters?

@acrobat
Copy link
Contributor

acrobat commented Jul 14, 2014

I think it's ok to use lowercase rc, it looks like it doesn't matter much because symfony tags it's pre-release (alpha, beta, rc) with all uppercase. So it's just a standard you agree on i think!

@ahilles107
Copy link
Contributor Author

Hey @acrobat @lsmith77, looks like all tests are passed (new one also), all works ok also for me, cs is fixed. Please review.

I still think that this if(){}else{} can be done better - of you agree then help me with this, if you think that this what we have now is ok then please merge it.

$patch = substr($patch, 0, strpos($patch, "-"));

return implode(array($major, $minor, $patch), '.').'-'.$label.$labelVersion;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

the following code does not need to be in an else, since the if statement before ends with a return

Copy link
Contributor

Choose a reason for hiding this comment

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

that being said .. seems like the end of the if statement could be refactored to no longer contain duplicate code in the else clause

beta_releases

add missing option
@ahilles107
Copy link
Contributor Author

@lsmith77, @acrobat - rebased and cleaned.

// if label is new clear version
if ($label !== $oldLabel) {
$labelVersion = false;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be an elseif now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

@ahilles107
Copy link
Contributor Author

@acrobat it's ready to merge.

@acrobat
Copy link
Contributor

acrobat commented Jul 14, 2014

great, nice work! But i think we should ping @lsmith77 @jeanmonod for the merge

@takeit
Copy link

takeit commented Jul 15, 2014

👍

lsmith77 added a commit that referenced this pull request Jul 15, 2014
@lsmith77 lsmith77 merged commit 202a8a0 into liip:master Jul 15, 2014
@ahilles107
Copy link
Contributor Author

Thanks for help guys!

jeanmonod added a commit to jeanmonod/RMT that referenced this pull request Jul 28, 2014
…the label management. Most of the users were currently not using the label system, so forced them to always answer 'none' could be painful. To activate it on your project (or a dedicated branch) just add 'allow-label' in your config
@jeanmonod
Copy link
Member

Hi guys,

First thanks you all for taking care of this. I was in holidays those last weeks, so not very present on the subject.
I just push one more commit to add your feature as an option and not by default. Everything is available under a new version 1.1.0

@acrobat
Copy link
Contributor

acrobat commented Jul 28, 2014

👍 thanks @jeanmonod!

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

Successfully merging this pull request may close these issues.

6 participants