Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RParser

Dockta Parser class for R requirements files and source code.

For each package, meta-data is obtained from http://crandb.r-pkg.org and used to create a SoftwarePackage instance using crosswalks from column "R Package Description" in https://github.com/codemeta/codemeta/blob/master/crosswalk.csv

System dependencies for each package are obtained from https://sysreqs.r-hub.io.

Hierarchy

Index

Constructors

constructor

Properties

folder

folder: string

The directory to scan for relevant files

Protected Readonly urlFetcher

urlFetcher: UrlFetcher

The instance of IUrlFetcher to fetch URLs

Methods

Private createPackage

  • createPackage(name: string): Promise<SoftwarePackage>
  • Create a SoftwarePackage instance from a R package name

    This method fetches meta-data for a R package to populate the properties of a SoftwarePackage instance. It recursively fetches meta-data on the package's dependencies, including system dependencies.

    Parameters

    • name: string

      Name of the R package

    Returns Promise<SoftwarePackage>

exists

  • exists(subpath: string): boolean
  • Does a path exist within the project folder?

    Parameters

    • subpath: string

      The path within the folder

    Returns boolean

fetch

  • fetch(url: string, options?: any): Promise<any>
  • Fetch content from a URL

    Parameters

    • url: string

      The URL to fetch

    • Default value options: any = { responseType: 'json' }

      Request options

    Returns Promise<any>

glob

  • glob(pattern: string | Array<string>): Array<string>
  • Get a list of paths that match a pattern in the project folder.

    Parameters

    • pattern: string | Array<string>

      The glob pattern

    Returns Array<string>

parse

  • parse(): Promise<SoftwarePackage | null>
  • Parse a folder by detecting any R requirements or source code files and return a SoftwarePackage instance

    Returns Promise<SoftwarePackage | null>

read

  • read(subpath: string): string
  • Read a file within the project folder

    Parameters

    • subpath: string

      The path within the folder

    Returns string

write

  • write(subpath: string, content: string): void
  • Write to a file within the project folder

    Parameters

    • subpath: string

      The path within the folder

    • content: string

      The content to write to the file

    Returns void

Generated using TypeDoc