Sha256: 778f37998f0fc44e3d9164e543c4d98271725e97f03b2e1e6f62fd4833329182

Contents?: true

Size: 809 Bytes

Versions: 5

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

module Masks
  # Generator for +rails g masks:install+.
  class InstallGenerator < ::Rails::Generators::Base
    source_root File.expand_path("templates", __dir__)

    def add_routing
      route 'mount Masks::Engine => "/"'
    end

    def copy_initializer_file
      copy_file "initializer.rb", "config/initializers/masks.rb"
    end

    def copy_masks_json
      copy_file "masks.json", "masks.json"
    end

    def add_migrations
      if yes?("generate migrations for masks?")
        rails_command "masks:install:migrations"
      else
        puts
        puts 'run "rails masks:install:migrations" to add them later on...'
      end

      puts
      puts "[masks] welcome!"
      puts "[masks] visit https://masks.geiger.to for more information."
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masks-0.4.0 lib/generators/masks/install/install_generator.rb
masks-0.3.2 lib/generators/masks/install/install_generator.rb
masks-0.3.1 lib/generators/masks/install/install_generator.rb
masks-0.3.0 lib/generators/masks/install/install_generator.rb
masks-0.2.0 lib/generators/masks/install/install_generator.rb