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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b274378ab543ef47fe650ee8e460b76b082ad923
4
- data.tar.gz: e1a26dc9aeba6e4fa64c2435b604809a347b9bd1
3
+ metadata.gz: 0ad121f8e79a00d9ab6b1e3606a082756228bfa1
4
+ data.tar.gz: ec53781530954e351b7fb5b772592ac8b4910a8c
5
5
  SHA512:
6
- metadata.gz: 6547e89d1f24d62e0bc6d169fff21b67c57c4862a2d8c134fd0e284c6c79fd8a24435f5a15a94f6d8ca4d43b2e65d4cf596817a3ce17a9ddb0e9a8166e537c87
7
- data.tar.gz: 4439705a16ca9d2e49fc01e2666d07ca9ebe756e3901565f0776af49e918a0082cf1cd390181d795c0f688587c72e7df17884e2cded9fb6fe2d211fc26bf5954
6
+ metadata.gz: 8401196bdea0358cc80773e59dbaa0bdcf6c39cf24347dcc7cc758cf29a6be166fbb4ab6949babc32841e6c1705c5d21e635686a11b8c63fb0bf8847db5bdd8b
7
+ data.tar.gz: c98664f6aa2614b25d55433c2f172f5c30a0532ac0dbedbdf0639d6c3fe7ecaa48014abd5e48f86fd0000455dad3bf6d8f7336028089b682b3df012fe8fe0bdd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brief (1.14.2)
4
+ brief (1.15.0)
5
5
  activesupport (> 3.2)
6
6
  commander (~> 4.3)
7
7
  em-websocket (~> 0.5)
@@ -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
@@ -13,6 +13,7 @@ module Brief
13
13
  include AccessorMethods
14
14
  include Persistence
15
15
  include Serializers
16
+ include Reports
16
17
 
17
18
  class_attribute :models, :after_initialization_hooks
18
19
 
data/lib/brief/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Brief
2
- VERSION = '1.14.3'
2
+ VERSION = '1.15.0'
3
3
  end
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/serializers'
147
+ require 'brief/model/reports'
148
148
  require 'brief/data'
149
149
  require 'brief/dsl'
150
150
  require 'brief/server'
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  type: concept
3
- needle: i5wt25dv3tug69u5at7k0mrd8buy41lbeub9
3
+
4
4
  ---
5
5
 
6
- # Modified Content ponsmqgjrpttz2wxpszae6nfsapnqucwow3b
6
+ # Modified Content m080vwvx12ilsu4c7ayty4xxlilnf8s7qw1r
7
+
8
+ 1
9
+
10
+ 1
@@ -6,6 +6,8 @@ status: Planned
6
6
  date: 2018-12-18
7
7
  attachments:
8
8
  - diagrams/test
9
+ reports:
10
+ sample: SampleReport
9
11
  ---
10
12
 
11
13
  This is a release it is a simple file with no real structure.
@@ -0,0 +1,5 @@
1
+ class SampleReport < Brief::GenericReport
2
+ def entries
3
+ [document.title]
4
+ end
5
+ end
@@ -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.14.3
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