Sha256: ac975d4a7cafd87ecb2889a2acc3791ee4fae29e29f494eeb8ef21827d58f180

Contents?: true

Size: 1.13 KB

Versions: 8

Compression:

Stored size: 1.13 KB

Contents

# Rails 2: class DynamicImageGenerator < Rails::Generator::NamedBase

require 'rails/generators'
require 'rails/generators/migration'

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

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

    def next_migration_number(dirname)
      if ActiveRecord::Base.timestamped_migrations
        Time.now.utc.strftime("%Y%m%d%H%M%S")
      else
        "%.3d" % (current_migration_number(dirname) + 1)
      end
    end

  end

  def migrations
    migration_template 'migrations/create_images.rb', 'db/migrate/create_images.rb'
  end

  # def manifest
  # 	record do |m|
  # 		#m.file 'controllers/images_controller.rb', 'app/controllers/images_controller.rb'
  # 		#m.file 'models/image.rb', 'app/models/image.rb'
  # 		#m.file 'models/binary.rb', 'app/models/binary.rb'
  # 		m.file 'migrations/20090909231629_create_binaries.rb', 'db/migrate/20090909231629_create_binaries.rb'
  # 		m.file 'migrations/20090909231630_create_images.rb', 'db/migrate/20090909231630_create_images.rb'
  # 	end
  # end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dynamic_image-1.0.4 lib/generators/dynamic_image/dynamic_image_generator.rb
dynamic_image-1.0.3 lib/generators/dynamic_image/dynamic_image_generator.rb
dynamic_image-1.0.2 lib/generators/dynamic_image/dynamic_image_generator.rb
dynamic_image-1.0.1 lib/generators/dynamic_image/dynamic_image_generator.rb
dynamic_image-0.9.9 lib/generators/dynamic_image/dynamic_image_generator.rb
dynamic_image-0.9.8 lib/generators/dynamic_image/dynamic_image_generator.rb
dynamic_image-0.9.7 lib/generators/dynamic_image/dynamic_image_generator.rb
dynamic_image-0.9.6 lib/generators/dynamic_image/dynamic_image_generator.rb