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 openssl-dev git RUN gem update --system RUN gem install bundler gem_hadar script: &script |- echo -e "\\e[1m" ruby -v echo -e "\\e[0m" bundle update --all bundle install --jobs=$(getconf _NPROCESSORS_ONLN) bundle exec rake spec fail_fast: true images: ruby:4.0-alpine: *script 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.
64 65 66 |
# File 'lib/all_images/config.rb', line 64 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
51 52 53 54 55 |
# File 'lib/all_images/config.rb', line 51 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 |