class Onoma::Migrator::Reference
Public Class Methods
Source
# File lib/onoma/migrator/reference.rb, line 14 def initialize @set = if Onoma.reference_path.exist? Onoma::NomenclatureSet.load_file(Onoma.reference_path) else Onoma::NomenclatureSet.new end end
Source
# File lib/onoma/migrator/reference.rb, line 4 def self.run(migration) ref = new migration.each_action do |action| ref.send(action.action_name, action) end ref.version = migration.number puts "Write DB in #{Onoma.reference_path.relative_path_from(Onoma.root)}" ref.write end
Public Instance Methods
Source
# File lib/onoma/migrator/reference.rb, line 58 def item_change(action) @set.change_item(action.nomenclature, action.name, action.changes) end
Source
# File lib/onoma/migrator/reference.rb, line 54 def item_creation(action) @set.add_item(action.nomenclature, action.name, action.options) end
Source
# File lib/onoma/migrator/reference.rb, line 62 def item_merging(action) @set.merge_item(action.nomenclature, action.name, action.into) end
Source
# File lib/onoma/migrator/reference.rb, line 66 def item_removal(action) @set.remove_item(action.nomenclature, action.name) end
Source
# File lib/onoma/migrator/reference.rb, line 38 def nomenclature_change(action) @set.change_nomenclature(action.nomenclature, action.changes) end
Source
# File lib/onoma/migrator/reference.rb, line 34 def nomenclature_creation(action) @set.add_nomenclature(action.name, action.options) end
Source
# File lib/onoma/migrator/reference.rb, line 42 def nomenclature_removal(action) @set.remove_nomenclature(action.nomenclature) end
Source
# File lib/onoma/migrator/reference.rb, line 50 def property_change(action) @set.change_property(action.nomenclature, action.name, action.changes) end
Source
# File lib/onoma/migrator/reference.rb, line 46 def property_creation(action) @set.add_property(action.nomenclature, action.name, action.type, action.options) end
Source
# File lib/onoma/migrator/reference.rb, line 26 def version=(number) @set.version = number end
Source
# File lib/onoma/migrator/reference.rb, line 30 def write File.write(Onoma.reference_path, @set.to_xml) end