brief 1.9.11 → 1.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/apps/blueprint/documentation/diagram.md +4 -10
- data/apps/blueprint/documentation/epic.md +4 -7
- data/apps/blueprint/documentation/milestone.md +2 -3
- data/apps/blueprint/documentation/outline.md +2 -5
- data/apps/blueprint/documentation/page.md +1 -0
- data/apps/blueprint/documentation/persona.md +1 -0
- data/apps/blueprint/documentation/project.md +1 -0
- data/apps/blueprint/documentation/release.md +1 -0
- data/apps/blueprint/documentation/roadmap.md +1 -0
- data/apps/blueprint/documentation/sitemap.md +1 -0
- data/apps/blueprint/documentation/user_story.md +1 -0
- data/apps/blueprint/documentation/wireframe.md +1 -0
- data/lib/brief.rb +1 -0
- data/lib/brief/briefcase.rb +23 -12
- data/lib/brief/document.rb +21 -1
- data/lib/brief/document/rendering.rb +3 -9
- data/lib/brief/document/transformer.rb +77 -0
- data/lib/brief/dsl.rb +2 -0
- data/lib/brief/model.rb +34 -4
- data/lib/brief/version.rb +1 -1
- data/spec/fixtures/example/brief.rb +6 -0
- data/spec/fixtures/example/docs/concept.html.md +2 -6
- data/spec/fixtures/example/docs/index.md +6 -0
- data/spec/fixtures/example/docs/wireframe.html.md +3 -0
- data/spec/lib/brief/apps_spec.rb +1 -1
- data/spec/lib/brief/content_transformation_spec.rb +18 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 316633c274b953b641bfba353bd834ba968a22a7
|
4
|
+
data.tar.gz: db0f92002cd2c63c2e44dfb89972fec21f1ea9e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 716128ec26d9525c7eddca5c448ff4486a95ac0aff751ba2fd33e38c99981067015e13223cf4d93a07d332a9f7ae627c9a176748117033020c634c967b639a68
|
7
|
+
data.tar.gz: f72905da6879984d8b52b5252024cb1e876781f2fef27c5fb43c3c732332a942ba62337c28ff530ba5e55a114b910f8dd203a3bf27fd4d92e32191cc201da061
|
data/CHANGELOG.md
CHANGED
@@ -134,3 +134,13 @@ attributes.
|
|
134
134
|
- Cleaned up some implementations
|
135
135
|
- Fully implemented the command set
|
136
136
|
- CLI can be used to generate JSON data
|
137
|
+
|
138
|
+
### 1.9.4
|
139
|
+
- Added support for including asset attachments inline as data
|
140
|
+
|
141
|
+
### 1.9.10
|
142
|
+
- Added a websocket server for easy on the fly parsing / querying
|
143
|
+
|
144
|
+
### 1.9.12
|
145
|
+
- Included ability to transform content using special markdown link syntax
|
146
|
+
- Included ability to inline svg assets
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,7 @@
|
|
1
|
-
|
1
|
+
#### Blueprint Diagram
|
2
2
|
|
3
|
-
The Diagram model is useful for combining notes with an SVG diagram.
|
3
|
+
The Diagram model is useful for combining notes with an SVG diagram.
|
4
4
|
|
5
|
-
One workflow I like to use is building a UML Diagram in Google Draw, and
|
6
|
-
exporting it as SVG. Then using a tool like Adobe Illustrator, I will
|
7
|
-
group the elements of the diagram, and then assign IDs and Classes to
|
8
|
-
them.
|
5
|
+
One workflow I like to use is building a UML Diagram in Google Draw, and exporting it as SVG. Then using a tool like Adobe Illustrator, I will group the elements of the diagram, and then assign IDs and Classes to them.
|
9
6
|
|
10
|
-
The Diagram document allows for a section called Annotations. The
|
11
|
-
Annotations section will be parsed, and treated as data. This allows
|
12
|
-
for rendering the diagram document, along with the diagram itself, and
|
13
|
-
displaying the annotations in a novel way.
|
7
|
+
The Diagram document allows for a section called Annotations. The Annotations section will be parsed, and treated as data. This allows for rendering the diagram document, along with the diagram itself, and displaying the annotations in a novel way.
|
@@ -1,10 +1,7 @@
|
|
1
|
-
|
1
|
+
#### Feature Epics
|
2
2
|
|
3
|
-
The Feature Epic model is a document that is used to document a bunch of
|
4
|
-
related user stories related to a general feature category or group.
|
3
|
+
The Feature Epic model is a document that is used to document a bunch of related user stories related to a general feature category or group.
|
5
4
|
|
6
|
-
For example you might have a "3rd Party Integrations" Epic which has
|
7
|
-
User Stories for LinkedIn, Facebook, Github, and Twitter.
|
5
|
+
For example you might have a "3rd Party Integrations" Epic which has User Stories for LinkedIn, Facebook, Github, and Twitter.
|
8
6
|
|
9
|
-
The Epic Document can be used to describe the importance of the module
|
10
|
-
as a whole at the same time that it captures the user stories.
|
7
|
+
The Epic Document can be used to describe the importance of the module as a whole at the same time that it captures the user stories.
|
@@ -0,0 +1 @@
|
|
1
|
+
#### Pages
|
@@ -0,0 +1 @@
|
|
1
|
+
#### Personas
|
@@ -0,0 +1 @@
|
|
1
|
+
#### Projects
|
@@ -0,0 +1 @@
|
|
1
|
+
#### Releases
|
@@ -0,0 +1 @@
|
|
1
|
+
#### Roadmaps
|
@@ -0,0 +1 @@
|
|
1
|
+
#### Sitemaps
|
@@ -0,0 +1 @@
|
|
1
|
+
#### User Stories
|
@@ -0,0 +1 @@
|
|
1
|
+
#### Wireframes
|
data/lib/brief.rb
CHANGED
@@ -112,6 +112,7 @@ require 'brief/document/rendering'
|
|
112
112
|
require 'brief/document/front_matter'
|
113
113
|
require 'brief/document/templating'
|
114
114
|
require 'brief/document/content_extractor'
|
115
|
+
require 'brief/document/transformer'
|
115
116
|
require 'brief/document/structure'
|
116
117
|
require 'brief/document/section'
|
117
118
|
require 'brief/document/section/mapping'
|
data/lib/brief/briefcase.rb
CHANGED
@@ -51,24 +51,31 @@ module Brief
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
def as_default(params={})
|
58
|
-
params.symbolize_keys!
|
59
|
-
|
60
|
-
base = {
|
54
|
+
def info_hash
|
55
|
+
{
|
56
|
+
BRIEF_VERSION: Brief::VERSION,
|
61
57
|
views: Brief.views.keys,
|
62
58
|
key: folder_name.to_s.parameterize,
|
63
59
|
name: folder_name.to_s.titlecase,
|
64
60
|
settings: settings,
|
65
61
|
cache_key: cache_key,
|
66
62
|
root: root.to_s,
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
63
|
+
paths:{
|
64
|
+
docs_path: docs_path.to_s,
|
65
|
+
assets_path: assets_path.to_s,
|
66
|
+
models_path: models_path.to_s,
|
67
|
+
data_path: data_path.to_s
|
68
|
+
}
|
71
69
|
}
|
70
|
+
end
|
71
|
+
|
72
|
+
# TODO
|
73
|
+
# The serialization of an entire briefcase at once
|
74
|
+
# is important enough to be its own module
|
75
|
+
def as_default(params={})
|
76
|
+
params.symbolize_keys!
|
77
|
+
|
78
|
+
base = info_hash
|
72
79
|
|
73
80
|
if params[:include_data] || params[:data]
|
74
81
|
base[:data] = data.as_json
|
@@ -93,7 +100,10 @@ module Brief
|
|
93
100
|
|
94
101
|
all = all_models.compact
|
95
102
|
|
96
|
-
base[:models] = all.map
|
103
|
+
base[:models] = all.map do |m|
|
104
|
+
m.document.refresh! if params[:refresh_models]
|
105
|
+
m.as_json(model_settings)
|
106
|
+
end
|
97
107
|
end
|
98
108
|
|
99
109
|
base
|
@@ -104,6 +114,7 @@ module Brief
|
|
104
114
|
rendered: true,
|
105
115
|
models: true,
|
106
116
|
schema: true,
|
117
|
+
documentation: true,
|
107
118
|
attachments: true)
|
108
119
|
as_default(options)
|
109
120
|
end
|
data/lib/brief/document.rb
CHANGED
@@ -270,17 +270,37 @@ module Brief
|
|
270
270
|
super || (data && data.respond_to?(method)) || (data && data.key?(method))
|
271
271
|
end
|
272
272
|
|
273
|
+
# The structure analyzer of the document is responsible for grouping
|
274
|
+
# the content under the headings by wrapping them in divs, and creating
|
275
|
+
# relationships between the nodes. This is what lets us provide an easy
|
276
|
+
# iteration API on top of the parsed document
|
273
277
|
def structure
|
274
278
|
@structure_analyzer ||= Brief::Document::Structure.new(fragment, raw_content.lines.to_a)
|
275
279
|
end
|
276
280
|
|
281
|
+
# The Parser wraps the rendered HTML in a nokogiri element so we can easily manipulate it.
|
282
|
+
# Prior to doing so, we use the structure analyzer to build more metadata into the markup
|
277
283
|
def parser
|
278
284
|
@parser ||= begin
|
279
285
|
structure.prescan
|
280
|
-
|
286
|
+
|
287
|
+
structure.create_wrappers.tap do |f|
|
288
|
+
transformer_for(f).all if data.transform
|
289
|
+
end
|
281
290
|
end
|
282
291
|
end
|
283
292
|
|
293
|
+
# The transformer is responsible for performing content modifications
|
294
|
+
# on the rendered document. This is useful for supporting extensions that
|
295
|
+
# are driven by the markdown language.
|
296
|
+
#
|
297
|
+
# TODO: This is hidden behind a feature flag, and requires the document
|
298
|
+
# to have metadata that specifies transform = true
|
299
|
+
def transformer_for(doc_fragment=nil)
|
300
|
+
doc_fragment ||= fragment
|
301
|
+
@transformer ||= Brief::Document::Transformer.new(doc_fragment, self)
|
302
|
+
end
|
303
|
+
|
284
304
|
def fragment
|
285
305
|
@fragment ||= Nokogiri::HTML.fragment(to_raw_html)
|
286
306
|
end
|
@@ -1,16 +1,10 @@
|
|
1
1
|
module GitHub
|
2
2
|
class Markdown
|
3
|
-
|
4
3
|
def self.render_gfm(content)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.add_level_and_heading(html)
|
11
|
-
html.gsub(/<h([1-6])>(.+?)<\/h\1>/,"<h\\1 data-level='\\1' data-heading='\\2'>\\2<\/h\\1>")
|
4
|
+
self.to_html(content, :gfm).tap do |html|
|
5
|
+
html.gsub!(/<h([1-6])>(.+?)<\/h\1>/,"<h\\1 data-level='\\1' data-heading='\\2'>\\2<\/h\\1>")
|
6
|
+
end
|
12
7
|
end
|
13
|
-
|
14
8
|
end
|
15
9
|
end
|
16
10
|
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Brief
|
2
|
+
class Document::Transformer
|
3
|
+
attr_reader :document, :fragment
|
4
|
+
|
5
|
+
def initialize(fragment, document)
|
6
|
+
@fragment = fragment
|
7
|
+
@document = document
|
8
|
+
end
|
9
|
+
|
10
|
+
def all
|
11
|
+
transform_dynamic_links
|
12
|
+
inline_svg_content
|
13
|
+
end
|
14
|
+
|
15
|
+
def inline_svg_content
|
16
|
+
inline_svg_images.each do |img|
|
17
|
+
_, value = img['src'].to_s.split("=")
|
18
|
+
|
19
|
+
if asset = document.briefcase.find_asset(value)
|
20
|
+
img.replace("<div class='svg-wrapper'>#{ asset.read }</div>")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def transform_dynamic_links
|
26
|
+
dynamic_link_elements.each do |node|
|
27
|
+
attribute, value = node['href'].to_s.split("=")
|
28
|
+
instruction, strategy = node.text.to_s.split(':')
|
29
|
+
|
30
|
+
if instruction == "link" && attribute == "path"
|
31
|
+
begin
|
32
|
+
link_to_doc = document.briefcase.document_at(value)
|
33
|
+
text = link_to_doc.send(strategy)
|
34
|
+
node.inner_html = text
|
35
|
+
node['href'] = "brief://#{ link_to_doc.path }"
|
36
|
+
rescue
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
include_link_elements.each do |node|
|
43
|
+
attribute, value = node['href'].to_s.split("=")
|
44
|
+
instruction, strategy = node.text.to_s.split(':')
|
45
|
+
|
46
|
+
if instruction == "include" && attribute == "path"
|
47
|
+
include_doc = document.briefcase.document_at(value)
|
48
|
+
|
49
|
+
replacement = nil
|
50
|
+
|
51
|
+
if strategy == "raw_content"
|
52
|
+
replacement = include_doc.unwrapped_html
|
53
|
+
elsif strategy == "content"
|
54
|
+
replacement = include_doc.to_html
|
55
|
+
end
|
56
|
+
|
57
|
+
node.replace(replacement) if replacement
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def inline_svg_images
|
65
|
+
fragment.css('img[alt="inline:svg"]')
|
66
|
+
end
|
67
|
+
|
68
|
+
def dynamic_link_elements(needle="link:")
|
69
|
+
fragment.css('a:contains("' + needle + '")')
|
70
|
+
end
|
71
|
+
|
72
|
+
def include_link_elements
|
73
|
+
dynamic_link_elements("include:")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/lib/brief/dsl.rb
CHANGED
@@ -10,6 +10,7 @@ module Brief
|
|
10
10
|
Brief.views[name.to_sym] = block
|
11
11
|
end
|
12
12
|
|
13
|
+
# Extends an existing class
|
13
14
|
def extend(*args, &block)
|
14
15
|
options = args.dup.extract_options!
|
15
16
|
name = args.first
|
@@ -27,6 +28,7 @@ module Brief
|
|
27
28
|
klass.definition.validate!
|
28
29
|
end
|
29
30
|
|
31
|
+
# defines a new model class
|
30
32
|
def define(*args, &block)
|
31
33
|
options = args.dup.extract_options!
|
32
34
|
name = args.first
|
data/lib/brief/model.rb
CHANGED
@@ -142,18 +142,48 @@ module Brief
|
|
142
142
|
rendered: model_doc.rendered
|
143
143
|
}
|
144
144
|
else
|
145
|
-
{
|
146
|
-
|
145
|
+
{ }
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
def content_schema_summary
|
150
|
+
base = definition.content_schema.attributes
|
151
|
+
|
152
|
+
base.keys.inject({}) do |memo, key|
|
153
|
+
val = base[key]
|
154
|
+
args = Array(val[:args])
|
155
|
+
first = args.first
|
156
|
+
memo[key] = first if first
|
157
|
+
memo
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def metadata_schema_summary
|
162
|
+
base = definition.metadata_schema
|
163
|
+
|
164
|
+
base.keys.inject({}) do |memo, key|
|
165
|
+
val = base[key]
|
166
|
+
args = Array(val[:args])
|
167
|
+
first = args.first.to_s
|
168
|
+
|
169
|
+
if args.length == 1 && first == key.to_s
|
170
|
+
memo[key] = "string"
|
171
|
+
elsif args.length >= 2
|
172
|
+
memo[key] = args.last
|
173
|
+
end
|
174
|
+
|
175
|
+
memo
|
147
176
|
end
|
148
177
|
end
|
149
178
|
|
150
179
|
def to_schema
|
151
180
|
{
|
152
181
|
schema: {
|
153
|
-
content:
|
154
|
-
metadata:
|
182
|
+
content: content_schema_summary,
|
183
|
+
metadata: metadata_schema_summary,
|
155
184
|
},
|
156
185
|
documentation: to_documentation,
|
186
|
+
defined_in: defined_in,
|
157
187
|
class_name: to_s,
|
158
188
|
type_alias: type_alias,
|
159
189
|
name: name,
|
data/lib/brief/version.rb
CHANGED
data/spec/lib/brief/apps_spec.rb
CHANGED
@@ -11,7 +11,7 @@ describe "Packaged Apps" do
|
|
11
11
|
|
12
12
|
it "renders documentation for the app" do
|
13
13
|
rendered = blueprint.render_documentation.epic.rendered
|
14
|
-
expect(rendered).to include("
|
14
|
+
expect(rendered).to include("Feature Epics")
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should find the right path for an app name" do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "Content Transformation" do
|
4
|
+
let(:outline) { Brief.testcase.document_at("index.md") }
|
5
|
+
let(:wireframe) { Brief.testcase.document_at("wireframe.html.md") }
|
6
|
+
|
7
|
+
it "transforms the link tags based on the DSL" do
|
8
|
+
html = outline.to_html
|
9
|
+
expect(html).to include("Blueprint Persona Example")
|
10
|
+
expect(html).to include("brief://")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "automatically inlines SVG content for us" do
|
14
|
+
html = wireframe.to_html
|
15
|
+
expect(html).to include("svg-wrapper")
|
16
|
+
expect(html).to include("svg version")
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brief
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Soeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -353,6 +353,7 @@ files:
|
|
353
353
|
- lib/brief/document/section/mapping.rb
|
354
354
|
- lib/brief/document/structure.rb
|
355
355
|
- lib/brief/document/templating.rb
|
356
|
+
- lib/brief/document/transformer.rb
|
356
357
|
- lib/brief/document_mapper.rb
|
357
358
|
- lib/brief/dsl.rb
|
358
359
|
- lib/brief/model.rb
|
@@ -404,6 +405,7 @@ files:
|
|
404
405
|
- spec/lib/brief/apps_spec.rb
|
405
406
|
- spec/lib/brief/attachments_spec.rb
|
406
407
|
- spec/lib/brief/briefcase_spec.rb
|
408
|
+
- spec/lib/brief/content_transformation_spec.rb
|
407
409
|
- spec/lib/brief/data_spec.rb
|
408
410
|
- spec/lib/brief/document_spec.rb
|
409
411
|
- spec/lib/brief/dsl_spec.rb
|
@@ -499,6 +501,7 @@ test_files:
|
|
499
501
|
- spec/lib/brief/apps_spec.rb
|
500
502
|
- spec/lib/brief/attachments_spec.rb
|
501
503
|
- spec/lib/brief/briefcase_spec.rb
|
504
|
+
- spec/lib/brief/content_transformation_spec.rb
|
502
505
|
- spec/lib/brief/data_spec.rb
|
503
506
|
- spec/lib/brief/document_spec.rb
|
504
507
|
- spec/lib/brief/dsl_spec.rb
|