Skip to content

Provider Hooks API

Yann Stepienik edited this page Jun 12, 2019 · 3 revisions

Provider Hooks API

getPackageConfig

Description

Called to get the config file of the project.

Default

Return gupm.json at the root of the project

Returns

JSON package config

postGetPackageConfig

Description

Allow you to change the config retrieved by getPackageConfig.

Input

  • PackageConfig : JSON config

Returns

New JSON package config

bootstrap

Description

Initialize a project base folder structure. It is recommanded that your provider (if having a custom bootstrap) also have a way/template for user to continue using a gupm.json in their project (You can use a make.gs hook to make the project "make" two differents lists. See the official NPM provider for how to do that).

Default

Create a gupm.json file

getDependencyList

Description

Return the list of the dependencies of the current project.

Input

  • PackageConfig : JSON config

Default

Reads config.dependencies from the PackageConfig var and returns PRL.

Returns

Array of PRL.

resolveDependencyLocation

Description

Return a dependency with proper name / version / url.

Input

  • Dependency : Dependency as described in the config file of the project (no URL)
    • Dependency.provider
    • Dependency.name
    • Dependency.version

Default

Set URL as the name. You pretty much never want to use the default one.

Returns

Structured JSON dependency (with a dependency.url)

expandDependency

Description

Resolve dependency's own dependencies.

Input

  • Dependency : Dependency as described in the config file of the project (no URL)
    • Dependency.provider
    • Dependency.name
    • Dependency.version

Default

Read's depedency's gupm.json and returns default deps.

Returns

Structured JSON dependency (with a dependency.dependencies containing an array of PRL)

getDependency

Description

Get the dependency based on previous resolve step.

Input

  • Provider
  • Name
  • Version
  • Url
  • Path : path of the cached dependency

Default

HTTP GET the URL.

Returns

Path

postGetDependency

Description

Save Result somwhere after it has been retrieve by previous step.

Input

  • Provider
  • Name
  • Version
  • Url
  • Path : path of the cached dependency
  • Result : blob of previous GET step

Default

Save the files. Will unzip/untar/ungzip based on extension

Returns

Path

binaryInstall

Description

Opportunity to create in .bin any binary your package's dependencies has.

Input

  • Destination (By default will be .bin): where you should create the bins
  • Source : the depdency folder where you should try to find binaries

Default

Read gupm.json for a "binaries" field, and symlink those into .bin

saveDependencyList

Description

Save the list of dependency after a new dependency has been added. It is advised to not save the URL.

Input

  • Dependencies
    • Provider
    • Name
    • Version
    • Url

Default

Save into gupm.json

publish

Description

Publish the path folder.

Input

  • Path

Default

create and publish to a local gupm repo.