class Dokkufy::Server
Attributes
hostname[RW]
username[RW]
Public Class Methods
new(hostname, username)
click to toggle source
# File lib/dokkufy/server.rb, line 5 def initialize hostname, username self.hostname = hostname self.username = username end
Public Instance Methods
dokkufy(version, domain)
click to toggle source
# File lib/dokkufy/server.rb, line 10 def dokkufy(version, domain) ensure_passwordless_sudo install_dokku(version) configure_vhost(domain) setup_key end
method_missing(m, *args, &block)
click to toggle source
# File lib/dokkufy/server.rb, line 27 def method_missing(m, *args, &block) method_name = m.to_s filename = Dokkufy::Utils.script method_name server = "#{username}@#{hostname}" `scp #{filename} #{server}:` system("ssh -t -q #{server} 'OPTION1=#{args[0]} OPTION2=#{args[1]} ./#{method_name}.sh'") `ssh -t -q #{server} 'rm ~/#{method_name}.sh'` end
setup_key()
click to toggle source
# File lib/dokkufy/server.rb, line 17 def setup_key user = `echo $USER` public_key = "id_rsa.pub" until File.exists?(File.expand_path("~/.ssh/#{public_key}")) do public_key = ask "Enter public key file name(e.g. id_rsa.pub):" end command = "cat ~/.ssh/#{public_key} | ssh #{username}@#{hostname} 'sudo sshcommand acl-add dokku #{user}'" system command end