Class: Strata::CLI::Generators::Relation

Inherits:
Group
  • Object
show all
Defined in:
lib/strata/cli/generators/relation.rb

Overview

Generates a relationship definition YAML file from template.

Constant Summary

Constants included from Output

Output::THEME

Instance Method Summary collapse

Methods inherited from Group

exit_on_failure?, source_root

Methods included from Output

format, pastel, print_error, #print_error, print_hint, #print_hint, print_info, #print_info, print_status, #print_status, print_success, #print_success, print_warning, #print_warning, shell_for, thor_color

Instance Method Details

#create_relation_fileObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/strata/cli/generators/relation.rb', line 17

def create_relation_file
  output_path = resolve_output_path

  # Ensure directory exists
  empty_directory File.dirname(output_path)

  # Load template and update with datasource
  template_content = load_template
  updated_content = update_template(template_content)

  # Write the updated template
  create_file output_path, updated_content

  Output.print_status(:created, output_path, type: :success, context: self)
end