module Legion::Extensions::Data
Public Instance Methods
build()
click to toggle source
# File lib/legion/extensions/data.rb, line 10 def build Legion::Logging.fatal 'testing inside run' @models = [] @migrations = [] if Dir[File.expand_path("#{data_path}/migrations/*.rb")].count.positive? log.debug('Has migrations, checking status') run end models = Dir[File.expand_path("#{data_path}/models/*.rb")] if models.count.positive? log.debug('Including LEX models') models.each do |file| require file end models_class.constants.select do |model| models_class.const_get(model).extend Legion::Extensions::Data::Model end end true end
extension_model()
click to toggle source
# File lib/legion/extensions/data.rb, line 34 def extension_model Legion::Data::Model::Extension[namespace: lex_class.to_s] end
migrate_class()
click to toggle source
# File lib/legion/extensions/data.rb, line 46 def migrate_class @migrate_class ||= Legion::Extensions::Data::Migrator.new(migrations_path, lex_class.to_s, lex_name) end
migrations_path()
click to toggle source
# File lib/legion/extensions/data.rb, line 42 def migrations_path "#{data_path}/migrations/" end
run()
click to toggle source
# File lib/legion/extensions/data.rb, line 50 def run Legion::Logging.fatal 'testing inside run' return true if migrate_class.is_current? log.debug('Running LEX schema migrator') results = migrate_class.run extension_model.update(schema_version: results) end
schema_version()
click to toggle source
# File lib/legion/extensions/data.rb, line 38 def schema_version extension_model.values[:schema_version] end