SystemState.S3: Class: SystemState.S3

Description Usage Arguments Value Fields Intended use of this class Author(s) References See Also Examples

View source: R/SystemState.S3.r

Description

Class representing the system state (S3) and its constructor function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
SystemState.S3(.x, ask_authentication = TRUE, branch = "master",
  cmd_user_email = "git config --global user.email",
  cmd_user_name = "git config --global user.name", description_old = list(),
  git_tag = character(), git_user_email = character(),
  git_user_name = character(), global_or_local = "global",
  has_remote = TRUE, pat_or_basic = character(),
  path_netrc = file.path(Sys.getenv("HOME"), "_netrc"),
  path_netrc_tmp = file.path(Sys.getenv("HOME"), "_netrc_0"), quit = FALSE,
  remote = character(), remote_all = list(origin = character()),
  remote_name = "origin", remote_url = character(),
  temp_credentials = FALSE, what = NA)

Arguments

.x

ANY. An object of an arbitrary class whose class attribute should be updated so that it becomes an instance of class SystemState.S3. Mainly intended for rapid prototyping purposes

Value

Instance of class SystemState.S3.

Fields

ask_authentication

logical. Controls if user is asked how to handle authentication. Default: TRUE.

branch

character. Name of branch to push to remote. Default: "master".

cmd_user_email

character. Git command used to query user.email. Default: "git config --global user.email".

cmd_user_name

character. Git command used to query user.name. Default: "git config --global user.name".

description_old

character. Old state of DESCRIPTION file that can be used to rollback changes. Default: list().

git_tag

character. Git tag for new version. Default: character().

git_user_email

character. Git value for user.email. Default: character().

git_user_name

character. Git value for user.name. Default: character.

global_or_local

character. Controls if global or local Git user credentials are used. Default: "global".

has_remote

logical. Controls if remote Git repository is considered or not. Default: TRUE.

pat_or_basic

logical. Controls if a personal access token (PAT or OAuth token) or basic HTTPS authentication should be used. Default: character() which means that user is asked.

path_netrc

character. Path to _netrc file used for HTTPS authentication. Default: file.path(Sys.getenv("HOME"), "_netrc").

path_netrc_tmp

character. Path to temporary _netrc file used for HTTPS authentication. Default: file.path(Sys.getenv("HOME"), "_netrc_0").

quit

logical. Controls if function quits. Default: FALSE.

remote

character. Name or URL of remote repository to push to (depending on authentication type). Default: character().

remote_all

character. Name and URL of remote repository to push to. Default: list(origin = character()).

remote_name

character. Name of remote repository to push to. Default: "origin".

remote_url

character. URL of remote repository to push to. Default: character().

temp_credentials

logical. Controls if HTTPS credentials should only be stored temporarily. Only relevant if authentication type is basic (HTTPS). Default: FALSE.

what

ANY. Contains the object to bump. Default: NA.

quit

logical. Controls if function quits. Default: FALSE.

Intended use of this class

This S3 class, or to be more precise its constructor function, exists mainly for rapid prototyping purposes. This is mainly reflected in the fact, that when specifying .x, this constructor function will simply update the class attribute of whatever object has been provided.

However, it also allows for a more formal OOP-style of rapid prototyping by offering explicit class fields (all arguments except .x). Nevertheless, it is probably advisable to switch to an explicit formal approach such as S4 and/or Reference Classes once the package or application has reached a certain state of maturity.

Author(s)

Janko Thyson janko.thyson@gmail.com

References

http://github.com/jankothyson/bumpr

See Also

GitVersion.S3 RPackageVersion.S3

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Not run: 

## Informal use (intended mainly for rapid prototyping) //
## Takes *any* object and simply changes the class attributes
SystemState.S3(TRUE)  

## Formal use (explicitly using 'fields') //
SystemState.S3()
SystemState.S3(
  ask_authentication = TRUE,
  branch = "master",
  cmd_user_email = "git config --global user.email",
  cmd_user_name = "git config --global user.name",
  description_old = as.list(read.dcf("DESCRIPTION")[1,]),
  git_tag = "v1.1.2",
  git_user_email = "janko.thyson@rappster.de",
  git_user_name = "Janko Thyson",
  global_or_local = "global",
  has_remote = TRUE,
  pat_or_basic = "pat",
  path_netrc = file.path(Sys.getenv("HOME"), "_netrc"),
  path_netrc_tmp = file.path(Sys.getenv("HOME"), "_netrc_0"),
  quit = FALSE,
  remote = "origin",
  remote_all = list(origin = character()),
  remote_name = "origin",
  remote_url = "https://github.com/Rappster/bumpr",
  temp_credentials = FALSE,
  what = bumpr::GitVersion.S3()
)

## Recommended: inlcude namespace //
## Regardless if you plan on using this class in an informal or formal way
bumpr::SystemState.S3()


## End(Not run)

rappster/bumpr documentation built on May 26, 2019, 11:09 p.m.