earl-report 0.5.3 → 0.6.1

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
  SHA256:
3
- metadata.gz: 47de1e3c1d07adb1a2ae440c1c53f72ceeb2c7b4e33d947739474225c802ed50
4
- data.tar.gz: 611468fcef85b3a812ae184759d3c9806106ac2d15611f63cdbbe08fe194202b
3
+ metadata.gz: 77b18a547a9e1721a2c32e83abc8230dfb5c8a4a7170874cda1b4cf41d50d4d8
4
+ data.tar.gz: 04654044c3dfca443518097550ef07bd68b74203ca9dfc239a49c1a62a5c7556
5
5
  SHA512:
6
- metadata.gz: e023c3c5a1c42da0dbfc976149e50e590b3c9b770e0e66372794f68b2e881de064a515d0c6d8f73ac7a2acf1920cc95e0b35735a3a4897742ac6cb9d3385d8fa
7
- data.tar.gz: e1c6bc8836bc9629fd36c0bc67e2f5dd30694a28f64da9ee06d864e29b0ce3d1636a83e755f878cb756d424f93b739f01246e08156085d73e8ccc48867c8bc09
6
+ metadata.gz: 743c19a11e2b87f8819d841df0d37b9a6693b8eac15546d87e025d2c14f3464604cacc78adadc6d08103326070975334cb77e50a7da7b1824baf1babc4dbd33f
7
+ data.tar.gz: 23524a7e72dfd286504c422b05defa55e1ae00343a348926180d5d252a3ca041bc6a948cd929eca6e4183bdc2f8c1a0ff3b39861c34417ead1360bce7cd77525
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.6.1
data/bin/earl-report CHANGED
@@ -15,6 +15,7 @@ OPT_ARGS = [
15
15
  ["--output", "-o", GetoptLong::REQUIRED_ARGUMENT,"Output report to file"],
16
16
  ["--query", GetoptLong::REQUIRED_ARGUMENT,"Query, or file containing query for extracting information from Test manifest"],
17
17
  ["--rc", GetoptLong::NO_ARGUMENT, "Write options to run-control file"],
18
+ ["--strict", GetoptLong::NO_ARGUMENT, "Fails if any skipped result is found"],
18
19
  ["--template", GetoptLong::OPTIONAL_ARGUMENT,"Specify or return default report template"],
19
20
  ["--verbose", GetoptLong::NO_ARGUMENT, "Detail on execution"],
20
21
  ["--help", "-?", GetoptLong::NO_ARGUMENT, "This message"]
@@ -65,6 +66,7 @@ opts.each do |opt, arg|
65
66
  when '--name' then options[:name] = arg
66
67
  when '--output' then options[:io] = File.open(arg, "w")
67
68
  when '--rc' then options[:rc] = true
69
+ when '--strict' then options[:strict] = true
68
70
  when '--template' then options[:template] = (File.open(arg, "r") unless arg.empty?)
69
71
  when '--verbose' then options[:verbose] = true
70
72
  when '--help' then usage
@@ -94,6 +96,6 @@ if options.has_key?(:template) && options[:template].nil?
94
96
  elsif ARGV.empty?
95
97
  usage
96
98
  else
97
- earl = EarlReport.new(*ARGV, options)
98
- earl.generate(options)
99
+ earl = EarlReport.new(*ARGV, **options)
100
+ earl.generate(**options)
99
101
  end
data/lib/earl_report.rb CHANGED
@@ -11,6 +11,7 @@ class EarlReport
11
11
  autoload :VERSION, 'earl_report/version'
12
12
 
13
13
  attr_reader :graph
14
+ attr_reader :verbose
14
15
 
15
16
  # Return information about each test.
16
17
  # Tests all have an mf:action property.
@@ -186,29 +187,37 @@ class EarlReport
186
187
 
187
188
  ##
188
189
  # Load test assertions and look for referenced software and developer information
189
- # @overload initialize(*files)
190
- # @param [Array<String>] files Assertions
191
- # @overload initialize(*files, options = {})
192
- # @param [Hash{Symbol => Object}] options
193
- # @option options [Boolean] :verbose (true)
194
- # @option options [String] :base Base IRI for loading Manifest
195
- # @option options [String] :bibRef
196
- # ReSpec bibliography reference for specification being tested
197
- # @option options [String] :json Result of previous JSON-LD generation
198
- # @option options [String, Array<String>] :manifest Test manifest
199
- # @option options [String] :name Name of specification
200
- # @option options [String] :query
201
- # Query, or file containing query for extracting information from Test manifests
202
- def initialize(*files)
203
- @options = files.last.is_a?(Hash) ? files.pop.dup : {}
204
- @options[:query] ||= MANIFEST_QUERY
205
- raise "Test Manifests must be specified with :manifest option" unless @options[:manifest] || @options[:json]
190
+ #
191
+ # @param [Array<String>] files Assertions
192
+ # @param [String] base (nil) Base IRI for loading Manifest
193
+ # @param [String] bibRef ('Unknown reference')
194
+ # ReSpec bibliography reference for specification being tested
195
+ # @param [Boolean] json (false) File is in the JSON format of a report.
196
+ # @param [String, Array<String>] manifest (nil) Test manifest(s)
197
+ # @param [String] name ('Unknown') Name of specification
198
+ # @param [String] query (MANIFEST_QUERY)
199
+ # Query, or file containing query for extracting information from Test manifests
200
+ # @param [Boolean] strict (false) Abort on any warning
201
+ # @param [Boolean] verbose (false)
202
+ def initialize(*files,
203
+ base: nil,
204
+ bibRef: 'Unknown reference',
205
+ json: false,
206
+ manifest: nil,
207
+ name: 'Unknown',
208
+ query: MANIFEST_QUERY,
209
+ strict: false,
210
+ verbose: false,
211
+ **options)
212
+ @verbose = verbose
213
+ raise "Test Manifests must be specified with :manifest option" unless manifest || json
206
214
  raise "Require at least one input file" if files.empty?
207
215
  @files = files
208
216
  @prefixes = {}
217
+ @warnings = 0
209
218
 
210
- # If provided :json, it is used for generating all other output forms
211
- if @options[:json]
219
+ # If provided json, it is used for generating all other output forms
220
+ if json
212
221
  @json_hash = ::JSON.parse(File.read(files.first))
213
222
  # Add a base_uri so relative subjects aren't dropped
214
223
  JSON::LD::Reader.open(files.first, base_uri: "http://example.org/report") do |r|
@@ -223,25 +232,25 @@ class EarlReport
223
232
  end
224
233
 
225
234
  # Load manifests, possibly with base URI
226
- status "read #{@options[:manifest].inspect}"
235
+ status "read #{manifest.inspect}"
227
236
  man_opts = {}
228
- man_opts[:base_uri] = RDF::URI(@options[:base]) if @options[:base]
237
+ man_opts[:base_uri] = RDF::URI(base) if base
229
238
  @graph = RDF::Graph.new
230
- Array(@options[:manifest]).each do |man|
239
+ Array(manifest).each do |man|
231
240
  g = RDF::Graph.load(man, unique_bnodes: true, **man_opts)
232
241
  status " loaded #{g.count} triples from #{man}"
233
242
  graph << g
234
243
  end
235
244
 
236
245
  # Hash test cases by URI
237
- tests = SPARQL.execute(@options[:query], graph)
246
+ tests = SPARQL.execute(query, graph)
238
247
  .to_a
239
248
  .inject({}) {|memo, soln| memo[soln[:uri]] = soln; memo}
240
249
 
241
250
  if tests.empty?
242
251
  raise "no tests found querying manifest.\n" +
243
252
  "Results are found using the following query, this can be overridden using the --query option:\n" +
244
- "#{@options[:query]}"
253
+ "#{query}"
245
254
  end
246
255
 
247
256
  # Manifests in graph
@@ -262,7 +271,7 @@ class EarlReport
262
271
  status "read #{file}"
263
272
  file_graph = RDF::Graph.load(file)
264
273
  if file_graph.first_object(predicate: RDF::URI('http://www.w3.org/ns/earl#testSubjects'))
265
- status " skip #{file}, which seems to be a previous rollup earl report"
274
+ warn " skip #{file}, which seems to be a previous rollup earl report"
266
275
  @files -= [file]
267
276
  else
268
277
  status " loaded #{file_graph.count} triples"
@@ -314,7 +323,7 @@ class EarlReport
314
323
  subjects[solution[:uri]] = RDF::URI(file)
315
324
 
316
325
  # Add TestSubject information to main graph
317
- name = solution[:name].to_s if solution[:name]
326
+ doapName = solution[:name].to_s if solution[:name]
318
327
  language = solution[:language].to_s if solution[:language]
319
328
  doapDesc = solution[:doapDesc] if solution[:doapDesc]
320
329
  doapDesc.language ||= :en if doapDesc
@@ -322,7 +331,7 @@ class EarlReport
322
331
  graph << RDF::Statement(solution[:uri], RDF.type, RDF::Vocab::DOAP.Project)
323
332
  graph << RDF::Statement(solution[:uri], RDF.type, EARL.TestSubject)
324
333
  graph << RDF::Statement(solution[:uri], RDF.type, EARL.Software)
325
- graph << RDF::Statement(solution[:uri], RDF::Vocab::DOAP.name, name)
334
+ graph << RDF::Statement(solution[:uri], RDF::Vocab::DOAP.name, doapName)
326
335
  graph << RDF::Statement(solution[:uri], RDF::Vocab::DOAP.developer, solution[:developer])
327
336
  graph << RDF::Statement(solution[:uri], RDF::Vocab::DOAP.homepage, solution[:homepage]) if solution[:homepage]
328
337
  graph << RDF::Statement(solution[:uri], RDF::Vocab::DOAP.description, doapDesc) if doapDesc
@@ -350,12 +359,12 @@ class EarlReport
350
359
  subject = solution[:subject]
351
360
  unless tests[solution[:test]]
352
361
  assertion_stats["Skipped"] = assertion_stats["Skipped"].to_i + 1
353
- $stderr.puts "Skipping result for #{solution[:test]} for #{subject}, which is not defined in manifests"
362
+ warn "Skipping result for #{solution[:test]} for #{subject}, which is not defined in manifests"
354
363
  next
355
364
  end
356
365
  unless subjects[subject]
357
366
  assertion_stats["Missing Subject"] = assertion_stats["Missing Subject"].to_i + 1
358
- $stderr.puts "No test result subject found for #{subject}: in #{subjects.keys.join(', ')}"
367
+ warn "No test result subject found for #{subject}: in #{subjects.keys.join(', ')}"
359
368
  next
360
369
  end
361
370
  found_solutions ||= true
@@ -378,7 +387,7 @@ class EarlReport
378
387
  end
379
388
 
380
389
  # See if subject did not report results, which may indicate a formatting error in the EARL source
381
- $stderr.puts "No results found for #{subject} using #{ASSERTION_QUERY}" unless found_solutions
390
+ warn "No results found for #{subject} using #{ASSERTION_QUERY}" unless found_solutions
382
391
  end
383
392
  end
384
393
 
@@ -409,8 +418,8 @@ class EarlReport
409
418
  # Add report wrapper to graph
410
419
  ttl = TURTLE_PREFIXES + %(
411
420
  <> a earl:Software, doap:Project;
412
- doap:name #{quoted(@options.fetch(:name, 'Unknown'))};
413
- dc:bibliographicCitation "#{@options.fetch(:bibRef, 'Unknown reference')}";
421
+ doap:name #{quoted(name)};
422
+ dc:bibliographicCitation "#{bibRef}";
414
423
  earl:generatedBy <https://rubygems.org/gems/earl-report>;
415
424
  earl:assertions #{subjects.values.map {|f| f.to_ntriples}.join(",\n ")};
416
425
  earl:testSubjects #{subjects.keys.map {|f| f.to_ntriples}.join(",\n ")};
@@ -434,6 +443,8 @@ class EarlReport
434
443
  graph << RDF::Statement.new(u, RDF.type, EARL.TestCriterion)
435
444
  graph << RDF::Statement.new(u, RDF.type, EARL.TestCase)
436
445
  end
446
+
447
+ raise "Warnings issued in strict mode" if strict && @warnings > 0
437
448
  end
438
449
 
439
450
  ##
@@ -441,48 +452,47 @@ class EarlReport
441
452
  #
442
453
  # If no `io` option is provided, the output is returned as a string
443
454
  #
455
+ # @param [Symbol] format (:html)
456
+ # @param [IO] io (nil)
457
+ # `IO` to output results
444
458
  # @param [Hash{Symbol => Object}] options
445
- # @option options [Symbol] format (:html)
446
- # @option options[IO] :io
447
- # Optional `IO` to output results
459
+ # @param [String] template
460
+ # HAML template for generating report
448
461
  # @return [String] serialized graph, if `io` is nil
449
- def generate(options = {})
450
- options = {format: :html}.merge(options)
462
+ def generate(format: :html, io: nil, template: nil, **options)
451
463
 
452
- io = options[:io]
453
-
454
- status("generate: #{options[:format]}")
464
+ status("generate: #{format}")
455
465
  ##
456
466
  # Retrieve Hashed information in JSON-LD format
457
- case options[:format]
467
+ case format
458
468
  when :jsonld, :json
459
469
  json = json_hash.to_json(JSON::LD::JSON_STATE)
460
470
  io.write(json) if io
461
471
  json
462
472
  when :turtle, :ttl
463
473
  if io
464
- earl_turtle(options)
474
+ earl_turtle(io: io)
465
475
  else
466
476
  io = StringIO.new
467
- earl_turtle(options.merge(io: io))
477
+ earl_turtle(io: io)
468
478
  io.rewind
469
479
  io.read
470
480
  end
471
481
  when :html
472
- template = case options[:template]
473
- when String then options[:tempate]
474
- when IO, StringIO then options[:template].read
482
+ haml = case template
483
+ when String then template
484
+ when IO, StringIO then template.read
475
485
  else
476
486
  File.read(File.expand_path('../earl_report/views/earl_report.html.haml', __FILE__))
477
487
  end
478
488
 
479
489
  # Generate HTML report
480
- html = Haml::Engine.new(template, format: :xhtml).render(self, tests: json_hash)
490
+ html = Haml::Engine.new(haml, format: :xhtml).render(self, tests: json_hash)
481
491
  io.write(html) if io
482
492
  html
483
493
  else
484
- writer = RDF::Writer.for(options[:format])
485
- writer.dump(@graph, io, options.merge(standard_prefixes: true))
494
+ writer = RDF::Writer.for(format)
495
+ writer.dump(@graph, io, standard_prefixes: true, **options)
486
496
  end
487
497
  end
488
498
 
@@ -519,12 +529,11 @@ class EarlReport
519
529
 
520
530
  ##
521
531
  # Output consoloated EARL report as Turtle
522
- # @param [Hash{Symbol => Object}] options
523
- # @option options [IO, StringIO] :io
532
+ # @param [IO] io ($stdout)
533
+ # `IO` to output results
524
534
  # @return [String]
525
- def earl_turtle(options)
535
+ def earl_turtle(io: $stdout)
526
536
  context = JSON::LD::Context.parse(json_hash['@context'])
527
- io = options[:io]
528
537
  io.write(TURTLE_PREFIXES + "\n")
529
538
 
530
539
  # Write project header
@@ -628,10 +637,11 @@ class EarlReport
628
637
  end
629
638
 
630
639
  def warn(message)
640
+ @warnings += 1
631
641
  $stderr.puts message
632
642
  end
633
643
 
634
644
  def status(message)
635
- $stderr.puts message if @options[:verbose]
645
+ $stderr.puts message if verbose
636
646
  end
637
647
  end
@@ -6,10 +6,10 @@ describe EarlReport do
6
6
  let!(:earl) {
7
7
  EarlReport.new(
8
8
  File.expand_path("../test-files/report-complete.ttl", __FILE__),
9
- :bibRef => "[[TURTLE]]",
10
- :name => "Turtle Test Results",
11
- :verbose => false,
12
- :manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
9
+ bibRef: "[[TURTLE]]",
10
+ name: "Turtle Test Results",
11
+ verbose: false,
12
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
13
13
  }
14
14
  subject {earl}
15
15
 
@@ -26,6 +26,9 @@ describe EarlReport do
26
26
  let(:reportNoFoaf) {
27
27
  RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/report-no-foaf.ttl", __FILE__))
28
28
  }
29
+ let(:reportNoTest) {
30
+ RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/report-no-test.ttl", __FILE__))
31
+ }
29
32
  let(:doap) {
30
33
  RDF::Graph.new << RDF::Turtle::Reader.new(File.open File.expand_path("../test-files/doap.ttl", __FILE__))
31
34
  }
@@ -47,9 +50,9 @@ describe EarlReport do
47
50
  .and_return(reportComplete)
48
51
  EarlReport.new(
49
52
  File.expand_path("../test-files/report-complete.ttl", __FILE__),
50
- :verbose => false,
51
- :base => "http://example.com/base/",
52
- :manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
53
+ verbose: false,
54
+ base: "http://example.com/base/",
55
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
53
56
  end
54
57
  end
55
58
 
@@ -66,8 +69,8 @@ describe EarlReport do
66
69
  subject {
67
70
  EarlReport.new(
68
71
  File.expand_path("../test-files/report-complete.ttl", __FILE__),
69
- :verbose => false,
70
- :manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
72
+ verbose: false,
73
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
71
74
  }
72
75
  it "loads manifest" do
73
76
  expect(subject.graph.subjects.to_a).to include(RDF::URI("http://example/manifest.ttl"))
@@ -85,6 +88,18 @@ describe EarlReport do
85
88
  it "loads foaf" do
86
89
  expect(subject.graph.objects.to_a).to include(RDF::Vocab::FOAF.Person)
87
90
  end
91
+
92
+ it "does not raise an error if the strict option is used" do
93
+ expect do
94
+ expect do
95
+ EarlReport.new(
96
+ File.expand_path("../test-files/report-complete.ttl", __FILE__),
97
+ verbose: false,
98
+ strict: true,
99
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
100
+ end.not_to raise_error
101
+ end.not_to output.to_stderr
102
+ end
88
103
  end
89
104
 
90
105
  context "no doap report" do
@@ -103,8 +118,8 @@ describe EarlReport do
103
118
  subject {
104
119
  EarlReport.new(
105
120
  File.expand_path("../test-files/report-no-doap.ttl", __FILE__),
106
- :verbose => false,
107
- :manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
121
+ verbose: false,
122
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
108
123
  }
109
124
  it "loads manifest" do
110
125
  expect(subject.graph.subjects.to_a).to include(RDF::URI("http://example/manifest.ttl"))
@@ -122,6 +137,18 @@ describe EarlReport do
122
137
  it "loads foaf" do
123
138
  expect(subject.graph.objects.to_a).to include(RDF::Vocab::FOAF.Person)
124
139
  end
140
+
141
+ it "does not raise an error if the strict option is used" do
142
+ expect do
143
+ expect do
144
+ EarlReport.new(
145
+ File.expand_path("../test-files/report-no-doap.ttl", __FILE__),
146
+ verbose: false,
147
+ strict: true,
148
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
149
+ end.not_to raise_error
150
+ end.not_to output.to_stderr
151
+ end
125
152
  end
126
153
 
127
154
  context "no foaf report" do
@@ -140,8 +167,8 @@ describe EarlReport do
140
167
  subject {
141
168
  EarlReport.new(
142
169
  File.expand_path("../test-files/report-no-foaf.ttl", __FILE__),
143
- :verbose => false,
144
- :manifest => File.expand_path("../test-files/manifest.ttl", __FILE__))
170
+ verbose: false,
171
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
145
172
  }
146
173
  it "loads manifest" do
147
174
  expect(subject.graph.subjects.to_a).to include(RDF::URI("http://example/manifest.ttl"))
@@ -159,6 +186,67 @@ describe EarlReport do
159
186
  it "loads foaf" do
160
187
  expect(subject.graph.objects.to_a).to include(RDF::Vocab::FOAF.Person)
161
188
  end
189
+
190
+ it "does not raise an error if the strict option is used" do
191
+ expect do
192
+ expect do
193
+ EarlReport.new(
194
+ File.expand_path("../test-files/report-no-foaf.ttl", __FILE__),
195
+ verbose: false,
196
+ strict: true,
197
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
198
+ end.not_to raise_error
199
+ end.not_to output.to_stderr
200
+ end
201
+ end
202
+
203
+ context "asserts a test not in manifest" do
204
+ before(:each) do
205
+ expect(RDF::Graph).to receive(:load)
206
+ .with(File.expand_path("../test-files/manifest.ttl", __FILE__), {unique_bnodes: true, })
207
+ .and_return(manifest)
208
+ expect(RDF::Graph).to receive(:load)
209
+ .with(File.expand_path("../test-files/report-no-test.ttl", __FILE__))
210
+ .and_return(reportNoTest)
211
+ end
212
+
213
+ subject {
214
+ expect do
215
+ @no_test_earl = EarlReport.new(
216
+ File.expand_path("../test-files/report-no-test.ttl", __FILE__),
217
+ verbose: false,
218
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
219
+ end.to output.to_stderr
220
+ @no_test_earl
221
+ }
222
+ it "loads manifest" do
223
+ expect(subject.graph.subjects.to_a).to include(RDF::URI("http://example/manifest.ttl"))
224
+ expect(subject.graph.subjects.to_a).to include(RDF::URI("http://example/manifest.ttl#testeval00"))
225
+ end
226
+
227
+ it "loads report" do
228
+ expect(subject.graph.predicates.to_a).to include(RDF::URI("http://www.w3.org/ns/earl#generatedBy"))
229
+ end
230
+
231
+ it "loads doap" do
232
+ expect(subject.graph.subjects.to_a).to include(RDF::URI("https://rubygems.org/gems/rdf-turtle"))
233
+ end
234
+
235
+ it "loads foaf" do
236
+ expect(subject.graph.objects.to_a).to include(RDF::Vocab::FOAF.Person)
237
+ end
238
+
239
+ it "raises an error if the strict option is used" do
240
+ expect do
241
+ expect do
242
+ EarlReport.new(
243
+ File.expand_path("../test-files/report-no-test.ttl", __FILE__),
244
+ verbose: false,
245
+ strict: true,
246
+ manifest: File.expand_path("../test-files/manifest.ttl", __FILE__))
247
+ end.to raise_error(RuntimeError)
248
+ end.to output.to_stderr
249
+ end
162
250
  end
163
251
  end
164
252
 
@@ -227,7 +315,7 @@ describe EarlReport do
227
315
  let(:output) {
228
316
  @output ||= begin
229
317
  sio = StringIO.new
230
- earl.send(:earl_turtle, {io: sio})
318
+ earl.send(:earl_turtle, io: sio)
231
319
  sio.rewind
232
320
  sio.read
233
321
  end
data/spec/spec_helper.rb CHANGED
@@ -4,16 +4,22 @@ $:.unshift File.dirname(__FILE__)
4
4
  require "bundler/setup"
5
5
  require 'rspec'
6
6
  require 'rspec/its'
7
- require 'simplecov'
8
- require 'coveralls'
9
7
  require 'amazing_print'
10
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
11
- SimpleCov::Formatter::HTMLFormatter,
12
- Coveralls::SimpleCov::Formatter
13
- ])
14
- SimpleCov.start do
15
- add_filter "/spec/"
8
+
9
+ begin
10
+ require 'simplecov'
11
+ require 'coveralls'
12
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
13
+ SimpleCov::Formatter::HTMLFormatter,
14
+ Coveralls::SimpleCov::Formatter
15
+ ])
16
+ SimpleCov.start do
17
+ add_filter "/spec/"
18
+ end
19
+ rescue LoadError => e
20
+ STDERR.puts "Coverage Skipped: #{e.message}"
16
21
  end
22
+
17
23
  require 'earl_report'
18
24
 
19
25
  JSON_STATE = JSON::State.new(
@@ -0,0 +1,48 @@
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
3
+ @prefix dc: <http://purl.org/dc/terms/> .
4
+ @prefix earl: <http://www.w3.org/ns/earl#> .
5
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
6
+ @prefix doap: <http://usefulinc.com/ns/doap#> .
7
+ @prefix ex: <http://example.org/> .
8
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
9
+
10
+ <https://rubygems.org/gems/rdf-turtle> a doap:Project, earl:TestSubject, earl:Software ;
11
+ doap:name "RDF::Turtle" ;
12
+ doap:homepage <http://ruby-rdf.github.com/rdf-turtle> ;
13
+ doap:license <http://creativecommons.org/publicdomain/zero/1.0/> ;
14
+ doap:shortdesc "Turtle reader/writer for Ruby."@en ;
15
+ doap:description "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite."@en ;
16
+ doap:created "2011-08-29"^^xsd:date;
17
+ doap:programming-language "Ruby" ;
18
+ doap:implements <http://www.w3.org/TR/turtle/> ;
19
+ doap:category <http://dbpedia.org/resource/Resource_Description_Framework>,
20
+ <http://dbpedia.org/resource/Ruby_(programming_language)> ;
21
+ doap:download-page <https://rubygems.org/gems/rdf-turtle> ;
22
+ doap:mailing-list <http://lists.w3.org/Archives/Public/public-rdf-ruby/> ;
23
+ doap:bug-database <https://github.com/ruby-rdf/rdf-turtle/issues> ;
24
+ doap:blog <https://greggkellogg.net/> ;
25
+ doap:developer <https://greggkellogg.net/foaf#me> ;
26
+ doap:maintainer <https://greggkellogg.net/foaf#me> ;
27
+ doap:documenter <https://greggkellogg.net/foaf#me> ;
28
+ foaf:maker <https://greggkellogg.net/foaf#me> ;
29
+ dc:title "RDF::Turtle" ;
30
+ dc:description "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite."@en ;
31
+ dc:date "2011-08-29"^^xsd:date;
32
+ dc:creator <https://greggkellogg.net/foaf#me>;
33
+ dc:isPartOf <https://rubygems.org/gems/rdf> .
34
+
35
+ <https://greggkellogg.net/foaf#me> a foaf:Person, earl:Assertor;
36
+ foaf:name "Gregg Kellogg";
37
+ foaf:title "Implementor";
38
+ foaf:homepage <https://greggkellogg.net/> .
39
+
40
+ [ a earl:Assertion;
41
+ earl:assertedBy <https://greggkellogg.net/foaf#me>;
42
+ earl:subject <https://rubygems.org/gems/rdf-turtle>;
43
+ earl:test <http://example/manifest.ttl#notest>;
44
+ earl:result [
45
+ a earl:TestResult;
46
+ earl:outcome earl:passed;
47
+ dc:date "2012-11-06T19:23:29-08:00"^^xsd:dateTime];
48
+ earl:mode earl:automatic ] .
@@ -73,8 +73,8 @@ Implementation Report
73
73
  <h2 id='w3c-document-28-october-2015'>
74
74
  <abbr title='World Wide Web Consortium'>W3C</abbr>
75
75
  Document
76
- <time class='dt-published' datetime='2021-03-18' property='dc:issued'>
77
- 18 March 2021
76
+ <time class='dt-published' datetime='2021-03-19' property='dc:issued'>
77
+ 19 March 2021
78
78
  </time>
79
79
  </h2>
80
80
  <dl>
@@ -245,7 +245,7 @@ Test
245
245
  <a href='#subj_0'>RDF::Turtle</a>
246
246
  </th>
247
247
  </tr>
248
- <tr inlist='inlist' rel='mf:entries' resource='http://example/manifest.ttl#testeval00' typeof='http://www.w3.org/ns/rdftest#TestTurtleEval TestCriterion TestCase'>
248
+ <tr inlist='inlist' rel='mf:entries' resource='http://example/manifest.ttl#testeval00' typeof='http://www.w3.org/ns/rdftest#TestTurtleEval TestCase TestCriterion'>
249
249
  <td>
250
250
  <a href='#test_1fdd82ac4caf30510cabfdb0a5987ddd'>subm-test-00</a>
251
251
  </td>
@@ -261,9 +261,9 @@ PASS
261
261
  </span>
262
262
  </td>
263
263
  </tr>
264
- <tr inlist='inlist' rel='mf:entries' resource='_:b0' typeof='http://www.w3.org/ns/rdftest#TestTurtleEval TestCriterion TestCase'>
264
+ <tr inlist='inlist' rel='mf:entries' resource='_:b3' typeof='http://www.w3.org/ns/rdftest#TestTurtleEval TestCase TestCriterion'>
265
265
  <td>
266
- <a href='#test_9616fad74c7bf0cfba5d70f087ed0a96'>subm-test-01</a>
266
+ <a href='#test_14698d4bb89cdb1ecd9215e2a55d29c6'>subm-test-01</a>
267
267
  </td>
268
268
  <td class='UNTESTED' property='earl:assertions' typeof='Assertion'>
269
269
  <link href='https://rubygems.org/gems/rdf-turtle' property='earl:subject' />
@@ -300,7 +300,7 @@ This report was tested using the following test subjects:
300
300
  <span about='https://rubygems.org/gems/rdf-turtle' property='doap:name'>RDF::Turtle</span>
301
301
  </a>
302
302
  </dt>
303
- <dd property='earl:testSubjects' resource='https://rubygems.org/gems/rdf-turtle' typeof='doap:Project Software TestSubject'>
303
+ <dd property='earl:testSubjects' resource='https://rubygems.org/gems/rdf-turtle' typeof='doap:Project TestSubject Software'>
304
304
  <dl>
305
305
  <dt>Description</dt>
306
306
  <dd lang='en' property='doap:description'>RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.</dd>
@@ -376,11 +376,11 @@ Test
376
376
  <pre class='example actionDoc' property='mf:action' resource='http://example/test-00.ttl' title='subm-test-00 Input'>http://example/test-00.ttl not loaded</pre>
377
377
  <pre class='example resultDoc' property='mf:result' resource='http://example/test-00.out' title='subm-test-00 Result'>http://example/test-00.out not loaded</pre>
378
378
  </dd>
379
- <dt id='test_9616fad74c7bf0cfba5d70f087ed0a96' resource='_:b0'>
379
+ <dt id='test_14698d4bb89cdb1ecd9215e2a55d29c6' resource='_:b3'>
380
380
  Test
381
381
  <span property='dc:title mf:name'>subm-test-01</span>
382
382
  </dt>
383
- <dd resource='_:b0'>
383
+ <dd resource='_:b3'>
384
384
  <p property='dc:description rdfs:comment'></p>
385
385
  <pre class='example actionDoc' property='mf:action' resource='http://example/test-01.ttl' title='subm-test-01 Input'>http://example/test-01.ttl not loaded</pre>
386
386
  <pre class='example resultDoc' property='mf:result' resource='http://example/test-01.out' title='subm-test-01 Result'>http://example/test-01.out not loaded</pre>
@@ -399,9 +399,9 @@ This report generated by
399
399
  <meta content='Earl Report summary generator' property='doap:shortdesc' />
400
400
  <meta content='EarlReport generates HTML+RDFa rollups of multiple EARL reports' property='doap:description' />
401
401
  version
402
- <span property='doap:release' resource='https://github.com/gkellogg/earl-report/tree/0.5.2' typeof='doap:Version'>
403
- <span property='doap:revision'>0.5.2</span>
404
- <meta content='earl-report-0.5.2' property='doap:name' />
402
+ <span property='doap:release' resource='https://github.com/gkellogg/earl-report/tree/0.6.0' typeof='doap:Version'>
403
+ <span property='doap:revision'>0.6.0</span>
404
+ <meta content='earl-report-0.6.0' property='doap:name' />
405
405
  </span>
406
406
  an
407
407
  <a href='http://unlicense.org' property='doap:license'>Unlicensed</a>
@@ -107,74 +107,9 @@
107
107
  "doap:Project",
108
108
  "Software"
109
109
  ],
110
- "testSubjects": [
111
- {
112
- "@id": "https://rubygems.org/gems/rdf-turtle",
113
- "@type": [
114
- "doap:Project",
115
- "Software",
116
- "TestSubject"
117
- ],
118
- "language": "Ruby",
119
- "doapDesc": "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.",
120
- "release": {
121
- "@id": "_:b3",
122
- "revision": "unknown"
123
- },
124
- "name": "RDF::Turtle",
125
- "developer": [
126
- {
127
- "@id": "https://greggkellogg.net/foaf#me",
128
- "@type": [
129
- "foaf:Person",
130
- "Assertor"
131
- ],
132
- "foaf:name": "Gregg Kellogg",
133
- "foaf:homepage": "https://greggkellogg.net/"
134
- }
135
- ],
136
- "homepage": "http://ruby-rdf.github.com/rdf-turtle"
137
- }
138
- ],
139
- "bibRef": "[[TURTLE]]",
140
110
  "assertions": [
141
111
  "/Users/gregg/Projects/earl-report/spec/test-files/report-complete.ttl"
142
112
  ],
143
- "generatedBy": {
144
- "@id": "https://rubygems.org/gems/earl-report",
145
- "@type": [
146
- "doap:Project",
147
- "Software"
148
- ],
149
- "language": "Ruby",
150
- "license": "http://unlicense.org",
151
- "doapDesc": "EarlReport generates HTML+RDFa rollups of multiple EARL reports",
152
- "shortdesc": "Earl Report summary generator",
153
- "release": {
154
- "@id": "https://github.com/gkellogg/earl-report/tree/0.5.2",
155
- "@type": "doap:Version",
156
- "name": "earl-report-0.5.2",
157
- "doap:created": {
158
- "@type": "http://www.w3.org/2001/XMLSchema#date",
159
- "@value": "2021-01-19"
160
- },
161
- "revision": "0.5.2"
162
- },
163
- "name": "earl-report",
164
- "developer": [
165
- {
166
- "@id": "https://greggkellogg.net/foaf#me",
167
- "@type": [
168
- "foaf:Person",
169
- "Assertor"
170
- ],
171
- "foaf:name": "Gregg Kellogg",
172
- "foaf:homepage": "https://greggkellogg.net/"
173
- }
174
- ],
175
- "homepage": "https://github.com/gkellogg/earl-report"
176
- },
177
- "name": "Turtle Test Results",
178
113
  "entries": [
179
114
  {
180
115
  "@id": "http://example/manifest.ttl",
@@ -183,51 +118,50 @@
183
118
  "Report"
184
119
  ],
185
120
  "rdfs:comment": "Description for Example Test Cases",
186
- "title": "Example Test Cases",
187
121
  "entries": [
188
122
  {
189
123
  "@id": "http://example/manifest.ttl#testeval00",
190
124
  "@type": [
191
125
  "http://www.w3.org/ns/rdftest#TestTurtleEval",
192
- "TestCriterion",
193
- "TestCase"
126
+ "TestCase",
127
+ "TestCriterion"
194
128
  ],
195
129
  "rdfs:comment": "Blank subject",
196
130
  "assertions": [
197
131
  {
198
- "@id": "_:b1",
132
+ "@id": "_:b4",
199
133
  "@type": "Assertion",
200
- "mode": "earl:automatic",
201
134
  "subject": "https://rubygems.org/gems/rdf-turtle",
202
- "assertedBy": "https://greggkellogg.net/foaf#me",
135
+ "mode": "earl:automatic",
203
136
  "test": "http://example/manifest.ttl#testeval00",
137
+ "assertedBy": "https://greggkellogg.net/foaf#me",
204
138
  "result": {
205
- "@id": "_:b2",
139
+ "@id": "_:b5",
206
140
  "@type": "TestResult",
207
141
  "outcome": "earl:passed"
208
142
  }
209
143
  }
210
144
  ],
211
145
  "testAction": "http://example/test-00.ttl",
212
- "testResult": "http://example/test-00.out",
213
- "title": "subm-test-00"
146
+ "title": "subm-test-00",
147
+ "testResult": "http://example/test-00.out"
214
148
  },
215
149
  {
216
150
  "@id": "_:b0",
217
151
  "@type": [
218
152
  "http://www.w3.org/ns/rdftest#TestTurtleEval",
219
- "TestCriterion",
220
- "TestCase"
153
+ "TestCase",
154
+ "TestCriterion"
221
155
  ],
222
156
  "rdfs:comment": "@prefix and qnames",
223
157
  "assertions": [
224
158
  {
225
- "@id": "_:b4",
159
+ "@id": "_:b2",
226
160
  "@type": "Assertion",
227
161
  "subject": "https://rubygems.org/gems/rdf-turtle",
228
162
  "test": "_:b0",
229
163
  "result": {
230
- "@id": "_:b5",
164
+ "@id": "_:b3",
231
165
  "@type": "TestResult",
232
166
  "outcome": "earl:untested"
233
167
  },
@@ -235,10 +169,76 @@
235
169
  }
236
170
  ],
237
171
  "testAction": "http://example/test-01.ttl",
238
- "testResult": "http://example/test-01.out",
239
- "title": "subm-test-01"
172
+ "title": "subm-test-01",
173
+ "testResult": "http://example/test-01.out"
240
174
  }
241
- ]
175
+ ],
176
+ "title": "Example Test Cases"
242
177
  }
243
- ]
178
+ ],
179
+ "testSubjects": [
180
+ {
181
+ "@id": "https://rubygems.org/gems/rdf-turtle",
182
+ "@type": [
183
+ "doap:Project",
184
+ "TestSubject",
185
+ "Software"
186
+ ],
187
+ "developer": [
188
+ {
189
+ "@id": "https://greggkellogg.net/foaf#me",
190
+ "@type": [
191
+ "foaf:Person",
192
+ "Assertor"
193
+ ],
194
+ "foaf:name": "Gregg Kellogg",
195
+ "foaf:homepage": "https://greggkellogg.net/"
196
+ }
197
+ ],
198
+ "doapDesc": "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.",
199
+ "release": {
200
+ "@id": "_:b1",
201
+ "revision": "unknown"
202
+ },
203
+ "name": "RDF::Turtle",
204
+ "homepage": "http://ruby-rdf.github.com/rdf-turtle",
205
+ "language": "Ruby"
206
+ }
207
+ ],
208
+ "bibRef": "[[TURTLE]]",
209
+ "name": "Turtle Test Results",
210
+ "generatedBy": {
211
+ "@id": "https://rubygems.org/gems/earl-report",
212
+ "@type": [
213
+ "doap:Project",
214
+ "Software"
215
+ ],
216
+ "developer": [
217
+ {
218
+ "@id": "https://greggkellogg.net/foaf#me",
219
+ "@type": [
220
+ "foaf:Person",
221
+ "Assertor"
222
+ ],
223
+ "foaf:name": "Gregg Kellogg",
224
+ "foaf:homepage": "https://greggkellogg.net/"
225
+ }
226
+ ],
227
+ "doapDesc": "EarlReport generates HTML+RDFa rollups of multiple EARL reports",
228
+ "license": "http://unlicense.org",
229
+ "release": {
230
+ "@id": "https://github.com/gkellogg/earl-report/tree/0.6.0",
231
+ "@type": "doap:Version",
232
+ "revision": "0.6.0",
233
+ "doap:created": {
234
+ "@type": "http://www.w3.org/2001/XMLSchema#date",
235
+ "@value": "2021-03-19"
236
+ },
237
+ "name": "earl-report-0.6.0"
238
+ },
239
+ "name": "earl-report",
240
+ "homepage": "https://github.com/gkellogg/earl-report",
241
+ "shortdesc": "Earl Report summary generator",
242
+ "language": "Ruby"
243
+ }
244
244
  }
@@ -8,21 +8,21 @@
8
8
  @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
9
9
 
10
10
  <> a doap:Project, earl:Software ;
11
+ earl:assertions </Users/gregg/Projects/earl-report/spec/test-files/report-complete.ttl> ;
12
+ mf:entries (<http://example/manifest.ttl>) ;
11
13
  earl:testSubjects <https://rubygems.org/gems/rdf-turtle> ;
12
14
  dc:bibliographicCitation "[[TURTLE]]" ;
13
- earl:assertions </Users/gregg/Projects/earl-report/spec/test-files/report-complete.ttl> ;
14
- earl:generatedBy <https://rubygems.org/gems/earl-report> ;
15
15
  doap:name "Turtle Test Results" ;
16
- mf:entries (<http://example/manifest.ttl>) .
16
+ earl:generatedBy <https://rubygems.org/gems/earl-report> .
17
17
 
18
18
  # Manifests
19
19
  <http://example/manifest.ttl> a mf:Manifest, earl:Report ;
20
20
  rdfs:comment "Description for Example Test Cases" ;
21
- mf:name "Example Test Cases" ;
22
21
  mf:entries (<http://example/manifest.ttl#testeval00>
23
- _:b0) .
22
+ _:b0) ;
23
+ mf:name "Example Test Cases" .
24
24
 
25
- <http://example/manifest.ttl#testeval00> a <http://www.w3.org/ns/rdftest#TestTurtleEval>, earl:TestCriterion, earl:TestCase ;
25
+ <http://example/manifest.ttl#testeval00> a <http://www.w3.org/ns/rdftest#TestTurtleEval>, earl:TestCase, earl:TestCriterion ;
26
26
  rdfs:comment "Blank subject" ;
27
27
  earl:assertions [
28
28
  a earl:Assertion ;
@@ -35,10 +35,10 @@
35
35
  earl:assertedBy <https://greggkellogg.net/foaf#me> ;
36
36
  ] ;
37
37
  mf:action <http://example/test-00.ttl> ;
38
- mf:result <http://example/test-00.out> ;
39
- mf:name "subm-test-00" .
38
+ mf:name "subm-test-00" ;
39
+ mf:result <http://example/test-00.out> .
40
40
 
41
- _:b0 a <http://www.w3.org/ns/rdftest#TestTurtleEval>, earl:TestCriterion, earl:TestCase ;
41
+ _:b0 a <http://www.w3.org/ns/rdftest#TestTurtleEval>, earl:TestCase, earl:TestCriterion ;
42
42
  rdfs:comment "@prefix and qnames" ;
43
43
  earl:assertions [
44
44
  a earl:Assertion ;
@@ -50,16 +50,16 @@ _:b0 a <http://www.w3.org/ns/rdftest#TestTurtleEval>, earl:TestCriterion, earl:T
50
50
  ] ;
51
51
  ] ;
52
52
  mf:action <http://example/test-01.ttl> ;
53
- mf:result <http://example/test-01.out> ;
54
- mf:name "subm-test-01" .
53
+ mf:name "subm-test-01" ;
54
+ mf:result <http://example/test-01.out> .
55
55
 
56
- <https://rubygems.org/gems/rdf-turtle> a doap:Project, earl:Software, earl:TestSubject ;
57
- doap:programming-language "Ruby" ;
56
+ <https://rubygems.org/gems/rdf-turtle> a doap:Project, earl:TestSubject, earl:Software ;
57
+ doap:developer <https://greggkellogg.net/foaf#me> ;
58
58
  doap:description "RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite."@en ;
59
59
  doap:release [doap:revision "unknown"] ;
60
60
  doap:name "RDF::Turtle" ;
61
- doap:developer <https://greggkellogg.net/foaf#me> ;
62
- doap:homepage <http://ruby-rdf.github.com/rdf-turtle> .
61
+ doap:homepage <http://ruby-rdf.github.com/rdf-turtle> ;
62
+ doap:programming-language "Ruby" .
63
63
 
64
64
  <https://greggkellogg.net/foaf#me> a foaf:Person, earl:Assertor ;
65
65
  foaf:name "Gregg Kellogg" ;
@@ -74,10 +74,10 @@ _:b0 a <http://www.w3.org/ns/rdftest#TestTurtleEval>, earl:TestCriterion, earl:T
74
74
  doap:homepage <https://github.com/gkellogg/earl-report>;
75
75
  doap:programming-language "Ruby";
76
76
  doap:license <http://unlicense.org>;
77
- doap:release <https://github.com/gkellogg/earl-report/tree/0.5.2>;
77
+ doap:release <https://github.com/gkellogg/earl-report/tree/0.6.0>;
78
78
  doap:developer <https://greggkellogg.net/foaf#me> .
79
79
 
80
- <https://github.com/gkellogg/earl-report/tree/0.5.2> a doap:Version;
81
- doap:name "earl-report-0.5.2";
82
- doap:created "2021-01-19"^^xsd:date;
83
- doap:revision "0.5.2" .
80
+ <https://github.com/gkellogg/earl-report/tree/0.6.0> a doap:Version;
81
+ doap:name "earl-report-0.6.0";
82
+ doap:created "2021-03-19"^^xsd:date;
83
+ doap:revision "0.6.0" .
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: earl-report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg Kellogg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-18 00:00:00.000000000 Z
11
+ date: 2021-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: linkeddata
@@ -171,6 +171,7 @@ files:
171
171
  - spec/test-files/report-complete.ttl
172
172
  - spec/test-files/report-no-doap.ttl
173
173
  - spec/test-files/report-no-foaf.ttl
174
+ - spec/test-files/report-no-test.ttl
174
175
  - spec/test-files/results.html
175
176
  - spec/test-files/results.jsonld
176
177
  - spec/test-files/results.ttl
@@ -188,7 +189,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
189
  requirements:
189
190
  - - ">="
190
191
  - !ruby/object:Gem::Version
191
- version: '2.4'
192
+ version: '2.5'
192
193
  required_rubygems_version: !ruby/object:Gem::Requirement
193
194
  requirements:
194
195
  - - ">="
@@ -208,6 +209,7 @@ test_files:
208
209
  - spec/test-files/report-complete.ttl
209
210
  - spec/test-files/report-no-doap.ttl
210
211
  - spec/test-files/report-no-foaf.ttl
212
+ - spec/test-files/report-no-test.ttl
211
213
  - spec/test-files/results.html
212
214
  - spec/test-files/results.jsonld
213
215
  - spec/test-files/results.ttl