Ruby Library and Command Line tools for BagIt
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
bin Log errors from validatable gem at log level 'error' Dec 14, 2016
lib Version bump! Dec 14, 2016
spec Add coveralls Nov 1, 2016
.gitignore First stab at reformatting this gem a bit. Aug 7, 2013
.travis.yml Update travis.yml Oct 30, 2016
Gemfile First stab at reformatting this gem a bit. Aug 7, 2013
LICENSE.txt usual stuff Feb 17, 2009 Updating README Nov 1, 2016
bagit.gemspec Update gemspec with min ruby version Nov 1, 2016

BagIt (for ruby)

Build Status Coverage Status

This is a Ruby library and command line utility for creating BagIt archives based on the BagItspec v0.97.

Supported Features:

  • Bag creation
  • Manifest & tagmanifest generation
  • Generation of tag files bag-info.txt and bagit.txt
  • Fetching remote files (fetch.txt)
  • Bag validation


# gem install bagit validatable

Example: making a bag

require 'bagit'

# make a new bag at base_path
bag = base_path

# make a new file
bag.add_file("samplefile") do |io|
  io.puts "Hello Bag!"

# generate the manifest and tagmanifest files

Example: validating an existing bag

bag = existing_base_path

if bag.valid?
  puts "#{existing_base_path} is valid"
  puts "#{existing_base_path} is not valid"

Console Tool

# create a new bag/add files to existing bag
bagit add -f file1 file2 -t tagfile1 tagfile2 ./path/to/bag 
# validate
bagit validate ./path/to/bag
# for other commands
bagit --help

Copyright © 2009, Francesco Lazzarino.

Current maintainer: Jamie Little.

Initial development sponsored by Florida Center for Library Automation.

See LICENSE.txt for terms.