Rake tasks - LafayetteCollegeLibraries/spot GitHub Wiki


spot:ci

bundle exec rails spot:ci

Runs CI tasks (Rubocop + RSpec tests)

spot:clear_ingest_tmp

bundle exec rails spot:clear_ingest_tmp[days_since = 3]

Clears out directories in tmp/ingest that are older than days_since, which defaults to 3 days. This is a convenience wrapper around the following:

find tmp/ingest -ctime +3 -type d -d 1

solely so I didn't have to need to remember the find command.

spot:collections:create

bundle exec rails spot:collections:create (config=/path/to/collections_config.yml)

Creates collections programmatically using a YAML config file. The default file lives at config/collections.yml and looks like:

- title: Lafayette Magazine archive
  visibility: public
  metadata:
    description: >
      Digitized archive of Lafayette publications:
      Lafayette Alumnus, Lafayette Alumni Quarterly,
      Lafayette Magazine, as well as the Football
      News Letter and Leopard Letter.

Note that this is essentially a wrapper around Spot::CollectionsFromConfig, which has a lot of inline documentation.

spot:dev:reset

bundle exec rails spot:dev:reset

💥 The nuclear option ⚠️

  • clears out the Fedora + Solr databases
  • drops, resets, and reseeds the PostgreSQL database
  • clears out Redis
  • empties out the derivatives and upload paths

Only affects the 'development' environment (this environment variable is set beforehand) and requires the user to type yes to confirm.

spot:ingest

bundle exec spot:ingest source=source work_class=work_class path=/path/to/bag/files working_path=/path/to/store/tmp/files

The task used to ingest items into the repository. Currently this uses the zipped-BagIt record importer, but may expand to allow other formats in the future. It relies on the following environment variables:

variable description required?
source the origin of the record (used during migration to determine the metadata mapper used) yes
work_class the class used for the object yes
path path to the ingest file(s). if a directory, all zip files are imported yes
working_path where to store the extracted bags while enqueued for ingest no (defaults to Rails.root + 'tmp/ingest')

spot:rdf:clear_labels

bundle exec rails spot:rdf:clear_labels[days_ago = 60]

Clears out RdfLabel values older than days_ago days. Default time is 60 days.

spot:rdf:load

bundle exec rails spot:rdf:load[name, uri]

Loads remote RDF terms locally using Spot::RDFAuthorityParser

spot:roles:create

bundle exec spot:roles:create roles=list,of,roles

Creates roles (when not existing) supplied by the environment variable roles.