ncs_mdes 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.rvmrc +1 -0
- data/.yardopts +5 -0
- data/CHANGELOG.md +18 -0
- data/Gemfile +9 -0
- data/README.md +59 -0
- data/Rakefile +7 -0
- data/bin/mdes-console +21 -0
- data/documents/1.2/Data_Transmission_Schema_V1.2.xsd +13980 -0
- data/documents/2.0/NCS_Transmission_Schema_2.0.01.02.xml +26918 -0
- data/lib/ncs_navigator/mdes/source_documents.rb +103 -0
- data/lib/ncs_navigator/mdes/specification.rb +86 -0
- data/lib/ncs_navigator/mdes/transmission_table.rb +53 -0
- data/lib/ncs_navigator/mdes/variable.rb +119 -0
- data/lib/ncs_navigator/mdes/variable_type.rb +196 -0
- data/lib/ncs_navigator/mdes/version.rb +5 -0
- data/lib/ncs_navigator/mdes.rb +27 -0
- data/ncs_mdes.gemspec +27 -0
- data/spec/ncs_navigator/mdes/source_documents_spec.rb +95 -0
- data/spec/ncs_navigator/mdes/specification_spec.rb +102 -0
- data/spec/ncs_navigator/mdes/transmission_table_spec.rb +89 -0
- data/spec/ncs_navigator/mdes/variable_spec.rb +216 -0
- data/spec/ncs_navigator/mdes/variable_type_spec.rb +202 -0
- data/spec/ncs_navigator/mdes/version_spec.rb +13 -0
- data/spec/ncs_navigator/mdes_spec.rb +9 -0
- data/spec/spec_helper.rb +45 -0
- metadata +165 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.expand_path("../../../spec_helper.rb", __FILE__)
|
2
|
+
|
3
|
+
module NcsNavigator
|
4
|
+
describe Mdes, "::VERSION" do
|
5
|
+
it "exists" do
|
6
|
+
lambda { Mdes::VERSION }.should_not raise_error
|
7
|
+
end
|
8
|
+
|
9
|
+
it "has 3 or 4 dot separated parts" do
|
10
|
+
Mdes::VERSION.split('.').size.should be_between(3, 4)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
5
|
+
require 'ncs_navigator/mdes'
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
def logger
|
9
|
+
@logger ||= NcsNavigator::Mdes::Spec::AccumulatingLogger.new
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
# Returns a parsed XML element whose root ancestor is an appropriate
|
14
|
+
# schema root.
|
15
|
+
#
|
16
|
+
# @param [String] xml_fragment
|
17
|
+
def schema_element(xml_fragment)
|
18
|
+
Nokogiri::XML(<<-XSD).root.elements.first
|
19
|
+
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:ncs="http://www.nationalchildrensstudy.gov" xmlns:ncsdoc="http://www.nationalchildrensstudy.gov/doc" xmlns:xlink="http://www.w3.org/TR/WD-xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.nationalchildrensstudy.gov" elementFormDefault="unqualified" attributeFormDefault="unqualified">
|
20
|
+
#{xml_fragment}
|
21
|
+
</xs:schema>
|
22
|
+
XSD
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module NcsNavigator::Mdes
|
27
|
+
module Spec
|
28
|
+
##
|
29
|
+
# A logger that holds on to everything that is logged for later examination.
|
30
|
+
class AccumulatingLogger
|
31
|
+
def messages
|
32
|
+
@messages ||= {}
|
33
|
+
end
|
34
|
+
|
35
|
+
def [](name)
|
36
|
+
messages[name] ||= []
|
37
|
+
end
|
38
|
+
|
39
|
+
def method_missing(name, *args)
|
40
|
+
self[name] << (args.size == 1 ? args.first : args)
|
41
|
+
true # what Logger does
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ncs_mdes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Rhett Sutphin
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-07-08 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: nokogiri
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 4
|
33
|
+
version: "1.4"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 15
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 6
|
48
|
+
version: "2.6"
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rake
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 63
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 9
|
63
|
+
- 2
|
64
|
+
version: 0.9.2
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: yard
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 7
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
- 7
|
79
|
+
- 2
|
80
|
+
version: 0.7.2
|
81
|
+
type: :development
|
82
|
+
version_requirements: *id004
|
83
|
+
description: |
|
84
|
+
|
85
|
+
Provides a consistent ruby interface to the project metainformation in the
|
86
|
+
National Children's Study's Master Data Element Specification.
|
87
|
+
|
88
|
+
email:
|
89
|
+
- r-sutphin@northwestern.edu
|
90
|
+
executables:
|
91
|
+
- mdes-console
|
92
|
+
extensions: []
|
93
|
+
|
94
|
+
extra_rdoc_files: []
|
95
|
+
|
96
|
+
files:
|
97
|
+
- .gitignore
|
98
|
+
- .rvmrc
|
99
|
+
- .yardopts
|
100
|
+
- CHANGELOG.md
|
101
|
+
- Gemfile
|
102
|
+
- README.md
|
103
|
+
- Rakefile
|
104
|
+
- bin/mdes-console
|
105
|
+
- documents/1.2/Data_Transmission_Schema_V1.2.xsd
|
106
|
+
- documents/2.0/NCS_Transmission_Schema_2.0.01.02.xml
|
107
|
+
- lib/ncs_navigator/mdes.rb
|
108
|
+
- lib/ncs_navigator/mdes/source_documents.rb
|
109
|
+
- lib/ncs_navigator/mdes/specification.rb
|
110
|
+
- lib/ncs_navigator/mdes/transmission_table.rb
|
111
|
+
- lib/ncs_navigator/mdes/variable.rb
|
112
|
+
- lib/ncs_navigator/mdes/variable_type.rb
|
113
|
+
- lib/ncs_navigator/mdes/version.rb
|
114
|
+
- ncs_mdes.gemspec
|
115
|
+
- spec/ncs_navigator/mdes/source_documents_spec.rb
|
116
|
+
- spec/ncs_navigator/mdes/specification_spec.rb
|
117
|
+
- spec/ncs_navigator/mdes/transmission_table_spec.rb
|
118
|
+
- spec/ncs_navigator/mdes/variable_spec.rb
|
119
|
+
- spec/ncs_navigator/mdes/variable_type_spec.rb
|
120
|
+
- spec/ncs_navigator/mdes/version_spec.rb
|
121
|
+
- spec/ncs_navigator/mdes_spec.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
has_rdoc: true
|
124
|
+
homepage: ""
|
125
|
+
licenses: []
|
126
|
+
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
hash: 3
|
138
|
+
segments:
|
139
|
+
- 0
|
140
|
+
version: "0"
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
hash: 3
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
version: "0"
|
150
|
+
requirements: []
|
151
|
+
|
152
|
+
rubyforge_project:
|
153
|
+
rubygems_version: 1.3.7
|
154
|
+
signing_key:
|
155
|
+
specification_version: 3
|
156
|
+
summary: A ruby API for various versions of the NCS MDES.
|
157
|
+
test_files:
|
158
|
+
- spec/ncs_navigator/mdes/source_documents_spec.rb
|
159
|
+
- spec/ncs_navigator/mdes/specification_spec.rb
|
160
|
+
- spec/ncs_navigator/mdes/transmission_table_spec.rb
|
161
|
+
- spec/ncs_navigator/mdes/variable_spec.rb
|
162
|
+
- spec/ncs_navigator/mdes/variable_type_spec.rb
|
163
|
+
- spec/ncs_navigator/mdes/version_spec.rb
|
164
|
+
- spec/ncs_navigator/mdes_spec.rb
|
165
|
+
- spec/spec_helper.rb
|