Class: Backups::Runner

Inherits:
Object
  • Object
show all
Includes:
Loader, System
Defined in:
lib/backups/runner.rb

Constant Summary collapse

ADAPTER_PREFIX =
"Backups::Adapter::"
VERIFY_PREFIX =
"Backups::Verify::"

Constants included from Loader

Loader::CONFIG_ENV, Loader::CONFIG_SYSTEM, Loader::CONFIG_USER

Instance Method Summary collapse

Methods included from Loader

#load_configs

Methods included from System

#delete, #delete_dir, #exec, #get_latest_s3, #mkdir, #nuke_dir, #write

Constructor Details

#initializeRunner

Returns a new instance of Runner.



10
11
12
13
# File 'lib/backups/runner.rb', line 10

def initialize
  load_configs
  load_listeners
end

Instance Method Details

#show(job = nil) ⇒ Object



75
76
77
78
# File 'lib/backups/runner.rb', line 75

def show job = nil
  return _load_config(job) if job
  $GLOBAL
end

#start(job) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/backups/runner.rb', line 29

def start job
  $LOGGER.progname = job
  $LOGGER.info "Started backup"

  config = _load_config(job)

  Events.fire :start, {
    job:    job,
    config: config,
  }

  details = _backup(job, config)

  Events.fire :done, {
    type:    :backup,
    job:     job,
    config:  config,
    details: details,
  }

  $LOGGER.info "Completed backup"
end

#start_allObject



15
16
17
18
19
20
# File 'lib/backups/runner.rb', line 15

def start_all
  $LOGGER.info "Starting all jobs sequentially"
  $GLOBAL["jobs"].each do |name, config|
    start name
  end
end

#verify(job) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/backups/runner.rb', line 52

def verify job
  $LOGGER.progname = job
  $LOGGER.info "Started verification"

  config = _load_config(job)

  Events.fire :start, {
    job:    job,
    config: config,
  }

  details = _verify(job, config)

  Events.fire :done, {
    type:    :verify,
    job:     job,
    config:  config,
    details: details,
  }

  $LOGGER.info "Completed verification"
end

#verify_allObject



22
23
24
25
26
27
# File 'lib/backups/runner.rb', line 22

def verify_all
  $LOGGER.info "Verifying all jobs sequentially"
  $GLOBAL["jobs"].each do |name, config|
    verify name
  end
end