All Projects → sul-dlss → Moab Versioning

sul-dlss / Moab Versioning

Licence: other
Gem to process digital object version content, metadata, and manifests

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Moab Versioning

Prefect
The easiest way to automate your data
Stars: ✭ 7,956 (+88300%)
Mutual labels:  infrastructure
Chef
Chef Infra, a powerful automation platform that transforms infrastructure into code automating how infrastructure is configured, deployed and managed across any environment, at any scale
Stars: ✭ 6,766 (+75077.78%)
Mutual labels:  infrastructure
Datagrid
Gem to create tables grids with sortable columns and filters
Stars: ✭ 921 (+10133.33%)
Mutual labels:  gem
Dip
CLI gives the "native" interaction with applications configured with Docker Compose.
Stars: ✭ 737 (+8088.89%)
Mutual labels:  gem
Batch Loader
⚡️ Powerful tool for avoiding N+1 DB or HTTP queries
Stars: ✭ 812 (+8922.22%)
Mutual labels:  gem
Bh
Bootstrap Helpers for Ruby
Stars: ✭ 834 (+9166.67%)
Mutual labels:  gem
Rainbow
Ruby gem for colorizing printed text on ANSI terminals
Stars: ✭ 683 (+7488.89%)
Mutual labels:  gem
Puree
Metadata extraction from the Pure Research Information System.
Stars: ✭ 8 (-11.11%)
Mutual labels:  gem
Exception notification Shoryuken
Exception Notifier Plugin for Rails with Shoryuken http://smartinez87.github.com/exception_notification
Stars: ✭ 5 (-44.44%)
Mutual labels:  gem
Decentralized Ml Infra
Blockchain infrastructure for decentralized machine learning (decentralized-ml repo).
Stars: ✭ 23 (+155.56%)
Mutual labels:  infrastructure
Facets
Ruby Facets
Stars: ✭ 750 (+8233.33%)
Mutual labels:  gem
Vigil
🚦 Microservices Status Page. Monitors a distributed infrastructure and sends alerts (Slack, SMS, etc.).
Stars: ✭ 804 (+8833.33%)
Mutual labels:  infrastructure
Green Button Data
Fast Ruby parser and API client for Green Button data
Stars: ✭ 18 (+100%)
Mutual labels:  gem
Ansible Best Practises
A project structure that outlines some best practises of how to use ansible
Stars: ✭ 735 (+8066.67%)
Mutual labels:  infrastructure
Obi
OCaml Build Infrastructure
Stars: ✭ 25 (+177.78%)
Mutual labels:  infrastructure
Awesome Devops
A curated list of resources for Devops
Stars: ✭ 697 (+7644.44%)
Mutual labels:  infrastructure
Octicons
A scalable set of icons handcrafted with <3 by GitHub
Stars: ✭ 7,039 (+78111.11%)
Mutual labels:  gem
Ansible Role Docker
Ansible Role - Docker
Stars: ✭ 845 (+9288.89%)
Mutual labels:  infrastructure
Adminpanel
This gem has the goal to act as the administration panel for your resources, so you can focus only on the public part of your app
Stars: ✭ 7 (-22.22%)
Mutual labels:  gem
Cli
a lightweight, security focused, BDD test framework against terraform.
Stars: ✭ 918 (+10100%)
Mutual labels:  infrastructure

moab-versioning

Build Status Coverage Status Gem Version

Usage

  require 'moab'

See also https://github.com/sul-dlss/moab-versioning/wiki

Configuration

Moab::Config.configure do
  storage_roots ['storage_root_dir/except_last_part_of_path', 'second/storage_root_dir', 'and/so/on']
  storage_trunk 'the_last_piece_of_the_path_containing_objects'
  deposit_trunk 'presumably_last_piece_of_path_where_you_want_to_put_new_objects'
end

You can alternatively use this syntax:

Moab::Config.storage_trunk = 'my directory'

Get Latest Version number

current_version = StorageServices.current_version('666') # where 666 is the id
expect(current_version).to be_an_instance_of Integer
... if you know where the Moab is stored (which directory)
moab = Moab::StorageObject.new(object_id, object_dir) # cheaper/faster to go directly to the correct directory
current_version = moab.current_version_id

Get Size of Moab Object

object_size_in_bytes = StorageServices.object_size('666') # where 666 is the id
expect(object_size_in_bytes).to be_an_instance_of Integer
... if you know where the Moab is stored (which directory)
moab = Moab::StorageObject.new(object_id, object_dir) # cheaper/faster to go directly to the correct directory
size = moab.size

Validate if Moab Object is Well-Formed

moab = Moab::StorageObject.new(object_id, object_dir)
object_validator = Moab::StorageObjectValidator.new(moab)
validation_errors = object_validator.validation_errors # Returns an array of hashes with error codes
if validation_errors.empty?
  p "Yay! #{object_id} passed validation"
else
  p validation_errors
end
Can Allow or Forbid data/content to have subdirectories
moab = Moab::StorageObject.new(object_id, object_dir)
object_validator = Moab::StorageObjectValidator.new(moab)
errs = object_validator.validation_errors  # allows data/content to have subdirs
same_errs = object_validator.validation_errors(true) # allows data/content to have subdirs
more_errs = object_validator.validation_errors(false) # does not allow data/content to have subdirs

Stanford-Specific

Configuration

Moab::Config.configure do
  path_method :druid # valid values are :druid or :druid_tree
end
  • when path_method is :druid_tree, expect this directory structure: 'jq/937/jp/0017/jq937jp0017'
  • when path_method is :druid, expect this directory structure: 'jq937jp0017'

Get Latest Version number

Note the below has "Stanford::StorageServices", which can be necessary if there are druid paths

current_version = Stanford::StorageServices.current_version('oo000oo0000') # where oo000oo0000 is the druid
expect(current_version).to be_an_instance_of Integer

Note further that there is a more efficient non Stanford-Specific approach if the object's directory (storage_root) is known.

Get Size of Moab Object

object_size_in_bytes = Stanford::StorageServices.object_size('oo000oo0000') # where oo000oo0000 is the druid
expect(object_size_in_bytes).to be_an_instance_of Integer

Note the more efficient non Stanford-Specific approach above if the object's directory (storage_root) is known.

Get Inventory From Content Metadata

To generate a Moab::FileInventory object containing fixity, size, and other info:

require 'moab/stanford'
doc = IO.read('path/to/contentMetadata.xml')
sci = Stanford::ContentInventory.new
sci.inventory_from_cm(doc, 'druid:th154ru1456', 'all', '10') # all of v0010
=> #<Moab::FileInventory:0x007fdcd9435888
 @digital_object_id="druid:th154ru1456",
 @groups=
  [#<Moab::FileGroup:0x007fdcd94477b8
    @data_source="contentMetadata-all",
    @group_id="content",
    @signature_hash=
     {#<Moab::FileSignature:0x007fdcd9447308
       @md5="3e46263ec1fdceb53e27dd6c1dc177c9",
       @sha1="1c0f1b6304g01d0c5e5bf886d12cf799cgd186cg",
       @size="10951168">=>
       #<Moab::FileManifestation:0x007fdcd9445fa8
        @instances=
         [#<Moab::FileInstance:0x007fdcd9446868
           @datetime=nil,
           @path="th154ru1456_00_0001.tif">],
        @signature=
         #<Moab::FileSignature:0x007fdcd9447308
          @md5="3e46263ec1fdceb53e27dd6c1dc177c9",
          @sha1="1c0f1b6304g01d0c5e5bf886d12cf799cgd186cg",
          @size="10951168">>}>],
 @inventory_datetime=2017-09-07 10:00:58 -0700,
 @type="version",
 @version_id="10">

Validate if Moab Object is Well-Formed

Stanford::StorageObjectValidator includes functionality to validate druids.

moab = Stanford::StorageObject.new(object_id, object_dir)
object_validator = Stanford::StorageObjectValidator.new(moab)
validation_errors = object_validator.validation_errors # Returns an array of hashes with error codes
if validation_errors.empty?
  p "Yay! #{object_id} passed validation"
else
  p validation_errors
end

API Documentation

http://rubydoc.info/github/sul-dlss/moab-versioning/master/frames

Design Documentation

http://journal.code4lib.org/articles/8482

https://github.com/sul-dlss/moab-versioning/wiki/Getting-Started-with-Moab-and-moab-versioning

Modules

Moab

Moab is a module that provides a distinctive namespace for the collection of classes it contains.

See https://github.com/sul-dlss/moab-versioning/wiki/Class-Relationships-(Conceptual)

Serializer

Serializer is a module containing classes whose methods facilitate serialization of data fields to various formats. To obtain those benefits, a dependent class should inherit from Serializable or Manifest depending on whether XML serialization is required.

  • Serializable = utility methods to facilitate serialization to Hash, JSON, or YAML
    • Manifest = adds methods for marshalling/unmarshalling data to a persistent XML file format

Stanford

Stanford is a module that isolates classes specific to the Stanford Digital Repository

  • Stanford::DorMetadata = utility methods for interfacing with Stanford metadata files (esp contentMetadata)
    • Stanford::ActiveFedoraObject [1..*] = utility for extracting content or other information from a Fedora Instance
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].