class Indocker::CrontabRedeployRulesBuilder

Constants

COMMAND
CRONTAB
LOG_FILE
REDEPLOY_RULE

Public Class Methods

new(configuration:, logger:) click to toggle source
# File lib/indocker/crontab_redeploy_rules_builder.rb, line 13
def initialize(configuration:, logger:)
  @configuration  = configuration
  @logger         = logger
end

Private Class Methods

env() click to toggle source
# File lib/indocker/crontab_redeploy_rules_builder.rb, line 25
def self.env
  Indocker.configuration_name
end

Public Instance Methods

call(containers) click to toggle source
# File lib/indocker/crontab_redeploy_rules_builder.rb, line 18
def call(containers)
  CRONTAB % {
    rules: containers.map{ |c| redeploy_rule(c) }.join("\n"),
  }
end

Private Instance Methods

command(container) click to toggle source
# File lib/indocker/crontab_redeploy_rules_builder.rb, line 39
def command(container)
  COMMAND % {
    env:            env,
    container_name: container.name,
    deploy_dir: Indocker.deploy_dir
  }
end
env() click to toggle source
# File lib/indocker/crontab_redeploy_rules_builder.rb, line 29
def env
  self.class.env
end
log_file() click to toggle source
# File lib/indocker/crontab_redeploy_rules_builder.rb, line 33
def log_file
  LOG_FILE % {
    env: env,
  }
end
redeploy_rule(container) click to toggle source
# File lib/indocker/crontab_redeploy_rules_builder.rb, line 47
def redeploy_rule(container)
  REDEPLOY_RULE % {
    schedule:   container.redeploy_schedule,
    command:    command(container),
    log_file:   log_file,
  }
end