craft_parts.plugins.ruby_plugin module

The Ruby plugin.

class craft_parts.plugins.ruby_plugin.RubyFlavor(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: str, Enum

All Ruby implementations supported by ruby-install.

jruby = 'jruby'
mruby = 'mruby'
ruby = 'ruby'
truffleruby = 'truffleruby'
class craft_parts.plugins.ruby_plugin.RubyPlugin(*, properties, part_info)[source]

Bases: Plugin

A plugin for Ruby based projects.

The desired Ruby interpreter is compiled using ruby-install.

The ruby plugin uses the following ruby-specific keywords:

  • ruby-flavor (string) ruby,jruby,truffleruby,mruby

  • ruby-gems (list of str) Defaults to []

  • ruby-version (str) Minor version number of the specified interpreter flavor. e.g. ‘3.2’, meaning the newest release of the 3.2.x series.

  • ruby-use-jemalloc (bool) Defaults to False

  • ruby-shared (bool) Defaults to False

  • ruby-configure-options (list of str) Defaults to []

  • ruby-use-bundler (bool) Defaults to False

Parameters:
get_build_commands()[source]

Return a list of commands to run during the build step.

Return type:

list[str]

get_build_environment()[source]

Return a dictionary with the environment to use in the build step.

Return type:

dict[str, str]

get_build_packages()[source]

Return a set of required packages to install in the build environment.

Return type:

set[str]

get_build_snaps()[source]

Return a set of required snaps to install in the build environment.

Return type:

set[str]

get_pull_commands()[source]

Return a list of commands to run during the pull step.

Return type:

list[str]

properties_class

alias of RubyPluginProperties

validator_class

alias of RubyPluginEnvironmentValidator

class craft_parts.plugins.ruby_plugin.RubyPluginEnvironmentValidator(*, part_name, env, properties)[source]

Bases: PluginEnvironmentValidator

Check the execution environment for the Ruby plugin.

Parameters:
  • part_name (str) – The part whose build environment is being validated.

  • env (str) – A string containing the build step environment setup.

  • properties (PluginProperties)

validate_environment(*, part_dependencies=None)[source]

Ensure the environment has the dependencies to build Ruby applications.

Parameters:

part_dependencies (list[str] | None) – A list of the parts this part depends on.

Return type:

None

class craft_parts.plugins.ruby_plugin.RubyPluginProperties(**data)[source]

Bases: PluginProperties

The part properties used by the Ruby plugin.

Parameters:

data (Any)

model_config: ClassVar[ConfigDict] = {'alias_generator': <function PluginProperties.<lambda>>, 'extra': 'forbid', 'frozen': True, 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

plugin: Literal['ruby']
ruby_configure_options: list[str]
ruby_flavor: RubyFlavor | None
ruby_gems: list[str]
ruby_shared: bool
ruby_use_bundler: bool
ruby_use_jemalloc: bool
ruby_version: str | None
source: str