lib/bagit/bag.rb in bagit-0.3.2 vs lib/bagit/bag.rb in bagit-0.3.4
- old
+ new
@@ -4,24 +4,24 @@
require 'bagit/manifest'
require 'bagit/string'
require 'bagit/valid'
module BagIt
-
# Represents the state of a bag on a filesystem
class Bag
attr_reader :bag_dir
include Validity # Validity functionality
include Info # bagit & bag info functionality
include Manifest # manifest related functionality
include Fetch # fetch related functionality
# Make a new Bag based at path
- def initialize(path, info={})
+ def initialize(path, info={}, create=false)
+
+
@bag_dir = path
-
# make the dir structure if it doesn't exist
FileUtils::mkdir bag_dir unless File.directory? bag_dir
FileUtils::mkdir data_dir unless File.directory? data_dir
# write some tag info if its not there
@@ -30,9 +30,10 @@
end
unless File.exist? bag_info_txt_file
write_bag_info(info)
end
+
end
# Return the path to the data directory
def data_dir
File.join @bag_dir, 'data'