Class: AhoyCaptain::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/ahoy_captain/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_templatesObject



8
9
10
11
12
13
14
15
# File 'lib/generators/ahoy_captain/install_generator.rb', line 8

def copy_templates
  insert_into_file ::Rails.root.join("app/models/ahoy/event.rb").to_s, "  include AhoyCaptain::Ahoy::EventMethods\n", after: "class Ahoy::Event < ApplicationRecord\n"
  insert_into_file ::Rails.root.join("app/models/ahoy/visit.rb").to_s, "  include AhoyCaptain::Ahoy::VisitMethods\n", after: "class Ahoy::Visit < ApplicationRecord\n"

  template "config.rb", "config/initializers/ahoy_captain.rb"

  route "mount AhoyCaptain::Engine => '/ahoy_captain'"
end