Class: GitlabInternalEventsCli::Flows::FlowAdvisor

Inherits:
Object
  • Object
show all
Includes:
Helpers, Text::FlowAdvisor
Defined in:
lib/gitlab_internal_events_cli/flows/flow_advisor.rb

Constant Summary

Constants included from Text::FlowAdvisor

Text::FlowAdvisor::ALTERNATE_RESOURCES_NOTICE, Text::FlowAdvisor::DATABASE_METRIC_EXAMPLES, Text::FlowAdvisor::EVENT_EXISTENCE_CHECK_INSTRUCTIONS, Text::FlowAdvisor::EVENT_TRACKING_EXAMPLES

Constants included from Helpers::Formatting

Helpers::Formatting::DEFAULT_WINDOW_HEIGHT, Helpers::Formatting::DEFAULT_WINDOW_WIDTH

Constants included from Helpers

Helpers::NAME_REGEX

Constants included from Helpers::Files

Helpers::Files::MAX_FILENAME_LENGTH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Formatting

#clear_format, #counter, #divider, #format_error, #format_heading, #format_help, #format_info, #format_prefix, #format_prompt, #format_selection, #format_subheader, #format_warning, #progress_bar

Methods included from Helpers

#feedback_notice, #milestone, #new_page!

Methods included from Helpers::ServicePingDashboards

#metric_exploration_group_path, #metric_trend_path

Methods included from Helpers::MetricOptions

#get_metric_options

Methods included from Helpers::EventOptions

#events_by_filepath, #generate_ai_event_suggestion, #generate_python_advice, #get_event_options

Methods included from Helpers::GroupOwnership

#find_categories, #find_section, #find_stage, #known_categories, #prompt_for_feature_categories, #prompt_for_group_ownership

Methods included from Helpers::Files

#absolute_path, #file_saved_message, #prompt_to_save_file, #write_to_file

Methods included from Helpers::CliInputs

#disableable_option, #disabled_format_callback, #filter_opts, #format_disabled_options_as_dividers, #input_optional_text, #input_opts, #input_required_text, #multiselect_opts, #prompt_for_array_selection, #prompt_for_text, #select_option_divider, #select_opts, #yes_no_opts

Constructor Details

#initialize(cli) ⇒ FlowAdvisor

Returns a new instance of FlowAdvisor.



13
14
15
# File 'lib/gitlab_internal_events_cli/flows/flow_advisor.rb', line 13

def initialize(cli)
  @cli = cli
end

Instance Attribute Details

#cliObject (readonly)

Returns the value of attribute cli.



11
12
13
# File 'lib/gitlab_internal_events_cli/flows/flow_advisor.rb', line 11

def cli
  @cli
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gitlab_internal_events_cli/flows/flow_advisor.rb', line 17

def run
  return use_case_error unless goal_is_tracking_usage?

  if usage_trackable_with_internal_events?
    event_already_tracked? ? proceed_to_metric_definition : proceed_to_event_definition
  elsif usage_trackable_from_database?
    proceed_to_database_metric_definition
  else
    use_case_error
  end
end