class XMigra::SchemaManipulator

Constants

ACCESS_SUBDIR
DBINFO_FILE
INDEXES_SUBDIR
PERMISSIONS_FILE
PLUGIN_KEY
STRUCTURE_SUBDIR
VERINC_FILE

Attributes

path[R]
plugin[R]

Public Class Methods

new(path) click to toggle source
# File lib/xmigra/schema_manipulator.rb, line 13
def initialize(path)
  @path = Pathname.new(path)
  @db_info = YAML.load_file(@path + DBINFO_FILE)
  raise TypeError, "Expected Hash in #{DBINFO_FILE}" unless Hash === @db_info
  @db_info = Hash.new do |h, k|
    raise Error, "#{DBINFO_FILE} missing key #{k.inspect}"
  end.update(@db_info)
  
  db_system = @db_info['system']
  extend(
    @db_specifics = DatabaseSupportModules.find {|m|
      m::SYSTEM_NAME == db_system
    } || NoSpecifics
  )
  
  extend(
    @vcs_specifics = VersionControlSupportModules.find {|m|
      m.manages(path)
    } || NoSpecifics
  )
  
  if @db_info.has_key? PLUGIN_KEY
    @plugin = @db_info[PLUGIN_KEY]
  end
end

Public Instance Methods

branch_upgrade_file() click to toggle source
# File lib/xmigra/schema_manipulator.rb, line 41
def branch_upgrade_file
  @path.join(STRUCTURE_SUBDIR, VERINC_FILE)
end
load_plugin!() click to toggle source
# File lib/xmigra/schema_manipulator.rb, line 45
def load_plugin!
  Plugin.load! plugin if plugin
end