From cef6f039aab23fd6c5be6e4b04df496635b0a08d Mon Sep 17 00:00:00 2001 From: Katja Date: Thu, 5 Sep 2024 14:04:02 -0700 Subject: [PATCH] update stage, release, extract --- lib/egads/command/extract.rb | 8 +++----- lib/egads/command/release.rb | 9 +++------ lib/egads/command/stage.rb | 9 +++------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/lib/egads/command/extract.rb b/lib/egads/command/extract.rb index be67497..49f11f6 100644 --- a/lib/egads/command/extract.rb +++ b/lib/egads/command/extract.rb @@ -4,6 +4,7 @@ class Extract < Group desc "[remote, plumbing] Downloads tarball for SHA from S3 and extracts it to the filesystem" class_option :force, type: :boolean, aliases: '-f', default: false, banner: "Overwrite existing files" + class_option :deployment_id, type: :string, default: nil, banner: 'Append suffix to release directory' argument :sha, type: :string, required: true, desc: 'git SHA to download and extract' attr_accessor :seed_sha, :seed_path @@ -89,11 +90,8 @@ def do_extract(path) # Directory created upon successful extraction def release_dir - base_dir = RemoteConfig.release_dir(sha) - if options[:deployment_id] - return "#{base_dir}_TEST" - end - base_dir + suffix = options[:deployment_id] ? "_#{options[:deployment_id]}" : '' + dir(sha) + suffix end # Directory where in-progress extraction occurs diff --git a/lib/egads/command/release.rb b/lib/egads/command/release.rb index 9e22ba6..48bd6a7 100644 --- a/lib/egads/command/release.rb +++ b/lib/egads/command/release.rb @@ -10,7 +10,7 @@ class Release < Group desc '[remote] Symlinks SHA to current and restarts services. If needed, stages SHA' class_option :force, type: :boolean, default: false, banner: 'Overwrite existing release' - class_option :deployment_id, type: :boolean, default: false, banner: 'Include deployment ID in release directory' + class_option :deployment_id, type: :string, default: nil, banner: 'Append suffix to release directory' argument :sha, type: :string, required: true, desc: 'git SHA to stage' def setup_environment @@ -56,11 +56,8 @@ def trim protected def dir - base_dir = RemoteConfig.release_dir(sha) - if options[:deployment_id] - return "#{base_dir}_TEST" - end - base_dir + suffix = options[:deployment_id] ? "_#{options[:deployment_id]}" : '' + RemoteConfig.release_dir(sha) + suffix end def release_to diff --git a/lib/egads/command/stage.rb b/lib/egads/command/stage.rb index 19c9758..7b78660 100644 --- a/lib/egads/command/stage.rb +++ b/lib/egads/command/stage.rb @@ -10,7 +10,7 @@ class Stage < Group desc '[remote] Readies SHA for release. If needed, generates URL for SHA and extracts' class_option :force, type: :boolean, default: false, banner: 'Overwrite existing files' - class_option :deployment_id, type: :boolean, default: false, banner: 'Include deployment ID in release directory' + class_option :deployment_id, type: :string, default: nil, banner: 'Append suffix to release directory' argument :sha, type: :string, required: true, desc: 'git SHA to stage' def setup_environment @@ -68,11 +68,8 @@ def mark_as_staged protected def dir - base_dir = RemoteConfig.release_dir(sha) - if options[:deployment_id] - return "#{base_dir}_TEST" - end - base_dir + suffix = options[:deployment_id] ? "_#{options[:deployment_id]}" : '' + RemoteConfig.release_dir(sha) + suffix end def stage_flag_path