brief 1.8.12 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/apps/blueprint/config.rb +13 -5
- data/apps/blueprint/models/sitemap.rb +15 -0
- data/lib/brief/briefcase.rb +21 -18
- data/lib/brief/cli/all.rb +35 -20
- data/lib/brief/model/serializers.rb +6 -5
- data/lib/brief/server/handlers/browse.rb +6 -1
- data/lib/brief/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2be8fb315c30c8b5534ffa5b215a5f3ae058fb7
|
4
|
+
data.tar.gz: aaaedeffe0b34d86a724ed4d25dc9cccdbaa712a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 111d44be6dcd95672ccf28adb0149cfa2cc41691f057ce557ce0b18572ce2fe9f124f60f0f0bc5fa89b73ca0a472099aab66d07aa13049ec140fc5a79e803ca4
|
7
|
+
data.tar.gz: 2b5401b3ed0b66b01bc33c100388a0ad911a0e4c5f0a8bcffe44af039ba8ea43a72140619dc7aab5d676040026d65aca0814c7c6a9786ea2768edb4e2d3ba347
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/apps/blueprint/config.rb
CHANGED
@@ -4,14 +4,22 @@ view(:summary) do |*args|
|
|
4
4
|
|
5
5
|
briefcase.present(:default, params).tap do |hash|
|
6
6
|
if summary = briefcase.pages.find {|p| p.title == "Summary" }
|
7
|
-
hash
|
7
|
+
hash[:summary] = summary.to_model.as_json(params)
|
8
|
+
end
|
9
|
+
|
10
|
+
if briefcase.has_table_of_contents?
|
11
|
+
hash[:table_of_contents] = table_of_contents.as_json(params)
|
8
12
|
end
|
9
13
|
end
|
10
14
|
end
|
11
15
|
|
12
|
-
|
13
|
-
|
16
|
+
class Brief::Briefcase
|
17
|
+
def has_table_of_contents?
|
18
|
+
docs_path.join('index.md').exist?
|
19
|
+
end
|
14
20
|
|
15
|
-
|
16
|
-
|
21
|
+
def table_of_contents
|
22
|
+
doc = Brief::Document.new(briefcase.docs_path.join("index.md"), document_type: "outline")
|
23
|
+
doc && doc.to_model
|
24
|
+
end
|
17
25
|
end
|
data/lib/brief/briefcase.rb
CHANGED
@@ -51,32 +51,35 @@ module Brief
|
|
51
51
|
def as_default(params={})
|
52
52
|
params.symbolize_keys!
|
53
53
|
|
54
|
-
|
55
|
-
docs_path: docs_path
|
56
|
-
}
|
57
|
-
|
58
|
-
model_settings[:rendered] = !!(params.key?(:rendered))
|
59
|
-
model_settings[:content] = !!(params.key?(:content))
|
60
|
-
|
61
|
-
all = all_models.compact
|
62
|
-
|
63
|
-
schema = schema_map
|
64
|
-
models = all.map {|m| m.as_json(model_settings) }
|
65
|
-
|
66
|
-
{
|
54
|
+
base = {
|
67
55
|
views: Brief.views.keys,
|
68
56
|
key: briefcase.folder_name.to_s.parameterize,
|
69
57
|
name: briefcase.folder_name.to_s.titlecase,
|
70
|
-
schema: schema,
|
71
|
-
models: models,
|
72
58
|
settings: settings,
|
73
59
|
cache_key: briefcase.cache_key
|
74
|
-
}
|
75
|
-
|
60
|
+
}
|
61
|
+
|
62
|
+
if params[:include_schema]
|
63
|
+
base[:schema] = schema_map
|
76
64
|
end
|
65
|
+
|
66
|
+
if params[:include_models]
|
67
|
+
model_settings = {
|
68
|
+
docs_path: docs_path
|
69
|
+
}
|
70
|
+
|
71
|
+
%w(urls content rendered).each do |opt|
|
72
|
+
model_settings[opt.to_sym] = !!(params[opt.to_sym] || params["include_#{opt}".to_sym])
|
73
|
+
end
|
74
|
+
|
75
|
+
all = all_models.compact
|
76
|
+
base[:models] = all.map {|m| m.as_json(model_settings) }
|
77
|
+
end
|
78
|
+
|
79
|
+
base
|
77
80
|
end
|
78
81
|
|
79
|
-
def as_full_export
|
82
|
+
def as_full_export(options={})
|
80
83
|
as_default(content: true, rendered: true)
|
81
84
|
end
|
82
85
|
|
data/lib/brief/cli/all.rb
CHANGED
@@ -53,29 +53,44 @@ command 'init' do |c|
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
command
|
57
|
-
c.syntax =
|
58
|
-
c.description =
|
56
|
+
command "browse" do |c|
|
57
|
+
c.syntax = "brief browse FOLDER"
|
58
|
+
c.description = "Lists information about each of the briefcases in FOLDER"
|
59
|
+
|
60
|
+
c.option '--format FORMAT', String, 'Which format to render the output in? default: printed, or json'
|
61
|
+
c.option '--presenter-format FORMAT', String, 'Which presenter to use?'
|
62
|
+
c.option '--config-filename FILENAME', String, 'Which filename has the briefcase config? default(brief.rb)'
|
63
|
+
c.option '--include-schema', 'Include schema information'
|
64
|
+
c.option '--include-models', 'Include individual models as well'
|
65
|
+
c.option '--include-content', 'Gets passed to the model renderers if present'
|
66
|
+
c.option '--include-rendered', 'Gets passed to the model renderers if present'
|
67
|
+
c.option '--include-urls', 'Gets passed to the model renderers if present'
|
68
|
+
|
69
|
+
c.when_called do |args, options|
|
70
|
+
folder = Pathname(args.first)
|
71
|
+
|
72
|
+
options.default(config_filename:'brief.rb', presenter_format: 'default')
|
73
|
+
|
74
|
+
roots = folder.children.select do |root|
|
75
|
+
root.join(options.config_filename).exist?
|
76
|
+
end
|
59
77
|
|
60
|
-
|
78
|
+
briefcases = roots.map {|root| Brief::Briefcase.new(root: Pathname(root).realpath) }
|
61
79
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
puts Brief::Apps.available_apps.join("\n")
|
71
|
-
else
|
72
|
-
json = {
|
73
|
-
version: Brief::VERSION,
|
74
|
-
available_apps: Brief::Apps.available_apps,
|
75
|
-
pwd: Brief.pwd
|
76
|
-
}.to_json
|
80
|
+
if options.format == 'json'
|
81
|
+
output = briefcases.map do |b|
|
82
|
+
b.present(options.presenter_format, rendered: options.include_rendered,
|
83
|
+
content: options.include_content,
|
84
|
+
urls: options.include_urls,
|
85
|
+
schema: options.include_schema,
|
86
|
+
models: options.include_models)
|
87
|
+
end
|
77
88
|
|
78
|
-
puts
|
89
|
+
puts output.to_json
|
90
|
+
else
|
91
|
+
briefcases.each do |bc|
|
92
|
+
puts bc
|
93
|
+
end
|
79
94
|
end
|
80
95
|
end
|
81
96
|
end
|
@@ -23,7 +23,11 @@ module Brief::Model::Serializers
|
|
23
23
|
hash: file_hash,
|
24
24
|
sections: {},
|
25
25
|
section_headings: [],
|
26
|
-
|
26
|
+
}.tap do |h|
|
27
|
+
h[:content] = document.combined_data_and_content if options[:content]
|
28
|
+
h[:rendered] = document.to_html if options[:rendered]
|
29
|
+
|
30
|
+
h[:urls] = {
|
27
31
|
view_content_url: "/view/content/#{ doc_path }",
|
28
32
|
view_rendered_url: "/view/rendered/#{ doc_path }",
|
29
33
|
view_details_url: "/view/details/#{ doc_path }",
|
@@ -31,10 +35,7 @@ module Brief::Model::Serializers
|
|
31
35
|
remove_url: "/remove/#{ doc_path }",
|
32
36
|
schema_url: "/schema/#{ type }",
|
33
37
|
actions_url: "/actions/:action/#{ doc_path }"
|
34
|
-
}
|
35
|
-
}.tap do |h|
|
36
|
-
h[:content] = document.combined_data_and_content if options[:content]
|
37
|
-
h[:rendered] = document.to_html if options[:rendered]
|
38
|
+
} if options[:urls]
|
38
39
|
end.tap do |h|
|
39
40
|
if document.has_sections?
|
40
41
|
h[:section_headings] = document.section_headings
|
@@ -9,7 +9,12 @@ module Brief::Server::Handlers
|
|
9
9
|
|
10
10
|
if available_handlers.include?(model_type)
|
11
11
|
models = briefcase.send(model_type.to_s)
|
12
|
-
|
12
|
+
|
13
|
+
presented_models = models.map do |model|
|
14
|
+
model.as_json(options.symbolize_keys)
|
15
|
+
end
|
16
|
+
|
17
|
+
[200, {"Content-Type"=>"application/json"}, presented_models]
|
13
18
|
else
|
14
19
|
[403, {"Content-Type"=>"application/json"}, {error: "Invalid model type"}]
|
15
20
|
end
|
data/lib/brief/version.rb
CHANGED
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.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Soeder
|
@@ -248,6 +248,7 @@ files:
|
|
248
248
|
- apps/blueprint/models/project.rb
|
249
249
|
- apps/blueprint/models/release.rb
|
250
250
|
- apps/blueprint/models/roadmap.rb
|
251
|
+
- apps/blueprint/models/sitemap.rb
|
251
252
|
- apps/blueprint/models/user_story.rb
|
252
253
|
- apps/blueprint/models/wireframe.rb
|
253
254
|
- apps/blueprint/templates/epic.md.erb
|