Class: Indocker::CrontabRedeployRulesBuilder
- Inherits:
-
Object
- Object
- Indocker::CrontabRedeployRulesBuilder
- Defined in:
- lib/indocker/crontab_redeploy_rules_builder.rb
Constant Summary collapse
- CRONTAB =
<<~CRONTAB SHELL=/bin/bash PATH=/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin %{rules} CRONTAB
- LOG_FILE =
"/var/log/indocker-redeploy-%{env}.log"
- COMMAND =
"export TERM=xterm;%{deploy_dir}/indocker/bin/deploy -C %{env} -f -B -y -c %{container_name}"
- REDEPLOY_RULE =
%Q{%{schedule} echo `date` "- %{command}..." >> %{log_file}; %{command} 1>/dev/null 2>>%{log_file}; echo `date` "- done, exitcode = $?" >> %{log_file}}
Instance Method Summary collapse
- #call(containers) ⇒ Object
-
#initialize(configuration:, logger:) ⇒ CrontabRedeployRulesBuilder
constructor
A new instance of CrontabRedeployRulesBuilder.
Constructor Details
#initialize(configuration:, logger:) ⇒ CrontabRedeployRulesBuilder
Returns a new instance of CrontabRedeployRulesBuilder.
13 14 15 16 |
# File 'lib/indocker/crontab_redeploy_rules_builder.rb', line 13 def initialize(configuration:, logger:) @configuration = configuration @logger = logger end |
Instance Method Details
#call(containers) ⇒ Object
18 19 20 21 22 |
# File 'lib/indocker/crontab_redeploy_rules_builder.rb', line 18 def call(containers) CRONTAB % { rules: containers.map{ |c| redeploy_rule(c) }.join("\n"), } end |