stead 0.0.6 → 0.0.7

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
data/bin/csv2ead CHANGED
@@ -26,10 +26,11 @@ EOS
26
26
  opt :stdout, 'Output full EAD to terminal'
27
27
  end
28
28
 
29
- unless opts[:output] or opts[:stdout]
30
- puts "You must specify either --output <file> and/or --stdout to direct output to the terminal."
31
- exit
32
- end
29
+ # unless opts[:output] or opts[:stdout]
30
+ # puts "You must specify either --output <file> and/or --stdout to direct output to the terminal."
31
+ # exit
32
+ # end
33
+
33
34
 
34
35
  if opts[:ncsu]
35
36
  opts[:template] = File.join(File.dirname(__FILE__), '..', 'lib', 'stead', 'templates', 'ncsu_ead.xml')
@@ -66,5 +67,5 @@ if opts[:output]
66
67
  end
67
68
  end
68
69
 
69
- puts Stead.pretty_write(ead) if opts[:stdout]
70
+ puts Stead.pretty_write(ead) if !opts[:output]
70
71
 
data/lib/stead/ead.rb CHANGED
@@ -21,11 +21,12 @@ module Stead
21
21
  end
22
22
 
23
23
  def self.from_csv(csv, opts={})
24
- lines = csv.split(/\r\n|\n/)
25
- 100.times do
26
- lines[0] = lines.first.gsub(',,', ',"",')
24
+ lines = csv.split(/\r\n|\n|\r/)
25
+ # trim empty lines
26
+ cleaned_lines = lines.select do |line|
27
+ !line.strip.empty?
27
28
  end
28
- csv = lines.join("\n")
29
+ csv = cleaned_lines.join("\n")
29
30
  self.new(opts.merge(:csv => csv))
30
31
  end
31
32
 
data/test/helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'test/unit'
3
3
  require 'shoulda'
4
4
  require 'ruby-debug'
5
+ require 'equivalent-xml'
5
6
 
6
7
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
8
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -0,0 +1,18 @@
1
+ require 'helper'
2
+
3
+ class TestWheless < Test::Unit::TestCase
4
+ include SteadTestHelpers
5
+ def setup
6
+ #@example = Nokogiri::XML('')
7
+ @ead_generator = Stead::EadGenerator.from_csv(File.read(File.join(File.dirname(__FILE__),
8
+ 'container_lists', 'wheless.csv' )))
9
+ @generated_ead = @ead_generator.to_ead
10
+ end
11
+
12
+ def test_lack_of_empty_c01_at_end
13
+ last_c01 = @generated_ead.xpath('//xmlns:c01').last
14
+ assert !EquivalentXml.equivalent?("<c01 level=\"file\">\n <did/>\n</c01>",
15
+ last_c01.to_xml, opts = { :element_order => false, :normalize_whitespace => true })
16
+ end
17
+
18
+ end
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: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason Ronallo
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-24 00:00:00 -05:00
18
+ date: 2011-02-25 00:00:00 -05:00
19
19
  default_executable: csv2ead
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -104,6 +104,7 @@ files:
104
104
  - lib/stead/templates/ead.xsd
105
105
  - lib/stead/templates/ncsu_ead.xml
106
106
  - test/test_ead_no_series.rb
107
+ - test/test_empty_note.rb
107
108
  - test/test_ead_bad_container_type.rb
108
109
  - test/test_ead_series.rb
109
110
  - test/helper.rb
@@ -144,6 +145,7 @@ specification_version: 3
144
145
  summary: Spreadsheets To Encoded Archival Description
145
146
  test_files:
146
147
  - test/test_ead_no_series.rb
148
+ - test/test_empty_note.rb
147
149
  - test/test_ead_bad_container_type.rb
148
150
  - test/test_ead_series.rb
149
151
  - test/helper.rb