A long-lived project that still receives updates
PreservationUtils provides the FilePath module for standardizing filepaths for objects used in our Preservation services.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 0.1.0
~> 2.8, >= 2.8.6
 Project Readme

Cul::PreservationUtils

A collection of modules with Utility Methods related to working with Preservation objects.

Incudes:

  • FilePath: a module for standardizing filepaths for objects used in our Preservation services.

(More modules will be added in the future)

Preservation objects are put in cloud storage, either with Google Cloud or Amazon Web Services. Validation rules for object file paths were imlpemented based on the charactersets allowed in object names in Google Cloud and AWS.

Installation

bundle add cul/preservation_utils

If bundler is not being used to manage dependencies, install the gem by executing:

gem install cul/preservation_utils

Usage

You can access the FilePath module via namespace constants:

require 'cul/preservaion_utils'

# Determine if a file path is valid or not (invalid means it contains unsupported characters)

test_file_path = 'top_dir/!a$b%c%/我能.我能'
Cul::PreservationUtils::FilePath.valid_file_path?(test_file_path)
#=> False

# Remediate a file path

remediated_file_path = Cul::PreservationUtils::FilePath.remediate(test_file_path)
puts remediated_file_path #=> 'top_dir/_a_b_c_/Wo_Neng_.Wo_Neng_'

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/cul/cul-preservation_utils.