Sha256: 662b6e264032bcb53c55e8a829e4dba4c79ca918f1cee26dfc88ef74fe74309b

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

require 'rails/generators'

class RailsAdminContentBuilderGenerator < Rails::Generators::Base
  include Rails::Generators::Migration

  def self.source_root
    @source_root ||= File.expand_path(
      File.join(File.dirname(__FILE__), 'templates/')
    )
  end

  def self.next_migration_number(*)
    if @migration
      @migration += 1
    else
      @migration = Time.now.utc.strftime('%Y%m%d%H%M%S').to_i
    end
    @migration.to_s
  end

  def create_uploader_content_builder_image_model
    template 'content_builder_image_uploader.rb',
             'app/uploaders/content_builder_image_uploader.rb'
  end

  def create_rails_admin_config_in_initializer
    template 'rails_admin_content_builder.rb',
             'config/initializers/rails_admin_content_builder.rb'
  end

  def create_migrations
    path = 'db/migrate'
    migration_template 'create_content_builder_category_migration.rb',
                       File.join(path, 'create_content_builder_categories.rb')
    migration_template 'create_content_builder_migration.rb',
                       File.join(path, 'create_content_builders.rb')
    migration_template 'create_content_builder_image_migration.rb',
                       File.join(path, 'create_content_builder_images.rb')
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
rails_admin_content_builder_rails_6-1.2.0 lib/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder_rails_6-1.1.0 lib/rails_admin_content_builder_rails_6/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder_rails_6-1.0.1 lib/rails_admin_content_builder_rails_6/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder_rails_6-1.0.0 lib/rails_admin_content_builder_rails_6/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder-1.3.0 lib/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder-1.2.0 lib/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder-1.1.0 lib/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder-1.0.6 lib/generators/rails_admin_content_builder_generator.rb
rails_admin_content_builder-1.0.5 lib/generators/rails_admin_content_builder_generator.rb