stead 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.rvmrc ADDED
@@ -0,0 +1,2 @@
1
+ rvm ree@stead
2
+
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ gem 'nokogiri'
7
+ gem 'fastercsv'
8
+ gem 'trollop'
9
+
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ gem "shoulda", ">= 0"
15
+ gem "bundler", "~> 1.0.0"
16
+ gem "jeweler", "~> 1.5.2"
17
+ gem "rcov", ">= 0"
18
+ end
19
+
20
+ group :development, :test do
21
+ gem 'ruby-debug'
22
+ gem 'equivalent-xml'
23
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ columnize (0.3.2)
5
+ equivalent-xml (0.1.6)
6
+ nokogiri
7
+ fastercsv (1.5.4)
8
+ git (1.2.5)
9
+ jeweler (1.5.2)
10
+ bundler (~> 1.0.0)
11
+ git (>= 1.2.5)
12
+ rake
13
+ linecache (0.43)
14
+ nokogiri (1.4.4)
15
+ rake (0.8.7)
16
+ rcov (0.9.9)
17
+ ruby-debug (0.10.4)
18
+ columnize (>= 0.1)
19
+ ruby-debug-base (~> 0.10.4.0)
20
+ ruby-debug-base (0.10.4)
21
+ linecache (>= 0.3)
22
+ shoulda (2.11.3)
23
+ trollop (1.16.2)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.0.0)
30
+ equivalent-xml
31
+ fastercsv
32
+ jeweler (~> 1.5.2)
33
+ nokogiri
34
+ rcov
35
+ ruby-debug
36
+ shoulda
37
+ trollop
data/Rakefile CHANGED
@@ -1,27 +1,29 @@
1
1
  require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
2
10
  require 'rake'
3
11
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "stead"
8
- gem.summary = %Q{Spreadsheets To Encoded Archival Description}
9
- gem.description = %Q{Converts CSV files of a specific schema into EAD XML.}
10
- gem.email = "jronallo@gmail.com"
11
- gem.homepage = "http://github.com/jronallo/stead"
12
- gem.authors = ["Jason Ronallo"]
13
- gem.add_dependency "nokogiri", ">= 1.4.1"
14
- gem.add_dependency "fastercsv", ">= 1.5.0"
15
- gem.add_dependency "trollop", ">= 1.16.2"
16
- gem.add_development_dependency "shoulda", ">= 0"
17
- gem.add_development_dependency 'equivalent-xml'
18
- gem.files = FileList["[A-Z]*", "{bin,examples,lib}/**/*"]
19
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
- end
21
- Jeweler::GemcutterTasks.new
22
- rescue LoadError
23
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
+ gem.name = "stead"
16
+ gem.summary = %Q{Spreadsheets To Encoded Archival Description}
17
+ gem.description = %Q{Converts CSV files of a specific schema into EAD XML.}
18
+ gem.email = "jronallo@gmail.com"
19
+ gem.homepage = "http://github.com/jronallo/stead"
20
+ gem.authors = ["Jason Ronallo"]
21
+ # Include your dependencies below. Runtime dependencies are required when using your gem,
22
+ # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
23
+ # gem.add_runtime_dependency 'jabber4r', '> 0.1'
24
+ # gem.add_development_dependency 'rspec', '> 1.2.3'
24
25
  end
26
+ Jeweler::RubygemsDotOrgTasks.new
25
27
 
26
28
  require 'rake/testtask'
27
29
  Rake::TestTask.new(:test) do |test|
@@ -30,32 +32,11 @@ Rake::TestTask.new(:test) do |test|
30
32
  test.verbose = true
31
33
  end
32
34
 
33
- begin
34
- require 'rcov/rcovtask'
35
- Rcov::RcovTask.new do |test|
36
- test.libs << 'test'
37
- test.pattern = 'test/**/test_*.rb'
38
- test.verbose = true
39
- end
40
- rescue LoadError
41
- task :rcov do
42
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
43
- end
44
- end
45
-
46
- task :test => :check_dependencies
47
-
48
- begin
49
- require 'reek/adapters/rake_task'
50
- Reek::RakeTask.new do |t|
51
- t.fail_on_error = true
52
- t.verbose = false
53
- t.source_files = 'lib/**/*.rb'
54
- end
55
- rescue LoadError
56
- task :reek do
57
- abort "Reek is not available. In order to run reek, you must: sudo gem install reek"
58
- end
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
59
40
  end
60
41
 
61
42
  task :default => :test
@@ -65,8 +46,7 @@ Rake::RDocTask.new do |rdoc|
65
46
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
66
47
 
67
48
  rdoc.rdoc_dir = 'rdoc'
68
- rdoc.title = "stead #{version}"
49
+ rdoc.title = "something #{version}"
69
50
  rdoc.rdoc_files.include('README*')
70
51
  rdoc.rdoc_files.include('lib/**/*.rb')
71
52
  end
72
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
data/lib/stead/ead.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Stead
2
2
  class EadGenerator
3
- attr_accessor :csv, :ead, :template, :series, :component_parts
3
+ attr_accessor :csv, :ead, :template, :series, :subseries, :component_parts
4
4
 
5
5
  def initialize(opts = {})
6
6
  @csv = opts[:csv] || nil
@@ -53,9 +53,10 @@ module Stead
53
53
  @dsc = @ead.xpath('//xmlns:archdesc/xmlns:dsc')[0]
54
54
  if series?
55
55
  add_series
56
- end
56
+ add_subseries if subseries?
57
+ end
57
58
  @component_parts.each do |cp|
58
- c = node(file_component_part_name)
59
+ c = node(file_component_part_name(cp))
59
60
  c['level'] = 'file'
60
61
  c['audience'] = 'internal' if !cp['internal only'].nil?
61
62
  did = node('did')
@@ -101,7 +102,35 @@ module Stead
101
102
  series_did.add_child(unitdate)
102
103
  end
103
104
  end
104
-
105
+
106
+ def add_subseries
107
+ @component_parts.each do |cp|
108
+ if !cp['subseries number'].nil?
109
+ series_list = @dsc.xpath("xmlns:c01/xmlns:did/xmlns:unitid[text()='#{cp['series number']}']")
110
+ subseries_list = @dsc.xpath("xmlns:c01/xmlns:c02[@level='subseries']/xmlns:did/xmlns:unitid[text()='#{cp['subseries number']}']")
111
+ if series_list.length == 1 and subseries_list.length == 0
112
+ series = series_list.first.parent.parent
113
+ subseries_node = node('c02')
114
+ series.add_child(subseries_node)
115
+ subseries_node['level'] = 'subseries'
116
+ # create series did and add to subseries node
117
+ # FIXME: DRY this up with add_series
118
+ subseries_did = node('did')
119
+ subseries_node.add_child(subseries_did)
120
+ unitid = node('unitid')
121
+ unitid.content = cp['subseries number']
122
+ unittitle = node('unittitle')
123
+ unittitle.content = cp['subseries title']
124
+ unitdate = node('unitdate')
125
+ unitdate.content = cp['subseries dates']
126
+ subseries_did.add_child(unitid)
127
+ subseries_did.add_child(unittitle)
128
+ subseries_did.add_child(unitdate)
129
+ end
130
+ end
131
+ end
132
+ end
133
+
105
134
  def add_arrangement
106
135
  arrangement = node('arrangement')
107
136
  head = node('head')
@@ -128,7 +157,10 @@ module Stead
128
157
 
129
158
  # metadata is a hash from the @component_part and c is the actual node
130
159
  def add_file_component_part(metadata, c)
131
- if series?
160
+ if !metadata['subseries number'].nil?
161
+ current_subseries = find_current_subseries(metadata)
162
+ current_subseries.add_child(c)
163
+ elsif series?
132
164
  current_series = find_current_series(metadata)
133
165
  current_series.add_child(c)
134
166
  else
@@ -142,9 +174,17 @@ module Stead
142
174
  return node.parent.parent if node.content == series_title
143
175
  end
144
176
  end
177
+
178
+ def find_current_subseries(cp)
179
+ @ead.xpath("//xmlns:c02/xmlns:did/xmlns:unitid[text()='#{cp['subseries number']}']").each do |node|
180
+ return node.parent.parent if node.content == cp['subseries number']
181
+ end
182
+ end
145
183
 
146
- def file_component_part_name
147
- if series?
184
+ def file_component_part_name(cp)
185
+ if !cp['subseries number'].nil?
186
+ 'c03'
187
+ elsif series?
148
188
  'c02'
149
189
  else
150
190
  'c01'
@@ -294,6 +334,18 @@ module Stead
294
334
  return false if row['series number'].nil?
295
335
  end
296
336
  end
337
+
338
+ def subseries?
339
+ if subseries_found?
340
+ subseries = true
341
+ end
342
+ end
343
+
344
+ def subseries_found?
345
+ @component_parts.each do |row|
346
+ return true if !row['subseries number'].nil?
347
+ end
348
+ end
297
349
 
298
350
  end
299
351
  end
data/stead.gemspec ADDED
@@ -0,0 +1,105 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{stead}
8
+ s.version = "0.0.9"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jason Ronallo"]
12
+ s.date = %q{2011-08-10}
13
+ s.default_executable = %q{csv2ead}
14
+ s.description = %q{Converts CSV files of a specific schema into EAD XML.}
15
+ s.email = %q{jronallo@gmail.com}
16
+ s.executables = ["csv2ead"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.rdoc"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ ".rvmrc",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE",
27
+ "README.rdoc",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "bin/csv2ead",
31
+ "examples/ncsu.rb",
32
+ "lib/stead.rb",
33
+ "lib/stead/ead.rb",
34
+ "lib/stead/error.rb",
35
+ "lib/stead/stead.rb",
36
+ "lib/stead/templates/ead.xml",
37
+ "lib/stead/templates/ead.xsd",
38
+ "lib/stead/templates/ncsu_ead.xml",
39
+ "stead.gemspec",
40
+ "test/container_lists/mc00000-ead-series.xml",
41
+ "test/container_lists/mc00000-ead.xml",
42
+ "test/container_lists/mc00000_container_list.csv",
43
+ "test/container_lists/mc00000_container_list_bad_container_type.csv",
44
+ "test/container_lists/mc00000_container_list_no_series.csv",
45
+ "test/container_lists/mc00084_container_list_empty_header.csv",
46
+ "test/container_lists/wheless.csv",
47
+ "test/helper.rb",
48
+ "test/test_ead_bad_container_type.rb",
49
+ "test/test_ead_no_series.rb",
50
+ "test/test_ead_series.rb",
51
+ "test/test_stead.rb",
52
+ "test/test_wheless.rb",
53
+ "watchr.rb"
54
+ ]
55
+ s.homepage = %q{http://github.com/jronallo/stead}
56
+ s.require_paths = ["lib"]
57
+ s.rubygems_version = %q{1.6.2}
58
+ s.summary = %q{Spreadsheets To Encoded Archival Description}
59
+ s.test_files = [
60
+ "examples/ncsu.rb",
61
+ "test/helper.rb",
62
+ "test/test_ead_bad_container_type.rb",
63
+ "test/test_ead_no_series.rb",
64
+ "test/test_ead_series.rb",
65
+ "test/test_stead.rb",
66
+ "test/test_wheless.rb"
67
+ ]
68
+
69
+ if s.respond_to? :specification_version then
70
+ s.specification_version = 3
71
+
72
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
73
+ s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
74
+ s.add_runtime_dependency(%q<fastercsv>, [">= 0"])
75
+ s.add_runtime_dependency(%q<trollop>, [">= 0"])
76
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
77
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
78
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
79
+ s.add_development_dependency(%q<rcov>, [">= 0"])
80
+ s.add_development_dependency(%q<ruby-debug>, [">= 0"])
81
+ s.add_development_dependency(%q<equivalent-xml>, [">= 0"])
82
+ else
83
+ s.add_dependency(%q<nokogiri>, [">= 0"])
84
+ s.add_dependency(%q<fastercsv>, [">= 0"])
85
+ s.add_dependency(%q<trollop>, [">= 0"])
86
+ s.add_dependency(%q<shoulda>, [">= 0"])
87
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
88
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
89
+ s.add_dependency(%q<rcov>, [">= 0"])
90
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
91
+ s.add_dependency(%q<equivalent-xml>, [">= 0"])
92
+ end
93
+ else
94
+ s.add_dependency(%q<nokogiri>, [">= 0"])
95
+ s.add_dependency(%q<fastercsv>, [">= 0"])
96
+ s.add_dependency(%q<trollop>, [">= 0"])
97
+ s.add_dependency(%q<shoulda>, [">= 0"])
98
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
99
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
100
+ s.add_dependency(%q<rcov>, [">= 0"])
101
+ s.add_dependency(%q<ruby-debug>, [">= 0"])
102
+ s.add_dependency(%q<equivalent-xml>, [">= 0"])
103
+ end
104
+ end
105
+
@@ -0,0 +1,116 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <ead xsi:schemaLocation="urn:isbn:1-931666-22-9 http://www.loc.gov/ead/ead.xsd"
3
+ xmlns:ns2="http://www.w3.org/1999/xlink"
4
+ xmlns="urn:isbn:1-931666-22-9"
5
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6
+ <eadheader>
7
+ <eadid>mc00000</eadid>
8
+ <filedesc>
9
+ <titlestmt>
10
+ <titleproper>
11
+ <num></num>
12
+ </titleproper>
13
+ <author></author>
14
+ </titlestmt>
15
+ <publicationstmt>
16
+ <publisher>Special Collections Research Center</publisher>
17
+ </publicationstmt>
18
+ </filedesc>
19
+ </eadheader>
20
+ <archdesc level="subgrp">
21
+ <did>
22
+ <unittitle></unittitle>
23
+ </did>
24
+ <dsc>
25
+ <c01 level="series">
26
+ <did>
27
+ <unitid>1</unitid>
28
+ <unittitle>Project Files</unittitle>
29
+ <unitdate>1951-1978</unitdate>
30
+ </did>
31
+ <c02 level="file">
32
+ <did>
33
+ <unitid>7732</unitid>
34
+ <unittitle>Lucey, John and Mari</unittitle>
35
+ <unitdate>1977</unitdate>
36
+ <physdesc>
37
+ <extent>extent</extent>
38
+ </physdesc>
39
+ <note><p>note1</p></note>
40
+ <note><p>note2</p></note>
41
+ <container type="box" label="Mixed materials">45</container>
42
+ <container type="folder" label="Mixed materials">404</container>
43
+ <container type="item" label="Mixed materials">3</container>
44
+ </did>
45
+ </c02>
46
+ <c02 level="file">
47
+ <did>
48
+ <unitid>7801</unitid>
49
+ <unittitle>Foster, David</unittitle>
50
+ <unitdate>1979</unitdate>
51
+ <note><p>note1</p></note>
52
+ <note><p>note2</p></note>
53
+ <container type="box" label="Mixed materials">46</container>
54
+ <container type="folder" label="Mixed materials">405</container>
55
+ </did>
56
+ </c02>
57
+ </c01>
58
+ <c01 level="series">
59
+ <did>
60
+ <unitid>2</unitid>
61
+ <unittitle>Professional and Personal</unittitle>
62
+ <unitdate>1955-1978</unitdate>
63
+ </did>
64
+
65
+ <c02 level="subseries">
66
+ <did>
67
+ <unitid>1</unitid>
68
+ <unittitle>MC 00000 Subseries 01.01</unittitle>
69
+ <unitdate>1951</unitdate>
70
+ </did>
71
+ <c03>
72
+ <did>
73
+ <unittitle>Daily Financial Ledger</unittitle>
74
+ <unitdate>1969-1970</unitdate>
75
+ <container type="box" label="Mixed materials">58</container>
76
+ <container type="othertype" label="Mixed materials">550</container>
77
+ </did>
78
+ </c03>
79
+ </c02>
80
+ <c02>
81
+ <did>
82
+ <unitid>2</unitid>
83
+ <unittitle>MC 00000 Subseries 01.02</unittitle>
84
+ <unitdate>1952</unitdate>
85
+ </did>
86
+ <c03>
87
+ <did>
88
+ <unittitle>Scott, Correspondence Prior to 1959</unittitle>
89
+ <unitdate>1955-1959</unitdate>
90
+ <container type="box" label="Mixed materials">58</container>
91
+ <container type="othertype" label="Mixed materials">551</container>
92
+ </did>
93
+ </c03>
94
+ </c02>
95
+ </c01>
96
+ <c01 level="series">
97
+ <did>
98
+ <unitid>3</unitid>
99
+ <unittitle>Microfilm</unittitle>
100
+ <unitdate>1969-1979</unitdate>
101
+ </did>
102
+ <c02 level="file">
103
+ <did>
104
+ <unitid>4250</unitid>
105
+ <unittitle>Kenneth McCoy Scott</unittitle>
106
+ <container type="box" label="Mixed materials">63</container>
107
+ <container type="othertype" label="Mixed materials">1</container>
108
+ </did>
109
+ <scopecontent>
110
+ <p>Sessions 32-38</p>
111
+ </scopecontent>
112
+ </c02>
113
+ </c01>
114
+ </dsc>
115
+ </archdesc>
116
+ </ead>
@@ -0,0 +1,86 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <ead xsi:schemaLocation="urn:isbn:1-931666-22-9 http://www.loc.gov/ead/ead.xsd"
3
+ xmlns:ns2="http://www.w3.org/1999/xlink"
4
+ xmlns="urn:isbn:1-931666-22-9"
5
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
6
+ <eadheader>
7
+ <eadid>mc00000</eadid>
8
+ <filedesc>
9
+ <titlestmt>
10
+ <titleproper>
11
+ <num></num>
12
+ </titleproper>
13
+ <author></author>
14
+ </titlestmt>
15
+ <publicationstmt>
16
+ <publisher>Special Collections Research Center</publisher>
17
+ </publicationstmt>
18
+ </filedesc>
19
+ </eadheader>
20
+ <archdesc level="subgrp">
21
+ <did>
22
+ <unittitle></unittitle>
23
+ </did>
24
+ <dsc>
25
+ <c01 level="file">
26
+ <did>
27
+ <unitid>7732</unitid>
28
+ <unittitle>Lucey, John and Mari</unittitle>
29
+ <unitdate>1977</unitdate>
30
+ <physdesc>
31
+ <extent>extent</extent>
32
+ </physdesc>
33
+ <note><p>note1</p></note>
34
+ <note><p>note2</p></note>
35
+ <container type="Box" label="Mixed materials">45</container>
36
+ <container type="Folder" label="Mixed materials">404</container>
37
+ <container type="container3type" label="Mixed materials">3</container>
38
+ </did>
39
+ </c01>
40
+
41
+ <c01 level="file">
42
+ <did>
43
+ <unitid>7801</unitid>
44
+ <unittitle>Foster, David</unittitle>
45
+ <unitdate>1979</unitdate>
46
+ <note><p>note1</p></note>
47
+ <note><p>note2</p></note>
48
+ <container type="Box" label="Mixed materials">46</container>
49
+ <container type="Folder" label="Mixed materials">405</container>
50
+ </did>
51
+ </c01>
52
+
53
+ <c01>
54
+ <did>
55
+ <unittitle>Daily Financial Ledger</unittitle>
56
+ <unitdate>1969-1970</unitdate>
57
+ <container type="Box" label="Mixed materials">58</container>
58
+ <container label="Mixed materials">550</container>
59
+ </did>
60
+ </c01>
61
+
62
+ <c01>
63
+ <did>
64
+ <unittitle>Scott, Correspondence Prior to 1959</unittitle>
65
+ <unitdate>1955-1959</unitdate>
66
+ <container type="Box" label="Mixed materials">58</container>
67
+ <container label="Mixed materials">551</container>
68
+ </did>
69
+ <accessrestrict><p>Restricted</p></accessrestrict>
70
+ </c01>
71
+
72
+ <c01 level="file">
73
+ <did>
74
+ <unitid>4250</unitid>
75
+ <unittitle>Kenneth McCoy Scott</unittitle>
76
+ <container type="Box" label="Mixed materials">63</container>
77
+ <container type="Microfilmbox" label="Mixed materials">1</container>
78
+ </did>
79
+ <scopecontent>
80
+ <p>Sessions 32-38</p>
81
+ </scopecontent>
82
+ </c01>
83
+
84
+ </dsc>
85
+ </archdesc>
86
+ </ead>
@@ -0,0 +1,6 @@
1
+ "series number","series title","series dates","subseries number","subseries title","subseries dates","file id","file title","file dates","extent","physdesc","internal only","restrictions","conditions governing access","scopecontent","note1","note2","instance type","container 1 type","container 1 number","container 2 type","container 2 number","container 3 type","container 3 number","geogname","geogname_source","corpname","corpname_source","famname","famname_source","name","name_source","persname","persname_source","subject","subject_source"
2
+ 1,"Project Files","1951-1978",,,,7732,"Lucey, John and Mari",1977,"extent","physdesc","x",,,,"note1","note2","Mixed materials","box",45,"folder",404,"item",3,"Raleigh (N.C.)","lcnaf","corpname","corpname_source","famname","famname_source","name","name_source","persname","persname_source","subject","subject_source"
3
+ 1,"Project Files","1951-1978",,,,7801,"Foster, David",1979,,,,,,,,,"Mixed materials","box",46,"folder",405,,,,,,,,,,,,,,
4
+ 2,"Professional and Personal","1955-1978",1,"MC 00000 Subseries 01.01",1951,,"Daily Financial Ledger","1969-1970",,,,,,,,,"Mixed materials","box",58,"othertype",550,,,,,,,,,,,,,,
5
+ 2,"Professional and Personal","1955-1978",2,"MC 00000 Subseries 01.02",1952,,"Scott, Correspondence Prior to 1959","1955-1959",,,,,"Restricted",,,,"Mixed materials","box",58,"othertype",551,,,,,,,,,,,,,,
6
+ 3,"Microfilm","1969-1979",,,,4250,"Kenneth McCoy Scott",,,,,,,"Sessions 32-38",,,"Mixed materials","box",63,"othertype",1,,,,,,,,,,,,,,
@@ -0,0 +1,2 @@
1
+ "series number","series title","series dates","subseries number","subseries title","subseries dates","file id","file title","file dates","extent","physdesc","internal only","restrictions","conditions governing access","scopecontent","note1","note2","instance type","container 1 type","container 1 number","container 2 type","container 2 number","container 3 type","container 3 number"
2
+ ,,,,,,7732,"Lucey, John and Mari",1977,"extent","physdesc","x",,,,"note1","note2","Mixed materials","Boxer",45,"Folder",404,"container3type",3
@@ -0,0 +1,6 @@
1
+ "series number","series title","series dates","subseries number","subseries title","subseries dates","file id","file title","file dates","extent","physdesc","internal only","restrictions","conditions governing access","scopecontent","note1","note2","instance type","container 1 type","container 1 number","container 2 type","container 2 number","container 3 type","container 3 number"
2
+ ,,,,,,7732,"Lucey, John and Mari",1977,"extent","physdesc","x",,,,"note1","note2","Mixed materials","box",45,"folder",404,"artifactbox",3
3
+ ,,,,,,7801,"Foster, David",1979,,,,,,,,,"Mixed materials","box",46,"folder",405,,
4
+ ,,,,,,,"Daily Financial Ledger","1969-1970",,,,,,,,,"Mixed materials","box",58,"othertype",550,,
5
+ ,,,,,,,"Scott, Correspondence Prior to 1959","1955-1959",,,,,"Restricted",,,,"Mixed materials","box",58,"othertype",551,,
6
+ ,,,,,,4250,"Kenneth McCoy Scott",,,,,,,"Sessions 32-38",,,"Mixed materials","box",63,"othertype",1,,
@@ -0,0 +1,4 @@
1
+ "container 1 type","container 1 number","container 2 type","container 2 number","file title","scopecontent","physdesc","extent","file date","note",
2
+ "box",1,"item",166,"Proposed Site Lees Chapel Road, Greensboro, NC","Community systems development","Sepia with red & black pencil",4,"3-Jul-81",,
3
+ "box",1,"item",167,"Providence Village, Charlotte, NC","First phase development, Sardis Lane-Providence Road Site, Charlotte, NC","Sepia, red & black pencil, ink, blueprint; drafting paper with color, tracing paper; aerial photographs",4,"2-Jan-86","Edwards, McKimmon, & Etheridge",
4
+ "box",1,"item",168,"Quarterdeck: River Bend Plantation","Staking, grading, site details, play area details, landscape details","Sepia with pencil, blueprint",7,"8 -Nov-83; 28-Aug-88 ","Lu &Sears Associates, Belmont MA","Moore Square Historic District Streetscape"
@@ -0,0 +1 @@
1
+ series number,series title,series dates,file title,file dates,note1,note1,instance type,container 1 type,container 1 number,container 2 type,container 2 number,geogname,geogname_source,name,name_source
@@ -22,6 +22,10 @@ class TestSteadEadSeries < Test::Unit::TestCase
22
22
  def test_ead_c02_counts
23
23
  assert_equal 5, @generated_ead.xpath('//xmlns:c02').length
24
24
  end
25
+
26
+ def test_ead_c03_counts
27
+ assert_equal 2, @generated_ead.xpath('//xmlns:c03').length
28
+ end
25
29
 
26
30
  def test_validity
27
31
  assert @xsd.valid?(@generated_ead)
@@ -32,7 +36,7 @@ class TestSteadEadSeries < Test::Unit::TestCase
32
36
  #puts number
33
37
  did = @generated_ead.xpath(@did_xpath)[number]
34
38
  example_did = @example.xpath(@did_xpath)[number]
35
- assert_equal 'file', did.parent['level']
39
+ #assert_equal 'file', did.parent['level']
36
40
  assert_main_elements_equal(did, example_did)
37
41
  end
38
42
  end
data/watchr.rb ADDED
@@ -0,0 +1,68 @@
1
+ #watch( 'test/test_.*\.rb' ) {|md| system("rake test") }
2
+ #watch( 'lib/(.*)\.rb' ) {|md| system("rake test") }
3
+
4
+
5
+ def notify(message)
6
+ notify_send = `which notify-send`.chomp
7
+ title = "Watchr Test Results"
8
+ image = message.include?('0 failures, 0 errors') ? '~/.autotest_images/pass.png' : '~/.autotest_images/fail.png'
9
+ msg = message.slice(/(\d+)\stests,\s(\d+)\sassertions,\s(\d+)\sfailures,\s(\d+)\serrors/)
10
+ system %Q{#{notify_send} '#{title}' '#{msg}' -i #{image} -t 2000 &}
11
+ end
12
+
13
+ def run(cmd)
14
+ puts(cmd)
15
+ `#{cmd}`
16
+ end
17
+
18
+
19
+ def run_test_file(file)
20
+ system('clear')
21
+ puts file
22
+ result = run(%Q(ruby -I"lib:test" -rubygems #{file}))
23
+ notify result.split("\n").last rescue nil
24
+ puts result
25
+ end
26
+
27
+ def related_test_files(path)
28
+ Dir['test/*.rb'].select { |file| file =~ /test_#{File.basename(path).split(".").first}.rb/ }
29
+ end
30
+
31
+
32
+
33
+ def run_all_tests
34
+ system('clear')
35
+ result = `rake test`
36
+ notify result.split("\n").last rescue nil
37
+ puts result
38
+ end
39
+
40
+ def run_validation_tests
41
+ system('clear')
42
+ result = `rake test:units TEST=test/test_validations.rb`
43
+ notify result.split("\n").last rescue nil
44
+ puts result
45
+ end
46
+
47
+
48
+ watch('test/helper\.rb') { run_all_tests }
49
+ watch('test/test_.*\.rb') { run_all_tests }
50
+ watch('lib/.*\.rb') {run_all_tests}
51
+ watch('lib/.*/.*\.rb') { run_all_tests }
52
+
53
+
54
+
55
+ # Ctrl-C
56
+ Signal.trap 'INT' do
57
+ if @interrupted then
58
+ @wants_to_quit = true
59
+ abort("\n")
60
+ else
61
+ puts "Interrupt a second time to quit"
62
+ @interrupted = true
63
+ Kernel.sleep 1.5
64
+ # raise Interrupt, nil # let the run loop catch it
65
+ run_all_tests
66
+ end
67
+ end
68
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stead
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
4
+ hash: 13
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Ronallo
@@ -15,28 +15,25 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-26 00:00:00 -05:00
18
+ date: 2011-08-10 00:00:00 -04:00
19
19
  default_executable: csv2ead
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: nokogiri
23
- prerelease: false
22
+ type: :runtime
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 5
28
+ hash: 3
30
29
  segments:
31
- - 1
32
- - 4
33
- - 1
34
- version: 1.4.1
35
- type: :runtime
30
+ - 0
31
+ version: "0"
32
+ name: nokogiri
36
33
  version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: fastercsv
39
34
  prerelease: false
35
+ - !ruby/object:Gem::Dependency
36
+ type: :runtime
40
37
  requirement: &id002 !ruby/object:Gem::Requirement
41
38
  none: false
42
39
  requirements:
@@ -44,31 +41,27 @@ dependencies:
44
41
  - !ruby/object:Gem::Version
45
42
  hash: 3
46
43
  segments:
47
- - 1
48
- - 5
49
44
  - 0
50
- version: 1.5.0
51
- type: :runtime
45
+ version: "0"
46
+ name: fastercsv
52
47
  version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: trollop
55
48
  prerelease: false
49
+ - !ruby/object:Gem::Dependency
50
+ type: :runtime
56
51
  requirement: &id003 !ruby/object:Gem::Requirement
57
52
  none: false
58
53
  requirements:
59
54
  - - ">="
60
55
  - !ruby/object:Gem::Version
61
- hash: 83
56
+ hash: 3
62
57
  segments:
63
- - 1
64
- - 16
65
- - 2
66
- version: 1.16.2
67
- type: :runtime
58
+ - 0
59
+ version: "0"
60
+ name: trollop
68
61
  version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: shoulda
71
62
  prerelease: false
63
+ - !ruby/object:Gem::Dependency
64
+ type: :development
72
65
  requirement: &id004 !ruby/object:Gem::Requirement
73
66
  none: false
74
67
  requirements:
@@ -78,12 +71,44 @@ dependencies:
78
71
  segments:
79
72
  - 0
80
73
  version: "0"
81
- type: :development
74
+ name: shoulda
82
75
  version_requirements: *id004
83
- - !ruby/object:Gem::Dependency
84
- name: equivalent-xml
85
76
  prerelease: false
77
+ - !ruby/object:Gem::Dependency
78
+ type: :development
86
79
  requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ~>
83
+ - !ruby/object:Gem::Version
84
+ hash: 23
85
+ segments:
86
+ - 1
87
+ - 0
88
+ - 0
89
+ version: 1.0.0
90
+ name: bundler
91
+ version_requirements: *id005
92
+ prerelease: false
93
+ - !ruby/object:Gem::Dependency
94
+ type: :development
95
+ requirement: &id006 !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ~>
99
+ - !ruby/object:Gem::Version
100
+ hash: 7
101
+ segments:
102
+ - 1
103
+ - 5
104
+ - 2
105
+ version: 1.5.2
106
+ name: jeweler
107
+ version_requirements: *id006
108
+ prerelease: false
109
+ - !ruby/object:Gem::Dependency
110
+ type: :development
111
+ requirement: &id007 !ruby/object:Gem::Requirement
87
112
  none: false
88
113
  requirements:
89
114
  - - ">="
@@ -92,8 +117,37 @@ dependencies:
92
117
  segments:
93
118
  - 0
94
119
  version: "0"
120
+ name: rcov
121
+ version_requirements: *id007
122
+ prerelease: false
123
+ - !ruby/object:Gem::Dependency
95
124
  type: :development
96
- version_requirements: *id005
125
+ requirement: &id008 !ruby/object:Gem::Requirement
126
+ none: false
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ hash: 3
131
+ segments:
132
+ - 0
133
+ version: "0"
134
+ name: ruby-debug
135
+ version_requirements: *id008
136
+ prerelease: false
137
+ - !ruby/object:Gem::Dependency
138
+ type: :development
139
+ requirement: &id009 !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ name: equivalent-xml
149
+ version_requirements: *id009
150
+ prerelease: false
97
151
  description: Converts CSV files of a specific schema into EAD XML.
98
152
  email: jronallo@gmail.com
99
153
  executables:
@@ -104,6 +158,10 @@ extra_rdoc_files:
104
158
  - LICENSE
105
159
  - README.rdoc
106
160
  files:
161
+ - .document
162
+ - .rvmrc
163
+ - Gemfile
164
+ - Gemfile.lock
107
165
  - LICENSE
108
166
  - README.rdoc
109
167
  - Rakefile
@@ -117,19 +175,28 @@ files:
117
175
  - lib/stead/templates/ead.xml
118
176
  - lib/stead/templates/ead.xsd
119
177
  - lib/stead/templates/ncsu_ead.xml
120
- - test/test_ead_bad_container_type.rb
178
+ - stead.gemspec
179
+ - test/container_lists/mc00000-ead-series.xml
180
+ - test/container_lists/mc00000-ead.xml
181
+ - test/container_lists/mc00000_container_list.csv
182
+ - test/container_lists/mc00000_container_list_bad_container_type.csv
183
+ - test/container_lists/mc00000_container_list_no_series.csv
184
+ - test/container_lists/mc00084_container_list_empty_header.csv
185
+ - test/container_lists/wheless.csv
121
186
  - test/helper.rb
122
- - test/test_stead.rb
123
- - test/test_wheless.rb
187
+ - test/test_ead_bad_container_type.rb
124
188
  - test/test_ead_no_series.rb
125
189
  - test/test_ead_series.rb
190
+ - test/test_stead.rb
191
+ - test/test_wheless.rb
192
+ - watchr.rb
126
193
  has_rdoc: true
127
194
  homepage: http://github.com/jronallo/stead
128
195
  licenses: []
129
196
 
130
197
  post_install_message:
131
- rdoc_options:
132
- - --charset=UTF-8
198
+ rdoc_options: []
199
+
133
200
  require_paths:
134
201
  - lib
135
202
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -153,15 +220,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
220
  requirements: []
154
221
 
155
222
  rubyforge_project:
156
- rubygems_version: 1.3.7
223
+ rubygems_version: 1.6.2
157
224
  signing_key:
158
225
  specification_version: 3
159
226
  summary: Spreadsheets To Encoded Archival Description
160
227
  test_files:
161
- - test/test_ead_bad_container_type.rb
228
+ - examples/ncsu.rb
162
229
  - test/helper.rb
163
- - test/test_stead.rb
164
- - test/test_wheless.rb
230
+ - test/test_ead_bad_container_type.rb
165
231
  - test/test_ead_no_series.rb
166
232
  - test/test_ead_series.rb
167
- - examples/ncsu.rb
233
+ - test/test_stead.rb
234
+ - test/test_wheless.rb