ruby3mf 0.2.7 → 0.2.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 560dd08731ad8ca1bd20f9368086f8bd55cb175a
4
- data.tar.gz: ee40d214929e604a7596032941c0bf872590f6f5
3
+ metadata.gz: 737fe004ae04714fe3a70c43ec4ccfa82b0472fb
4
+ data.tar.gz: 887d66d7fc0779bd0094ebd3c7a09fbfd3c1bc16
5
5
  SHA512:
6
- metadata.gz: 59f57931ceaffec30387c9edcea8e79e95648350ce9b2dce71f2723037d3f854a20a8933209ba68b47a11befc41cf8b5113835628e46827ff655382a9b5fe802
7
- data.tar.gz: f3c9aa7b5f78d9788801bc30513abf88b5b56643f79cb2ab2e76fcbdb1bd88d4baae76964c709550d701ba313aff775aa9b629f7c663cc2927543a528b3868d6
6
+ metadata.gz: 1cd5a582a8d7450f6f8b9cd8076a674e520c0782061871058371c998b4e06e77bb8e777cc27c0334db083d2f12ce0fefe9833571781ef0aae856046703869694
7
+ data.tar.gz: 1f0a3bf6e58cdbda7b84506032c1ba08c5ad69fc8edb145f84c06573341c4cb81345add496546cef26e42f215de8deeddf0eae6f9bab9046e42c49ce82c25292
@@ -34,7 +34,7 @@ class Model3mf
34
34
  end
35
35
 
36
36
  l.context "verifying requiredextensions" do |l|
37
- model_doc.css("//model").map{|node| node.attributes["requiredextensions"]}.compact.each do |required_extension|
37
+ model_doc.css("//model").map { |node| node.attributes["requiredextensions"] }.compact.each do |required_extension|
38
38
  required_extension.value.split(" ").each do |ns|
39
39
  namespace_uri = model_doc.namespaces["xmlns:#{ns}"]
40
40
  l.error :missing_extension_namespace_uri, ns: ns unless namespace_uri
@@ -81,8 +81,11 @@ class Model3mf
81
81
 
82
82
  l.context "verifying build items" do |l|
83
83
 
84
- l.error :build_with_other_item if model_doc.css('build/item').map { |x| x.attributes["objectid"].value }.map{ |id| model_doc.search(".//xmlns:object[@id=$id][@type=$type]", nil, { :id => id, :type => 'other' } ) }.flatten.any?
84
+ build_items = model_doc.css('build/item')
85
+ object_ids = build_items.map { |x| x.attributes["objectid"].value }
86
+ other_build_items = object_ids.map { |id| find_model_object(model_doc, id, 'other') }.flatten
85
87
 
88
+ l.error :build_with_other_item if other_build_items.any?
86
89
  end
87
90
 
88
91
  l.context "checking metadata" do |l|
@@ -117,4 +120,10 @@ class Model3mf
117
120
  end
118
121
  model_doc
119
122
  end
123
+
124
+ def self.find_model_object(model_doc, id, type)
125
+ model_doc.css('model/resources/object').select do |item|
126
+ item.attributes['id'].to_s == id && item.attributes['type'] && item.attributes['type'].value == type
127
+ end
128
+ end
120
129
  end
@@ -1,3 +1,3 @@
1
1
  module Ruby3mf
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby3mf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Whitmarsh, Jeff Porter, and William Hertling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-07 00:00:00.000000000 Z
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler