Class: CapistranoMulticonfigParallel::RakeTaskHooks
- Inherits:
-
Object
- Object
- CapistranoMulticonfigParallel::RakeTaskHooks
- Includes:
- ApplicationHelper
- Defined in:
- lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb
Overview
class used to handle the rake worker and sets all the hooks before and after running the worker
Instance Attribute Summary collapse
-
#job_id ⇒ Object
Returns the value of attribute job_id.
-
#task ⇒ Object
Returns the value of attribute task.
Instance Method Summary collapse
- #automatic_hooks(&block) ⇒ Object
-
#initialize(task = nil) ⇒ RakeTaskHooks
constructor
A new instance of RakeTaskHooks.
- #print_question?(question) ⇒ Boolean
Methods included from ApplicationHelper
action_confirmed?, fetch_parsed_string, fetch_remaining_arguments, find_remaining_args, get_question_details, message_from_bundler?, message_is_about_a_task?, message_is_for_stdout?, msg_for_stdin?, parse_task_string, percent_of, regex_last_match, setup_command_line_standard, wrap_string
Methods included from CapistranoHelper
env_key_format, env_prefix, filtered_env_keys_format, setup_flags_for_job, trace_flag
Methods included from GemHelper
fetch_gem_version, find_loaded_gem, find_loaded_gem_property, format_gem_version, get_parsed_version, verify_gem_version
Methods included from StagesHelper
app_names_from_stages, check_stage_path, checks_paths, fetch_stages_app, fetch_stages_from_file, fetch_stages_paths, independent_deploy?, multi_apps?, sorted_paths, stages, stages_paths, stages_root
Methods included from ParseHelper
check_hash_set, check_numeric, strip_characters_from_string, value_is_array?, verify_array_of_strings, verify_empty_options, warn_array_without_strings
Methods included from CoreHelper
app_debug_enabled?, ask_confirm, ask_stdout_confirmation, check_terminal_tty, debug_websocket?, error_filtered?, execute_with_rescue, find_worker_log, force_confirmation, format_error, log_error, log_output_error, log_to_file, multi_fetch_argv, print_to_log_file, rescue_error, rescue_interrupt, setup_filename_logger, setup_logger_formatter, show_warning, terminal_actor, terminal_errors?, websocket_config, websocket_server_config
Methods included from InternalHelper
arg_is_in_default_config?, check_file, create_log_file, custom_commands, default_config_keys, default_internal_config, default_internal_configuration_params, detect_root, enable_main_log_file, fail_capfile_not_found, fetch_default_internal_config, find_config_type, find_env_multi_cap_root, find_file_in_directory, get_current_gem_name, internal_config_directory, internal_config_file, log_directory, main_log_file, multi_level_prop, pathname_is_root?, pwd_directory, pwd_parent_dir, root, setup_default_configuration_types, sliced_default_config, try_detect_file
Constructor Details
#initialize(task = nil) ⇒ RakeTaskHooks
Returns a new instance of RakeTaskHooks.
10 11 12 13 |
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 10 def initialize(task = nil) @job_id = CapistranoMulticonfigParallel.job_id @task = task.respond_to?(:fully_qualified_name) ? task.fully_qualified_name : task end |
Instance Attribute Details
#job_id ⇒ Object
Returns the value of attribute job_id.
9 10 11 |
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 9 def job_id @job_id end |
#task ⇒ Object
Returns the value of attribute task.
9 10 11 |
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 9 def task @task end |
Instance Method Details
#automatic_hooks(&block) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 15 def automatic_hooks(&block) if configuration.multi_secvential.to_s.downcase == 'false' && job_id.present? && @task.present? actor_start_working(action: 'invoke') actor.wait_execution until actor.task_approved actor_execute_block(&block) else block.call end end |
#print_question?(question) ⇒ Boolean
25 26 27 28 29 30 31 |
# File 'lib/capistrano_multiconfig_parallel/classes/rake_task_hooks.rb', line 25 def print_question?(question) if job_id.present? actor.user_prompt_needed?(question) else yield if block_given? end end |