Sha256: a21edf70a6dee1529f1f0a39f615de3199fde4aa780ff20d67c3514fd3f5fd23

Contents?: true

Size: 1019 Bytes

Versions: 25

Compression:

Stored size: 1019 Bytes

Contents

require 'pathname'
require 'rails/generators'
require File.expand_path('utils', __dir__)

module Bobot
  class InstallGenerator < Rails::Generators::Base
    include Rails::Generators::Migration
    include Generators::Utils::InstanceMethods
    extend Generators::Utils::ClassMethods
    source_root File.expand_path('templates', __dir__)

    argument :_namespace, type: :string, required: false, desc: 'Bot url namespace'
    desc 'Bobot install'

    def install
      remove_file 'config/initializers/bobot.rb'
      namespace = ask_for('Where do you want to mount bobot?', 'bot', _namespace)
      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/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
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
bobot-5.0.4 lib/generators/bobot/install_generator.rb
bobot-5.0.3 lib/generators/bobot/install_generator.rb
bobot-5.0.2 lib/generators/bobot/install_generator.rb
bobot-5.0.1 lib/generators/bobot/install_generator.rb
bobot-5.0.0 lib/generators/bobot/install_generator.rb
bobot-4.15.0 lib/generators/bobot/install_generator.rb
bobot-4.14.0 lib/generators/bobot/install_generator.rb
bobot-4.13.1 lib/generators/bobot/install_generator.rb
bobot-4.13.0 lib/generators/bobot/install_generator.rb
bobot-4.11.0 lib/generators/bobot/install_generator.rb
bobot-4.10.0 lib/generators/bobot/install_generator.rb
bobot-4.9.0 lib/generators/bobot/install_generator.rb
bobot-4.8.0 lib/generators/bobot/install_generator.rb
bobot-4.7.0 lib/generators/bobot/install_generator.rb
bobot-4.6.0 lib/generators/bobot/install_generator.rb
bobot-4.5.0 lib/generators/bobot/install_generator.rb
bobot-4.4.1 lib/generators/bobot/install_generator.rb
bobot-4.4.0 lib/generators/bobot/install_generator.rb
bobot-4.3.1 lib/generators/bobot/install_generator.rb
bobot-4.3.0 lib/generators/bobot/install_generator.rb