Title: | Creation of NEWS.md File |
Version: | 0.5.1 |
Date: | 2023-04-17 |
Description: | Adding updates (version or bullet points) to the NEWS.md file. |
License: | MIT + file LICENSE |
URL: | https://github.com/Dschaykib/newsmd |
BugReports: | https://github.com/Dschaykib/newsmd/issues |
Depends: | R (≥ 3.3) |
Imports: | R6 |
Suggests: | desc, knitr, lintr, rmarkdown, testthat |
VignetteBuilder: | knitr |
Encoding: | UTF-8 |
Language: | en-GB |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2023-04-17 15:40:22 UTC; jakobgepp |
Author: | Jakob Gepp [cre, aut] |
Maintainer: | Jakob Gepp <jakob.gepp@yahoo.de> |
Repository: | CRAN |
Date/Publication: | 2023-04-17 21:30:03 UTC |
Combining dev-versions into the next version
Description
Combining dev-versions into the next version
Usage
combine_dev(text = "")
Arguments
text |
a string vector with the content of the get_text method |
Value
a string vector with the reduced NEWS.md text
Retrieve the version number of a NEWS.md file
Description
This function tries to extract the version number within a file. There are a few pitfalls:
* If the word "version" is within the text but denotes a dependency it is still detected. * If the files has a date before the version it will return the date instead of the version * It is assumed, that the NEWS.md files is updated from the top. Ergo the latest version is the first one.
Usage
get_version(file, latest = TRUE)
Arguments
file |
a path to a file |
latest |
a Boolean, if TRUE (default) only the latest version is returned |
Value
either a single string or a vector with version numbers
Manipulate the NEWS.md file
Description
Manipulate the NEWS.md file.
Format
An R6 class.
Methods
Public methods
Method new()
Create a new news object.
Usage
news$new( text = c(paste0("## version ", version), "", "---", "", "### NEWS.md setup", "", "- added NEWS.md creation with [newsmd](https://github.com/Dschaykib/newsmd)", ""), version = "0.0.0.9000", file = NULL )
Arguments
text
vector with context for the news.md file.
version
current version of the package.
file
a text file with the current news.md file. Use NULL to create new file.
Returns
A new 'news' object.
Method print()
Print a news object.
Usage
news$print()
Method get_text()
Get the news object as a text.
Usage
news$get_text()
Returns
The context of the news file.
Method write()
Write and save a news object.
Usage
news$write(file = "NEWS.md", reduce_dev = FALSE)
Arguments
file
A path and file to where the news file is saved.
reduce_dev
A boolean, if TRUE dev version's points are combined into the next version
Method add_version()
Adds a version line to a news object.
Usage
news$add_version(x)
Arguments
x
A string with the version number.
Method add_subtitle()
Adds a subtitle line to a news object.
Usage
news$add_subtitle(x)
Arguments
x
A string with the subtitle.
Method add_bullet()
Adds a bullet points to the last subtitle.
Usage
news$add_bullet(x)
Arguments
x
A vector with the bullet points.
Method clone()
The objects of this class are cloneable with this method.
Usage
news$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
See Also
Examples
## Create a template
my_news <- news$new()
my_news$add_subtitle("improved things 1")
my_news$add_bullet("point 1")
my_news$add_bullet("point 2")
Creating a NEWS.md file
Description
This is a convenience wrapper for news$new()
. If you already have a
NEWS
file you can add it's path to newsmd()
.
Usage
newsmd(
file = NULL,
text = c(paste0("## version ", version), "", "---", "", "### NEWS.md setup", "",
"- added NEWS.md creation with [newsmd](https://github.com/Dschaykib/newsmd)", ""),
version = "0.0.0.9000"
)
Arguments
file |
name of the |
text |
a character scalar containing the initial text. |
version |
a character with the version in the format
|
Details
This functions creates a news
object, which can be saved as the
NEWS.md file with the internal method write()
. One can add versions,
subtitles and bullet points to the news
.
If an existing NEWS.md file is given, the version is extracted with
get_version
and the dev part is bumped up.
Examples
newsmd()