ncs_mdes 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -8,3 +8,6 @@ spec/doc-base
8
8
  .yardoc
9
9
  docs
10
10
  *.dot
11
+ doc
12
+
13
+ reports
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm ruby-1.8.7-p334@ncs_mdes
1
+ rvm @ncs_mdes --create
@@ -1,11 +1,17 @@
1
1
  NCS Navigator MDES Module history
2
2
  =================================
3
3
 
4
+ 0.4.2
5
+ -----
6
+
7
+ - Add `specification_version` to distinguish from the short version
8
+ names we use for easy reference. (#6)
9
+
4
10
  0.4.1
5
11
  -----
6
12
 
7
- - Add separate {#omittable?} and {#nillable?} subconditions of
8
- {#required?} (#4).
13
+ - Add separate `omittable?` and `nillable?` subconditions of
14
+ `required?` (#4).
9
15
 
10
16
  0.4.0
11
17
  -----
data/Rakefile CHANGED
@@ -1,7 +1,15 @@
1
1
  require 'bundler/gem_tasks'
2
2
 
3
3
  require 'rspec/core/rake_task'
4
+ require 'ci/reporter/rake/rspec'
4
5
 
5
6
  RSpec::Core::RakeTask.new do |t|
6
7
  t.pattern = "spec/**/*_spec.rb"
7
8
  end
9
+
10
+ namespace :ci do
11
+ ENV["CI_REPORTS"] = "reports/spec-xml"
12
+
13
+ desc "Run specs for CI"
14
+ task :spec => ['ci:setup:rspec', 'rake:spec']
15
+ end
@@ -4,6 +4,16 @@
4
4
  # Provides a IRB session with a NcsNavigator::Mdes::Specification instance
5
5
  # for free-form prodding.
6
6
 
7
+ # Allow this executable to be run directly from the source as well as
8
+ # from an installed gem.
9
+ begin
10
+ lib = File.expand_path('../../lib', __FILE__)
11
+ unless $LOAD_PATH.include?(lib)
12
+ $LOAD_PATH << lib
13
+ require 'rubygems'
14
+ end
15
+ end
16
+
7
17
  require 'irb'
8
18
  require 'ncs_navigator/mdes'
9
19
 
@@ -0,0 +1,43 @@
1
+ #!/bin/bash -xe
2
+
3
+ BUNDLER_VERSION=1.0.18
4
+ GEMSET=ncs_mdes
5
+
6
+ if [ -z $CI_RUBY ]; then
7
+ echo "CI_RUBY must be set"
8
+ exit 1
9
+ fi
10
+
11
+ set +xe
12
+ echo "Initializing RVM"
13
+ source ~/.rvm/scripts/rvm
14
+ set -xe
15
+
16
+ # On the overnight build, reinstall all gems
17
+ if [ `date +%H` -lt 5 ]; then
18
+ set +xe
19
+ echo "Purging gemset to verify that all deps can still be installed"
20
+ rvm --force $CI_RUBY gemset delete $GEMSET
21
+ set -xe
22
+ fi
23
+
24
+ RVM_CONFIG="${CI_RUBY}@${GEMSET}"
25
+ set +xe
26
+ echo "Switching to ${RVM_CONFIG}"
27
+ rvm use $RVM_CONFIG
28
+ set -xe
29
+
30
+ which ruby
31
+ ruby -v
32
+
33
+ set +e
34
+ gem list -i bundler -v $BUNDLER_VERSION
35
+ if [ $? -ne 0 ]; then
36
+ set -e
37
+ gem install bundler -v $BUNDLER_VERSION
38
+ fi
39
+ set -e
40
+
41
+ bundle update
42
+
43
+ bundle exec rake ci:spec --trace
@@ -29,6 +29,11 @@ module NcsNavigator::Mdes
29
29
  # @return [String]
30
30
  attr_accessor :version
31
31
 
32
+ ##
33
+ # @return [String] The specification version that these documents
34
+ # describe, if more specific than the overall version.
35
+ attr_accessor :specification_version
36
+
32
37
  ##
33
38
  # Instance-level alias for {.xmlns}.
34
39
  # @method xmlns
@@ -45,18 +50,19 @@ module NcsNavigator::Mdes
45
50
  when '1.2'
46
51
  create('1.2', '1.2/Data_Transmission_Schema_V1.2.xsd')
47
52
  when '2.0'
48
- create('2.0', '2.0/NCS_Transmission_Schema_2.0.01.02.xml')
53
+ create('2.0', '2.0/NCS_Transmission_Schema_2.0.01.02.xml', '2.0.01.02')
49
54
  else
50
55
  raise "MDES #{version} is not supported by this version of ncs_mdes"
51
56
  end
52
57
  end
53
58
 
54
- def create(version, schema)
59
+ def create(version, schema, specification_version=nil)
55
60
  self.new.tap do |sd|
56
61
  sd.version = version
57
62
  sd.schema = schema
58
63
  sd.heuristic_overrides = "#{version}/heuristic_overrides.yml"
59
64
  sd.disposition_codes = "#{version}/disposition_codes.yml"
65
+ sd.specification_version = specification_version
60
66
  end
61
67
  end
62
68
  private :create
@@ -82,6 +88,10 @@ module NcsNavigator::Mdes
82
88
  )
83
89
  end
84
90
 
91
+ def specification_version
92
+ @specification_version || self.version
93
+ end
94
+
85
95
  ##
86
96
  # The absolute path to the XML Schema describing the MDES
87
97
  # transmission structure for this instance.
@@ -126,20 +136,20 @@ module NcsNavigator::Mdes
126
136
  def heuristic_overrides=(path)
127
137
  @heuristic_overrides = path
128
138
  end
129
-
139
+
130
140
  ##
131
141
  # The absolute path to a YAML-formatted document defining
132
- # the disposition codes as found in the Master Data Element Specifications
142
+ # the disposition codes as found in the Master Data Element Specifications
133
143
  # spreadsheet.
134
144
  #
135
- # This is path is optional; if one is not provided no disposition
145
+ # This is path is optional; if one is not provided no disposition
136
146
  # codes will be loaded.
137
147
  #
138
148
  # @return [String]
139
149
  def disposition_codes
140
150
  absolutize(@disposition_codes)
141
151
  end
142
-
152
+
143
153
  ##
144
154
  # Set the path to the disposition codes document.
145
155
  # If the path is relative (i.e., it does not begin with `/`), it
@@ -19,6 +19,13 @@ module NcsNavigator::Mdes
19
19
  # @return [String] the version of the MDES to which this instance refers.
20
20
  def_delegator :@source_documents, :version
21
21
 
22
+ ##
23
+ # @method specification_version
24
+ # @return [String] the exact version this specification
25
+ # matches. It may be more exact than the requested version due
26
+ # to applied patches.
27
+ def_delegator :@source_documents, :specification_version
28
+
22
29
  ##
23
30
  # @param [String,SourceDocuments] version either the string
24
31
  # version of the MDES metadata you would like to read, or a
@@ -143,7 +150,7 @@ module NcsNavigator::Mdes
143
150
  end
144
151
  end
145
152
  end
146
-
153
+
147
154
  def empty_disposition_codes
148
155
  []
149
156
  end
@@ -53,8 +53,8 @@ module NcsNavigator::Mdes
53
53
  attr_writer :required
54
54
 
55
55
  ##
56
- # If this variable is a foreign key, this is the {table
57
- # TransmissionTable} to which it refers.
56
+ # If this variable is a foreign key, this is the
57
+ # {TransmissionTable table} to which it refers.
58
58
  #
59
59
  # @return [TransmissionTable,nil] the parent table.
60
60
  attr_accessor :table_reference
@@ -153,9 +153,9 @@ module NcsNavigator::Mdes
153
153
  end
154
154
 
155
155
  ##
156
- # Attempts to resolve this variable as a {reference to another
157
- # table #table_reference}. There are two mechanisms for performing
158
- # the resolution:
156
+ # Attempts to resolve this variable as a {#table_reference
157
+ # reference to another table}. There are two mechanisms for
158
+ # performing the resolution:
159
159
  #
160
160
  # 1. If an `override_name` is provided, that table will be looked
161
161
  # up in the provided table list. If it exists, it will be used,
@@ -1,5 +1,5 @@
1
1
  module NcsNavigator
2
2
  module Mdes
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
@@ -24,4 +24,5 @@ National Children's Study's Master Data Element Specification.
24
24
  s.add_development_dependency 'rspec', '~> 2.6'
25
25
  s.add_development_dependency 'rake', '~> 0.9.2'
26
26
  s.add_development_dependency 'yard', '~> 0.7.2'
27
+ s.add_development_dependency 'ci_reporter', '~> 1.6'
27
28
  end
@@ -60,7 +60,7 @@ module NcsNavigator::Mdes
60
60
  SourceDocuments.new.heuristic_overrides.should be_nil
61
61
  end
62
62
  end
63
-
63
+
64
64
  describe '#disposition_codes' do
65
65
  let(:property) { :disposition_codes }
66
66
 
@@ -82,7 +82,7 @@ module NcsNavigator::Mdes
82
82
  it 'has the correct path for the overrides' do
83
83
  subject.heuristic_overrides.should =~ %r{1.2/heuristic_overrides.yml$}
84
84
  end
85
-
85
+
86
86
  it 'has the correct path for the disposition codes' do
87
87
  subject.disposition_codes.should =~ %r{1.2/disposition_codes.yml$}
88
88
  end
@@ -90,6 +90,10 @@ module NcsNavigator::Mdes
90
90
  it 'is of the specified version' do
91
91
  subject.version.should == '1.2'
92
92
  end
93
+
94
+ it 'has no more specific specification_version' do
95
+ subject.specification_version.should == '1.2'
96
+ end
93
97
  end
94
98
 
95
99
  describe '2.0' do
@@ -102,7 +106,7 @@ module NcsNavigator::Mdes
102
106
  it 'has the correct path for the overrides' do
103
107
  subject.heuristic_overrides.should =~ %r{2.0/heuristic_overrides.yml$}
104
108
  end
105
-
109
+
106
110
  it 'has the correct path for the disposition codes' do
107
111
  subject.disposition_codes.should =~ %r{2.0/disposition_codes.yml$}
108
112
  end
@@ -110,6 +114,10 @@ module NcsNavigator::Mdes
110
114
  it 'is of the specified version' do
111
115
  subject.version.should == '2.0'
112
116
  end
117
+
118
+ it 'has a different specification_version' do
119
+ subject.specification_version.should == '2.0.01.02'
120
+ end
113
121
  end
114
122
 
115
123
  it 'fails for an unsupported version' do
@@ -63,8 +63,17 @@ module NcsNavigator::Mdes
63
63
  include_examples 'tables fully resolved'
64
64
  end
65
65
  end
66
-
67
-
66
+
67
+ describe '#specification_version' do
68
+ it 'is the named version by default' do
69
+ Specification.new('1.2').specification_version.should == '1.2'
70
+ end
71
+
72
+ it 'is the read-in version if the source has one' do
73
+ Specification.new('2.0').specification_version.should == '2.0.01.02'
74
+ end
75
+ end
76
+
68
77
  describe '#disposition codes' do
69
78
  it 'is composed of DispositionCode instances' do
70
79
  Specification.new('2.0', :log => logger).disposition_codes.first.
@@ -85,7 +94,7 @@ module NcsNavigator::Mdes
85
94
  it 'has 251 codes' do
86
95
  disposition_codes.size.should == 251
87
96
  end
88
-
97
+
89
98
  it 'creates valid codes' do
90
99
  code = disposition_codes.first
91
100
  code.event.should == "Household Enumeration Event"
metadata CHANGED
@@ -1,99 +1,85 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ncs_mdes
3
- version: !ruby/object:Gem::Version
4
- hash: 13
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 4
9
- - 1
10
- version: 0.4.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.2
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Rhett Sutphin
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-31 00:00:00 -05:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-09 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: nokogiri
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2152825220 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 7
30
- segments:
31
- - 1
32
- - 4
33
- version: "1.4"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.4'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: rspec
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2152825220
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2152824560 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
29
+ requirements:
42
30
  - - ~>
43
- - !ruby/object:Gem::Version
44
- hash: 15
45
- segments:
46
- - 2
47
- - 6
48
- version: "2.6"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.6'
49
33
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: rake
53
34
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *2152824560
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &2152823680 !ruby/object:Gem::Requirement
55
39
  none: false
56
- requirements:
40
+ requirements:
57
41
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 63
60
- segments:
61
- - 0
62
- - 9
63
- - 2
42
+ - !ruby/object:Gem::Version
64
43
  version: 0.9.2
65
44
  type: :development
66
- version_requirements: *id003
67
- - !ruby/object:Gem::Dependency
68
- name: yard
69
45
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *2152823680
47
+ - !ruby/object:Gem::Dependency
48
+ name: yard
49
+ requirement: &2152822920 !ruby/object:Gem::Requirement
71
50
  none: false
72
- requirements:
51
+ requirements:
73
52
  - - ~>
74
- - !ruby/object:Gem::Version
75
- hash: 7
76
- segments:
77
- - 0
78
- - 7
79
- - 2
53
+ - !ruby/object:Gem::Version
80
54
  version: 0.7.2
81
55
  type: :development
82
- version_requirements: *id004
83
- description: |
84
-
56
+ prerelease: false
57
+ version_requirements: *2152822920
58
+ - !ruby/object:Gem::Dependency
59
+ name: ci_reporter
60
+ requirement: &2152822260 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: '1.6'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2152822260
69
+ description: ! '
70
+
85
71
  Provides a consistent ruby interface to the project metainformation in the
86
- National Children's Study's Master Data Element Specification.
87
72
 
88
- email:
73
+ National Children''s Study''s Master Data Element Specification.
74
+
75
+ '
76
+ email:
89
77
  - r-sutphin@northwestern.edu
90
- executables:
78
+ executables:
91
79
  - mdes-console
92
80
  extensions: []
93
-
94
81
  extra_rdoc_files: []
95
-
96
- files:
82
+ files:
97
83
  - .gitignore
98
84
  - .rvmrc
99
85
  - .yardopts
@@ -102,6 +88,7 @@ files:
102
88
  - README.md
103
89
  - Rakefile
104
90
  - bin/mdes-console
91
+ - ci-exec.sh
105
92
  - documents/1.2/Data_Transmission_Schema_V1.2.xsd
106
93
  - documents/1.2/heuristic_overrides.yml
107
94
  - documents/2.0/NCS_Transmission_Schema_2.0.01.02.xml
@@ -124,41 +111,37 @@ files:
124
111
  - spec/ncs_navigator/mdes/version_spec.rb
125
112
  - spec/ncs_navigator/mdes_spec.rb
126
113
  - spec/spec_helper.rb
127
- has_rdoc: true
128
- homepage: ""
114
+ homepage: ''
129
115
  licenses: []
130
-
131
116
  post_install_message:
132
117
  rdoc_options: []
133
-
134
- require_paths:
118
+ require_paths:
135
119
  - lib
136
- required_ruby_version: !ruby/object:Gem::Requirement
120
+ required_ruby_version: !ruby/object:Gem::Requirement
137
121
  none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ segments:
143
127
  - 0
144
- version: "0"
145
- required_rubygems_version: !ruby/object:Gem::Requirement
128
+ hash: 1899662951154371602
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
130
  none: false
147
- requirements:
148
- - - ">="
149
- - !ruby/object:Gem::Version
150
- hash: 3
151
- segments:
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ segments:
152
136
  - 0
153
- version: "0"
137
+ hash: 1899662951154371602
154
138
  requirements: []
155
-
156
139
  rubyforge_project:
157
- rubygems_version: 1.3.7
140
+ rubygems_version: 1.8.6
158
141
  signing_key:
159
142
  specification_version: 3
160
143
  summary: A ruby API for various versions of the NCS MDES.
161
- test_files:
144
+ test_files:
162
145
  - spec/ncs_navigator/mdes/source_documents_spec.rb
163
146
  - spec/ncs_navigator/mdes/specification_spec.rb
164
147
  - spec/ncs_navigator/mdes/transmission_table_spec.rb