Class: Mimas::Server
- Inherits:
-
Object
- Object
- Mimas::Server
- Includes:
- SSH, Caddy, DeployUser, Harden, Ruby, Template, Terminal::Printer
- Defined in:
- lib/mimas/server.rb,
lib/mimas/server/ruby.rb,
lib/mimas/server/caddy.rb,
lib/mimas/server/harden.rb,
lib/mimas/server/console.rb,
lib/mimas/server/deploy_user.rb,
lib/mimas/server/prerequisites.rb
Defined Under Namespace
Modules: Caddy, Console, DeployUser, Harden, Prerequisites, Ruby
Constant Summary
Constants included from Template
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ssh_options ⇒ Object
readonly
Returns the value of attribute ssh_options.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #current_path(site) ⇒ Object
- #http_root ⇒ Object
-
#initialize(name, args) ⇒ Server
constructor
A new instance of Server.
- #site_root(site) ⇒ Object
- #user_home ⇒ Object
- #user_systemd_path ⇒ Object
- #validate! ⇒ Object
Methods included from Harden
Methods included from DeployUser
Methods included from Ruby
#install_ruby, #install_ruby_prerequisites
Methods included from Caddy
Methods included from SSH
Methods included from Template
#copy_file, lookup_paths, #read_file, #template
Methods included from Terminal::Printer
Constructor Details
#initialize(name, args) ⇒ Server
Returns a new instance of Server.
10 11 12 13 14 15 |
# File 'lib/mimas/server.rb', line 10 def initialize(name, args) @name = name @host = args[:host] @user = args[:user] @ssh_options = args.except(:host, :user) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
8 9 10 |
# File 'lib/mimas/server.rb', line 8 def host @host end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/mimas/server.rb', line 8 def name @name end |
#ssh_options ⇒ Object (readonly)
Returns the value of attribute ssh_options.
8 9 10 |
# File 'lib/mimas/server.rb', line 8 def @ssh_options end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/mimas/server.rb', line 8 def user @user end |
Instance Method Details
#current_path(site) ⇒ Object
33 34 35 |
# File 'lib/mimas/server.rb', line 33 def current_path(site) site_root(site).join("current") end |
#http_root ⇒ Object
21 22 23 |
# File 'lib/mimas/server.rb', line 21 def http_root @http_root ||= user_home.join("http") end |
#site_root(site) ⇒ Object
29 30 31 |
# File 'lib/mimas/server.rb', line 29 def site_root(site) http_root.join("#{site.domain}") end |
#user_home ⇒ Object
17 18 19 |
# File 'lib/mimas/server.rb', line 17 def user_home @user_home ||= Pathname.new(File.join("/", "home", @user.to_s)) end |
#user_systemd_path ⇒ Object
25 26 27 |
# File 'lib/mimas/server.rb', line 25 def user_systemd_path @user_systemd_path ||= user_home.join(".config", "systemd", "user") end |
#validate! ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/mimas/server.rb', line 37 def validate! raise Config::InvalidConfiguration.new("`server` requires a `host`") \ unless self.host && self.host.size > 0 raise Config::InvalidConfiguration.new("`server` requires a `user`") \ unless self.user && self.user.size > 0 true end |