Sha256: cebd0b43014fa8b9a4a6afcbb299be497a84f7aca09c80b4b53582418fb40dd4

Contents?: true

Size: 882 Bytes

Versions: 11

Compression:

Stored size: 882 Bytes

Contents

require 'rails/generators'
require 'rails/generators/generated_attribute'

module Redde
  module Generators
    class PhotoGenerator < ::Rails::Generators::Base
      include Rails::Generators::Migration
      source_root File.expand_path('../templates', __FILE__)

      def self.next_migration_number(_path)
        Time.now.utc.strftime('%Y%m%d%H%M%S')
      end

      def copy_controller
        template 'controller.rb', 'app/controllers/admin/photos_controller.rb'
      end

      def copy_views
        directory 'photos', 'app/views/admin/photos'
      end

      def copy_model
        template 'photo.rb', 'app/models/photo.rb'
      end

      def copy_uploader
        template 'uploader.rb', 'app/uploaders/photo_uploader.rb'
      end

      def copy_migration
        migration_template 'create_photos.rb', 'db/migrate/create_photos.rb'
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
redde-0.1.18 lib/generators/redde/photo/photo_generator.rb
redde-0.1.17 lib/generators/redde/photo/photo_generator.rb
redde-0.1.16 lib/generators/redde/photo/photo_generator.rb
redde-0.1.15 lib/generators/redde/photo/photo_generator.rb
redde-0.1.14 lib/generators/redde/photo/photo_generator.rb
redde-0.1.13 lib/generators/redde/photo/photo_generator.rb
redde-0.1.12 lib/generators/redde/photo/photo_generator.rb
redde-0.1.11 lib/generators/redde/photo/photo_generator.rb
redde-0.1.10 lib/generators/redde/photo/photo_generator.rb
redde-0.1.9 lib/generators/redde/photo/photo_generator.rb
redde-0.1.8 lib/generators/redde/photo/photo_generator.rb