Sha256: 36fa33f1fef25f0d2f1ae424ec3004a4fd83ba5d60937c7cba23310caa2b8ba5

Contents?: true

Size: 1.47 KB

Versions: 3

Compression:

Stored size: 1.47 KB

Contents

require 'rails/generators/migration'

module ActiveadminMagicfields
  module Generators
    class InstallGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)
      desc "add the migrations"

      def self.next_migration_number(path)
        unless @prev_migration_nr
          @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
        else
          @prev_migration_nr += 1
        end
        @prev_migration_nr.to_s
      end

      def copy_migrations
        migration_template "create_parts.rb", "db/migrate/create_parts.rb"
        migration_template "create_part_objects.rb", "db/migrate/create_part_objects.rb"
        migration_template "create_part_object_fields.rb", "db/migrate/create_part_object_fields.rb"
        migration_template "create_field_templates.rb", "db/migrate/create_field_templates.rb"
        migration_template "create_field_text.rb", "db/migrate/create_field_text.rb"
        migration_template "create_field_image.rb", "db/migrate/create_field_image.rb"
        migration_template "create_field_textarea.rb", "db/migrate/create_field_textarea.rb"
        migration_template "create_field_checkbox.rb", "db/migrate/create_field_checkbox.rb"
        migration_template "create_field_repeater.rb", "db/migrate/create_field_repeater.rb"
        migration_template "create_repeater_part_objects.rb", "db/migrate/create_repeater_part_objects.rb"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-magicfields-0.4.2 lib/generators/activeadmin-magicfields/install/install_generator.rb
activeadmin-magicfields-0.4.1 lib/generators/activeadmin-magicfields/install/install_generator.rb
activeadmin-magicfields-0.4.0 lib/generators/activeadmin-magicfields/install/install_generator.rb