-
Notifications
You must be signed in to change notification settings - Fork 284
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
use_version function #223
use_version function #223
Conversation
@hadley Will you indicate your opinion at a high level? If you basically support the goal, I can shepherd the PR further along. |
Seems like a little too much interactivity right now - I think if you want to increment in some non-standard way, you'll need to use the arguments. Also need to adjust Overall seems like a good idea, although the implementation needs some work. |
@EmilHvitfeldt Let me know if you want more concrete advice before proceeding. Otherwise, just ping me when things have advanced. I came across this function today, which you should probably look into: |
Thanks @jennybc! Yes I would like some more concrete advice. So right now I feel the direction is:
I will look at What convention are using with regard to bumping of .9000. What increment levels should remove .9000 or should it be a separate action? |
A few thoughts:
or
It seems like, if you have a dev version number, bumping the patch version should take you out of a dev version number. Does this help? At this point, you've probably thought about this more than I have. Added: I just read the docs on |
Okay @jennybc, I think this is it. I have
with lowercase words to match the arguments to lessen confusing.
I tried using the |
DESCRIPTION
Outdated
@@ -1,6 +1,6 @@ | |||
Package: usethis | |||
Title: Automate Package and Project Setup | |||
Version: 1.2.0.9000 | |||
Version: 1.1.1.9000 |
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.
Please remove this change.
I don't quite understand this and would like to. Do you mean it's impossible to just get a version string back from the desc package vs. actually changing the version? I think I'm beginning to see the problem.... |
R/helpers.R
Outdated
@@ -237,3 +237,28 @@ view_url <- function(..., open = interactive()) { | |||
} | |||
invisible(url) | |||
} | |||
|
|||
bump_version <- function(ver, choice) { |
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'd stick with same vocabulary and input values. So "which" instead of "choice" and c("major", "minor", "patch", "dev")
as possible values.
tests/testthat/test-use-version.R
Outdated
@@ -0,0 +1,97 @@ | |||
context("use_version.R") | |||
|
|||
test_that("use_version() increments Mayor by 1 and resets other fields", { |
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.
"major"
tests/testthat/test-use-version.R
Outdated
) | ||
}) | ||
|
||
test_that("use_version() increments patch by 1 leaving other fields alone", { |
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.
Is this a duplicate of the test above?
I'd shift the all the case-by-case testing to be testing the |
R/version.R
Outdated
bump_version(ver, 3), | ||
bump_version(ver, 4)) | ||
|
||
if(is.null(which)) { |
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.
Feels like there should be an early check for which = NULL
in a non interactive session that exits early and does nothing.
Yes the desc package will calculate the updated version string and update the DESCRIPTION at the same time. |
Thanks to @gaborcsardi: There is a way to use desc's version incrementation logic w/o changing the version of the active package: Are you game to put this inside |
That is amazing! I put it inside |
Thanks! Will you add a bullet to the dev version section of NEWS? I might groom this a bit after the merge but will cc you on those commits, so you're in the loop. |
I'm a little unsure of how I would change the NEWS.md file since my forked directory is behind and doesn't have the up to date NEWS.md. |
OK I'll take it from here then. Next time, you should create a branch in your fork, then do your pull request work in that branch. If master changes during the process, you would pull those changes into master in your fork, then merge master into your branch. But this PR is fine. We are developing a guide for this, but it's not in position yet. Thanks! |
Fixes #188
I would like to resolve #188 and I think I have a solution ready here.
It defaults to an interactive menu where the current version is shown and you are asked which level and how much you would like to increment with. Furthermore does it have arguments for faster non-interactive use. :)