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
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
.activate_adapter(identifier) ⇒ Object
Adapters for Rails, Middleman, or Jekyll apps
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
|
.apps_path ⇒ Object
76
77
78
|
# File 'lib/brief.rb', line 76
def self.apps_path
lib_root.join("..","apps")
end
|
.case(fire = false) ⇒ Object
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
|
.case=(value) ⇒ Object
35
36
37
|
# File 'lib/brief.rb', line 35
def self.case=(value)
@briefcase = value
end
|
.cases ⇒ Object
31
32
33
|
# File 'lib/brief.rb', line 31
def self.cases
@cases ||= {}
end
|
.commands ⇒ Object
53
54
55
|
# File 'lib/brief.rb', line 53
def self.commands
@commands ||= {}
end
|
.configuration ⇒ Object
68
69
70
|
# File 'lib/brief.rb', line 68
def self.configuration
Brief::Configuration.instance
end
|
.create_command_dispatchers ⇒ Object
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/brief.rb', line 85
def self.create_command_dispatchers
Brief::Model.classes.each do |klass|
Array(klass.defined_actions).uniq.each do |action|
Brief::Util.create_method_dispatcher_command_for(action, klass)
end
end
end
|
.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
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
|
.environment_info ⇒ Object
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/brief.rb', line 57
def self.environment_info
{
VERSION: Brief::VERSION,
lib_root: Brief.lib_root.to_s,
apps: {
search_paths: Brief::Apps.search_paths.map(&:to_s),
available: Brief::Apps.available_apps
}
}
end
|
.home ⇒ Object
23
24
25
|
# File 'lib/brief.rb', line 23
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)
121
122
123
|
# File 'lib/brief.rb', line 121
def self.href_builder
@href_builder || ->(o){o}
end
|
.href_builder=(value) ⇒ Object
125
126
127
|
# File 'lib/brief.rb', line 125
def self.href_builder= value
@href_builder = value
end
|
.initialize_home! ⇒ Object
27
28
29
|
# File 'lib/brief.rb', line 27
def self.initialize_home!
FileUtils.mkdir_p(home)
end
|
.lib_root ⇒ Object
72
73
74
|
# File 'lib/brief.rb', line 72
def self.lib_root
Pathname(File.dirname(__FILE__))
end
|
.load_commands ⇒ Object
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
|
.load_modules_from(folder) ⇒ Object
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
|
.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
19
20
21
|
# File 'lib/brief.rb', line 19
def self.pwd
ENV.fetch('BRIEF_PWD') { Dir.pwd }
end
|
.views ⇒ Object
49
50
51
|
# File 'lib/brief.rb', line 49
def self.views
@views ||= {}
end
|