Class: Superhosting::ConfigExecutor::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/superhosting/config_executor/base.rb

Direct Known Subclasses

Container

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#instance_variables_to_hash

Methods included from Helper::Config

#_config, #_config_options, #_save_registry!, #apply, #configure, #configure_with_apply, #reconfig, #unapply, #unconfigure, #unconfigure_with_unapply

Methods included from Helper::Cmd

#_command, #_command_without_debug, #command, #command!

Methods included from Helper::File

#chmod!, #chown!, #chown_r!, #safe_link!, #safe_unlink!

Methods included from Helper::Logger

#__debug, #__dry_run, #__dry_run=, #__logger, #__logger=, #debug, #debug_block, #debug_operation, #indent, #indent=, #indent_reset, #indent_step, #indent_step_back, #info, #storage, #t, #with_dry_run, #with_indent, #with_logger

Constructor Details

#initialize(model:, lib:, etc:, docker_api:, **kwargs) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/superhosting/config_executor/base.rb', line 9

def initialize(model:, lib:, etc:, docker_api:, **kwargs)
  kwargs.each do |k, v|
    instance_variable_set("@#{k}", v)
    self.class.class_eval("attr_accessor :#{k}")
  end

  self.commands = []
  self.model = model
  self.lib = lib
  self.etc = etc
  self.docker_api = docker_api
end

Instance Attribute Details

#commandsObject

Returns the value of attribute commands.



6
7
8
# File 'lib/superhosting/config_executor/base.rb', line 6

def commands
  @commands
end

#docker_apiObject

Returns the value of attribute docker_api.



7
8
9
# File 'lib/superhosting/config_executor/base.rb', line 7

def docker_api
  @docker_api
end

#etcObject

Returns the value of attribute etc.



7
8
9
# File 'lib/superhosting/config_executor/base.rb', line 7

def etc
  @etc
end

#libObject

Returns the value of attribute lib.



7
8
9
# File 'lib/superhosting/config_executor/base.rb', line 7

def lib
  @lib
end

#modelObject

Returns the value of attribute model.



7
8
9
# File 'lib/superhosting/config_executor/base.rb', line 7

def model
  @model
end

Instance Method Details

#execute(script) ⇒ Object



22
23
24
# File 'lib/superhosting/config_executor/base.rb', line 22

def execute(script)
  self.instance_eval(script, script.path.to_s)
end