Class: BoringBuilder::Configuration
- Inherits:
-
Object
- Object
- BoringBuilder::Configuration
- Defined in:
- lib/boringbuilder/configuration.rb
Constant Summary collapse
- FORMATS =
%i[directory tar tar_zst oci docker].freeze
- RUNTIMES =
%i[auto apple docker].freeze
- FORMAT_ALIASES =
{ "tar.zst" => :tar_zst, "tar-zst" => :tar_zst, "tar_zst" => :tar_zst }.freeze
Instance Attribute Summary collapse
-
#artifact ⇒ Object
Returns the value of attribute artifact.
-
#artifact_name ⇒ Object
Returns the value of attribute artifact_name.
-
#assets ⇒ Object
Returns the value of attribute assets.
-
#base_image ⇒ Object
Returns the value of attribute base_image.
-
#bootsnap ⇒ Object
Returns the value of attribute bootsnap.
-
#build_environment ⇒ Object
Returns the value of attribute build_environment.
-
#build_packages ⇒ Object
Returns the value of attribute build_packages.
-
#command ⇒ Object
Returns the value of attribute command.
-
#exporter ⇒ Object
Returns the value of attribute exporter.
-
#files ⇒ Object
Returns the value of attribute files.
-
#format ⇒ Object
Returns the value of attribute format.
-
#host_paths ⇒ Object
Returns the value of attribute host_paths.
-
#load ⇒ Object
Returns the value of attribute load.
-
#output ⇒ Object
Returns the value of attribute output.
-
#paths ⇒ Object
Returns the value of attribute paths.
- #pipeline(&block) ⇒ Object
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#port ⇒ Object
Returns the value of attribute port.
-
#progress ⇒ Object
Returns the value of attribute progress.
-
#publish ⇒ Object
Returns the value of attribute publish.
-
#root ⇒ Object
Returns the value of attribute root.
-
#runtime ⇒ Object
Returns the value of attribute runtime.
-
#runtime_packages ⇒ Object
Returns the value of attribute runtime_packages.
Instance Method Summary collapse
- #apply(options) ⇒ Object
-
#initialize(root: Dir.pwd, runtime: :auto, platform: nil, format: :tar_zst, output: nil, base_image: nil, paths: nil, files: nil, host_paths: nil, publish: nil, load: nil, progress: nil, assets: nil, bootsnap: nil, artifact: nil, command: nil, port: nil, exporter: :auto, artifact_name: nil, pipeline: nil, build_packages: nil, runtime_packages: nil, build_environment: nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize(root: Dir.pwd, runtime: :auto, platform: nil, format: :tar_zst, output: nil, base_image: nil, paths: nil, files: nil, host_paths: nil, publish: nil, load: nil, progress: nil, assets: nil, bootsnap: nil, artifact: nil, command: nil, port: nil, exporter: :auto, artifact_name: nil, pipeline: nil, build_packages: nil, runtime_packages: nil, build_environment: nil) ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/boringbuilder/configuration.rb', line 22 def initialize(root: Dir.pwd, runtime: :auto, platform: nil, format: :tar_zst, output: nil, base_image: nil, paths: nil, files: nil, host_paths: nil, publish: nil, load: nil, progress: nil, assets: nil, bootsnap: nil, artifact: nil, command: nil, port: nil, exporter: :auto, artifact_name: nil, pipeline: nil, build_packages: nil, runtime_packages: nil, build_environment: nil) @root = Pathname.new(root). @runtime = normalize_runtime(runtime) @platform = platform @format = normalize_format(format) @output = output && Pathname.new(output).(@root) @base_image = base_image @paths = Array(paths).compact @files = Array(files).compact @host_paths = Array(host_paths).compact @publish = publish @load = load @progress = progress @assets = assets @bootsnap = bootsnap @artifact = artifact || Artifact.new(root: @root) @command = command @port = port @exporter = normalize_exporter(exporter) @artifact_name = artifact_name @pipeline = pipeline @build_packages = normalize_packages(build_packages) @runtime_packages = normalize_packages(runtime_packages) @build_environment = normalize_environment(build_environment) end |
Instance Attribute Details
#artifact ⇒ Object
Returns the value of attribute artifact.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def artifact @artifact end |
#artifact_name ⇒ Object
Returns the value of attribute artifact_name.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def artifact_name @artifact_name end |
#assets ⇒ Object
Returns the value of attribute assets.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def assets @assets end |
#base_image ⇒ Object
Returns the value of attribute base_image.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def base_image @base_image end |
#bootsnap ⇒ Object
Returns the value of attribute bootsnap.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def bootsnap @bootsnap end |
#build_environment ⇒ Object
Returns the value of attribute build_environment.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def build_environment @build_environment end |
#build_packages ⇒ Object
Returns the value of attribute build_packages.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def build_packages @build_packages end |
#command ⇒ Object
Returns the value of attribute command.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def command @command end |
#exporter ⇒ Object
Returns the value of attribute exporter.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def exporter @exporter end |
#files ⇒ Object
Returns the value of attribute files.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def files @files end |
#format ⇒ Object
Returns the value of attribute format.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def format @format end |
#host_paths ⇒ Object
Returns the value of attribute host_paths.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def host_paths @host_paths end |
#load ⇒ Object
Returns the value of attribute load.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def load @load end |
#output ⇒ Object
Returns the value of attribute output.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def output @output end |
#paths ⇒ Object
Returns the value of attribute paths.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def paths @paths end |
#pipeline(&block) ⇒ Object
74 75 76 77 |
# File 'lib/boringbuilder/configuration.rb', line 74 def pipeline(&block) @pipeline = block if block @pipeline end |
#platform ⇒ Object
Returns the value of attribute platform.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def platform @platform end |
#port ⇒ Object
Returns the value of attribute port.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def port @port end |
#progress ⇒ Object
Returns the value of attribute progress.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def progress @progress end |
#publish ⇒ Object
Returns the value of attribute publish.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def publish @publish end |
#root ⇒ Object
Returns the value of attribute root.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def root @root end |
#runtime ⇒ Object
Returns the value of attribute runtime.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def runtime @runtime end |
#runtime_packages ⇒ Object
Returns the value of attribute runtime_packages.
15 16 17 |
# File 'lib/boringbuilder/configuration.rb', line 15 def runtime_packages @runtime_packages end |
Instance Method Details
#apply(options) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/boringbuilder/configuration.rb', line 64 def apply() .each do |name, value| writer = "#{name}=" raise ConfigurationError, "Unknown configuration option: #{name}" unless respond_to?(writer) public_send(writer, value) end self end |
#validate! ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/boringbuilder/configuration.rb', line 54 def validate! normalize! validate_project_directory! validate_option_combinations! validate_port! validate_artifact! validate_output_path! self end |