bagit 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bagit.rb +2 -2
- data/lib/bagit/bag.rb +4 -4
- data/lib/bagit/info.rb +9 -9
- data/lib/bagit/valid.rb +1 -0
- metadata +27 -9
data/lib/bagit.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# == About bagit.rb
|
2
2
|
# Author:: Francesco Lazzarino (mailto:flazzarino@gmail.com)
|
3
|
-
# Functionality conforms to the BagIt Spec v0.
|
3
|
+
# Functionality conforms to the BagIt Spec v0.96:
|
4
4
|
# http://www.cdlib.org/inside/diglib/bagit/bagitspec.html
|
5
5
|
|
6
6
|
require 'bagit/bag'
|
7
7
|
|
8
8
|
module BagIt
|
9
9
|
# The version of the BagIt specification the code is conforming to.
|
10
|
-
SPEC_VERSION = '0.
|
10
|
+
SPEC_VERSION = '0.96'
|
11
11
|
end
|
data/lib/bagit/bag.rb
CHANGED
@@ -13,7 +13,7 @@ module BagIt
|
|
13
13
|
attr_reader :bag_dir
|
14
14
|
|
15
15
|
include Validity # Validity functionality
|
16
|
-
include Info #
|
16
|
+
include Info # bagit & bag info functionality
|
17
17
|
include Manifest # manifest related functionality
|
18
18
|
include Fetch # fetch related functionality
|
19
19
|
|
@@ -27,11 +27,11 @@ module BagIt
|
|
27
27
|
|
28
28
|
# write some tag info if its not there
|
29
29
|
unless File.exist? bagit_txt_file
|
30
|
-
|
30
|
+
write_bagit("BagIt-Version" => SPEC_VERSION, "Tag-File-Character-Encoding" => "UTF-8")
|
31
31
|
end
|
32
32
|
|
33
|
-
unless File.exist?
|
34
|
-
|
33
|
+
unless File.exist? bag_info_txt_file
|
34
|
+
write_bag_info('Bag-Software-Agent' => "BagIt Ruby Gem (http://bagit.rubyforge.org)")
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
data/lib/bagit/info.rb
CHANGED
@@ -4,27 +4,27 @@ module BagIt
|
|
4
4
|
|
5
5
|
module Info
|
6
6
|
|
7
|
-
def
|
8
|
-
File.join bag_dir, '
|
7
|
+
def bag_info_txt_file
|
8
|
+
File.join bag_dir, 'bag-info.txt'
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
read_info_file
|
11
|
+
def bag_info
|
12
|
+
read_info_file bag_info_txt_file
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
write_info_file
|
15
|
+
def write_bag_info(hash)
|
16
|
+
write_info_file bag_info_txt_file, hash
|
17
17
|
end
|
18
18
|
|
19
19
|
def bagit_txt_file
|
20
20
|
File.join bag_dir, 'bagit.txt'
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def bagit
|
24
24
|
read_info_file bagit_txt_file
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
27
|
+
def write_bagit(hash)
|
28
28
|
write_info_file bagit_txt_file, hash
|
29
29
|
end
|
30
30
|
|
@@ -37,7 +37,7 @@ module BagIt
|
|
37
37
|
entries = io.read.split /\n(?=[^\s])/
|
38
38
|
|
39
39
|
entries.inject({}) do |hash, line|
|
40
|
-
name, value = line.chomp.split /\s*:\s
|
40
|
+
name, value = line.chomp.split /\s*:\s*/, 2
|
41
41
|
hash.merge({name => value})
|
42
42
|
end
|
43
43
|
|
data/lib/bagit/valid.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bagit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Francesco Lazzarino
|
@@ -9,19 +15,25 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-07-28 00:00:00 -04:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: semver
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ~>
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 1
|
33
|
+
- 0
|
23
34
|
version: 0.1.0
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
description: Ruby Library and Command Line tools for bagit
|
26
38
|
email: flazzarino@gmail.com
|
27
39
|
executables: []
|
@@ -51,21 +63,27 @@ rdoc_options: []
|
|
51
63
|
require_paths:
|
52
64
|
- lib
|
53
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
54
67
|
requirements:
|
55
68
|
- - ">="
|
56
69
|
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
71
|
+
segments:
|
72
|
+
- 0
|
57
73
|
version: "0"
|
58
|
-
version:
|
59
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
60
76
|
requirements:
|
61
77
|
- - ">="
|
62
78
|
- !ruby/object:Gem::Version
|
79
|
+
hash: 3
|
80
|
+
segments:
|
81
|
+
- 0
|
63
82
|
version: "0"
|
64
|
-
version:
|
65
83
|
requirements: []
|
66
84
|
|
67
85
|
rubyforge_project:
|
68
|
-
rubygems_version: 1.3.
|
86
|
+
rubygems_version: 1.3.7
|
69
87
|
signing_key:
|
70
88
|
specification_version: 3
|
71
89
|
summary: BagIt package generation and validation
|