Sha256: a8860cbe6d24c0b1b10dc4a930cd7e05e82bb20985dbced8c604ddd29c471636

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

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
    #       create_attribute(: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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.9.5 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.9.4 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.9.3.1.36404185 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.9.2.1.125136549 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.9.1.3.22208381 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.9.0.3.197272233 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.3.174.51542603 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.3.115.227021242 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.3.73.75172665 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.3.2.153416031 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.3.67.110847540 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.3.1.23895778 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.2.36.82613853 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.2.7.128454143 lib/rails_connector/migrations/migration.rb
infopark_cloud_connector-6.8.1.26.236500544 lib/rails_connector/migrations/migration.rb