Sha256: b11c3779c0f8422ded6d8cd1a6cfe07e5540ada1f0aacbca524ba0e14225cf36

Contents?: true

Size: 892 Bytes

Versions: 2

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators'

module Ibrain
  module Auth
    class InstallGenerator < Rails::Generators::Base
      class_option :with_ridgepole, type: :boolean, default: true

      def self.source_paths
        paths = superclass.source_paths
        paths << File.expand_path('templates', __dir__)
        paths.flatten
      end

      def add_files
        template 'config/initializers/devise.rb.tt', 'config/initializers/devise.rb', { skip: true }
        template 'config/initializers/ibrain_auth.rb.tt', 'config/initializers/ibrain_auth.rb', { skip: true }

        if options[:with_ridgepole]
          template 'db/schemas/users_schema.erb', 'db/schemas/users.schema', { skip: true }
        else
          template 'db/schemas/users_migrate.erb', "db/migrate/#{Time.current.to_i}_add_users.rb", { skip: true }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ibrain-auth-0.1.1 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.0 lib/generators/ibrain/auth/install/install_generator.rb