Module: AllImages::Config
Overview
Configuration handling for AllImages
Provides functionality for loading, initializing, and accessing example configuration files used by the AllImages application to define Docker image build and execution parameters.
Constant Summary collapse
- EXAMPLE =
Example configuration for ‘all_images`.
<<~EOT dockerfile: |- RUN apk add --no-cache build-base yaml-dev git RUN gem install gem_hadar script: &script |- echo -e "\\e[1m" ruby -v bundle echo -e "\\e[0m" rake test images: ruby:3.4-alpine: *script ruby:3.3-alpine: *script ruby:3.2-alpine: *script EOT
Instance Method Summary collapse
-
#example ⇒ String
Returns the example configuration content.
-
#init(filename) ⇒ Object
Initializes a configuration file with example content.
-
#load(filename) ⇒ Object
Loads and parses a YAML configuration file.
Instance Method Details
#example ⇒ String
Returns the example configuration content
This method provides access to the predefined example configuration that can be used to initialize a new configuration file.
59 60 61 |
# File 'lib/all_images/config.rb', line 59 def example EXAMPLE end |
#init(filename) ⇒ Object
Initializes a configuration file with example content
Creates a new configuration file at the specified path and writes example configuration content to it. This method is typically used when no existing configuration file is found, providing a starting point for users to customize.
will be created
46 47 48 49 50 |
# File 'lib/all_images/config.rb', line 46 def init(filename) File.open(filename, ?w) do |output| output.print EXAMPLE end end |
#load(filename) ⇒ Object
Loads and parses a YAML configuration file
14 15 16 |
# File 'lib/all_images/config.rb', line 14 def load(filename) YAML.unsafe_load_file(filename) end |