class Indocker::Containers::RestartPolicy
Constants
- TIMESTAMPS_DIR
Public Class Methods
new(configuration, logger)
click to toggle source
# File lib/indocker/containers/restart_policy.rb, line 6 def initialize(configuration, logger) @configuration = configuration @logger = logger end
Public Instance Methods
restart?(container, timestamp)
click to toggle source
# File lib/indocker/containers/restart_policy.rb, line 11 def restart?(container, timestamp) file = timestamp_file(container) return true if !File.exists?(file) last_timestamp = File.read(file).strip timestamp != last_timestamp end
update(container, timestamp)
click to toggle source
# File lib/indocker/containers/restart_policy.rb, line 19 def update(container, timestamp) FileUtils.mkdir_p(timestamp_folder) File.open(timestamp_file(container), 'w') do |f| f.write(timestamp) end end
Private Instance Methods
timestamp_file(container)
click to toggle source
# File lib/indocker/containers/restart_policy.rb, line 33 def timestamp_file(container) File.join(timestamp_folder, container.name.to_s) end
timestamp_folder()
click to toggle source
# File lib/indocker/containers/restart_policy.rb, line 29 def timestamp_folder timestamp = File.join(File.expand_path(Indocker.deploy_dir), TIMESTAMPS_DIR) end