Sha256: b4d3021745f38dfb77d1aba0c6c2618897e8d3fa21b32c35749932c06d11cfb2

Contents?: true

Size: 605 Bytes

Versions: 8

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

module Authorizy
  class InstallGenerator < Rails::Generators::Base
    source_root File.expand_path('templates', __dir__)

    desc 'Creates Initializer and Migration for Authorizy'

    def create_initializer
      copy_file 'config/initializers/authorizy.rb', 'config/initializers/authorizy.rb'
    end

    def create_migration
      copy_file 'db/migrate/add_authorizy_on_users.rb', "db/migrate/#{timestamp(0)}_add_authorizy_on_users.rb"
    end

    private

    def timestamp(seconds)
      (Time.current + seconds.seconds).strftime('%Y%m%d%H%M%S')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
authorizy-0.5.0 lib/generators/authorizy/install_generator.rb
authorizy-0.4.1 lib/generators/authorizy/install_generator.rb
authorizy-0.4.0 lib/generators/authorizy/install_generator.rb
authorizy-0.3.0 lib/generators/authorizy/install_generator.rb
authorizy-0.2.2 lib/generators/authorizy/install_generator.rb
authorizy-0.2.1 lib/generators/authorizy/install_generator.rb
authorizy-0.2.0 lib/generators/authorizy/install_generator.rb
authorizy-0.1.0 lib/generators/authorizy/install_generator.rb