Sha256: d7252ee0f652a6e297f3d177920d6d9921fe061e3676ff8a727aab1f8656b561

Contents?: true

Size: 964 Bytes

Versions: 80

Compression:

Stored size: 964 Bytes

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)
        CmsRestApi.put(endpoint("objs/#{migration_store_obj.id}"),
          obj: {versions: ['string', value]})

        Workspace.current.reload
      end

      private

      def create
        CmsRestApi.post(endpoint('objs'),
          obj: {_path: path, _obj_class: 'MigrationStore', versions: ['string', '']})

        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

80 entries across 80 versions & 1 rubygems

Version Path
scrivito_sdk-1.6.0.rc5 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.4.rc1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.6.0.rc4 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.6.0.rc3 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.3 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.6.0.rc2 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.3.rc1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.6.0.rc1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.2 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.2.rc1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.1.rc2 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.1.rc1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.0 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.0.rc2 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.5.0.rc1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.4.2 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.4.1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.4.1.rc1 lib/scrivito/migrations/cms_backend.rb
scrivito_sdk-1.4.0 lib/scrivito/migrations/cms_backend.rb