module RailsConnector module Migrations # CMS Migrations can alter the structure and content of the CMS and allow # other developers to simultaneously apply changes. Migrations provide a set # of methods to create, update or delete CMS objects, attributes and object # classes. # # @example Simple Migration # # class CreateTestAttribute < RailsConnector::Migrations::Migration # def up # add_attribute_to('homepage', :name => 'test', :type => 'string') # end # end class Migration include MigrationDsl attr_accessor :name attr_accessor :version def initialize(name, version) @name = name @version = version.to_i end def migrate announce 'migrating' time = Benchmark.measure { up } announce 'migrated (%.4fs)' % time.real; puts end private def announce(message) text = "#{version} #{name}: #{message}" length = [0, 75 - text.length].max puts('== %s %s' % [text, '=' * length]) end end end end