Class: Deploymatic::Conf
- Inherits:
-
Struct
- Object
- Struct
- Deploymatic::Conf
- Defined in:
- lib/deploymatic/conf.rb
Instance Attribute Summary collapse
-
#enviroment_variables ⇒ Object
Returns the value of attribute enviroment_variables.
-
#install_commands ⇒ Object
Returns the value of attribute install_commands.
-
#install_dir ⇒ Object
Returns the value of attribute install_dir.
-
#log_path ⇒ Object
Returns the value of attribute log_path.
-
#name ⇒ Object
Returns the value of attribute name.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#run_after ⇒ Object
Returns the value of attribute run_after.
-
#ssh_host ⇒ Object
Returns the value of attribute ssh_host.
-
#ssh_port ⇒ Object
Returns the value of attribute ssh_port.
-
#ssh_user ⇒ Object
Returns the value of attribute ssh_user.
-
#start_command ⇒ Object
Returns the value of attribute start_command.
-
#start_limit_burst ⇒ Object
Returns the value of attribute start_limit_burst.
-
#start_limit_interval_seconds ⇒ Object
Returns the value of attribute start_limit_interval_seconds.
-
#stop_command ⇒ Object
Returns the value of attribute stop_command.
Instance Method Summary collapse
- #check_required_fields ⇒ Object
- #check_required_fields! ⇒ Object
-
#initialize(**args) ⇒ Conf
constructor
A new instance of Conf.
- #url ⇒ Object
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_variables ⇒ Object
Returns the value of attribute enviroment_variables
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def enviroment_variables @enviroment_variables end |
#install_commands ⇒ Object
Returns the value of attribute install_commands
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def install_commands @install_commands end |
#install_dir ⇒ Object
Returns the value of attribute install_dir
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def install_dir @install_dir end |
#log_path ⇒ Object
Returns the value of attribute log_path
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def log_path @log_path end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def name @name end |
#repo ⇒ Object
Returns the value of attribute repo
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def repo @repo end |
#run_after ⇒ Object
Returns the value of attribute run_after
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def run_after @run_after end |
#ssh_host ⇒ Object
Returns the value of attribute ssh_host
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def ssh_host @ssh_host end |
#ssh_port ⇒ Object
Returns the value of attribute ssh_port
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def ssh_port @ssh_port end |
#ssh_user ⇒ Object
Returns the value of attribute ssh_user
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def ssh_user @ssh_user end |
#start_command ⇒ Object
Returns the value of attribute start_command
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def start_command @start_command end |
#start_limit_burst ⇒ Object
Returns the value of attribute start_limit_burst
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def start_limit_burst @start_limit_burst end |
#start_limit_interval_seconds ⇒ Object
Returns the value of attribute 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_command ⇒ Object
Returns the value of attribute stop_command
6 7 8 |
# File 'lib/deploymatic/conf.rb', line 6 def stop_command @stop_command end |
Instance Method Details
#check_required_fields ⇒ Object
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 |
#url ⇒ Object
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 |