Class: Dock0::Install

Inherits:
Base
  • Object
show all
Defined in:
lib/dock0/install.rb

Overview

An Install is a deployment of components onto a system

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#cleanup, #initialize, #render_templates, #run, #run_script, #run_scripts, #templates

Constructor Details

This class inherits a constructor from Dock0::Base

Instance Method Details

#artifactsObject



27
28
29
30
31
32
# File 'lib/dock0/install.rb', line 27

def artifacts
  @config[:artifacts].map do |artifact|
    artifact[:url] ||= build_url(artifact)
    artifact
  end
end

#build_url(artifact) ⇒ Object



21
22
23
24
25
# File 'lib/dock0/install.rb', line 21

def build_url(artifact)
  org = artifact[:org] || @config[:org]
  name, version, file = artifact.values_at(:name, :version, :file)
  "https://github.com/#{org}/#{name}/releases/download/#{version}/#{file}"
end

#default_configObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dock0/install.rb', line 8

def default_config
  {
    paths: {
      templates: './templates',
      scripts: './scripts',
      build: './build',
      base: '/'
    },
    org: 'dock0',
    artifacts: []
  }
end

#easy_modeObject



41
42
43
44
45
# File 'lib/dock0/install.rb', line 41

def easy_mode
  load_artifacts
  render_templates('')
  run_scripts
end

#load_artifactsObject



34
35
36
37
38
39
# File 'lib/dock0/install.rb', line 34

def load_artifacts
  Dir.chdir("#{@paths[:build]}/#{@paths[:base]}") do
    menagerie = Menagerie.new @config[:menagerie]
    menagerie.add_release artifacts
  end
end