framecurve 2.0.0 → 2.1.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.
@@ -1,3 +1,7 @@
1
+ 2.1.0
2
+
3
+ * Adds Validator#ok?
4
+
1
5
  2.0.0
2
6
 
3
7
  * Added a FinalCut extractor, plus some bugfixes
@@ -18,7 +18,7 @@ ARGV.each do | arg |
18
18
  validator = Framecurve::Validator.new
19
19
  validator.parse_and_validate(arg)
20
20
 
21
- unless validator.any_errors? || validator.any_warnings?
21
+ if validator.ok?
22
22
  puts Color.green { "Framecurve file %s TOTALLY OK! Good job!" % arg }
23
23
  else
24
24
  $stderr.puts Color.bold{ arg }
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "framecurve"
8
- s.version = "2.0.0"
8
+ s.version = "2.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julik"]
12
- s.date = "2012-01-08"
12
+ s.date = "2012-01-10"
13
13
  s.description = " Parser, validation and interpolation"
14
14
  s.email = "me@julik.nl"
15
15
  s.executables = ["framecurve_from_fcp_xml", "framecurve_validator"]
@@ -1,5 +1,5 @@
1
1
  module Framecurve
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
 
4
4
  # Is raised when a malformed framecurve bit has occurred in the system
5
5
  class Malformed < RuntimeError
@@ -7,7 +7,7 @@ class Framecurve::Validator
7
7
  attr_reader :warnings, :errors
8
8
 
9
9
  def initialize
10
- @warnings, @errors = [], []
10
+ @warnings, @errors, @performed = [], [], false
11
11
  end
12
12
 
13
13
  # Tells whether this validator instance has any errors
@@ -35,6 +35,12 @@ class Framecurve::Validator
35
35
  methods_matching(/^(verify|recommend)/).each do | method_name |
36
36
  method(method_name).call(curve)
37
37
  end
38
+ @performed = true
39
+ end
40
+
41
+ # Returns true if validation has been performed and there are no warnings and no errors
42
+ def ok?
43
+ @performed && !any_errors? && !any_warnings?
38
44
  end
39
45
 
40
46
  private
@@ -72,6 +72,7 @@ class TestFramecurveValidator < Test::Unit::TestCase
72
72
  c = Framecurve::Curve.new( Framecurve::Tuple.new(10, 123.4), Framecurve::Tuple.new(1, 123.4) )
73
73
  v = Framecurve::Validator.new
74
74
  v.validate(c)
75
+ assert !v.ok?
75
76
  assert v.any_errors?
76
77
  assert_equal ["The frame sequencing is out of order (expected [1, 10] but got [10, 1]). The framecurve spec mandates that frames are recorded sequentially"], v.errors
77
78
  end
@@ -83,24 +84,28 @@ class TestFramecurveValidator < Test::Unit::TestCase
83
84
  assert v.any_errors?
84
85
  errs = ["The line 1 had it's at_frame value (-10) below 1. The spec mandates at_frame >= 1.",
85
86
  "The line 2 had a use_frame_of_source value (-345.67000) below 0. The spec mandates use_frame_of_source >= 0."]
87
+ assert !v.ok?
86
88
  assert_equal errs, v.errors
87
89
  end
88
90
 
89
91
  def test_parse_from_err_bad_extension
90
92
  v = Framecurve::Validator.new
91
93
  v.parse_and_validate(File.dirname(__FILE__) + "/fixtures/framecurves/incorrect.extension")
94
+ assert !v.ok?
92
95
  assert_equal ["The framecurve file has to have the .framecurve.txt double extension, but had \".extension\""], v.errors
93
96
  end
94
97
 
95
98
  def test_parse_from_err_neg_frames
96
99
  v = Framecurve::Validator.new
97
100
  v.parse_and_validate(File.dirname(__FILE__) + "/fixtures/framecurves/err-neg-frames.framecurve.txt")
101
+ assert !v.ok?
98
102
  assert_equal ["The line 3 had it's at_frame value (-1) below 1. The spec mandates at_frame >= 1."], v.errors
99
103
  end
100
104
 
101
105
  def test_parse_from_err_no_tuples
102
106
  v = Framecurve::Validator.new
103
107
  v.parse_and_validate(File.dirname(__FILE__) + "/fixtures/framecurves/err-no-tuples.framecurve.txt")
108
+ assert !v.ok?
104
109
  assert_equal ["The framecurve did not contain any frame correlation records"], v.errors
105
110
  end
106
111
 
@@ -109,6 +114,7 @@ class TestFramecurveValidator < Test::Unit::TestCase
109
114
  v = Framecurve::Validator.new
110
115
  v.validate(c)
111
116
  assert v.any_warnings?
117
+ assert !v.ok?
112
118
  assert_equal "It is recommended that a framecurve starts with a comment with the specification URL", v.warnings[0]
113
119
  end
114
120
 
@@ -116,8 +122,19 @@ class TestFramecurveValidator < Test::Unit::TestCase
116
122
  c = Framecurve::Curve.new( Framecurve::Comment.new("http://framecurve.org/specification-v1"), Framecurve::Tuple.new(10, 123.4))
117
123
  v = Framecurve::Validator.new
118
124
  v.validate(c)
125
+ assert !v.ok?
119
126
  assert v.any_warnings?
120
127
  assert_equal "It is recommended for the second comment to provide a column header", v.warnings[0]
121
128
  end
122
129
 
130
+ def test_should_parse_well
131
+ c = Framecurve::Curve.new(
132
+ Framecurve::Comment.new("http://framecurve.org/specification-v1"),
133
+ Framecurve::Comment.new("at_frame\tuse_frame_of_source"),
134
+ Framecurve::Tuple.new(10, 123.4)
135
+ )
136
+ v = Framecurve::Validator.new
137
+ v.validate(c)
138
+ assert v.ok?
139
+ end
123
140
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: framecurve
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-08 00:00:00.000000000 Z
12
+ date: 2012-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: term-ansicolor
16
- requirement: &11839020 !ruby/object:Gem::Requirement
16
+ requirement: &12017030 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *11839020
24
+ version_requirements: *12017030
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jeweler
27
- requirement: &11838780 !ruby/object:Gem::Requirement
27
+ requirement: &12016790 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.6.4
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *11838780
35
+ version_requirements: *12016790
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &11838540 !ruby/object:Gem::Requirement
38
+ requirement: &12016550 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *11838540
46
+ version_requirements: *12016550
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: cli_test
49
- requirement: &11838300 !ruby/object:Gem::Requirement
49
+ requirement: &12016310 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *11838300
57
+ version_requirements: *12016310
58
58
  description: ! ' Parser, validation and interpolation'
59
59
  email: me@julik.nl
60
60
  executables: