Add skip_hooks option

This commit is contained in:
Donal McBreen
2023-05-23 15:56:47 +01:00
parent f9cb87e55a
commit 19f0f40adf
4 changed files with 34 additions and 31 deletions

View File

@@ -20,6 +20,8 @@ module Mrsk::Cli
class_option :config_file, aliases: "-c", default: "config/deploy.yml", desc: "Path to config file"
class_option :destination, aliases: "-d", desc: "Specify destination to be used for config file (staging -> deploy.staging.yml)"
class_option :skip_hooks, aliases: "-H", type: :boolean, default: false, desc: "Don't run hooks"
def initialize(*)
super
load_envs
@@ -130,7 +132,7 @@ module Mrsk::Cli
end
def run_hook(hook, **details)
if MRSK.hook.hook_exists?(hook)
if !options[:skip_hooks] && MRSK.hook.hook_exists?(hook)
say "Running the #{hook} hook...", :magenta
run_locally do
MRSK.with_verbosity(:debug) { execute *MRSK.hook.run(hook, **details) }