Class: Mimas::Server
- Inherits:
-
Object
- Object
- Mimas::Server
- Includes:
- SSH, Caddy, Console, 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 Console
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.
12 13 14 15 16 17 |
# File 'lib/mimas/server.rb', line 12 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.
10 11 12 |
# File 'lib/mimas/server.rb', line 10 def host @host end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/mimas/server.rb', line 10 def name @name end |
#ssh_options ⇒ Object (readonly)
Returns the value of attribute ssh_options.
10 11 12 |
# File 'lib/mimas/server.rb', line 10 def @ssh_options end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
10 11 12 |
# File 'lib/mimas/server.rb', line 10 def user @user end |
Instance Method Details
#current_path(site) ⇒ Object
35 36 37 |
# File 'lib/mimas/server.rb', line 35 def current_path(site) site_root(site).join("current") end |
#http_root ⇒ Object
23 24 25 |
# File 'lib/mimas/server.rb', line 23 def http_root @http_root ||= user_home.join("http") end |
#site_root(site) ⇒ Object
31 32 33 |
# File 'lib/mimas/server.rb', line 31 def site_root(site) http_root.join("#{site.domain}") end |
#user_home ⇒ Object
19 20 21 |
# File 'lib/mimas/server.rb', line 19 def user_home @user_home ||= Pathname.new(File.join("/", "home", @user.to_s)) end |
#user_systemd_path ⇒ Object
27 28 29 |
# File 'lib/mimas/server.rb', line 27 def user_systemd_path @user_systemd_path ||= user_home.join(".config", "systemd", "user") end |
#validate! ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/mimas/server.rb', line 39 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 |