rvm

package
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const RubyVersionRegEx = `^ruby ["']([[:alnum:]\.\-]+)["'].*$`

RubyVersionRegEx is a regular expression used to fin the ruby version in a call to the "ruby" method, see: https://bundler.io/man/gemfile.5.html#RUBY

Variables

This section is empty.

Functions

func Build

func Build(environment EnvironmentConfiguration, logger LogEmitter) packit.BuildFunc

Build the RVM layer provided by this buildpack

func DefaultVariables

func DefaultVariables(rvmLayer *packit.Layer) []string

DefaultVariables returns a list of environment variables to help with command execution

func Detect

func Detect(logger LogEmitter, rubyVersionParser VersionParser, gemFileParser VersionParser, gemFileLockParser VersionParser, buildpackYMLParser VersionParser) packit.DetectFunc

Detect whether this buildpack should install RVM

func ParseVersion

func ParseVersion(env VersionParserEnv, version *string) error

ParseVersion is a generalized function that parses a particular ruby version source

Types

type BuildPackYML

type BuildPackYML struct {
	RvmVersion  string `yaml:"rvm_version"`
	RubyVersion string `yaml:"ruby_version"`
	NodeVersion string `yaml:"node_version"`
	RequireNode bool   `yaml:"require_node"`
}

BuildPackYML represents the buildpack.yml file provided by a user / an app

func BuildpackYMLParse

func BuildpackYMLParse(path string) (BuildPackYML, error)

BuildpackYMLParse parses the buildpack.yml file

type BuildPlanMetadata

type BuildPlanMetadata struct {
	RubyVersion   string `toml:"ruby_version"`
	VersionSource string `toml:"version_source"`
}

BuildPlanMetadata represents this buildpack's metadata

type BuildpackYMLParser

type BuildpackYMLParser struct{}

BuildpackYMLParser represents the buildpack.yml parser

func NewBuildpackYMLParser

func NewBuildpackYMLParser() BuildpackYMLParser

NewBuildpackYMLParser creates and returns a new buildpack.yml parser

func (BuildpackYMLParser) ParseVersion

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

ParseVersion parses the buildpack.yml file and returns a a ruby version, if one was specified

type Configuration

type Configuration struct {
	URI                string `toml:"uri"`
	DefaultRVMVersion  string `toml:"default_rvm_version"`
	DefaultRubyVersion string `toml:"default_ruby_version"`
	DefaultNodeVersion string `toml:"default_node_version"`
	DefaultRequireNode bool   `toml:"default_require_node"`
}

Configuration represents this buildpack's configuration read from a table named "configuration"

func ReadConfiguration

func ReadConfiguration(cnbPath string) (Configuration, error)

ReadConfiguration returns the configuration for this buildpack

type Env

type Env struct {
	BuildPackYML  BuildPackYML
	Context       packit.BuildContext
	Logger        LogEmitter
	Configuration Configuration
	Environment   EnvironmentConfiguration
}

Env represents an RVM environment

func (Env) BuildRvm

func (r Env) BuildRvm() (packit.BuildResult, error)

BuildRvm builds the RVM environment

func (Env) RunBashCmd

func (r Env) RunBashCmd(command string, rvmLayer *packit.Layer) error

RunBashCmd executes a command using BASH

func (Env) RunRvmCmd

func (r Env) RunRvmCmd(command string, rvmLayer *packit.Layer) error

RunRvmCmd executes a command in an RVM environment

type Environment

type Environment struct {
	// contains filtered or unexported fields
}

Environment represents a shell environment

func NewEnvironment

func NewEnvironment(logger LogEmitter) Environment

NewEnvironment returns a new Environment with a logger

func (Environment) Configure

func (e Environment) Configure(env packit.Environment, path string) error

Configure a shell environment for use with RVM

type EnvironmentConfiguration

type EnvironmentConfiguration interface {
	Configure(env packit.Environment, path string) error
}

EnvironmentConfiguration represents an environment and a path to the RVM layer

type GemfileLockParser

type GemfileLockParser struct{}

GemfileLockParser represents a Gemfile.lock parser

func NewGemfileLockParser

func NewGemfileLockParser() GemfileLockParser

NewGemfileLockParser creates a new Gemfile.lock parser

func (GemfileLockParser) ParseVersion

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

ParseVersion looks for a Gemfile.lock file in a given path and, if it exists, parses it to find a string "RUBY VERSION" and returns the string in the next line minus the whitespace and the prefix string "ruby "

type GemfileParser

type GemfileParser struct{}

GemfileParser represents a Gemfile parser

func NewGemfileParser

func NewGemfileParser() GemfileParser

NewGemfileParser creates a new Gemfile parser

func (GemfileParser) ParseVersion

func (r GemfileParser) ParseVersion(path string) (string, error)

ParseVersion looks for a Gemfile file in a given path and, if it exists, parses it to find a ruby version spec

type LogEmitter

type LogEmitter struct {
	scribe.Logger
}

LogEmitter allows to write logs using the packing lib

func NewLogEmitter

func NewLogEmitter(output io.Writer) LogEmitter

NewLogEmitter returns a new LogEmitter instance

type MetaData

type MetaData struct {
	Metadata struct {
		Configuration Configuration `toml:"configuration"`
	} `toml:"metadata"`
}

MetaData represents this buildpack's metadata

type RubyVersionParser

type RubyVersionParser struct{}

RubyVersionParser represents a ruby version parser

func NewRubyVersionParser

func NewRubyVersionParser() RubyVersionParser

NewRubyVersionParser creates a new ruby version parser

func (RubyVersionParser) ParseVersion

func (r RubyVersionParser) ParseVersion(path string) (string, error)

ParseVersion looks for a .ruby-version file in a given path and, if it exists, parses it and removes trailing whitespace

type VersionParser

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

VersionParser represents a parser for files like .ruby-version and Gemfiles

type VersionParserEnv

type VersionParserEnv struct {
	Parser  VersionParser
	Path    string
	Context packit.DetectContext
	Logger  LogEmitter
}

VersionParserEnv represents an environment that contains everything that is needed to execute a particular ruby version parser

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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