Sha256: 2169681931634a57c0d22434d41785091d8a2f405ab4c977e0bb136fe6e0f8fe
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
module Scrivito module Migrations class CmsBackend def read if obj = find_migration_store_obj obj.data_from_cms.value_of('versions') else '' end end def save(value) if Workspace.current.uses_obj_classes CmsRestApi.put(endpoint("objs/#{migration_store_obj.id}"), obj: {versions: value}) else CmsRestApi.put(endpoint("objs/#{migration_store_obj.id}"), obj: {versions: ['string', value]}) end Workspace.current.reload end private def create if Workspace.current.uses_obj_classes CmsRestApi.post(endpoint('objs'), obj: {_path: path, _obj_class: 'MigrationStore', versions: ''}) else CmsRestApi.post(endpoint('objs'), obj: {_path: path, _obj_class: 'MigrationStore', versions: ['string', '']}) end Workspace.current.reload end def migration_store_obj create unless find_migration_store_obj find_migration_store_obj end def find_migration_store_obj Obj.find_by_path(path) end def path '/_internal/migration-store' end def endpoint(path) "workspaces/#{Workspace.current.id}/#{path}" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems