Class: PoBoxGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- PoBoxGenerator
- Defined in:
- lib/generators/po_box/po_box_generator.rb
Instance Method Summary collapse
- #append_to_manifest ⇒ Object
- #include_concerns ⇒ Object
- #mount_engine ⇒ Object
- #setup_inbox ⇒ Object
- #setup_initializer ⇒ Object
Instance Method Details
#append_to_manifest ⇒ Object
28 29 30 31 32 |
# File 'lib/generators/po_box/po_box_generator.rb', line 28 def append_to_manifest append_to_file "app/assets/config/manifest.js" do "//= link po_box/application.css\n" end end |
#include_concerns ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/generators/po_box/po_box_generator.rb', line 12 def include_concerns inject_into_file "app/models/#{name.tableize.singularize}.rb", after: "class #{name.camelize} < ApplicationRecord\n" do <<-RUBY include PoBox::Emailable RUBY end end |
#mount_engine ⇒ Object
8 9 10 |
# File 'lib/generators/po_box/po_box_generator.rb', line 8 def mount_engine route "mount PoBox::Engine, at: \"/po_box\"" end |
#setup_inbox ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/generators/po_box/po_box_generator.rb', line 20 def setup_inbox inject_into_file "app/mailboxes/application_mailbox.rb", after: "class ApplicationMailbox < ActionMailbox::Base\n" do <<-RUBY routing all: "po_box/inbox" RUBY end end |
#setup_initializer ⇒ Object
4 5 6 |
# File 'lib/generators/po_box/po_box_generator.rb', line 4 def setup_initializer create_file "config/initializers/po_box.rb", "PoBox.emailable_class = \"#{name.camelize}\"" end |