Sha256: 3af7bfe9636a01beda35e0591c5b66ebf1ef1f8752169879cb2ee04f042073a1

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

require 'rails/generators'

class RailsAdminFeaturedContentGenerator < 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(*)
    unless @migration
      @migration = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
    else
      @migration += 1
    end
    @migration.to_s
  end

  def create_uploader_featured_content_image_model
    template "featured_content_image_uploader.rb", "app/uploaders/featured_content_image_uploader.rb"
  end

  def create_rails_admin_config_in_initializer
    template "rails_admin_featured_content.rb", "config/initializers/rails_admin_featured_content.rb"
  end

  def create_migrations
    migration_template "create_featured_content_migration.rb", File.join('db/migrate', "create_featured_contents.rb")
    migration_template "create_featured_content_images_migration.rb", File.join('db/migrate', "create_featured_content_images.rb")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails_admin_featured_content-1.2.3 lib/generators/rails_admin_featured_content_generator.rb
rails_admin_featured_content-1.2.2 lib/generators/rails_admin_featured_content_generator.rb
rails_admin_featured_content-1.2.1 lib/generators/rails_admin_featured_content_generator.rb
rails_admin_featured_content-1.1.0 lib/generators/rails_admin_featured_content_generator.rb
rails_admin_featured_content-1.0.6 lib/generators/rails_admin_featured_content_generator.rb
rails_admin_featured_content-1.0.5 lib/generators/rails_admin_featured_content_generator.rb
rails_admin_featured_content-1.0.4 lib/generators/rails_admin_featured_content_generator.rb
rails_admin_featured_content-1.0.3 lib/generators/rails_admin_featured_content_generator.rb