Class: Dapp::Config::Application
- Inherits:
-
Object
- Object
- Dapp::Config::Application
- Defined in:
- lib/dapp/config/application.rb
Overview
Application
Instance Attribute Summary collapse
-
#_app_install_dependencies ⇒ Object
readonly
Returns the value of attribute _app_install_dependencies.
-
#_app_setup_dependencies ⇒ Object
readonly
Returns the value of attribute _app_setup_dependencies.
-
#_builder ⇒ Object
readonly
Returns the value of attribute _builder.
-
#_chef ⇒ Object
readonly
Returns the value of attribute _chef.
-
#_docker ⇒ Object
readonly
Returns the value of attribute _docker.
-
#_git_artifact ⇒ Object
readonly
Returns the value of attribute _git_artifact.
-
#_home_path ⇒ Object
readonly
Returns the value of attribute _home_path.
-
#_name ⇒ Object
readonly
Returns the value of attribute _name.
-
#_parent ⇒ Object
readonly
Returns the value of attribute _parent.
-
#_shell ⇒ Object
readonly
Returns the value of attribute _shell.
Instance Method Summary collapse
- #_app_chain ⇒ Object
- #_app_runlist ⇒ Object
- #_apps ⇒ Object
- #_root_app ⇒ Object
- #app_install_depends_on(*args) ⇒ Object
- #app_setup_depends_on(*args) ⇒ Object
- #builder(type) ⇒ Object
- #chef ⇒ Object
- #docker ⇒ Object
- #git_artifact ⇒ Object
-
#initialize(parent) {|_self| ... } ⇒ Application
constructor
A new instance of Application.
- #shell ⇒ Object
Constructor Details
#initialize(parent) {|_self| ... } ⇒ Application
Returns a new instance of Application.
17 18 19 20 21 22 23 24 25 |
# File 'lib/dapp/config/application.rb', line 17 def initialize(parent) @_apps = [] @_parent = parent @_app_install_dependencies = [] @_app_setup_dependencies = [] yield self if block_given? end |
Instance Attribute Details
#_app_install_dependencies ⇒ Object (readonly)
Returns the value of attribute _app_install_dependencies.
13 14 15 |
# File 'lib/dapp/config/application.rb', line 13 def _app_install_dependencies @_app_install_dependencies end |
#_app_setup_dependencies ⇒ Object (readonly)
Returns the value of attribute _app_setup_dependencies.
14 15 16 |
# File 'lib/dapp/config/application.rb', line 14 def _app_setup_dependencies @_app_setup_dependencies end |
#_builder ⇒ Object (readonly)
Returns the value of attribute _builder.
6 7 8 |
# File 'lib/dapp/config/application.rb', line 6 def _builder @_builder end |
#_chef ⇒ Object (readonly)
Returns the value of attribute _chef.
10 11 12 |
# File 'lib/dapp/config/application.rb', line 10 def _chef @_chef end |
#_docker ⇒ Object (readonly)
Returns the value of attribute _docker.
8 9 10 |
# File 'lib/dapp/config/application.rb', line 8 def _docker @_docker end |
#_git_artifact ⇒ Object (readonly)
Returns the value of attribute _git_artifact.
9 10 11 |
# File 'lib/dapp/config/application.rb', line 9 def _git_artifact @_git_artifact end |
#_home_path ⇒ Object (readonly)
Returns the value of attribute _home_path.
7 8 9 |
# File 'lib/dapp/config/application.rb', line 7 def _home_path @_home_path end |
#_name ⇒ Object (readonly)
Returns the value of attribute _name.
5 6 7 |
# File 'lib/dapp/config/application.rb', line 5 def _name @_name end |
#_parent ⇒ Object (readonly)
Returns the value of attribute _parent.
12 13 14 |
# File 'lib/dapp/config/application.rb', line 12 def _parent @_parent end |
#_shell ⇒ Object (readonly)
Returns the value of attribute _shell.
11 12 13 |
# File 'lib/dapp/config/application.rb', line 11 def _shell @_shell end |
Instance Method Details
#_app_chain ⇒ Object
64 65 66 |
# File 'lib/dapp/config/application.rb', line 64 def _app_chain @_app_chain ||= (_parent ? _parent._app_chain : []) + [self] end |
#_app_runlist ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/dapp/config/application.rb', line 68 def _app_runlist _app_chain.map(&:_name).map do |name| if subname = name.split("#{_root_app._name}-", 2)[1] subname_parts = subname.split('-') subname_parts.join('_') if subname_parts.any? end end.compact end |
#_apps ⇒ Object
60 61 62 |
# File 'lib/dapp/config/application.rb', line 60 def _apps @_apps.empty? ? [self] : @_apps.flatten end |
#_root_app ⇒ Object
77 78 79 |
# File 'lib/dapp/config/application.rb', line 77 def _root_app _app_chain.first end |
#app_install_depends_on(*args) ⇒ Object
27 28 29 |
# File 'lib/dapp/config/application.rb', line 27 def app_install_depends_on(*args) @_app_install_dependencies.concat(args) end |
#app_setup_depends_on(*args) ⇒ Object
31 32 33 |
# File 'lib/dapp/config/application.rb', line 31 def app_setup_depends_on(*args) @_app_setup_dependencies.concat(args) end |
#builder(type) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/dapp/config/application.rb', line 53 def builder(type) raise Error::Config, code: :builder_type_unsupported, data: { type: type } unless [:chef, :shell].include?((type = type.to_sym)) another_builder = [:chef, :shell].find { |t| t != type } instance_variable_set(:"@_#{another_builder}", Config.const_get(another_builder.capitalize).new) @_builder = type end |
#chef ⇒ Object
35 36 37 38 |
# File 'lib/dapp/config/application.rb', line 35 def chef raise Error::Config, code: :builder_type_conflict unless _builder == :chef @_chef ||= Chef.new end |
#docker ⇒ Object
49 50 51 |
# File 'lib/dapp/config/application.rb', line 49 def docker @_docker ||= Docker.new end |
#git_artifact ⇒ Object
45 46 47 |
# File 'lib/dapp/config/application.rb', line 45 def git_artifact @_git_artifact ||= GitArtifact.new end |