Class: CapistranoProvisioning::User

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano-provisioning/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ User

Returns a new instance of User.



6
7
8
9
10
# File 'lib/capistrano-provisioning/user.rb', line 6

def initialize(opts = {})
  self.name = opts[:name]
  self.config = opts[:config]
  self.groups = opts[:groups].to_a || []
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



3
4
5
# File 'lib/capistrano-provisioning/user.rb', line 3

def config
  @config
end

#groupsObject



27
28
29
# File 'lib/capistrano-provisioning/user.rb', line 27

def groups
  @groups.uniq
end

#key=(value) ⇒ Object

Sets the attribute key

Parameters:

  • value

    the value to set the attribute key to.



4
5
6
# File 'lib/capistrano-provisioning/user.rb', line 4

def key=(value)
  @key = value
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/capistrano-provisioning/user.rb', line 3

def name
  @name
end

Instance Method Details

#install(opts = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/capistrano-provisioning/user.rb', line 12

def install(opts = {})    
  abort "Aborting - Cannot install user #{self.name} as no server specified" unless opts[:server]
  abort "Aborting - Could not find key for #{self.name} at #{local_key_file_path}" unless key

  self.server = opts[:server]

  logger.debug "installing #{self.name} on #{self.server}"    

  self. unless self.
  self.create_ssh_config_directory
  self.update_authorized_keys
  self.set_ssh_config_permissions
  self.
end