Class: Teleport::Install

Inherits:
Object
  • Object
show all
Includes:
Constants, Mirror, Util
Defined in:
lib/teleport/install.rb

Overview

Class that performs the install on the target machine.

Constant Summary

Constants included from Mirror

Mirror::IGNORE

Constants included from Constants

Constants::DATA, Constants::DIR, Constants::FILES, Constants::GEM, Constants::PUBKEY, Constants::RUBYGEMS

Constants included from Util

Util::BLUE, Util::CYAN, Util::GREEN, Util::MAGENTA, Util::RED, Util::RESET, Util::YELLOW

Instance Method Summary collapse

Methods included from Mirror

#install_dir, #install_file

Methods included from Util

#banner, #chmod, #chown, #copy_metadata, #copy_perms, #cp, #cp_if_necessary, #cp_with_mkdir, #different?, #fails?, #fatal, #gem_if_necessary, #gem_version, #ln, #ln_if_necessary, #md5sum, #mkdir, #mkdir_if_necessary, #mv, #mv_with_mkdir, #package_if_necessary, #package_is_installed?, #process_by_pid?, #rm, #rm_and_mkdir, #rm_if_necessary, #run, #run_capture, #run_capture_lines, #run_quietly, #run_verbose!, #shell, #shell_escape, #succeeds?, #warning, #whoami

Constructor Details

#initialize(config) ⇒ Install

Returns a new instance of Install.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/teleport/install.rb', line 8

def initialize(config)
  @config = config
  run_verbose!
  _read_config

  # setup @config constants. Put them in mirror so they're
  # accessible to both the DSL and Mirror itself. That way you can
  # access these if you call install_file directly.
  Mirror.const_set("HOST", @host)
  Mirror.const_set("USER", @config.user)
  Mirror.const_set("ROLE", @role && @role.name)
  Mirror.const_set("SERVER", @server)

  # add mixins
  @config.dsl.extend(Mirror)
  @config.dsl.extend(Util)
  @config.dsl.run_verbose!

  # handle CONFIG_RECIPE
  if @config_file[:recipe]
    _with_callback(:install) do
      _with_callback(:recipes) do
        _recipe(@config_file[:recipe])
      end
    end
    return
  end

  _with_callback(:install) do
    _gems
    _hostname
    _with_callback(:user) do
      _create_user
    end
    _apt
    _with_callback(:packages) do
      _packages
    end
    _with_callback(:gemfiles) do
      _gemfiles
    end
    _with_callback(:files) do
      _files
    end
    _with_callback(:recipes) do
      _recipes
    end
  end
end