Class: XMigra::SchemaManipulator
- Defined in:
- lib/xmigra/schema_manipulator.rb
Direct Known Subclasses
NewAccessArtifactAdder, NewIndexAdder, NewMigrationAdder, PermissionScriptWriter, SchemaUpdater
Constant Summary collapse
- DBINFO_FILE =
'database.yaml'
- PERMISSIONS_FILE =
'permissions.yaml'
- ACCESS_SUBDIR =
'access'
- INDEXES_SUBDIR =
'indexes'
- STRUCTURE_SUBDIR =
'structure'
- VERINC_FILE =
'branch-upgrade.yaml'
- PLUGIN_KEY =
'XMigra plugin'
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
Instance Method Summary collapse
- #branch_upgrade_file ⇒ Object
-
#initialize(path) ⇒ SchemaManipulator
constructor
A new instance of SchemaManipulator.
- #load_plugin! ⇒ Object
Constructor Details
#initialize(path) ⇒ SchemaManipulator
Returns a new instance of SchemaManipulator.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# 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 |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
39 40 41 |
# File 'lib/xmigra/schema_manipulator.rb', line 39 def path @path end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
39 40 41 |
# File 'lib/xmigra/schema_manipulator.rb', line 39 def plugin @plugin end |
Instance Method Details
#branch_upgrade_file ⇒ Object
41 42 43 |
# File 'lib/xmigra/schema_manipulator.rb', line 41 def branch_upgrade_file @path.join(STRUCTURE_SUBDIR, VERINC_FILE) end |