Skip to content

Commit c0f62db

Browse files
authored
Merge pull request #2 from Ottis1/use-golem
Refactor the app to use the Golem framework for Shiny apps
2 parents 82a93e0 + 71d73a0 commit c0f62db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3816
-3262
lines changed

.Rbuildignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
^data-raw$
4+
dev_history.R
5+
^dev$
6+
$run_dev.*
7+
^LICENSE\.md$
8+
^app\.R$
9+
^rsconnect$
10+
^README\.Rmd$

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.Rproj.user
2+
.Rhistory
3+
.Rdata
4+
.httr-oauth
5+
.DS_Store
6+
dev/dev_events/
7+
inst/extdata/database.sqlite

DESCRIPTION

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Package: fieldactivity
2+
Title: An app for keeping track of field activity
3+
Version: 0.1.0
4+
Authors@R: person('Otto', 'Kuusela', email = 'otto.kuusela@helsinki.fi', role = c('cre', 'aut'))
5+
Description: An app for keeping track of field activity in the Field
6+
Observatory project. Built using Shiny, the application allows farmers to
7+
enter information about common farming events like tillage, sowing and
8+
harvest. These event data are stored in .json files, which mostly follow the
9+
ICASA standards for agricultural data.
10+
License: MIT + file LICENSE
11+
Imports:
12+
attempt,
13+
bslib,
14+
config (>= 0.3.1),
15+
DT,
16+
glue,
17+
golem (>= 0.3.1),
18+
htmltools,
19+
htmlwidgets,
20+
jsonlite,
21+
methods,
22+
pkgload,
23+
processx,
24+
shiny (>= 1.6.0),
25+
shinyjs,
26+
shinymanager (>= 1.0.400),
27+
stringr,
28+
tools
29+
Encoding: UTF-8
30+
LazyData: true
31+
RoxygenNote: 7.1.1
32+
URL: https://github.com/Ottis1/fieldactivity
33+
BugReports: https://github.com/Ottis1/fieldactivity/issues
34+
Suggests:
35+
spelling,
36+
testthat (>= 3.0.0)
37+
Config/testthat/edition: 3
38+
Language: en-US

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
YEAR: 2021
2+
COPYRIGHT HOLDER: fieldactivity authors

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2021 fieldactivity authors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NAMESPACE

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(run_app)
4+
import(glue)
5+
import(shiny)
6+
importFrom(glue,glue)
7+
importFrom(golem,activate_js)
8+
importFrom(golem,add_resource_path)
9+
importFrom(golem,bundle_resources)
10+
importFrom(golem,favicon)
11+
importFrom(golem,with_golem_options)
12+
importFrom(shiny,NS)
13+
importFrom(shiny,shinyApp)
14+
importFrom(shiny,tagList)

R/_disable_autoload.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Disabling shiny autoload
2+
3+
# See ?shiny::loadSupport for more information

R/app_config.R

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#' Access files in the current app
2+
#'
3+
#' NOTE: If you manually change your package name in the DESCRIPTION,
4+
#' don't forget to change it here too, and in the config file.
5+
#' For a safer name change mechanism, use the `golem::set_golem_name()` function.
6+
#'
7+
#' @param ... character vectors, specifying subdirectory and file(s)
8+
#' within your package. The default, none, returns the root of the app.
9+
#'
10+
#' @noRd
11+
app_sys <- function(...){
12+
system.file(..., package = "fieldactivity")
13+
}
14+
15+
16+
#' Read App Config
17+
#'
18+
#' @param value Value to retrieve from the config file.
19+
#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE.
20+
#' If unset, "default".
21+
#' @param use_parent Logical, scan the parent directory for config file.
22+
#'
23+
#' @noRd
24+
get_golem_config <- function(
25+
value,
26+
config = Sys.getenv(
27+
"GOLEM_CONFIG_ACTIVE",
28+
Sys.getenv(
29+
"R_CONFIG_ACTIVE",
30+
"default"
31+
)
32+
),
33+
use_parent = TRUE
34+
){
35+
config::get(
36+
value = value,
37+
config = config,
38+
# Modify this if your config file is somewhere else:
39+
file = app_sys("golem-config.yml"),
40+
use_parent = use_parent
41+
)
42+
}
43+

0 commit comments

Comments
 (0)