Class: Mimas::Deployment

Inherits:
Object
  • Object
show all
Includes:
Caddy, Files, Paths, RubyApp, StaticSite, SSH, Template, Terminal::Printer
Defined in:
lib/mimas/deployment.rb,
lib/mimas/deployment/caddy.rb,
lib/mimas/deployment/files.rb,
lib/mimas/deployment/paths.rb,
lib/mimas/deployment/ruby_app.rb,
lib/mimas/deployment/static_site.rb

Defined Under Namespace

Modules: Caddy, Files, Paths, RubyApp, StaticSite

Constant Summary

Constants included from Files

Files::CADDYFILE_PATH

Constants included from Template

Template::BASE_DIRECTORY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StaticSite

#deploy_static_site

Methods included from RubyApp

#deploy_ruby_app

Methods included from Caddy

#refreshing_caddy

Methods included from Paths

#archive_name, #archive_path, #caddyfile_path, #current_path, #deploy_script_path, #mimas_path, #new_caddyfile_path, #releases_path, #remote_destination, #ruby_version, #site_root, #unix_socket

Methods included from Files

#caddyfile, #deploy_script, #mimas_env, #systemd, #systemd_service_name

Methods included from Terminal::Printer

#ask, #say

Methods included from Template

#copy_file, lookup_paths, #read_file, #template

Methods included from SSH

#ssh

Constructor Details

#initialize(site:, server:) ⇒ Deployment

Returns a new instance of Deployment.



10
11
12
13
14
15
# File 'lib/mimas/deployment.rb', line 10

def initialize(site:, server:)
  @site = site
  @server = server
  @version = Time.now.utc.strftime("%Y%m%d%H%M%S")
  @commit_hash = `git rev-parse HEAD`
end

Instance Attribute Details

#commit_hashObject (readonly)

Returns the value of attribute commit_hash.



8
9
10
# File 'lib/mimas/deployment.rb', line 8

def commit_hash
  @commit_hash
end

#serverObject (readonly)

Returns the value of attribute server.



8
9
10
# File 'lib/mimas/deployment.rb', line 8

def server
  @server
end

#siteObject (readonly)

Returns the value of attribute site.



8
9
10
# File 'lib/mimas/deployment.rb', line 8

def site
  @site
end

#versionObject (readonly)

Returns the value of attribute version.



8
9
10
# File 'lib/mimas/deployment.rb', line 8

def version
  @version
end

Instance Method Details

#deployObject



17
18
19
20
21
22
23
24
25
# File 'lib/mimas/deployment.rb', line 17

def deploy
  if site.static?
    deploy_static_site
  else
    deploy_ruby_app
  end
ensure
  File.delete(archive_path) if archive_path
end