ruby3mf 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2103e190da26beb2e01fb74ce4faf7443085ca3a
4
- data.tar.gz: 21b7a9b19a9ebcf65661481138afdbb7b27c2c8e
3
+ metadata.gz: 5c3c875e13f40a3230c7146228502167eae4452b
4
+ data.tar.gz: e572579b6da6f51705ced9dded95eec810a2230f
5
5
  SHA512:
6
- metadata.gz: 7d91f2e9ec52ea81032401064895e83ea4bd7c6d17b93af515a02f5d4aa7c66143e578b1736f50c206e73efd866ec1848483b08341577742d3452569c6c17399
7
- data.tar.gz: d69275d9af624eb6f612569259cea989098acfa4b32e96a4be20c2cc097c6c3de39921f2f2752b85f7bb54b582916e8706ea17cda0068f705df33624cde6c024
6
+ metadata.gz: 3eda18a557d21f60cf8236786002085afa545236e206df90794f66341125f447e48ffa1189a898786cabb678cab74f650f45867a49938abfea82072129d20fb8
7
+ data.tar.gz: e4da8cb5bdab1a1fac1b36cfa351d542ebcef28738c13716d6dc928ebcb7dc7b8978d2b7bba7d20ce51107f989bb4ee3eaf2b7cc64351787bf1f1432417f8bcc
@@ -6,6 +6,7 @@ require "ruby3mf/hash"
6
6
  require "ruby3mf/model3mf"
7
7
  require "ruby3mf/relationships"
8
8
  require "ruby3mf/thumbnail3mf"
9
+ require "ruby3mf/texture3mf"
9
10
 
10
11
 
11
12
 
@@ -2,19 +2,19 @@ class Document
2
2
 
3
3
  attr_accessor :models
4
4
  attr_accessor :thumbnails
5
- # attr_accessor :textures
5
+ attr_accessor :textures
6
6
 
7
7
  # Relationship Type => Class validating relationship type
8
8
  RELATIONSHIP_TYPES = {
9
9
  'http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel' => {klass: 'Model3mf', collection: :models},
10
- 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail' => {klass: 'Thumbnail3mf', collection: :thumbnails} #,
11
- # 'http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture' => {klass: 'Texture3d', collection: :textures}
10
+ 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail' => {klass: 'Thumbnail3mf', collection: :thumbnails},
11
+ 'http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture' => {klass: 'Texture3mf', collection: :textures}
12
12
  }
13
13
 
14
14
  def initialize
15
15
  self.models=[]
16
16
  self.thumbnails=[]
17
- # self.textures=[]
17
+ self.textures=[]
18
18
  end
19
19
 
20
20
  def self.read(input_file)
@@ -89,14 +89,21 @@ class Log3mf
89
89
  Log3mf.instance.entries(*l)
90
90
  end
91
91
 
92
- def spec_link(page)
93
- "http://3mf.io/wp-content/uploads/2016/03/3MFcoreSpec_1.1.pdf#page=#{page}"
92
+ def spec_link(spec, page)
93
+ spec = :core unless spec
94
+ doc_urls={
95
+ core: 'http://3mf.io/wp-content/uploads/2016/03/3MFcoreSpec_1.1.pdf',
96
+ material: 'http://3mf.io/wp-content/uploads/2015/04/3MFmaterialsSpec_1.0.1.pdf',
97
+ production: 'http://3mf.io/wp-content/uploads/2016/07/3MFproductionSpec.pdf',
98
+ slice: 'http://3mf.io/wp-content/uploads/2016/07/3MFsliceSpec.pdf'
99
+ }
100
+ "#{doc_urls[spec]}#page=#{page}"
94
101
  end
95
102
 
96
103
  def to_json
97
104
  @log_list.collect { |ent|
98
105
  h = { context: ent[0], severity: ent[1], message: ent[2] }
99
- h[:spec_ref] = spec_link(ent[3][:page]) if (ent[3] && ent[3][:page])
106
+ h[:spec_ref] = spec_link(ent[3][:spec], ent[3][:page]) if (ent[3] && ent[3][:page])
100
107
  h
101
108
  }.to_json
102
109
  end
@@ -115,7 +122,7 @@ class Log3mf
115
122
  @log_list.each do |logline|
116
123
  msg = logline[2]
117
124
  if logline[3] && logline[3][:page]
118
- msg = "<a href=\"#{spec_link(logline[3][:page])}\" target=\"_blank\">#{msg}</a>"
125
+ msg = "<a href=\"#{spec_link(logline[3][:spec], logline[3][:page])}\" target=\"_blank\">#{msg}</a>"
119
126
  end
120
127
  s << "[#{logline[0].ljust(longest_context)}] #{logline[1].to_s.upcase.ljust(longest_severity)} #{msg}"
121
128
  end
@@ -0,0 +1,11 @@
1
+ class Texture3mf
2
+
3
+ def self.parse(relationship_file, relationships)
4
+ img_type = MimeMagic.by_magic(relationship_file.get_input_stream)
5
+ Log3mf.context "Texture3mf" do |l|
6
+ l.debug "texture is of type: #{img_type}"
7
+ l.error "Expected a png or jpeg texture but the texture was of type #{img_type}", spec: :material, page: 16 unless ['image/png', 'image/jpeg'].include? img_type.type
8
+ end
9
+
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Ruby3mf
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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.1.2
4
+ version: 0.1.3
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: 2016-11-10 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,6 +122,7 @@ files:
122
122
  - lib/ruby3mf/log3mf.rb
123
123
  - lib/ruby3mf/model3mf.rb
124
124
  - lib/ruby3mf/relationships.rb
125
+ - lib/ruby3mf/texture3mf.rb
125
126
  - lib/ruby3mf/thumbnail3mf.rb
126
127
  - lib/ruby3mf/version.rb
127
128
  - ruby3mf.gemspec