Skip to content

Commit

Permalink
Merge pull request #1 from user-workshop-cicd/init_package
Browse files Browse the repository at this point in the history
create a package
  • Loading branch information
pawelru authored May 6, 2024
2 parents 056a47b + d6c302f commit 131dd44
Show file tree
Hide file tree
Showing 13 changed files with 152 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^r\.package\.example\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.Rproj.user
15 changes: 15 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Package: r.package.example
Title: An example package for the workshop
Version: 0.0.0.9000
Authors@R:
person("First", "Last", , "[email protected]", role = c("aut", "cre"))
Description: This is an empty dummy package.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Imports:
cli
Suggests:
testthat (>= 3.0.0)
Config/testthat/edition: 3
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2024
COPYRIGHT HOLDER: r.package.example authors
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2024 r.package.example authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(hello)
export(hello_cli)
importFrom(cli,cli_text)
28 changes: 28 additions & 0 deletions R/hello.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#' Print "Hello, World!"
#'
#' This function prints "Hello, World!" to the console.
#'
#' @return nothing
#'
#' @export
#'
#' @examples
#' hello()
hello <- function() {
print("Hello, World!")
}

#' Print "Hello, World!" using the `cli` package
#'
#' This function prints "Hello, World!" to the console using the `cli` package.
#'
#' @return nothing
#'
#' @importFrom cli cli_text
#' @export
#'
#' @examples
#' hello_cli()
hello_cli <- function() {
cli::cli_text("Hello, World!")
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# r.package.example
# r.package.example

An example package for the workshop.
17 changes: 17 additions & 0 deletions man/hello.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/hello_cli.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions r.package.example.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Version: 1.0

RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
Encoding: UTF-8

AutoAppendNewline: Yes
StripTrailingWhitespace: Yes
LineEndingConversion: Posix

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(r.package.example)

test_check("r.package.example")
11 changes: 11 additions & 0 deletions tests/testthat/test-hello.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
test_that("hello() works", {
expect_output(hello(), "Hello, World!")
})

test_that("hello_cli() works", {
expect_message(hello_cli(), "Hello, World!")
})

test_that("fix me!!!", {
expect_equal(1, 2)
})

0 comments on commit 131dd44

Please sign in to comment.