Class: Livechat::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/livechat/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_initializerObject



15
16
17
# File 'lib/generators/livechat/install/install_generator.rb', line 15

def create_initializer
  copy_file 'initializer.rb', 'config/initializers/livechat.rb'
end

#create_migration_fileObject



19
20
21
22
# File 'lib/generators/livechat/install/install_generator.rb', line 19

def create_migration_file
  migration_template 'create_livechat_tables.rb.tt',
                     'db/migrate/create_livechat_tables.rb'
end

#mount_engineObject



24
25
26
# File 'lib/generators/livechat/install/install_generator.rb', line 24

def mount_engine
  route %(mount Livechat::Engine => "/livechat")
end

#post_installObject



28
29
30
31
32
33
# File 'lib/generators/livechat/install/install_generator.rb', line 28

def post_install
  say "\nlivechat installed. Run `rails db:migrate`, then add", :green
  say '`<%= livechat_tag %>` before </body> in your layout.'
  say 'Answer visitors at /livechat (development only until you set config.authorize_agent).'
  say "Set config.mailer_from + config.agent_emails to hear about new messages by email.\n"
end