Class: Deploymatic::Conf

Inherits:
Struct
  • Object
show all
Defined in:
lib/deploymatic/conf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Conf

Returns a new instance of Conf.



22
23
24
25
26
# File 'lib/deploymatic/conf.rb', line 22

def initialize(**args)
  super(**args)
  self.name = self.name.parameterize
  self.install_dir ||= "$HOME/#{self.name}"
end

Instance Attribute Details

#enviroment_variablesObject

Returns the value of attribute enviroment_variables

Returns:

  • (Object)

    the current value of enviroment_variables



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def enviroment_variables
  @enviroment_variables
end

#install_commandsObject

Returns the value of attribute install_commands

Returns:

  • (Object)

    the current value of install_commands



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def install_commands
  @install_commands
end

#install_dirObject

Returns the value of attribute install_dir

Returns:

  • (Object)

    the current value of install_dir



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def install_dir
  @install_dir
end

#log_pathObject

Returns the value of attribute log_path

Returns:

  • (Object)

    the current value of log_path



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def log_path
  @log_path
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def name
  @name
end

#repoObject

Returns the value of attribute repo

Returns:

  • (Object)

    the current value of repo



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def repo
  @repo
end

#run_afterObject

Returns the value of attribute run_after

Returns:

  • (Object)

    the current value of run_after



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def run_after
  @run_after
end

#ssh_hostObject

Returns the value of attribute ssh_host

Returns:

  • (Object)

    the current value of ssh_host



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def ssh_host
  @ssh_host
end

#ssh_portObject

Returns the value of attribute ssh_port

Returns:

  • (Object)

    the current value of ssh_port



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def ssh_port
  @ssh_port
end

#ssh_userObject

Returns the value of attribute ssh_user

Returns:

  • (Object)

    the current value of ssh_user



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def ssh_user
  @ssh_user
end

#start_commandObject

Returns the value of attribute start_command

Returns:

  • (Object)

    the current value of start_command



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def start_command
  @start_command
end

#start_limit_burstObject

Returns the value of attribute start_limit_burst

Returns:

  • (Object)

    the current value of start_limit_burst



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def start_limit_burst
  @start_limit_burst
end

#start_limit_interval_secondsObject

Returns the value of attribute start_limit_interval_seconds

Returns:

  • (Object)

    the current value of start_limit_interval_seconds



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def start_limit_interval_seconds
  @start_limit_interval_seconds
end

#stop_commandObject

Returns the value of attribute stop_command

Returns:

  • (Object)

    the current value of stop_command



6
7
8
# File 'lib/deploymatic/conf.rb', line 6

def stop_command
  @stop_command
end

Instance Method Details

#check_required_fieldsObject



28
29
30
31
32
# File 'lib/deploymatic/conf.rb', line 28

def check_required_fields
  i[name ssh_user ssh_host repo start_command install_dir].select do |field|
    self.send(field).nil?
  end
end

#check_required_fields!Object



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/deploymatic/conf.rb', line 34

def check_required_fields!
  fields = check_required_fields
  case fields.size
  when 0
    nil
  when 1
    raise InvalidConfValueError.new("Invalid conf value: #{fields.first} is not valid.")
  else
    raise InvalidConfValueError.new("Invalid conf values: #{fields.join(', ')} are not valid.")
  end
end

#urlObject



46
47
48
49
50
# File 'lib/deploymatic/conf.rb', line 46

def url
  url = "#{self.ssh_user}@#{ssh_host}"
  url += ":#{self.ssh_port}" if self.ssh_port
  return url
end