Module: Brief
- Defined in:
- lib/brief/document/structure.rb,
lib/brief.rb,
lib/brief/dsl.rb,
lib/brief/apps.rb,
lib/brief/data.rb,
lib/brief/model.rb,
lib/brief/version.rb,
lib/brief/document.rb,
lib/brief/briefcase.rb,
lib/brief/repository.rb,
lib/brief/configuration.rb,
lib/brief/server/socket.rb,
lib/brief/model/definition.rb,
lib/brief/model/persistence.rb,
lib/brief/document/rendering.rb,
lib/brief/document/attachments.rb,
lib/brief/document/transformer.rb,
lib/brief/document/front_matter.rb,
lib/brief/briefcase/documentation.rb,
lib/brief/document/content_extractor.rb,
lib/brief/cli/01_extensions.rb
Overview
The Document Transformer allows for special usage of markdown link and image embedding syntax. This lets us piggy back on these syntax and use them as include directives to embed other documents, or SVG diagrams.
Defined Under Namespace
Modules: Adapters, DSL, Data, DocumentMapper, Model, RemoteSyncing, Util
Classes: Apps, Briefcase, Configuration, Document, GenericReport, Repository, Server
Constant Summary
collapse
- VERSION =
'1.17.4'
Class Method Summary
collapse
Class Method Details
.activate_adapter(identifier) ⇒ Object
Adapters for Rails, Middleman, or Jekyll apps
111
112
113
114
115
116
|
# File 'lib/brief.rb', line 111
def self.activate_adapter(identifier)
require "brief/adapters/#{ identifier }"
(Brief::Adapters.const_get(identifier.camelize) rescue nil).tap do |adapter|
raise "Invalid adapter: #{ identifier }" unless adapter
end
end
|
.apps_path ⇒ Object
75
76
77
|
# File 'lib/brief.rb', line 75
def self.apps_path
lib_root.join("..","apps")
end
|
.case(fire = false) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/brief.rb', line 38
def self.case(fire=false)
if @briefcase.is_a?(Brief::Briefcase)
@briefcase
elsif fire && @briefcase.respond_to?(:call)
@briefcase = @briefcase.call()
else
@briefcase
end
end
|
.case=(value) ⇒ Object
34
35
36
|
# File 'lib/brief.rb', line 34
def self.case=(value)
@briefcase = value
end
|
.cases ⇒ Object
30
31
32
|
# File 'lib/brief.rb', line 30
def self.cases
@cases ||= {}
end
|
.commands ⇒ Object
52
53
54
|
# File 'lib/brief.rb', line 52
def self.commands
@commands ||= {}
end
|
.configuration ⇒ Object
67
68
69
|
# File 'lib/brief.rb', line 67
def self.configuration
Brief::Configuration.instance
end
|
.create_command_dispatchers ⇒ Object
.default_cli_options(c) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/brief/cli/01_extensions.rb', line 34
def self.default_cli_options(c)
c.option '--root DIRECTORY', String, 'The root for the briefcase'
c.option '--config FILE', String, 'Path to the config file for this briefcase'
c.option '--config-filename', String, 'The default filename for a briefcase config: brief.rb'
c.option '--output FILE', String, 'Save the output in the specified path'
c.option '--format FORMAT', String, 'How to format the CLI output: defaults to printed, accepts printed,json'
c.option '--prefix-output CONTENT', String, 'Prefix the generated output with the following content'
end
|
.default_model_class ⇒ Object
95
96
97
98
99
100
101
|
# File 'lib/brief.rb', line 95
def self.default_model_class
if defined?(Brief::DefaultModel)
Brief::DefaultModel
else
Brief.const_set(:DefaultModel, Class.new { include Brief::Model; def self.type_alias; "default"; end })
end
end
|
.environment_info ⇒ Object
.home ⇒ Object
22
23
24
|
# File 'lib/brief.rb', line 22
def self.home
Pathname(ENV['HOME']).join(".brief")
end
|
.href_builder ⇒ Object
This can be overridden so that you can generate uri values in the renderings that fit within the medium (e.g. website, electron app)
120
121
122
|
# File 'lib/brief.rb', line 120
def self.href_builder
@href_builder || ->(o){o}
end
|
.href_builder=(value) ⇒ Object
124
125
126
|
# File 'lib/brief.rb', line 124
def self.href_builder= value
@href_builder = value
end
|
.initialize_home! ⇒ Object
26
27
28
|
# File 'lib/brief.rb', line 26
def self.initialize_home!
FileUtils.mkdir_p(home)
end
|
.lib_root ⇒ Object
71
72
73
|
# File 'lib/brief.rb', line 71
def self.lib_root
Pathname(File.dirname(__FILE__))
end
|
.load_commands ⇒ Object
79
80
81
82
|
# File 'lib/brief.rb', line 79
def self.load_commands
Dir[lib_root.join('brief', 'cli', '**/*.rb')].each { |f| require(f) }
create_command_dispatchers
end
|
.load_modules_from(folder) ⇒ Object
103
104
105
106
107
108
|
# File 'lib/brief.rb', line 103
def self.load_modules_from(folder)
Dir[folder.join('**/*.rb')].each do |f|
require(f)
end
end
|
.pwd ⇒ Object
When packaging this up through the traveling ruby system Dir.pwd is not accurate because of the wrapper. We shim it by setting a special ENV variable in that file
18
19
20
|
# File 'lib/brief.rb', line 18
def self.pwd
ENV.fetch('BRIEF_PWD') { Dir.pwd }
end
|
.views ⇒ Object
48
49
50
|
# File 'lib/brief.rb', line 48
def self.views
@views ||= {}
end
|