Class: GitlabInternalEventsCli::Flows::EventDefiner

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

Constant Summary collapse

STEPS =
[
  'New Event',
  'Description',
  'Name',
  'Context',
  'URL',
  'Group',
  'Categories',
  'Tiers',
  'Classification',
  'Save files'
].freeze
DUO_EVENT_CLASS =
'duo'
IDENTIFIER_FORMATTING_BUFFER =
"[#{IDENTIFIER_OPTIONS.keys.map { |k| k.join(', ') }.max_by(&:length)}]".length

Constants included from Text::EventDefiner

Text::EventDefiner::ACTION_HELP, Text::EventDefiner::ACTION_INTRO, Text::EventDefiner::ADDITIONAL_PROPERTIES_ADD_MORE_HELP, Text::EventDefiner::ADDITIONAL_PROPERTIES_INTRO, Text::EventDefiner::CLASSIFICATION_INTRO, Text::EventDefiner::DESCRIPTION_HELP, Text::EventDefiner::DESCRIPTION_INTRO, Text::EventDefiner::IDENTIFIERS_INTRO, Text::EventDefiner::IDENTIFIER_OPTIONS

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

Class Method 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) ⇒ EventDefiner

Returns a new instance of EventDefiner.



36
37
38
39
# File 'lib/gitlab_internal_events_cli/flows/event_definer.rb', line 36

def initialize(cli)
  @cli = cli
  @event = Event.new(milestone: milestone)
end

Instance Attribute Details

#cliObject (readonly)

Returns the value of attribute cli.



34
35
36
# File 'lib/gitlab_internal_events_cli/flows/event_definer.rb', line 34

def cli
  @cli
end

#eventObject (readonly)

Returns the value of attribute event.



34
35
36
# File 'lib/gitlab_internal_events_cli/flows/event_definer.rb', line 34

def event
  @event
end

Class Method Details

.schemaObject



10
11
12
13
14
15
# File 'lib/gitlab_internal_events_cli/flows/event_definer.rb', line 10

def self.schema
  @schema ||= Helpers::SchemaLoader.load(
    GitlabInternalEventsCli.configuration.event_schema_url,
    'event'
  )
end

Instance Method Details

#runObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/gitlab_internal_events_cli/flows/event_definer.rb', line 41

def run
  prompt_for_description
  prompt_for_action
  prompt_for_context
  prompt_for_url
  prompt_for_product_group
  prompt_for_product_categories
  prompt_for_tier
  prompt_for_classification

  outcome = create_event_file
  display_result(outcome)

  prompt_for_next_steps
end