Sha256: 97ab5f28847195e33d4343983849a8f3907dd155afad16876e2d7ba382dfb8b4

Contents?: true

Size: 888 Bytes

Versions: 3

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators'

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

      def create_migration
        invoke 'migration', migration_args
        copy_file locale_source, locale_destination
      end

      def fields_command
        %w[
          followerable:belongs_to{polymorphic}
          followable:belongs_to{polymorphic}
          status:integer
        ]
      end

      def locale_source
        File.expand_path('../../../config/locales/en.yml', __dir__)
      end

      def locale_destination
        'config/locales/followability.en.yml'
      end

      def migration_name
        'CreateFollowabilityRelationships'
      end

      def migration_args
        [migration_name].concat(fields_command)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
followability-1.1.1 lib/followability/generators/install_generator.rb
followability-1.1.0 lib/followability/generators/install_generator.rb
followability-1.0.0 lib/followability/generators/install_generator.rb