Class: Vapid::Deployer

Inherits:
Object show all
Defined in:
lib/vapid/deployer.rb

Overview

Deploys to Vapid’s hosting service

Constant Summary collapse

MIMES =
{
  "text/css" => "css",
  "application/javascript" => "js",
  "text/html" => "html"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(api_key, site_id) ⇒ Deployer

Returns a new instance of Deployer.



16
17
18
19
# File 'lib/vapid/deployer.rb', line 16

def initialize(api_key, site_id)
  @api = API.new(api_key)
  @site_id = site_id
end

Instance Method Details

#deploy(project_files, &cli) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vapid/deployer.rb', line 21

def deploy(project_files, &cli)
  @cli = cli
  @project_files = project_files
  @manifest = {}
  @site_changed = false

  begin
    config_server
    prepare_build_dir
    build_site
    return unless upload_files
    update_site
  rescue Exception => e
    cli_say "Deploy Error: #{e.message}", color: :red
  end
end