brief 1.17.0 → 1.17.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
  SHA1:
3
- metadata.gz: 379b1d59287fbfabb503d50cca774092722c3201
4
- data.tar.gz: 76b5128f3003dd991804854e39c4b0c712fc7ca0
3
+ metadata.gz: 3d6d8f0dae8f7fc8a692782b2aa637724d54299b
4
+ data.tar.gz: 63459143af9c3b81c6c5624ea9713b5e6ac3652d
5
5
  SHA512:
6
- metadata.gz: e7a88ddd403c7db77efb356de2e1906f67e346eaa2708c9610228fdae3720f1e21147d33c6b52ccb6aa68d2fed69970f891fc8c807c911e0287b2bbda2c9ba76
7
- data.tar.gz: e63bd5e5ea3157cb8367ca99d371f6da4371a05ad15cca6d2a00541b1cf3b4456ebccdb7950a14adf725fdabda01f21b6152767916207c063c688c07a4157546
6
+ metadata.gz: 72b3c6b064a35c9561f17d0282dbd4c4d8fe575e267f0095c4b7c5a236a072687d3473fe834c8eab5e09bf667ebceb0926d75e80cf7e3aad072075d0d572c6f8
7
+ data.tar.gz: 81b53e8813875d7a708e4a9398cf5b579c6f5f4d61780e90913790a0fb9c30fa58bb39dece4d8d6cb62a1fa7e76c140da69ae721834683a1fcf3adb101aa6e66
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brief (1.16.3)
4
+ brief (1.17.1)
5
5
  activesupport (> 3.2)
6
6
  commander (~> 4.3)
7
7
  em-websocket (~> 0.5)
@@ -13,6 +13,17 @@ class BlueprintEpicPublisher
13
13
  end
14
14
  end
15
15
 
16
+ def self.syn(epic, options={})
17
+ via = (options.fetch(:via, :github) || :github)
18
+
19
+ if respond_to?("sync_via_#{via}")
20
+ send("sync_via_#{via}", epic,options)
21
+ else
22
+ raise "Invalid syncing source. Need to implement sync_via_#{via} method"
23
+ end
24
+ end
25
+
26
+
16
27
  # Epics get published to Pivotal
17
28
  # directly as epics, since Epics have first class support in pivotal
18
29
  def self.publish_via_pivotal(epic, options={})
@@ -0,0 +1,29 @@
1
+ class BlueprintFeaturePublisher
2
+ def self.publish(epic, options={})
3
+ via = (options.fetch(:via, :github) || :github)
4
+
5
+ if respond_to?("publish_via_#{via}")
6
+ send("publish_via_#{via}", epic,options)
7
+ else
8
+ raise "Invalid publishing source. Need to implement publish_via_#{via} method"
9
+ end
10
+ end
11
+
12
+ def self.sync(epic, options={})
13
+ via = (options.fetch(:via, :github) || :github)
14
+
15
+ if respond_to?("sync_via_#{via}")
16
+ send("sync_via_#{via}", epic,options)
17
+ else
18
+ raise "Invalid syncing source. Need to implement sync_via_#{via} method"
19
+ end
20
+ end
21
+
22
+ def self.publish_via_pivotal(epic, options={})
23
+ raise "Not Implemented. Implement #{ name }.publish_via_pivotal"
24
+ end
25
+
26
+ def self.publish_via_github(epic, options={})
27
+ raise "Not Implemented. Implement #{ name }.publish_via_github"
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ class BlueprintMilestonePublisher
2
+ def self.publish(epic, options={})
3
+ via = (options.fetch(:via, :github) || :github)
4
+
5
+ if respond_to?("publish_via_#{via}")
6
+ send("publish_via_#{via}", epic,options)
7
+ else
8
+ raise "Invalid publishing source. Need to implement publish_via_#{via} method"
9
+ end
10
+ end
11
+
12
+ def self.sync(epic, options={})
13
+ via = (options.fetch(:via, :github) || :github)
14
+
15
+ if respond_to?("sync_via_#{via}")
16
+ send("sync_via_#{via}", epic,options)
17
+ else
18
+ raise "Invalid syncing source. Need to implement sync_via_#{via} method"
19
+ end
20
+ end
21
+
22
+ def self.publish_via_pivotal(epic, options={})
23
+ raise "Not Implemented. Implement #{ name }.publish_via_pivotal"
24
+ end
25
+
26
+ def self.publish_via_github(epic, options={})
27
+ raise "Not Implemented. Implement #{ name }.publish_via_github"
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ class BlueprintProjectPublisher
2
+ def self.publish(epic, options={})
3
+ via = (options.fetch(:via, :github) || :github)
4
+
5
+ if respond_to?("publish_via_#{via}")
6
+ send("publish_via_#{via}", epic,options)
7
+ else
8
+ raise "Invalid publishing source. Need to implement publish_via_#{via} method"
9
+ end
10
+ end
11
+
12
+ def self.sync(epic, options={})
13
+ via = (options.fetch(:via, :github) || :github)
14
+
15
+ if respond_to?("sync_via_#{via}")
16
+ send("sync_via_#{via}", epic,options)
17
+ else
18
+ raise "Invalid syncing source. Need to implement sync_via_#{via} method"
19
+ end
20
+ end
21
+
22
+ def self.publish_via_pivotal(epic, options={})
23
+ raise "Not Implemented. Implement #{ name }.publish_via_pivotal"
24
+ end
25
+
26
+ def self.publish_via_github(epic, options={})
27
+ raise "Not Implemented. Implement #{ name }.publish_via_github"
28
+ end
29
+ end
@@ -58,6 +58,18 @@ class Brief::Apps::Blueprint::Epic
58
58
 
59
59
  helpers do
60
60
  def features
61
+ briefcase.features(project: project, epic: title)
62
+ end
63
+
64
+ def parent_project
65
+ briefcase.projects(project: project).first
66
+ end
67
+
68
+ def find_feature_by_title(feature_title)
69
+ briefcase.features(project: project, epic: title, title: feature_title)
70
+ end
71
+
72
+ def features_data
61
73
  sections.features.items.map do |item|
62
74
  item.components = Array(item.components)
63
75
 
@@ -68,8 +80,41 @@ class Brief::Apps::Blueprint::Epic
68
80
  end
69
81
  end
70
82
 
83
+ def generate_feature_content(feature_heading)
84
+ if feature_file_for(feature_heading).exist?
85
+ return feature_file_for(feature_heading).read
86
+ end
87
+
88
+ data = {
89
+ status: "published",
90
+ project: project,
91
+ epic: title,
92
+ title: feature_heading
93
+ }
94
+
95
+ content = raw_content_for_feature(feature_heading)
96
+
97
+ data.to_yaml + "\n---\n" + content
98
+ end
99
+
100
+ def feature_file_for(feature_heading)
101
+ folder = features_folder
102
+ filename = feature_heading.strip.parameterize
103
+ folder.join(filename)
104
+ end
105
+
106
+ def features_folder
107
+ briefcase.docs_path.join("features", project.parameterize, title.parameterize)
108
+ end
109
+
71
110
  def raw_content_for_feature(feature_heading, include_heading=true)
72
- document.content_under_heading(feature_heading, include_heading)
111
+ document.content_under_heading(feature_heading, include_heading).tap do |v|
112
+
113
+ # UGLY
114
+ # Promotes the h2 heading to an h1 for this document
115
+ v.gsub! "## #{ feature_heading }", "# #{ feature_heading }"
116
+ v.gsub! "###{ feature_heading }", "##{ feature_heading }"
117
+ end
73
118
  end
74
119
 
75
120
  def estimate_cli
@@ -11,7 +11,7 @@ class Brief::Apps::Blueprint::Feature
11
11
  persona
12
12
  goal
13
13
  behavior
14
- epic_title
14
+ epic
15
15
  remote_id
16
16
  tags Array
17
17
  end
@@ -26,7 +26,18 @@ class Brief::Apps::Blueprint::Feature
26
26
  end
27
27
 
28
28
  actions do
29
- def sync_with_github
29
+ def publish
30
+ BlueprintFeaturePublisher.publish(self, via: briefcase.settings.try(:tracking_system))
31
+ end
32
+
33
+ def sync
34
+ BlueprintFeaturePublisher.sync(self, via: briefcase.settings.try(:tracking_system))
35
+ end
36
+ end
37
+
38
+ helpers do
39
+ def parent_epic
40
+ briefcase.epics(title: epic, project: data.project).first
30
41
  end
31
42
  end
32
43
  end
@@ -18,4 +18,14 @@ class Brief::Apps::Blueprint::Milestone
18
18
  paragraphs "p"
19
19
  yaml_data "code.yaml:first-of-type", :serialize => :yaml, :hide => true
20
20
  end
21
+
22
+ actions do
23
+ def publish
24
+ BlueprintMilestonePublisher.publish(self, via: briefcase.settings.try(:tracking_system))
25
+ end
26
+
27
+ def sync
28
+ BlueprintMilestonePublisher.sync(self, via: briefcase.settings.try(:tracking_system))
29
+ end
30
+ end
21
31
  end
@@ -16,6 +16,16 @@ class Brief::Apps::Blueprint::Project
16
16
  yaml_data "code.yaml:first-of-type", :serialize => :yaml, :hide => true
17
17
  end
18
18
 
19
+ actions do
20
+ def publish
21
+ BlueprintProjectPublisher.publish(self, via: briefcase.settings.try(:tracking_system))
22
+ end
23
+
24
+ def sync
25
+ BlueprintProjectPublisher.sync(self, via: briefcase.settings.try(:tracking_system))
26
+ end
27
+ end
28
+
19
29
  def epics
20
30
  briefcase.epics(project: title)
21
31
  end
File without changes
@@ -34,15 +34,20 @@ module Brief::Document::SourceMap
34
34
  def content_under_heading(heading_element, include_heading=true)
35
35
  if heading_element.is_a?(String) && heading_element.length > 1
36
36
  heading_element = heading_element_tags.find do |el|
37
- el.attr('data-heading').include?(heading_element) || el.text.to_s.include?(heading_element)
37
+ el.attr('data-heading').include?(heading_element.strip.downcase) || el.text.to_s.strip.downcase.include?(heading_element.strip.downcase)
38
38
  end
39
39
  end
40
40
 
41
+ if heading_element.nil?
42
+ return nil
43
+ end
44
+
41
45
  start_index = heading_element.attr('data-line-number').to_i
42
- end_index = content.lines.length
43
46
 
44
47
  if next_heading = next_sibling_heading_for(heading_element)
45
48
  end_index = next_heading.attr('data-line-number').to_i
49
+ else
50
+ end_index = raw_content.lines.length + 1
46
51
  end
47
52
 
48
53
  end_index = end_index - start_index
@@ -50,6 +55,6 @@ module Brief::Document::SourceMap
50
55
 
51
56
  lines = raw_content.lines.dup.slice(start_index - 1, end_index)
52
57
 
53
- (include_heading ? lines : lines.slice(1, lines.length)).join("")
58
+ Array(include_heading ? lines : lines.slice(1, lines.length)).join("")
54
59
  end
55
60
  end
data/lib/brief/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Brief
2
- VERSION = '1.17.0'
2
+ VERSION = '1.17.1'
3
3
  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.17.0
4
+ version: 1.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Soeder
@@ -344,6 +344,9 @@ files:
344
344
  - apps/blueprint/examples/wireframe.md
345
345
  - apps/blueprint/extensions/middleman.rb
346
346
  - apps/blueprint/lib/epic_publisher.rb
347
+ - apps/blueprint/lib/feature_publisher.rb
348
+ - apps/blueprint/lib/milestone_publisher.rb
349
+ - apps/blueprint/lib/project_publisher.rb
347
350
  - apps/blueprint/models/concept.rb
348
351
  - apps/blueprint/models/diagram.rb
349
352
  - apps/blueprint/models/epic.rb
@@ -359,6 +362,7 @@ files:
359
362
  - apps/blueprint/models/sitemap.rb
360
363
  - apps/blueprint/models/wireframe.rb
361
364
  - apps/blueprint/templates/epic.md.erb
365
+ - apps/blueprint/templates/feature.md.erb
362
366
  - apps/blueprint/templates/milestone.md.erb
363
367
  - apps/blueprint/templates/page.md.erb
364
368
  - apps/blueprint/templates/persona.md.erb