Console

This commandline tool helps you to keep your local environments in sync with an Open content of your choice.

This tool uses Symfony’s console component. This means that it inherits the default Symfony console command and options.

Quick start

run www/vendor/bin/concepts from root if installed into project.

Commands

  • api - All CRUD-functions of the Concept-api,

  • bootstrap - Add all concepts from one OC to a site-url

  • sync - Synchronize events from one Open content to a site-url

How it works

In essence commands will always target a site so all commands will require the url of a site:

$ www/vendor/bin/concepts [command] <site>

For more more information, each command can be run with the -h flag:

$ www/vendor/bin/concepts [command] -h

All commands can be used for stage and production sites as well.

Source

Depending on the command you may be prompted for Open Content credentials. First enter the domain of the Open content you would like to use. This is added without schema (http/https). Then add the credentials to use while connecting to that Open Content.

This can be made easier by updating following variables in your local ./env:

  • OC_URL

  • OC_USER

  • OC_PASSWORD

The commands will then ask you to use them instead or you can just continue with that information as default values.

The password is bound to the user. This means that you need to provide a password if you enter another user than the one provided by .env even if it is the same.

Api Command

This command will request a sites concept API with one of our create|read|update|delete (CRUD) functions. It dose not require a source since the uuids will be provided as part och the command.

Arguments

  • site (Required) - The domain to target. Add without schema (http/https).

  • route (Optional) - The CRUD-functions to request or the more general sync-function

  • uuid (Optional) - One or a comma separated list of uuids you would like to handle

Usage

$ www/vendor/bin/concepts api <site> [<route> [<uuid>]]

Will prompt for uuid to create:

$ www/vendor/bin/concepts api <site> create

Both route and uuid will be prompted on execution if not set from the command.

Will prompt for uuid to create:

$ www/vendor/bin/concepts api <site> create

Will create the requested uuid:

$ www/vendor/bin/concepts api <site> create XXX-XXX-XXX

Use comma separation to handle multiple objects

Bootstrap Command

This command will "bootstrap" a site with concepts from a chosen Open Content. This means that all concepts will be fetched and added to the targeted site.

Arguments

  • site (Required) - The domain to target. Add without schema (http/https).

Usage

$ www/vendor/bin/concepts bootstrap <site>

Since this command probably will take some time to perform we have taken some precautions. We are actually first storing all of the Concepts locally. Then, one-by-one, we start picking objects from the locally stored list and use the api endpoints to try to added objects. Once added they will be removed from store. This means that a bootstrap-session may be paused and continued at a later time. You will also get notified if you get lots of errors while bootstrapping. You can then have a look att them and then choose to clear and continue or pause to take action before continuing.

We also fetch the last event from the event log so we know where to start synchronizing from once the bootstrap is done se sync.

If there is an unfinished process when this command is run you will be notified with the options to quit or continue.

You can only have one paused bootstrap-process at a time. Each new bootstrap-session(new site) will clear the previous one.

Sync Command

This command uses the event log from a chosen Open Content to synchronize a site. It will fetch events and respond to events concerning content type Concept. requesting the concept-api for the following types of events:

  • ADD

  • DELETE

  • UPDATE

Arguments

  • site (Required) - The domain to target. Add without schema (http/https).

Usage

$ www/vendor/bin/concepts sync <site>

This command will store the last handled event locally This means that a sync-process can be paused and continued later. This will also provide you with the possibility to keep a site up-to-date. As long as you have a "last handled event" stored locally you can use sync to continue synchronizing your site.

If there is an unfinished bootstrap-process for the targeted site when this command is run you will be notified with the options to quit or continue.

You can only have one sync-process at a time. Each new sync-session(new site) will clear the previous one.

Local Storage

As part of performance we store some data locally. The storage is located in [pluginPath]/commandStorage and consists of the following files:

  • conceptUuids.json - will contain a list of uuids yet to be used by the bootstrap command.

  • currentState.json - Will contain the "current state" of your site. This includes the last handled event id and the site that is currently being used for bootstrap and sync.

Last updated