scad4r 0.2.1 → 0.3.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -0,0 +1,12 @@
1
+ Feature: I want to know what openscad's done with my scad file
2
+
3
+ Scenario: Errors in geometry
4
+ Given I have a Scad4r::Runner with a Scad4r::ResultParser
5
+ And a file named "not_two_manifold.scad" with:
6
+ """
7
+ cube([20, 20, 20]);
8
+ translate([-20, -20, 0]) cube([20, 20, 20]);
9
+ cube([50, 50, 5], center = true);
10
+ """
11
+ When I run "not_two_manifold.scad" through the Scad4r::Runner
12
+ Then the results should be an error
@@ -0,0 +1,3 @@
1
+ Then /^the results should be an error$/ do
2
+ last_results.should include(:error)
3
+ end
@@ -2,6 +2,10 @@ Given /^I have a Scad4r::Runner$/ do
2
2
  self.runner= Scad4r::Runner.new
3
3
  end
4
4
 
5
+ Given /^I have a Scad4r::Runner with a Scad4r::ResultParser$/ do
6
+ self.runner= Scad4r::Runner.new(parser: Scad4r::ResultParser.new)
7
+ end
8
+
5
9
  When /^I run "(.*?)" through the Scad4r::Runner$/ do |path|
6
10
  in_current_dir do
7
11
  self.last_results= runner.run(path)
@@ -16,6 +16,7 @@ require 'rspec/expectations'
16
16
  require 'aruba/cucumber'
17
17
 
18
18
  require 'scad4r/runner'
19
+ require 'scad4r/result_parser'
19
20
 
20
21
  require 'pry'
21
22
 
@@ -4,6 +4,8 @@ module Scad4r
4
4
  case result
5
5
  when %r{Parser error in line (\d+): (.*)$}
6
6
  {error: "#{$2} line #{$1}"}
7
+ when %r{Object isn't}
8
+ {error: result}
7
9
  when %r{WARNING:}, %r{ECHO:}
8
10
  extract_timings(result).merge({
9
11
  warnings: extract_warnings(result),
data/scad4r.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "scad4r"
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Caleb Buxton"]
@@ -26,7 +26,9 @@ Gem::Specification.new do |s|
26
26
  "README.rdoc",
27
27
  "Rakefile",
28
28
  "VERSION",
29
+ "features/result_parser.feature",
29
30
  "features/runner.feature",
31
+ "features/step_definitions/result_parser_steps.rb",
30
32
  "features/step_definitions/runner_steps.rb",
31
33
  "features/support/env.rb",
32
34
  "lib/scad4r.rb",
@@ -9,12 +9,21 @@ module Scad4r
9
9
  subject { OpenStruct.new(described_class.new.parse(scad_result)) }
10
10
 
11
11
  context "with errors" do
12
- let(:scad_result) { <<-END
13
- Parser error in line 47: syntax error
12
+ context "in syntax" do
13
+ let(:scad_result) { <<-END
14
+ Parser error in line 47: syntax error
15
+
16
+ END
17
+ }
18
+ its(:error) { should eql("syntax error line 47") }
19
+ end
20
+
21
+ context "in geometry" do
22
+ let(:scad_result) {
23
+ "Object isn't a valid 2-manifold! Mobify your design." }
14
24
 
15
- END
16
- }
17
- its(:error) { should eql("syntax error line 47") }
25
+ its(:error) { should eql("Object isn't a valid 2-manifold! Mobify your design.")}
26
+ end
18
27
  end
19
28
 
20
29
  context "with warnings" do
@@ -105,7 +114,7 @@ END
105
114
  context "with timings" do
106
115
 
107
116
  let(:scad_result) { <<-END
108
- CGAL Cache insert: import(file=\"../Huxley/Print-Huxley/Indi (1728992 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,20],[0,1,0,0],[0,0,1, (1728992 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,20],[0,1,0,0] (1728992 bytes)\nCGAL Cache insert: group(){group(){multmatrix([[1,0,0,20],[ (1728992 bytes)\nCGAL Cache insert: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache hit: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache hit: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache hit: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,7.5],[0,1,0,2.9],[0,0 (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,32.5],[0,1,0,2.9],[0, (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,32.5],[0,1,0,25.9],[0 (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,7.5],[0,1,0,25.9],[0, (62712 bytes)\nCGAL Cache insert: cube(size=[3,3,5],center=false); (10872 bytes)\nCGAL Cache insert: multmatrix([[0.707107,-0.707107,0,0],[0. (10872 bytes)\nCGAL Cache hit: multmatrix([[0.707107,-0.707107,0,0],[0. (10872 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,-1.06066],[0,1,0,-2.1 (10872 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,41.0607],[0,1,0,-2.12 (10872 bytes)\nCGAL Cache insert: cube(size=[5.83095,5.83095,5],center=fal (10872 bytes)\nCGAL Cache insert: multmatrix([[0.857493,-0.514496,0,0],[0. (10872 bytes)\nCGAL Cache hit: cube(size=[5.83095,5.83095,5],center=fal (10872 bytes)\nCGAL Cache insert: multmatrix([[0.514496,-0.857493,0,0],[0. (10872 bytes)\nCGAL Cache insert: cube(size=[40,28.8,5],center=false); (10872 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,7.5],[0,1,0,2 (250560 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,-1.06066],[0, (21648 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,0],[0,1,0,25.8],[0,0, (10872 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,40],[0,1,0,25.8],[0,0 (10872 bytes)\nCGAL Cache insert: difference(){cube(size=[40,28.8,5],cente (273048 bytes)\nCGAL Cache hit: group(){group(){multmatrix([[1,0,0,20],[ (1728992 bytes)\nCGAL Cache hit: difference(){cube(size=[40,28.8,5],cente (273048 bytes)\nCGAL Cache insert: group(){difference(){cube(size=[40,28.8, (273048 bytes)\nCGAL Cache insert: difference(){group(){group(){multmatrix( (1190904 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,-60],[0,1,0,0],[0,0,1 (1728992 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,60],[0,1,0,0],[0,0,1, (1190904 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,-60],[0,1,0,0 (3192752 bytes)\nObject isn't a valid 2-manifold! Modify your design.\n 52.44 real 48.14 user 0.34 sys
117
+ CGAL Cache insert: import(file=\"../Huxley/Print-Huxley/Indi (1728992 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,20],[0,1,0,0],[0,0,1, (1728992 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,20],[0,1,0,0] (1728992 bytes)\nCGAL Cache insert: group(){group(){multmatrix([[1,0,0,20],[ (1728992 bytes)\nCGAL Cache insert: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache hit: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache hit: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache hit: cylinder($fn=24,$fa=12,$fs=2,h=5,r1=1.65 (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,7.5],[0,1,0,2.9],[0,0 (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,32.5],[0,1,0,2.9],[0, (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,32.5],[0,1,0,25.9],[0 (62712 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,7.5],[0,1,0,25.9],[0, (62712 bytes)\nCGAL Cache insert: cube(size=[3,3,5],center=false); (10872 bytes)\nCGAL Cache insert: multmatrix([[0.707107,-0.707107,0,0],[0. (10872 bytes)\nCGAL Cache hit: multmatrix([[0.707107,-0.707107,0,0],[0. (10872 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,-1.06066],[0,1,0,-2.1 (10872 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,41.0607],[0,1,0,-2.12 (10872 bytes)\nCGAL Cache insert: cube(size=[5.83095,5.83095,5],center=fal (10872 bytes)\nCGAL Cache insert: multmatrix([[0.857493,-0.514496,0,0],[0. (10872 bytes)\nCGAL Cache hit: cube(size=[5.83095,5.83095,5],center=fal (10872 bytes)\nCGAL Cache insert: multmatrix([[0.514496,-0.857493,0,0],[0. (10872 bytes)\nCGAL Cache insert: cube(size=[40,28.8,5],center=false); (10872 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,7.5],[0,1,0,2 (250560 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,-1.06066],[0, (21648 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,0],[0,1,0,25.8],[0,0, (10872 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,40],[0,1,0,25.8],[0,0 (10872 bytes)\nCGAL Cache insert: difference(){cube(size=[40,28.8,5],cente (273048 bytes)\nCGAL Cache hit: group(){group(){multmatrix([[1,0,0,20],[ (1728992 bytes)\nCGAL Cache hit: difference(){cube(size=[40,28.8,5],cente (273048 bytes)\nCGAL Cache insert: group(){difference(){cube(size=[40,28.8, (273048 bytes)\nCGAL Cache insert: difference(){group(){group(){multmatrix( (1190904 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,-60],[0,1,0,0],[0,0,1 (1728992 bytes)\nCGAL Cache insert: multmatrix([[1,0,0,60],[0,1,0,0],[0,0,1, (1190904 bytes)\nCGAL Cache insert: group(){multmatrix([[1,0,0,-60],[0,1,0,0 (3192752 bytes)\n 52.44 real 48.14 user 0.34 sys
109
118
  END
110
119
  }
111
120
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: scad4r
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.1
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Caleb Buxton
@@ -236,7 +236,9 @@ files:
236
236
  - README.rdoc
237
237
  - Rakefile
238
238
  - VERSION
239
+ - features/result_parser.feature
239
240
  - features/runner.feature
241
+ - features/step_definitions/result_parser_steps.rb
240
242
  - features/step_definitions/runner_steps.rb
241
243
  - features/support/env.rb
242
244
  - lib/scad4r.rb
@@ -268,7 +270,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
268
270
  - !ruby/object:Gem::Version
269
271
  segments:
270
272
  - 0
271
- hash: 198757374685059186
273
+ hash: 134172931124227608
272
274
  version: '0'
273
275
  required_rubygems_version: !ruby/object:Gem::Requirement
274
276
  none: false