devstuffs.R 5.39 KB
Newer Older
kapsner's avatar
kapsner committed
1
2
3
4
5
6
7
8
9
10
packagename <- "DQAgui"

# remove existing description object
unlink("DESCRIPTION")
# Create a new description object
my_desc <- desc::description$new("!new")
# Set your package name
my_desc$set("Package", packagename)
# Set author names
my_desc$set_authors(c(
11
12
13
14
  person(
    "Lorenz A.",
    "Kapsner",
    email = "lorenz.kapsner@uk-erlangen.de",
15
    role = c("cre", "aut"),
16
17
18
19
20
    comment = c(ORCID = "0000-0003-1866-860X")
  ),
  person(
    "Jonathan M.",
    "Mang",
21
    role = "aut",
22
    comment = c(ORCID = "0000-0003-0518-4710")
23
  ),
24
  person("MIRACUM - Medical Informatics in Research and Care in University Medicine", role = "fnd"),
Lorenz Kapsner's avatar
Lorenz Kapsner committed
25
  person("Universitätsklinikum Erlangen", role = "cph")
26
))
kapsner's avatar
kapsner committed
27
28
29
30
#  person("Name2", "Surname2", email = "mail@2", role = 'aut')))
# Remove some author fields
my_desc$del("Maintainer")
# Set the version
31
my_desc$set_version("0.1.6.9004")
kapsner's avatar
kapsner committed
32
33
34
35
36
# The title of your package
my_desc$set(Title = "DQA GUI")
# The description of your package
my_desc$set(Description = "A graphical user interface (GUI) to the functions implemented in the R package 'DQAstats'.")
# The description of your package
37
my_desc$set("Date" = as.character(Sys.Date()))
kapsner's avatar
kapsner committed
38
# The urls
39
my_desc$set("URL", "https://github.com/miracum/dqa-dqagui")
kapsner's avatar
kapsner committed
40
my_desc$set("BugReports",
41
            "https://github.com/miracum/dqa-dqagui/issues")
kapsner's avatar
kapsner committed
42
43
44
45
46
47
# License
my_desc$set("License", "GPL-3")
# Save everyting
my_desc$write(file = "DESCRIPTION")

# License
Jonathan Mang's avatar
Jonathan Mang committed
48
#usethis::use_gpl3_license(name="Universitätsklinikum Erlangen")
kapsner's avatar
kapsner committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65


# add Imports and Depends
# Listing a package in either Depends or Imports ensures that it’s installed when needed
# Imports just loads the package, Depends attaches it
# Loading will load code, data and any DLLs; register S3 and S4 methods; and run the .onLoad() function.
##      After loading, the package is available in memory, but because it’s not in the search path,
##      you won’t be able to access its components without using ::.
##      Confusingly, :: will also load a package automatically if it isn’t already loaded.
##      It’s rare to load a package explicitly, but you can do so with requireNamespace() or loadNamespace().
# Attaching puts the package in the search path. You can’t attach a package without first loading it,
##      so both library() or require() load then attach the package.
##      You can see the currently attached packages with search().

# Depends

# Imports
66
67
usethis::use_package("data.table", type = "Imports")
usethis::use_package("magrittr", type = "Imports")
68
69
# For date-restriction:
usethis::use_package("daterangepicker", type = "Imports")
70
usethis::use_package("DT", type = "Imports")
Jonathan Mang's avatar
Jonathan Mang committed
71
72
usethis::use_package("lubridate", type = "Imports")
usethis::use_package("parsedate", type = "Imports")
73
74
usethis::use_package("graphics", type = "Imports")
usethis::use_package("shiny", type = "Imports")
75
usethis::use_package("shinyalert", type = "Imports")
76
77
78
usethis::use_package("shinydashboard", type = "Imports")
usethis::use_package("shinyFiles", type = "Imports")
usethis::use_package("shinyjs", type = "Imports")
79
usethis::use_package("shinyWidgets", type = "Imports")
80
81
usethis::use_package("knitr", type = "Imports")
usethis::use_package("jsonlite", type = "Imports")
82
usethis::use_package("DIZutils", type = "Imports")
83
84
# For loading-animations:
usethis::use_package("waiter", type = "Imports")
85
86
usethis::use_package("reshape2", type = "Imports")

kapsner's avatar
kapsner committed
87
88
89
90

# Suggests
usethis::use_package("testthat", type = "Suggests")
usethis::use_package("processx", type = "Suggests")
91
usethis::use_package("lintr", type = "Suggests")
kapsner's avatar
kapsner committed
92
93

# Development package
Lorenz Kapsner's avatar
Lorenz Kapsner committed
94
stats_tag <- "feat_new_coreds" # e.g. "v0.1.7" or "development"
95
96
97
98
99
100
devtools::install_git(
  url = "https://gitlab.miracum.org/miracum/dqa/dqastats.git",
  ref = stats_tag,
  upgrade = "always",
  quiet = TRUE
)
101

Jonathan Mang's avatar
Jonathan Mang committed
102
# usethis::use_dev_package("DQAstats", type = "Imports")
103
# https://cran.r-project.org/web/packages/devtools/vignettes/dependencies.html
104
105
desc::desc_set_remotes(c(
  paste0(
106
    "url::https://gitlab.miracum.org/miracum/dqa/dqastats/-/archive/", stats_tag, "/dqastats-", stats_tag, ".zip")
107
108
),
file = usethis::proj_get())
kapsner's avatar
kapsner committed
109

Jonathan Mang's avatar
Jonathan Mang committed
110
111
112
113
## .Rbuildignore: ##
usethis::use_build_ignore("data-raw")
usethis::use_build_ignore("LICENSE.md")
usethis::use_build_ignore(".gitlab-ci.yml")
114
usethis::use_build_ignore(".vscode")
Lorenz Kapsner's avatar
Lorenz Kapsner committed
115
usethis::use_build_ignore(".lintr")
Jonathan Mang's avatar
Jonathan Mang committed
116
usethis::use_build_ignore("ci/*")
117
usethis::use_build_ignore("NEWS.md")
Jonathan Mang's avatar
Jonathan Mang committed
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

## .gitignore:
usethis::use_git_ignore("/*")
usethis::use_git_ignore("/*/")
usethis::use_git_ignore("*.log")
usethis::use_git_ignore("!/.gitignore")
usethis::use_git_ignore("!/data-raw/")
usethis::use_git_ignore("!/DESCRIPTION")
usethis::use_git_ignore("!/inst/")
usethis::use_git_ignore("!/LICENSE.md")
usethis::use_git_ignore("!/man/")
usethis::use_git_ignore("!NAMESPACE")
usethis::use_git_ignore("!/R/")
usethis::use_git_ignore("!/README.md")
usethis::use_git_ignore("!/tests/")
usethis::use_git_ignore("/.Rhistory")
usethis::use_git_ignore("!/*.Rproj")
usethis::use_git_ignore("/.Rproj*")
usethis::use_git_ignore("/.RData")
137
usethis::use_git_ignore("/.vscode")
Lorenz Kapsner's avatar
Lorenz Kapsner committed
138
usethis::use_git_ignore("!/.lintr")
139
usethis::use_git_ignore("!/NEWS.md")
Jonathan Mang's avatar
Jonathan Mang committed
140
141
#usethis::use_git_ignore("/inst/demo_data/utilities/MDR/.~lock.mdr_example_data.csv#")
usethis::use_git_ignore(".~lock.*.csv#")
kapsner's avatar
kapsner committed
142

143
144
145
146
147
148
# create NEWS.md using the python-package "auto-changelog" (must be installed)
# https://www.conventionalcommits.org/en/v1.0.0/
# build|ci|docs|feat|fix|perf|refactor|test
system(
  command = 'auto-changelog -u -t "DQAgui NEWS" --tag-prefix "v" -o "NEWS.md"'
)