Class: Bobot::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Extended by:
Generators::Utils::ClassMethods
Includes:
Generators::Utils::InstanceMethods, Rails::Generators::Migration
Defined in:
lib/generators/bobot/install_generator.rb

Instance Method Summary collapse

Methods included from Generators::Utils::InstanceMethods

#ask_for, #display

Instance Method Details

#installObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/generators/bobot/install_generator.rb', line 15

def install
  namespace = ask_for('Where do you want to mount bobot?', 'bot', _namespace)
  create_file 'config/routes.rb'
  gsub_file 'config/routes.rb', %r{mount Bobot::Engine => \'\/.+\'(, as: \'bot\')?}, ''
  route("mount Bobot::Engine => '/#{namespace}', as: 'bot'")
  template 'config/initializers/bobot.rb', 'config/initializers/bobot.rb'
  template 'app/bobot/workflow.rb', 'app/bobot/workflow.rb'
  copy_file 'config/bobot.yml', 'config/bobot.yml'
  copy_file 'config/locales/bobot.en.yml', 'config/locales/bobot.en.yml'
  copy_file 'config/locales/bobot.fr.yml', 'config/locales/bobot.fr.yml'
  display 'Installation done', :green
end