Skip to content

kennedymwavu/rmon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rmon

R's equivalent of nodemon. Designed to make development easier by automatically reloading your R scripts and applications.

can be used to auto-reload:

  • arbitrary R scripts
  • apps & apis:
    • shiny
    • ambiorix
    • plumber

rmon will monitor your source files for any changes and automatically restart/rerun your server. this allows you to focus on coding without manually restarting your server every time you make a change.

just like nodemon, rmon is perfect for development.

installation

install the dev version from GitHub:

remotes::install_github(repo = "kennedymwavu/rmon")

usage

rmon::monitor(
  dir = ".",
  file = "app.R"
)
  • dir: character vector. directory to monitor for changes
  • file: file to rerun when changes are detected in the directory

monitoring multiple directories

rmon::monitor(
  dir = c("path-to-first-dir", "path-to-another-dir"),
  file = "app.R"
)

if multiple directories are specified, file is assumed to be in the first directory.

specify extension watch list

by default, {rmon} monitors all files in dir for changes.

to watch only .R, .html, .css and .js files, set the ext parameter:

rmon::monitor(
  dir = ".",
  file = "app.R",
  ext = c("R", "html", "css", "js")
)

ignoring files

to ignore the file dev.R, do:

rmon::monitor(
  dir = ".",
  file = "app.R",
  exclude_files = "dev.R"
)

to ignore the directory test/:

rmon::monitor(
  dir = ".",
  file = "app.R",
  exclude_dirs = "test"
)

to ignore all files whose names match the pattern test:

rmon::monitor(
  dir = ".",
  file = "app.R",
  exclude_patterns = "test"
)

to ignore changes to hidden files, set monitor_hidden = FALSE:

rmon::monitor(
  dir = ".",
  file = "app.R",
  monitor_hidden = FALSE
)

delaying restarting

in some situations, you may want to delay restarting until multiple files have changed.

by default, rmon checks for file changes every second. if you're uploading or modifying multiple files, this can lead to unnecessary multiple restarts of your application.

to delay restarting and avoid this issue, use the delay parameter:

rmon::monitor(
  dir = ".",
  file = "app.R",
  delay = 10
)
  • delay: a length one numeric. number of seconds to wait before checking for file changes again.

About

R's equivalent of nodemon

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages