Class: CapistranoProvisioning::User
- Inherits:
-
Object
- Object
- CapistranoProvisioning::User
- Defined in:
- lib/capistrano-provisioning/user.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
- #groups ⇒ Object
-
#key ⇒ Object
writeonly
Sets the attribute key.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ User
constructor
A new instance of User.
- #install(opts = {}) ⇒ Object
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
#config ⇒ Object
Returns the value of attribute config.
3 4 5 |
# File 'lib/capistrano-provisioning/user.rb', line 3 def config @config end |
#groups ⇒ Object
27 28 29 |
# File 'lib/capistrano-provisioning/user.rb', line 27 def groups @groups.uniq end |
#key=(value) ⇒ Object
Sets the attribute key
4 5 6 |
# File 'lib/capistrano-provisioning/user.rb', line 4 def key=(value) @key = value end |
#name ⇒ Object
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.create_account_on_server unless self.account_exists? self.create_ssh_config_directory self. self. self.add_account_to_groups end |