From d4ce070629377092fda8b9acfa742b1a949f534a Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Thu, 15 Feb 2024 16:14:52 +0100 Subject: [PATCH 1/7] add a DESCRIPTION file --- DESCRIPTION | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 DESCRIPTION diff --git a/DESCRIPTION b/DESCRIPTION new file mode 100644 index 0000000..50096c7 --- /dev/null +++ b/DESCRIPTION @@ -0,0 +1,11 @@ +Package: workflow.scenario.preparation +Title: Run the Scenario Preparation Workflow +Version: 0.0.0.9000 +Authors@R: + person("Jackson", "Hoffart", , "jackson.hoffart@gmail.com", role = c("aut", "cre"), + comment = c(ORCID = "0000-0002-8600-5042")) +Description: A workflow to prepare climate change scenarios for the PACTA tool. +License: MIT + file LICENSE +Encoding: UTF-8 +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.3.1 From 60c72586c5bdd5594748109b79c4e3fff0430e59 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Thu, 15 Feb 2024 16:15:01 +0100 Subject: [PATCH 2/7] Add license --- .Rbuildignore | 1 + LICENSE | 23 ++--------------------- LICENSE.md | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 .Rbuildignore create mode 100644 LICENSE.md diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..5163d0b --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1 @@ +^LICENSE\.md$ diff --git a/LICENSE b/LICENSE index b12f8fc..49e7d3d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -MIT License - -Copyright (c) 2023 RMI-PACTA - -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. +YEAR: 2024 +COPYRIGHT HOLDER: Rocky Mountain Institute diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6f6efaf --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2024 Rocky Mountain Institute + +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. From 85878a539f89ade81d81b76e50c7301c55d3cc41 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Thu, 15 Feb 2024 16:20:33 +0100 Subject: [PATCH 3/7] Prefer DESCRIPTION over renv --- DESCRIPTION | 2 ++ Dockerfile | 19 +++++++++++-------- run_pacta_scenario_preparation.R | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 50096c7..be80429 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,3 +9,5 @@ License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 +Imports: + dplyr diff --git a/Dockerfile b/Dockerfile index e4d7ade..3317fc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,17 +5,20 @@ RUN apt-get update \ && apt-get install -y git \ && rm -rf /var/lib/apt/lists/* -RUN Rscript -e 'install.packages(c("pak", "renv"))' +# copy in DESCRIPTION from this repo +COPY DESCRIPTION /DESCRIPTION + +# install pak, find dependencies from DESCRIPTION, and install them +RUN Rscript -e "\ + install.packages('pak'); \ + deps <- pak::local_deps(root = '.'); \ + pkg_deps <- deps[!deps[['direct']], 'ref']; \ + print(pkg_deps); \ + pak::pak(pkg_deps); \ + " COPY . /workflow.scenario.preparation WORKDIR /workflow.scenario.preparation -RUN Rscript -e '\ - readRenviron(".env"); \ - non_cran_pkg_deps <- c("RMI-PACTA/pacta.scenario.data.preparation"); \ - cran_pkg_deps <- setdiff(renv::dependencies()$Package, basename(non_cran_pkg_deps)); \ - pak::pkg_install(pkg = c(non_cran_pkg_deps, cran_pkg_deps)); \ - ' - CMD Rscript run_pacta_scenario_preparation.R diff --git a/run_pacta_scenario_preparation.R b/run_pacta_scenario_preparation.R index ab352f3..be244d2 100644 --- a/run_pacta_scenario_preparation.R +++ b/run_pacta_scenario_preparation.R @@ -1,4 +1,4 @@ -library(tidyverse) +library(dplyr) mtcars %>% distinct(cyl, mpg) From 9373b684a45edf43ee55bebf54d667b41d5ccd5d Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Thu, 15 Feb 2024 17:01:26 +0100 Subject: [PATCH 4/7] Add RMI as copyright holder --- DESCRIPTION | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index be80429..03c2bc3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,8 +2,14 @@ Package: workflow.scenario.preparation Title: Run the Scenario Preparation Workflow Version: 0.0.0.9000 Authors@R: - person("Jackson", "Hoffart", , "jackson.hoffart@gmail.com", role = c("aut", "cre"), - comment = c(ORCID = "0000-0002-8600-5042")) + person(c(person(given = "Jackson", + family = "Hoffart", + role = c("aut", "cre", "ctr"), + email = "jackson.hoffart@gmail.com", + comment = c(ORCID = "0000-0002-8600-5042")), + person(given = "RMI", + role = c("cph", "fnd"), + email = "PACTA4investors@rmi.org")) Description: A workflow to prepare climate change scenarios for the PACTA tool. License: MIT + file LICENSE Encoding: UTF-8 From 5f90da5cd86dc75f280734204f12a70b0a87f56c Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Fri, 16 Feb 2024 10:23:01 +0100 Subject: [PATCH 5/7] update copyright holder name --- LICENSE | 2 +- LICENSE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 49e7d3d..7ec6c95 100644 --- a/LICENSE +++ b/LICENSE @@ -1,2 +1,2 @@ YEAR: 2024 -COPYRIGHT HOLDER: Rocky Mountain Institute +COPYRIGHT HOLDER: RMI diff --git a/LICENSE.md b/LICENSE.md index 6f6efaf..c3f0481 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # MIT License -Copyright (c) 2024 Rocky Mountain Institute +Copyright (c) 2024 RMI Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From ac7f8460948e675d5d963eeb2cc0f0f8c2b9ee85 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Fri, 16 Feb 2024 10:25:24 +0100 Subject: [PATCH 6/7] remove git install --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3317fc6..9d59e13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM --platform=linux/amd64 rocker/tidyverse # install system dependencies for R packages RUN apt-get update \ - && apt-get install -y git \ && rm -rf /var/lib/apt/lists/* # copy in DESCRIPTION from this repo From 544167ed6c25e4ce02f94cefd23cdc22ae43f3f1 Mon Sep 17 00:00:00 2001 From: Jackson Hoffart Date: Fri, 16 Feb 2024 10:25:50 +0100 Subject: [PATCH 7/7] add and buildignore .Rproj --- .Rbuildignore | 2 ++ workflow.scenario.preparation.Rproj | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.Rbuildignore b/.Rbuildignore index 5163d0b..2eb964e 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1 +1,3 @@ ^LICENSE\.md$ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/workflow.scenario.preparation.Rproj b/workflow.scenario.preparation.Rproj index 4f10a56..f6cd4b6 100644 --- a/workflow.scenario.preparation.Rproj +++ b/workflow.scenario.preparation.Rproj @@ -14,3 +14,7 @@ LaTeX: XeLaTeX AutoAppendNewline: Yes StripTrailingWhitespace: Yes + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source