bundler

package module
v0.8.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

README

Paketo Buildpack for Bundler

gcr.io/paketo-buildpacks/bundler

The Bundler CNB provides the Bundler binary.

The buildpack installs Bundler onto the $PATH and $GEM_PATH which makes it available for subsequent buildpacks and/or in the final running container.

Integration

The Bundler CNB provides bundler as a dependency. Downstream buildpacks can require the bundler dependency by generating a Build Plan TOML file that looks like the following:

[[requires]]

  # The name of the Bundler dependency is "bundler". This value is considered
  # part of the public API for the buildpack and will not change without a plan
  # for deprecation.
  name = "bundler"

  # The Bundler buildpack supports some non-required metadata options.
  [requires.metadata]

    # Use `version` to request a specific version of `bundler`.
    # This buildpack supports specifying a semver constraint in the form of "2.*", "2.1.*",
    # or even "2.1.4".
    # Optional, defaults to the latest version of `bundler` found in the `buildpack.toml` file.
    version = "2.1.4"

    # When `build` is true, this buildpack will ensure that `bundler` is available
    # on the `$PATH` and `$GEM_PATH` for later buildpacks.
    # Optional, default false.
    build = true

    # When `launch` is true, this buildpack will ensure that `bundler` is available
    # on the `$PATH` and `$GEM_PATH` for the running application.
    # Optional, default false.
    launch = true

Usage

To package this buildpack for consumption:

$ ./scripts/package.sh

This builds the buildpack's Go source using GOOS=linux by default. You can supply another value as the first argument to package.sh.

Bundler Configurations

Specifying the Bundler version through buildpack.yml configuration will be deprecated in Bundler Buildpack v1.0.0.

To migrate from using buildpack.yml please set the $BP_BUNDLER_VERSION environment variable at build time either directly (ex. pack build my-app --env BP_BUNDLER_VERSION=2.7.*) or through a project.toml file

$BP_BUNDLER_VERSION="2.1.4"

This will replace the following structure in buildpack.yml:

bundler:
  version: 2.1.4

Logging Configurations

To configure the level of log output from the buildpack itself, set the $BP_LOG_LEVEL environment variable at build time either directly (ex. pack build my-app --env BP_LOG_LEVEL=DEBUG) or through a project.toml file If no value is set, the default value of INFO will be used.

The options for this setting are:

  • INFO: (Default) log information about the progress of the build process
  • DEBUG: log debugging information about the progress of the build process
$BP_LOG_LEVEL="DEBUG"

Compatibility

This buildpack is currently only supported on the Paketo Bionic and Jammy stack distributions. A pre-compiled distribution of Bundler is provided for the Paketo stacks (i.e. io.buildpacks.stack.jammy and io.buildpacks.stacks.bionic).

Documentation

Index

Constants

View Source
const (
	Bundler            = "bundler"
	BuildpackYMLSource = "buildpack.yml"
	GemfileLockSource  = "Gemfile.lock"
	GemfileSource      = "Gemfile"

	DepKey = "dependency-sha"
)
View Source
const VersionShimTemplate = "#!/usr/bin/env sh\nexec %s _%s_ ${@:-}"

Variables

This section is empty.

Functions

func Build

func Build(
	dependencies DependencyManager,
	versionShimmer Shimmer,
	sbomGenerator SBOMGenerator,
	logger scribe.Emitter,
	clock chronos.Clock,
) packit.BuildFunc

func Detect

func Detect(buildpackYMLParser, gemfileLockParser VersionParser) packit.DetectFunc

Types

type BuildPlanMetadata

type BuildPlanMetadata struct {
	VersionSource string `toml:"version-source"`
	Version       string `toml:"version"`
}

type BuildpackYMLParser

type BuildpackYMLParser struct{}

func NewBuildpackYMLParser

func NewBuildpackYMLParser() BuildpackYMLParser

func (BuildpackYMLParser) ParseVersion

func (p BuildpackYMLParser) ParseVersion(path string) (string, error)

type Config

type Config struct {
	Version string `yaml:"version"`
}

type DependencyManager

type DependencyManager interface {
	Resolve(path, id, version, stack string) (postal.Dependency, error)
	Deliver(dependency postal.Dependency, cnbPath, layerPath, platformPath string) error
	GenerateBillOfMaterials(dependencies ...postal.Dependency) []packit.BOMEntry
}

type GemfileLockParser

type GemfileLockParser struct{}

func NewGemfileLockParser

func NewGemfileLockParser() GemfileLockParser

func (GemfileLockParser) ParseVersion

func (p GemfileLockParser) ParseVersion(path string) (string, error)

type SBOMGenerator added in v0.5.0

type SBOMGenerator interface {
	GenerateFromDependency(dependency postal.Dependency, dir string) (sbom.SBOM, error)
}

type Shimmer

type Shimmer interface {
	Shim(path, version string) error
}

type VersionParser

type VersionParser interface {
	ParseVersion(path string) (version string, err error)
}

type VersionShimmer

type VersionShimmer struct{}

func NewVersionShimmer

func NewVersionShimmer() VersionShimmer

func (VersionShimmer) Shim

func (s VersionShimmer) Shim(dir, version string) error

Directories

Path Synopsis
dependency
retrieval Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL