stix_schema_spy 1.2.1 → 1.2.2

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.
@@ -168,7 +168,7 @@ module StixSchemaSpy
168
168
  end
169
169
 
170
170
  def self.schema_dir(version = self.latest_version)
171
- File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', 'config', version)
171
+ File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', '..', 'config', version, 'stix')
172
172
  end
173
173
 
174
174
  def self.latest_version
@@ -200,16 +200,19 @@ module StixSchemaSpy
200
200
  end
201
201
  end
202
202
 
203
- def self.preload!(version = self.latest_version)
203
+ def self.preload!(version = self.latest_version, schema_location = nil)
204
204
  @preloaded ||= {}
205
205
  return if @preloaded[version]
206
206
  @preloaded[version] = true
207
- Dir.glob("#{schema_dir(version)}/stix/cybox/*.xsd").each {|f| self.build(f, version)}
208
- Dir.glob("#{schema_dir(version)}/stix/cybox/objects/*.xsd").each {|f| self.build(f, version)}
209
- Dir.glob("#{schema_dir(version)}/stix/cybox/extensions/*.xsd").each {|f| self.build(f, version)}
210
- Dir.glob("#{schema_dir(version)}/stix/*.xsd").each {|f| self.build(f, version)}
211
- Dir.glob("#{schema_dir(version)}/stix/extensions/**/*.xsd").each {|f| self.build(f, version)}
212
- @uber_schema = Dir.chdir(schema_dir(version)) {Nokogiri::XML::Schema.new(File.read('uber_schema.xsd'))}
207
+ schema_location ||= schema_dir(version)
208
+ Dir.glob("#{schema_location}/cybox/*.xsd").each {|f| self.build(f, version)}
209
+ Dir.glob("#{schema_location}/cybox/objects/*.xsd").each {|f| self.build(f, version)}
210
+ Dir.glob("#{schema_location}/cybox/extensions/*.xsd").each {|f| self.build(f, version)}
211
+ Dir.glob("#{schema_location}/*.xsd").each {|f| self.build(f, version)}
212
+ Dir.glob("#{schema_location}/extensions/**/*.xsd").each {|f| self.build(f, version)}
213
+ @uber_schema = Dir.chdir(schema_location) {
214
+ Nokogiri::XML::Schema.new(File.read('uber_schema.xsd')) if File.exists?('uber_schema.xsd')
215
+ }
213
216
  Schema.all(version).each(&:preload!)
214
217
  return true
215
218
  end
@@ -1,3 +1,3 @@
1
1
  module StixSchemaSpy
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stix_schema_spy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-21 00:00:00.000000000 Z
12
+ date: 2014-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri