Module: Brief
- Defined in:
- lib/brief/briefcase.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/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/structure.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 more...
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
Class Method Summary
collapse
Class Method Details
permalink
.activate_adapter(identifier) ⇒ Object
Adapters for Rails, Middleman, or Jekyll apps
[View source]
112
113
114
115
116
117
|
# File 'lib/brief.rb', line 112
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
|
permalink
.apps_path ⇒ Object
[View source]
76
77
78
|
# File 'lib/brief.rb', line 76
def self.apps_path
lib_root.join("..","apps")
end
|
permalink
.case(fire = false) ⇒ Object
[View source]
39
40
41
42
43
44
45
46
47
|
# File 'lib/brief.rb', line 39
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
|
permalink
.case=(value) ⇒ Object
[View source]
35
36
37
|
# File 'lib/brief.rb', line 35
def self.case=(value)
@briefcase = value
end
|
[View source]
31
32
33
|
# File 'lib/brief.rb', line 31
def self.cases
@cases ||= {}
end
|
permalink
.commands ⇒ Object
[View source]
53
54
55
|
# File 'lib/brief.rb', line 53
def self.commands
@commands ||= {}
end
|
permalink
.default_cli_options(c) ⇒ Object
[View source]
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
|
permalink
.default_model_class ⇒ Object
[View source]
96
97
98
99
100
101
102
|
# File 'lib/brief.rb', line 96
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
|
[View source]
23
24
25
|
# File 'lib/brief.rb', line 23
def self.home
Pathname(ENV['HOME']).join(".brief")
end
|
permalink
.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)
[View source]
121
122
123
|
# File 'lib/brief.rb', line 121
def self.href_builder
@href_builder || ->(o){o}
end
|
permalink
.href_builder=(value) ⇒ Object
[View source]
125
126
127
|
# File 'lib/brief.rb', line 125
def self.href_builder= value
@href_builder = value
end
|
permalink
.initialize_home! ⇒ Object
[View source]
27
28
29
|
# File 'lib/brief.rb', line 27
def self.initialize_home!
FileUtils.mkdir_p(home)
end
|
permalink
.load_commands ⇒ Object
[View source]
80
81
82
83
|
# File 'lib/brief.rb', line 80
def self.load_commands
Dir[lib_root.join('brief', 'cli', '**/*.rb')].each { |f| require(f) }
create_command_dispatchers
end
|
permalink
.load_modules_from(folder) ⇒ Object
[View source]
104
105
106
107
108
109
|
# File 'lib/brief.rb', line 104
def self.load_modules_from(folder)
Dir[folder.join('**/*.rb')].each do |f|
require(f)
end
end
|
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
[View source]
19
20
21
|
# File 'lib/brief.rb', line 19
def self.pwd
ENV.fetch('BRIEF_PWD') { Dir.pwd }
end
|
[View source]
49
50
51
|
# File 'lib/brief.rb', line 49
def self.views
@views ||= {}
end
|