Sha256: 5b91d4169db5366928ab123e6d801bc7a7de32b1b2d350c9e951a9ec803a88cf
Contents?: true
Size: 1019 Bytes
Versions: 40
Compression:
Stored size: 1019 Bytes
Contents
require 'dply/logger' module Dply class ReleaseHelper include Logger def current_release_dir current_dir = "current" return if not File.symlink? current_dir name = File.basename (File.readlink current_dir) "releases/#{name}" end def prune_releases(keep: 5) releases = all_releases releases.reject! { |x| x == current_release_dir } old_releases = releases[keep..-1] return if not old_releases old_releases.each do |d| logger.info "deleting old release #{File.basename d}" FileUtils.rm_rf d end end def all_releases Dir["releases/*"].sort! { |x, y| File.mtime(y) <=> File.mtime(x) } end def parse(name) arr = name.split("-") deployed = File.exist? "releases/#{name}/.deployed" release = { revision: arr[0] || "NA", project: arr[1] || "NA", branch: arr[2] || "NA", timestamp: arr[3] || "NA", deployed: deployed } end end end
Version data entries
40 entries across 40 versions & 1 rubygems