Class: Generators::Avo::EjectGenerator
- Inherits:
-
BaseGenerator
- Object
- Rails::Generators::Base
- BaseGenerator
- Generators::Avo::EjectGenerator
- 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", }
Instance Method Summary collapse
Methods inherited from BaseGenerator
Constructor Details
This class inherits a constructor from Generators::Avo::BaseGenerator
Instance Method Details
#handle ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/generators/avo/eject_generator.rb', line 22 def handle if @filename.starts_with?(":") template_id = path_to_sym @filename template_path = TEMPLATES[template_id] if path_exists? template_path eject template_path else say("Failed to find the `#{template_id.to_sym}` template.", :yellow) end elsif path_exists? @filename eject @filename else say("Failed to find the `#{@filename}` template.", :yellow) end end |