Sha256: b69ad8b01cfc65de26b7f003d46b7b37e392f708f24958ce375e3542fb62dffe

Contents?: true

Size: 1001 Bytes

Versions: 12

Compression:

Stored size: 1001 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 }
        template 'config/initializers/ibrain_jwt.rb.tt', 'config/initializers/ibrain_jwt.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

12 entries across 12 versions & 1 rubygems

Version Path
ibrain-auth-0.2.3 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.2.2 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.2.1 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.2.0 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.9 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.8 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.7 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.6 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.5 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.4 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.3 lib/generators/ibrain/auth/install/install_generator.rb
ibrain-auth-0.1.2 lib/generators/ibrain/auth/install/install_generator.rb