brief 1.8.9 → 1.8.10
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/brief/briefcase.rb +7 -4
- data/lib/brief/cli/01_extensions.rb +16 -0
- data/lib/brief/cli/all.rb +18 -6
- data/lib/brief/cli/render.rb +5 -1
- data/lib/brief/cli/schema.rb +29 -0
- data/lib/brief/repository.rb +4 -0
- data/lib/brief/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 354726bac606b40861cd06b0779dcbb67e3b2dd6
|
|
4
|
+
data.tar.gz: 4205421b4c7895d29b2f1b3a61f57f81f027a53f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8cdd687ca3f932b1a92010af31ed105a3043daa41a7314e12aa72b8269aa239726f7f941c96a6524eca1a8835ab7b100beead97e38b2954ad0e0be800372de54
|
|
7
|
+
data.tar.gz: 6d8c68666bcaf5fd61bc7b11d6a7ed1e481cb5b7071bb71e63c2546ebfa4af2769e4822435233e6efea01cca340d3b085d10105ff1ce7c5934055e9bf526b5c7
|
data/Gemfile.lock
CHANGED
data/lib/brief/briefcase.rb
CHANGED
|
@@ -68,10 +68,7 @@ module Brief
|
|
|
68
68
|
|
|
69
69
|
all = all_models.compact
|
|
70
70
|
|
|
71
|
-
schema =
|
|
72
|
-
.map(&:to_schema)
|
|
73
|
-
.reduce({}) {|m, k| m[k[:type_alias]] = k; m }
|
|
74
|
-
|
|
71
|
+
schema = schema_map
|
|
75
72
|
models = all.map {|m| m.as_json(model_settings) }
|
|
76
73
|
|
|
77
74
|
{
|
|
@@ -97,6 +94,12 @@ module Brief
|
|
|
97
94
|
run(app_config_path) if app_path.try(&:exist?)
|
|
98
95
|
end
|
|
99
96
|
|
|
97
|
+
def schema_map(include_all=false)
|
|
98
|
+
list = include_all ? Brief::Model.classes : model_classes
|
|
99
|
+
list.map(&:to_schema)
|
|
100
|
+
.reduce({}) {|m, k| m[k[:type_alias]] = k; m }
|
|
101
|
+
end
|
|
102
|
+
|
|
100
103
|
def data
|
|
101
104
|
@data ||= data!
|
|
102
105
|
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Brief
|
|
2
|
+
def self.cli_action(c, &block)
|
|
3
|
+
c.action do |args, options|
|
|
4
|
+
options.default(root: Brief.pwd)
|
|
5
|
+
|
|
6
|
+
Brief.case = Brief::Briefcase.new(root: Pathname(options.root))
|
|
7
|
+
|
|
8
|
+
block.call(args, options)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.default_cli_options(c)
|
|
13
|
+
c.option '--root DIRECTORY', String, 'The root for the briefcase'
|
|
14
|
+
c.option '--config FILE', String, 'Path to the config file for this briefcase'
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/brief/cli/all.rb
CHANGED
|
@@ -57,13 +57,25 @@ command 'info' do |c|
|
|
|
57
57
|
c.syntax = 'brief info'
|
|
58
58
|
c.description = 'View info about the brief environment'
|
|
59
59
|
|
|
60
|
+
c.option '--print', 'Print output to the terminal'
|
|
61
|
+
|
|
60
62
|
c.action do |args, options|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
65
77
|
|
|
66
|
-
|
|
67
|
-
|
|
78
|
+
puts json
|
|
79
|
+
end
|
|
68
80
|
end
|
|
69
81
|
end
|
data/lib/brief/cli/render.rb
CHANGED
|
@@ -7,6 +7,8 @@ command 'render' do |c|
|
|
|
7
7
|
c.option '--app APP', String, 'Use the specified app to get our models etc'
|
|
8
8
|
c.option '--config PATH', String, 'Use the specified config file'
|
|
9
9
|
c.option '--include-raw', nil, 'Whether or not to include the raw content'
|
|
10
|
+
c.option '--type STRING', String, 'What type of document should this be?'
|
|
11
|
+
c.option '--all', 'Render all of the things'
|
|
10
12
|
|
|
11
13
|
c.action do |args, options|
|
|
12
14
|
options.default(root: Pathname(Brief.pwd))
|
|
@@ -22,10 +24,12 @@ command 'render' do |c|
|
|
|
22
24
|
|
|
23
25
|
index = 0
|
|
24
26
|
|
|
25
|
-
rendered = if
|
|
27
|
+
rendered = if options.all
|
|
26
28
|
briefcase.all_models.map do |model|
|
|
27
29
|
model.document.to_html(script: true, content: !!(options.include_raw), skip_preamble: (index += 1) > 1)
|
|
28
30
|
end
|
|
31
|
+
elsif args.empty? && stdin = STDIN.read
|
|
32
|
+
stdin
|
|
29
33
|
else
|
|
30
34
|
args.map do |a|
|
|
31
35
|
Dir[briefcase.root.join(a)].map do |f|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
command 'schema' do |c|
|
|
2
|
+
c.syntax = "brief schema"
|
|
3
|
+
c.description = "view information about the schema"
|
|
4
|
+
|
|
5
|
+
Brief.default_cli_options(c)
|
|
6
|
+
|
|
7
|
+
c.option '--output FILE', String, 'Output the contents to the specified file'
|
|
8
|
+
c.option '--all-models', 'Include all models, not just those that have documents'
|
|
9
|
+
c.option '--list-types', 'Only list the types'
|
|
10
|
+
|
|
11
|
+
Brief.cli_action(c) do |args, options|
|
|
12
|
+
schema_map = Brief.case.schema_map(options.all_models)
|
|
13
|
+
|
|
14
|
+
output = if args.empty?
|
|
15
|
+
schema_map.to_json
|
|
16
|
+
else
|
|
17
|
+
detail = schema_map.fetch(args.first.downcase, nil)
|
|
18
|
+
detail.to_json if detail
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if options.output
|
|
22
|
+
Pathname(options.output).open "w+" do |fh|
|
|
23
|
+
fh.write(output.chomp)
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
puts output
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/brief/repository.rb
CHANGED
|
@@ -114,6 +114,10 @@ module Brief
|
|
|
114
114
|
Dir[docs_path.join('**/*.md').to_s].map { |p| Pathname(p) }
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
def model_classes
|
|
118
|
+
all_models.compact.map(&:class).uniq
|
|
119
|
+
end
|
|
120
|
+
|
|
117
121
|
def all_models
|
|
118
122
|
@all_models ||= begin
|
|
119
123
|
list = documents.select(&:refresh!).map(&:to_model)
|
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.8.
|
|
4
|
+
version: 1.8.10
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jonathan Soeder
|
|
@@ -278,10 +278,12 @@ files:
|
|
|
278
278
|
- lib/brief/apps.rb
|
|
279
279
|
- lib/brief/briefcase.rb
|
|
280
280
|
- lib/brief/briefcase/initializer.rb
|
|
281
|
+
- lib/brief/cli/01_extensions.rb
|
|
281
282
|
- lib/brief/cli/all.rb
|
|
282
283
|
- lib/brief/cli/export.rb
|
|
283
284
|
- lib/brief/cli/parse.rb
|
|
284
285
|
- lib/brief/cli/render.rb
|
|
286
|
+
- lib/brief/cli/schema.rb
|
|
285
287
|
- lib/brief/cli/write.rb
|
|
286
288
|
- lib/brief/configuration.rb
|
|
287
289
|
- lib/brief/core_ext.rb
|