brief 1.14.3 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/brief/model/reports.rb +32 -0
- data/lib/brief/model.rb +1 -0
- data/lib/brief/version.rb +1 -1
- data/lib/brief.rb +1 -1
- data/spec/fixtures/example/docs/concept.html.md +6 -2
- data/spec/fixtures/example/docs/release.html.md +2 -0
- data/spec/fixtures/example/lib/sample_report.rb +5 -0
- data/spec/lib/brief/reports_spec.rb +9 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ad121f8e79a00d9ab6b1e3606a082756228bfa1
|
4
|
+
data.tar.gz: ec53781530954e351b7fb5b772592ac8b4910a8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8401196bdea0358cc80773e59dbaa0bdcf6c39cf24347dcc7cc758cf29a6be166fbb4ab6949babc32841e6c1705c5d21e635686a11b8c63fb0bf8847db5bdd8b
|
7
|
+
data.tar.gz: c98664f6aa2614b25d55433c2f172f5c30a0532ac0dbedbdf0639d6c3fe7ecaa48014abd5e48f86fd0000455dad3bf6d8f7336028089b682b3df012fe8fe0bdd
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
class Brief::GenericReport
|
2
|
+
attr_reader :document
|
3
|
+
|
4
|
+
def initialize(document)
|
5
|
+
@document = document
|
6
|
+
end
|
7
|
+
|
8
|
+
def briefcase
|
9
|
+
document.try(:briefcase)
|
10
|
+
end
|
11
|
+
|
12
|
+
def entries
|
13
|
+
[]
|
14
|
+
end
|
15
|
+
|
16
|
+
def headers
|
17
|
+
[]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module Brief::Model::Reports
|
22
|
+
def generate_report report_type
|
23
|
+
if data.reports && data.reports.fetch(report_type, nil)
|
24
|
+
klass = data.reports.fetch(report_type.to_s)
|
25
|
+
klass = Object.const_get(klass) unless klass.is_a?(Class)
|
26
|
+
else
|
27
|
+
klass = Brief::GenericReport
|
28
|
+
end
|
29
|
+
|
30
|
+
klass && klass.new(self)
|
31
|
+
end
|
32
|
+
end
|
data/lib/brief/model.rb
CHANGED
data/lib/brief/version.rb
CHANGED
data/lib/brief.rb
CHANGED
@@ -144,7 +144,7 @@ require 'brief/model'
|
|
144
144
|
require 'brief/model/definition'
|
145
145
|
require 'brief/model/persistence'
|
146
146
|
require 'brief/model/serializers'
|
147
|
-
require 'brief/model/
|
147
|
+
require 'brief/model/reports'
|
148
148
|
require 'brief/data'
|
149
149
|
require 'brief/dsl'
|
150
150
|
require 'brief/server'
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Document Reports" do
|
4
|
+
it "should be able to generate reports using custom report classes" do
|
5
|
+
sample = Brief.testcase.releases.first
|
6
|
+
report = sample.generate_report(:sample)
|
7
|
+
expect(report.entries).to include(sample.title)
|
8
|
+
end
|
9
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brief
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Soeder
|
@@ -403,6 +403,7 @@ files:
|
|
403
403
|
- lib/brief/model.rb
|
404
404
|
- lib/brief/model/definition.rb
|
405
405
|
- lib/brief/model/persistence.rb
|
406
|
+
- lib/brief/model/reports.rb
|
406
407
|
- lib/brief/model/serializers.rb
|
407
408
|
- lib/brief/repository.rb
|
408
409
|
- lib/brief/server.rb
|
@@ -440,6 +441,7 @@ files:
|
|
440
441
|
- spec/fixtures/example/docs/resource.html.md
|
441
442
|
- spec/fixtures/example/docs/user_story.html.md
|
442
443
|
- spec/fixtures/example/docs/wireframe.html.md
|
444
|
+
- spec/fixtures/example/lib/sample_report.rb
|
443
445
|
- spec/fixtures/example/lib/should_be_defined.rb
|
444
446
|
- spec/fixtures/example/models/concept.rb
|
445
447
|
- spec/fixtures/example/models/epic.rb
|
@@ -466,6 +468,7 @@ files:
|
|
466
468
|
- spec/lib/brief/models/release_spec.rb
|
467
469
|
- spec/lib/brief/persistence_spec.rb
|
468
470
|
- spec/lib/brief/rendering_spec.rb
|
471
|
+
- spec/lib/brief/reports_spec.rb
|
469
472
|
- spec/lib/brief/repository_spec.rb
|
470
473
|
- spec/lib/brief/section_builder_spec.rb
|
471
474
|
- spec/lib/brief/serializers_spec.rb
|
@@ -541,6 +544,7 @@ test_files:
|
|
541
544
|
- spec/fixtures/example/docs/resource.html.md
|
542
545
|
- spec/fixtures/example/docs/user_story.html.md
|
543
546
|
- spec/fixtures/example/docs/wireframe.html.md
|
547
|
+
- spec/fixtures/example/lib/sample_report.rb
|
544
548
|
- spec/fixtures/example/lib/should_be_defined.rb
|
545
549
|
- spec/fixtures/example/models/concept.rb
|
546
550
|
- spec/fixtures/example/models/epic.rb
|
@@ -567,6 +571,7 @@ test_files:
|
|
567
571
|
- spec/lib/brief/models/release_spec.rb
|
568
572
|
- spec/lib/brief/persistence_spec.rb
|
569
573
|
- spec/lib/brief/rendering_spec.rb
|
574
|
+
- spec/lib/brief/reports_spec.rb
|
570
575
|
- spec/lib/brief/repository_spec.rb
|
571
576
|
- spec/lib/brief/section_builder_spec.rb
|
572
577
|
- spec/lib/brief/serializers_spec.rb
|