Class: Dapp::Application
- Inherits:
-
Object
- Object
- Dapp::Application
- Includes:
- GitArtifact, Logging, Path, Tags, Filelock, Helper::I18n, Helper::Log, Helper::Sha256, Helper::Shellout
- Defined in:
- lib/dapp/application.rb,
lib/dapp/application/path.rb,
lib/dapp/application/tags.rb,
lib/dapp/application/logging.rb,
lib/dapp/application/git_artifact.rb
Overview
Application
Direct Known Subclasses
Defined Under Namespace
Modules: GitArtifact, Logging, Path, Tags
Constant Summary
Constants included from Logging
Instance Attribute Summary collapse
-
#cli_options ⇒ Object
readonly
Returns the value of attribute cli_options.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#ignore_git_fetch ⇒ Object
readonly
Returns the value of attribute ignore_git_fetch.
Instance Method Summary collapse
- #build! ⇒ Object
- #builder ⇒ Object
- #export!(repo) ⇒ Object
-
#initialize(config:, cli_options:, ignore_git_fetch: false) ⇒ Application
constructor
A new instance of Application.
Methods included from Filelock
Methods included from Path
#build_cache_path, #build_path, #container_build_path, #home_path
Methods included from GitArtifact
#git_artifacts, #local_git_artifacts, #remote_git_artifacts
Methods included from Logging
#dry_run?, #free_space, #log?, #log_process, #log_process_default, #log_process_short, #log_process_verbose, #log_quiet?, #log_secondary_process, #log_state, #log_time?, #log_verbose?, #rjust, #slice, #terminal_width
Methods included from Helper::Sha256
Methods included from Helper::I18n
Methods included from Helper::Shellout
included, #shellout, #shellout!
Methods included from Helper::Log
included, #log, #log_format_string, #log_indent, #log_indent_next, #log_indent_prev, #log_info, #log_secondary, #log_step, #log_time, #log_with_indent, #with_log_indent
Constructor Details
#initialize(config:, cli_options:, ignore_git_fetch: false) ⇒ Application
Returns a new instance of Application.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dapp/application.rb', line 18 def initialize(config:, cli_options:, ignore_git_fetch: false) @config = config @cli_options = @build_path = [:build_dir] || home_path('build') @build_cache_path = [:build_cache_dir] || home_path('build_cache') @last_stage = Build::Stage::Source5.new(self) @ignore_git_fetch = ignore_git_fetch end |
Instance Attribute Details
#cli_options ⇒ Object (readonly)
Returns the value of attribute cli_options.
15 16 17 |
# File 'lib/dapp/application.rb', line 15 def @cli_options end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
14 15 16 |
# File 'lib/dapp/application.rb', line 14 def config @config end |
#ignore_git_fetch ⇒ Object (readonly)
Returns the value of attribute ignore_git_fetch.
16 17 18 |
# File 'lib/dapp/application.rb', line 16 def ignore_git_fetch @ignore_git_fetch end |
Instance Method Details
#build! ⇒ Object
29 30 31 32 |
# File 'lib/dapp/application.rb', line 29 def build! last_stage.build! last_stage.save_in_cache! end |
#builder ⇒ Object
49 50 51 |
# File 'lib/dapp/application.rb', line 49 def builder @builder ||= Builder.const_get(config._builder.capitalize).new(self) end |
#export!(repo) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/dapp/application.rb', line 34 def export!(repo) raise Error::Application, code: :application_not_built unless last_stage.image.tagged? || dry_run? .each do |tag| image_name = [repo, tag].join(':') if dry_run? log_state(image_name, state: t(code: 'state.push'), styles: { status: :success }) else log_process(image_name, process: t(code: 'status.process.pushing')) do last_stage.image.export!(image_name, log_verbose: log_verbose?, log_time: log_time?, force: [:force]) end end end end |