ExtGenerator: Extension generator abstract class

ExtGeneratorR Documentation

Extension generator abstract class

Description

The mother class of all generators for biodb extension packages.

Details

All generator classes for biodb extensions must inherit from this class.

Methods

Public methods


Method new()

Initializer.

Usage
ExtGenerator$new(
  path,
  loadCfg = TRUE,
  saveCfg = TRUE,
  pkgName = getPkgName(path),
  email = "author@e.mail",
  dbName = "foo.db",
  dbTitle = "Foo database",
  pkgLicense = getLicenses(),
  firstname = "Firstname of author",
  lastname = "Lastname of author",
  newPkg = FALSE,
  connType = getConnTypes(),
  entryType = getEntryTypes(),
  editable = FALSE,
  writable = FALSE,
  remote = FALSE,
  downloadable = FALSE,
  makefile = FALSE,
  travis = FALSE,
  rcpp = FALSE,
  vignetteName = getPkgName(path),
  githubRepos = getReposName(path, default = "myaccount/myrepos")
)
Arguments
path

The path to the package folder.

loadCfg

Set to FALSE to disable loading of tag values from config file "biodb_ext.yml".

saveCfg

Set to FALSE to disable saving of tag values into config file "biodb_ext.yml".

pkgName

The package name. If set to NULL, the folder name pointer by the "path" paramater will be used as the package name.

email

The email of the author.

dbName

The name of the database (in biodb format "my.db.name"), that will be used in "definitions.yml" file and for connector and entry classes.

dbTitle

The official name of the database (e.g.: HMDB, UniProtKB, KEGG).

pkgLicense

The license of the package.

firstname

The firstname of the author.

lastname

The lastname of the author.

newPkg

Set to TRUE if the package is not yet published on Bioconductor.

connType

The type of connector class to implement.

entryType

The type of entry class to implement.

editable

Set to TRUE to allow the generated connector to create new entries in memory.

writable

Set to TRUE to enable the generated connector to write into the database.

remote

Set to TRUE if the database to connect to is not local.

downloadable

Set to TRUE if the database needs to be downloaded or offers this possiblity.

makefile

Set to TRUE if you want a Makefile to be generated.

travis

Set to TRUE if you want a .travis.yml file to be generated.

rcpp

Set to TRUE to enable Rcpp C/C++ code inside the package.

vignetteName

Set to the name of the default/main vignette.

githubRepos

Set to the name of the associated GitHub repository. Example: myaccount/myrepos.

Returns

Nothing.


Method generate()

Generates the destination file(s).

Usage
ExtGenerator$generate(overwrite = FALSE, fail = TRUE)
Arguments
overwrite

If set to TRUE and destination files exist, overwrite the destination files.

fail

If set to FALSE, do not fail if destination files exist, just do nothing and return.

Examples
# Generate a new extension package:
pkgFolder <- file.path(tempfile(), 'biodbFoo')
biodb::ExtPackage$new(pkgFolder)$generate()

Method upgrade()

Upgrade the destination file(s).

Usage
ExtGenerator$upgrade(generate = TRUE)
Arguments
generate

If set to FALSE, and destination file(s) do not exist, then do not generate them.


Method clone()

The objects of this class are cloneable with this method.

Usage
ExtGenerator$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

# Generate a new connector class inside the R folder:
pkgFolder <- file.path(tempfile(), 'biodbFoo')
dir.create(pkgFolder, recursive=TRUE)
biodb::ExtConnClass$new(path=pkgFolder, dbName='foo.db',
                        dbTitle='Foo database',
                        connType='mass', remote=TRUE)$generate()


## ------------------------------------------------
## Method `ExtGenerator$generate`
## ------------------------------------------------

# Generate a new extension package:
pkgFolder <- file.path(tempfile(), 'biodbFoo')
biodb::ExtPackage$new(pkgFolder)$generate()

pkrog/biodb documentation built on Nov. 29, 2022, 4:24 a.m.