# File lib/luban/deployment/configuration/server.rb, line 72 def primary? self[:primary] end
class Luban::Deployment::Configuration::Server
Attributes
roles[R]
Public Class Methods
create(host, **properties)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 9 def self.create(host, **properties) server = host.is_a?(Server) ? host : Server.new(host) server.add_properties(properties) unless properties.empty? server.ssh_options ||= {} server end
Public Instance Methods
[](key)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 45 def [](key) properties[key] end
Also aliased as: fetch
[]=(key, value)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 50 def []=(key, value) if respond_to?("#{key}=") send("#{key}=", value) else pval = properties[key] if pval.is_a? Hash and value.is_a? Hash pval.merge!(value) elsif pval.is_a? Set and value.is_a? Set pval.merge(value) elsif pval.is_a? Array and value.is_a? Array pval.concat value else properties[key] = value end end end
Also aliased as: set
add_cronjob(cronjob)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 85 def add_cronjob(cronjob) cronjobs.add(cronjob) end
Also aliased as: cronjob=
add_cronjobs(cronjobs)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 80 def add_cronjobs(cronjobs) cronjobs.each { |cronjob| add_cronjob(cronjob) } end
Also aliased as: cronjobs=
add_properties(_properties)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 68 def add_properties(_properties) _properties.each { |k, v| self[k] = v } end
add_role(role)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 33 def add_role(role) roles.add(role.to_sym) end
add_roles(roles)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 28 def add_roles(roles) roles.each { |role| add_role(role) } end
Also aliased as: roles=
cronjobs()
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 76 def cronjobs self[:cronjobs] end
has_role?(role)
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 37 def has_role?(role) roles.include? role.to_sym end
local?()
click to toggle source
Calls superclass method
# File lib/luban/deployment/configuration/server.rb, line 16 def local? super or (properties.has_key?(:local) ? properties[:local] : localhost?) end
localhost?()
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 20 def localhost? hostname == 'localhost' or hostname == `hostname -f`.chomp end
primary?()
click to toggle source
properties()
click to toggle source
# File lib/luban/deployment/configuration/server.rb, line 41 def properties @properties ||= { :roles => Set.new, :cronjobs => Set.new } end