eadcodec 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  PKG_NAME = 'eadcodec'
2
- PKG_VERSION = '0.0.2'
2
+ PKG_VERSION = '0.0.3'
3
3
 
4
4
  require 'rake'
5
5
  require 'rake/testtask'
@@ -16,6 +16,12 @@ PKG_FILES = FileList['lib/**/*.rb',
16
16
  'LICENSE',
17
17
  'Rakefile']
18
18
 
19
+ RDOC_OPTIONS = ['-S', '-w 2', '-N', '-Axmlsubel_mult=XML Subelement Collection',
20
+ '-Axmlsubel=XML Subelement', '-Axmlattr=XML Attribute']
21
+ RDOC_EXTRA_FILES = ['README']
22
+ CODE_FILES = 'lib/**/*.rb'
23
+ TEST_FILES = 'test/**/*.rb'
24
+
19
25
  spec = Gem::Specification.new do |s|
20
26
  s.platform = Gem::Platform::RUBY
21
27
  s.summary = "Importer/Exporter for the EAD XML format"
@@ -24,10 +30,13 @@ spec = Gem::Specification.new do |s|
24
30
  s.author = 'Pedro Côrte-Real'
25
31
  s.email = 'pedrocr@gmail.com'
26
32
  s.requirements << 'xmlcodec'
27
- s.add_dependency('xmlcodec', '>= 0.0.2')
33
+ s.add_dependency('xmlcodec', '>= 0.0.3')
28
34
  s.require_path = 'lib'
29
35
  s.autorequire = 'rake'
30
36
  s.files = PKG_FILES
37
+ s.has_rdoc = true
38
+ s.rdoc_options = RDOC_OPTIONS
39
+ s.extra_rdoc_files = RDOC_EXTRA_FILES
31
40
  s.description = <<EOF
32
41
  An exporter and importer for the Encoded Archival Description XML format. See
33
42
  http://www.loc.gov/ead/ for more information about the format.
@@ -50,8 +59,35 @@ end
50
59
  Rake::RDocTask.new do |rd|
51
60
  rd.main = "README"
52
61
  rd.name = :docs
53
- rd.rdoc_files.include("README", "lib/**/*.rb")
62
+ rd.rdoc_files.include(RDOC_EXTRA_FILES, CODE_FILES)
54
63
  rd.rdoc_dir = 'web/doc'
55
64
  rd.title = PKG_NAME+' API'
56
- rd.options = ['-S', '-w 2', '-N', '-Axmlsubel_mult=XML Subelement Collection', '-Axmlsubel=XML Subelement', '-Axmlattr=XML Attribute']
65
+ rd.options = RDOC_OPTIONS
66
+ end
67
+
68
+ task :stats do
69
+ code_code, code_comments = count_lines(FileList[CODE_FILES])
70
+ test_code, test_comments = count_lines(FileList[TEST_FILES])
71
+
72
+ puts "Code lines: #{code_code} code, #{code_comments} comments"
73
+ puts "Test lines: #{test_code} code, #{test_comments} comments"
74
+
75
+ ratio = test_code.to_f/code_code.to_f
76
+
77
+ puts "Code to test ratio: 1:%.2f" % ratio
78
+ end
79
+
80
+ def count_lines(files)
81
+ code = 0
82
+ comments = 0
83
+ files.each do |f|
84
+ File.open(f).each do |line|
85
+ if line.strip[0] == '#'[0]
86
+ comments += 1
87
+ else
88
+ code += 1
89
+ end
90
+ end
91
+ end
92
+ [code, comments]
57
93
  end
data/lib/EAD.rb CHANGED
@@ -129,6 +129,7 @@ require "EADProfileDesc"
129
129
  require "EADHeader"
130
130
  require "EADBiogHist"
131
131
  require "EADDocument"
132
+ require "EADLang"
132
133
 
133
134
  module EAD
134
135
  def self.c_levels
@@ -17,5 +17,6 @@ module EAD
17
17
  xmlsubel :physdesc
18
18
  xmlsubel :physloc
19
19
  xmlsubel :unitdate
20
+ xmlsubel :langmaterial
20
21
  end
21
22
  end
data/lib/EADLang.rb ADDED
@@ -0,0 +1,42 @@
1
+ module EAD
2
+ class EADLanguage < EADElement
3
+ elname "language"
4
+
5
+ xmlattr :altrender
6
+ xmlattr :audience
7
+ xmlattr :encodinganalog
8
+ xmlattr :id
9
+ xmlattr :langcode
10
+ xmlattr :scriptcode
11
+
12
+ xmlsubelements
13
+
14
+ def initialize(*values)
15
+ if values
16
+ values.each do |v|
17
+ self.subelements << v
18
+ end
19
+ end
20
+ end
21
+ end
22
+
23
+ class EADLangMaterial < EADElement
24
+ elname "langmaterial"
25
+
26
+ xmlattr :altrender
27
+ xmlattr :audience
28
+ xmlattr :encodinganalog
29
+ xmlattr :id
30
+ xmlattr :label
31
+
32
+ xmlsubelements
33
+
34
+ def initialize(*values)
35
+ if values
36
+ values.each do |v|
37
+ self.subelements << v
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: eadcodec
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.2
7
- date: 2006-05-18 00:00:00 +01:00
6
+ version: 0.0.3
7
+ date: 2006-05-29 00:00:00 +01:00
8
8
  summary: Importer/Exporter for the EAD XML format
9
9
  require_paths:
10
10
  - lib
@@ -15,7 +15,7 @@ description: An exporter and importer for the Encoded Archival Description XML f
15
15
  autorequire: rake
16
16
  default_executable:
17
17
  bindir: bin
18
- has_rdoc: false
18
+ has_rdoc: true
19
19
  required_ruby_version: !ruby/object:Gem::Version::Requirement
20
20
  requirements:
21
21
  - - ">"
@@ -44,6 +44,7 @@ files:
44
44
  - lib/EADProfileDesc.rb
45
45
  - lib/eadcodec.rb
46
46
  - lib/EADSubordinates.rb
47
+ - lib/EADLang.rb
47
48
  - test/TestXMLStreamObjectParser.rb
48
49
  - test/TestEADDescription.rb
49
50
  - test/TestEADScopeContent.rb
@@ -63,10 +64,15 @@ files:
63
64
  - Rakefile
64
65
  test_files: []
65
66
 
66
- rdoc_options: []
67
-
68
- extra_rdoc_files: []
69
-
67
+ rdoc_options:
68
+ - -S
69
+ - -w 2
70
+ - -N
71
+ - -Axmlsubel_mult=XML Subelement Collection
72
+ - -Axmlsubel=XML Subelement
73
+ - -Axmlattr=XML Attribute
74
+ extra_rdoc_files:
75
+ - README
70
76
  executables: []
71
77
 
72
78
  extensions: []
@@ -81,5 +87,5 @@ dependencies:
81
87
  requirements:
82
88
  - - ">="
83
89
  - !ruby/object:Gem::Version
84
- version: 0.0.2
90
+ version: 0.0.3
85
91
  version: