Class: Generators::Avo::EjectGenerator

Inherits:
BaseGenerator
  • Object
show all
Defined in:
lib/generators/avo/eject_generator.rb

Constant Summary collapse

TEMPLATES =
{
  logo: "app/views/avo/partials/_logo.html.erb",
  head: "app/views/avo/partials/_head.html.erb",
  header: "app/views/avo/partials/_header.html.erb",
  footer: "app/views/avo/partials/_footer.html.erb",
  pre_head: "app/views/avo/partials/_pre_head.html.erb",
  scripts: "app/views/avo/partials/_scripts.html.erb",
  sidebar_extra: "app/views/avo/partials/_sidebar_extra.html.erb",
  profile_menu_extra: "app/views/avo/partials/_profile_menu_extra.html.erb",
}

Instance Method Summary collapse

Methods inherited from BaseGenerator

#initialize

Constructor Details

This class inherits a constructor from Generators::Avo::BaseGenerator

Instance Method Details

#handleObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/generators/avo/eject_generator.rb', line 51

def handle
  if options[:controller].present?
    eject_controller
  elsif options[:partial].present?
    eject_partial
  elsif options[:component].present?
    eject_component
  elsif options["field-components"].present?
    eject_field_components
  else
    say "Please specify a partial or a component to eject.\n" \
        "Examples: rails g avo:eject --partial :logo\n" \
        "          rails g avo:eject --partial app/views/layouts/avo/application.html.erb\n" \
        "          rails g avo:eject --component Avo::Index::TableRowComponent\n" \
        "          rails g avo:eject --component avo/index/table_row_component\n" \
        "          rails g avo:eject --controller application_controller\n" \
        "          rails g avo:eject --field-components trix\n" \
        "          rails g avo:eject --field-components trix --scope users\n" \
        "          rails g avo:eject --field-components text --scope users --view edit\n" \
        "          rails g avo:eject --component Avo::Views::ResourceIndexComponent --scope users\n" \
        "          rails g avo:eject --component avo/views/resource_index_component --scope users", :yellow
  end
end