brief 1.8.12 → 1.9.0

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: 2c387f19c8ad49a0779cebe811c4bf7036400381
4
- data.tar.gz: 60106d90ac046020fa178b28881ea88af8e672ba
3
+ metadata.gz: b2be8fb315c30c8b5534ffa5b215a5f3ae058fb7
4
+ data.tar.gz: aaaedeffe0b34d86a724ed4d25dc9cccdbaa712a
5
5
  SHA512:
6
- metadata.gz: 4a0f50b0dc77533e07e03b15e644e117856aba281fdf272a0d947175a59b2170162785c8eac04345cf528a8e0b0776839cd65dd7f851f3e018cafb45cbda4904
7
- data.tar.gz: 7451362423fef638486fb758d03ca6818e6d82f8d291b29fa8ace319e192955ac1cd3de14d029db3c0a7e44956c4a68d703212fb748f07584721244973eedf6c
6
+ metadata.gz: 111d44be6dcd95672ccf28adb0149cfa2cc41691f057ce557ce0b18572ce2fe9f124f60f0f0bc5fa89b73ca0a472099aab66d07aa13049ec140fc5a79e803ca4
7
+ data.tar.gz: 2b5401b3ed0b66b01bc33c100388a0ad911a0e4c5f0a8bcffe44af039ba8ea43a72140619dc7aab5d676040026d65aca0814c7c6a9786ea2768edb4e2d3ba347
@@ -129,3 +129,8 @@ attributes.
129
129
  ### 1.8.3
130
130
  - General improvements to models & documents api
131
131
  - Added support for cache key
132
+
133
+ ### 1.9.0
134
+ - Cleaned up some implementations
135
+ - Fully implemented the command set
136
+ - CLI can be used to generate JSON data
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brief (1.8.12)
4
+ brief (1.9.0)
5
5
  activesupport (>= 4.0)
6
6
  commander (>= 4.2.1)
7
7
  github-fs
@@ -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.merge!(summary: summary.to_model.as_json(:rendered=>true, :content=>true))
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
- view(:table_of_contents) do |*args|
13
- briefcase = args.first
16
+ class Brief::Briefcase
17
+ def has_table_of_contents?
18
+ docs_path.join('index.md').exist?
19
+ end
14
20
 
15
- doc = Brief::Document.new(briefcase.docs_path.join("index.md"), document_type: "outline")
16
- doc && doc.to_model
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
@@ -0,0 +1,15 @@
1
+ class Brief::Apps::Blueprint::Sitemap
2
+ include Brief::Model
3
+
4
+ meta do
5
+ title
6
+ status
7
+ revision
8
+ end
9
+
10
+ content do
11
+ define_section("Pages") do
12
+ each("h2").has(:title=>"h2:first-of-type")
13
+ end
14
+ end
15
+ end
@@ -51,32 +51,35 @@ module Brief
51
51
  def as_default(params={})
52
52
  params.symbolize_keys!
53
53
 
54
- model_settings = {
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
- }.tap do |hash|
75
- hash[:table_of_contents] = briefcase.table_of_contents.as_json() rescue {}
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
 
@@ -53,29 +53,44 @@ command 'init' do |c|
53
53
  end
54
54
  end
55
55
 
56
- command 'info' do |c|
57
- c.syntax = 'brief info'
58
- c.description = 'View info about the brief environment'
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
- c.option '--print', 'Print output to the terminal'
78
+ briefcases = roots.map {|root| Brief::Briefcase.new(root: Pathname(root).realpath) }
61
79
 
62
- c.action do |args, options|
63
- if options.print
64
- # traveling ruby is reporting this incorrectly
65
- puts "\n-- Paths:"
66
- puts "Dir.pwd = #{ Dir.pwd }"
67
- puts "Brief.pwd = #{ Brief.pwd }"
68
-
69
- puts "\n-- Available apps:"
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 json
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
- urls: {
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
- [200, {"Content-Type"=>"application/json"}, models.map(&:as_json)]
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
@@ -1,3 +1,3 @@
1
1
  module Brief
2
- VERSION = '1.8.12'
2
+ VERSION = '1.9.0'
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.8.12
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