Save datasets in a yaml file

write(x, ...)

# S3 method for class 'IssuesTB'
write(
  x,
  dataset_dir = getOption("IssueTrackeR.dataset.dir"),
  dataset_name = getOption("IssueTrackeR.dataset.name"),
  overwrite = TRUE,
  verbose = TRUE,
  ...
)

# S3 method for class 'LabelsTB'
write(
  x,
  dataset_dir = getOption("IssueTrackeR.dataset.dir"),
  dataset_name = getOption("IssueTrackeR.dataset.name"),
  overwrite = TRUE,
  verbose = TRUE,
  ...
)

# S3 method for class 'MilestonesTB'
write(
  x,
  dataset_dir = getOption("IssueTrackeR.dataset.dir"),
  dataset_name = getOption("IssueTrackeR.dataset.name"),
  overwrite = TRUE,
  verbose = TRUE,
  ...
)

# Default S3 method
write(...)

Arguments

x

an object of class IssuesTB, LabelsTB or MilestonesTB.

...

Currently not used.

dataset_dir

Character. Path to the directory containing the YAML file. Default: value of option IssueTrackeR.dataset.dir.

dataset_name

Character. Name of the dataset. Default: value of option IssueTrackeR.dataset.name.

overwrite

Boolean indicating whether to overwrite the file if it already exists. Defaults to TRUE.

verbose

Boolean indicating whether to print additional information.

Value

invisibly (with invisible()) TRUE if the export was successful and an error otherwise.

Details

Depending on the object, dataset_name = NULL or dataset_name = "", the defaults value of the file name:

  • "list_issues.yaml" for issues;

  • "list_labels.yaml" for labels;

  • "list_milestones.yaml" for milestones.

The objects will be written in the dataset_dir.

Examples

local_selector <- init_selector(
    source = "Local",
    dataset_dir = system.file("data_issues", package = "IssueTrackeR"),
    dataset_name = NULL
)

issues <- get_issues(selector = local_selector)
#> The issues will be read from /home/runner/work/_temp/Library/IssueTrackeR/data_issues/list_issues.yaml.
labels <- get_labels(selector = local_selector)
#> The labels will be read from /home/runner/work/_temp/Library/IssueTrackeR/data_issues/list_labels.yaml.
milestones <- get_milestones(selector = local_selector)
#> The milestones will be read from /home/runner/work/_temp/Library/IssueTrackeR/data_issues/list_milestones.yaml.

write(x = issues, dataset_dir = tempdir())
#> The file already exists and will be overwritten.
#> The datasets will be exported to /tmp/RtmpSJddLH/list_issues_my_dataset.yaml.
write(x = labels, dataset_dir = tempdir())
#> The file already exists and will be overwritten.
#> The datasets will be exported to /tmp/RtmpSJddLH/list_labels_my_dataset.yaml.
write(x = milestones, dataset_dir = tempdir())
#> The file already exists and will be overwritten.
#> The datasets will be exported to /tmp/RtmpSJddLH/list_milestones_my_dataset.yaml.

write(x = issues, dataset_dir = tempdir(),
                 dataset_name = "my_issues")
#> The datasets will be exported to /tmp/RtmpSJddLH/list_issues_my_issues.yaml.
write(x = labels, dataset_dir = tempdir(),
                 dataset_name = "my_labels")
#> The datasets will be exported to /tmp/RtmpSJddLH/list_labels_my_labels.yaml.
write(x = milestones, dataset_dir = tempdir(),
                 dataset_name = "my_milestones")
#> The datasets will be exported to /tmp/RtmpSJddLH/list_milestones_my_milestones.yaml.