Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PackageGenerator

Generates a Dockerfile for a SoftwarePackage instance

Hierarchy

Index

Constructors

constructor

Properties

Optional baseImage

baseImage: undefined | string

Manually define the image to inherit FROM

folder

folder: string

The directory to scan for relevant files

package

package: SoftwarePackage

The package that this generator generates a Dockerfile for

Protected Readonly urlFetcher

urlFetcher: UrlFetcher

The instance of IUrlFetcher to fetch URLs

Methods

applies

  • applies(): boolean

aptKeysCommand

  • aptKeysCommand(sysVersion: string): string | undefined
  • A Bash command to run to install required apt keys

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns string | undefined

aptPackages

  • aptPackages(sysVersion: string): Array<string>

aptRepos

  • aptRepos(sysVersion: string): Array<string>
  • A list of any required apt repositories

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns Array<string>

baseIdentifier

  • baseIdentifier(): string

baseName

  • baseName(): string

baseVersion

  • baseVersion(): string

baseVersionName

  • baseVersionName(baseIdentifier: string): string

envVars

  • envVars(sysVersion: string): Array<[string, string]>
  • A list of environment variables to set in the image as name, value pairs

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns Array<[string, string]>

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>

filterPackages

  • filterPackages(runtimePlatform: string): Array<SoftwarePackage>
  • Get a list of packages in this.package.softwareRequirements which have have a particular runtimePlatform value

    Parameters

    • runtimePlatform: string

    Returns Array<SoftwarePackage>

generate

  • generate(comments?: boolean, stencila?: boolean): string
  • Generate a Dockerfile for a SoftwareEnvironment instance

    Parameters

    • Default value comments: boolean = true

      Should a comments be added to the Dockerfile?

    • Default value stencila: boolean = false

      Should relevant Stencila language packages be installed in the image?

    Returns string

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>

installCommand

  • installCommand(sysVersion: string): string | undefined
  • The Bash command to run to install required language packages

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns string | undefined

installFiles

  • installFiles(sysVersion: string): Array<[string, string]>
  • A list of files that need to be be copied into the image before running installCommand

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns Array<[string, string]>

    An array of [src, dest] tuples

projectFiles

  • projectFiles(sysVersion: string): Array<[string, string]>
  • The project's files that should be copied across to the image

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns Array<[string, string]>

    An array of [src, dest] tuples

read

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

    Parameters

    • subpath: string

      The path within the folder

    Returns string

runCommand

  • runCommand(sysVersion: string): string | undefined
  • The default command to run in containers created from this image

    Usually command will a file with a name main and the extension of the generator's language e.g. .R if it exists in the folder.

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns string | undefined

stencilaInstall

  • stencilaInstall(sysVersion: string): string | undefined
  • A Bash command to run to install Stencila execution host package/s

    Parameters

    • sysVersion: string

      The Ubuntu system version being used

    Returns string | undefined

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