Sha256: 822820a1683a7dde9a7945ec986b40f1daf8773881ebe90cf38f20618ae0b25c

Contents?: true

Size: 970 Bytes

Versions: 10

Compression:

Stored size: 970 Bytes

Contents

class CkeditorMigrationGenerator < Rails::Generator::Base

  def manifest
    record do |m|
      create_models(m)
      create_migration(m)
    end
  end

  protected
    
    def create_models(m)
      m.directory(File.join('app', 'models', ckeditor_dir))
      
      m.template "models/#{generator_dir}/asset.rb",
               File.join('app/models', ckeditor_dir, "asset.rb")
      
      m.template "models/#{generator_dir}/picture.rb",
               File.join('app/models', ckeditor_dir, "picture.rb")
      
      m.template "models/#{generator_dir}/attachment_file.rb",
               File.join('app/models', ckeditor_dir, "attachment_file.rb")
    end
    
    def create_migration(m)
      m.migration_template "models/#{generator_dir}/migration.rb", 'db/migrate', :migration_file_name => "create_ckeditor_assets.rb"
    end
      
    def ckeditor_dir
      'ckeditor'
    end
    
    def generator_dir
      options[:backend] || "paperclip"
    end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
artemk-ckeditor-3.5.5 generators/ckeditor_migration/ckeditor_migration_generator.rb
ckeditor-jess-3.4.3 generators/ckeditor_migration/ckeditor_migration_generator.rb
artemk-ckeditor-3.5.4 generators/ckeditor_migration/ckeditor_migration_generator.rb
artemk-ckeditor-3.4.4 generators/ckeditor_migration/ckeditor_migration_generator.rb
artemk-ckeditor-3.4.3 generators/ckeditor_migration/ckeditor_migration_generator.rb
ckeditor-3.4.3 generators/ckeditor_migration/ckeditor_migration_generator.rb
ckeditor-3.4.2 generators/ckeditor_migration/ckeditor_migration_generator.rb
ckeditor-3.4.1 generators/ckeditor_migration/ckeditor_migration_generator.rb
ckeditor-3.4.0 generators/ckeditor_migration/ckeditor_migration_generator.rb
ckeditor-3.3.2 generators/ckeditor_migration/ckeditor_migration_generator.rb