hologram 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/README.md +169 -82
- data/{lib/hologram_markdown_renderer.rb → example_markdown_renderer.rb.example} +6 -2
- data/hologram.gemspec +3 -3
- data/lib/hologram.rb +11 -1
- data/lib/hologram/cli.rb +45 -0
- data/lib/hologram/doc_block_collection.rb +23 -20
- data/lib/hologram/doc_builder.rb +160 -155
- data/lib/hologram/doc_parser.rb +26 -25
- data/lib/hologram/document_block.rb +27 -5
- data/lib/hologram/errors.rb +12 -0
- data/lib/hologram/markdown_renderer.rb +49 -0
- data/lib/hologram/template_variables.rb +1 -1
- data/lib/hologram/utils.rb +16 -0
- data/lib/hologram/version.rb +1 -1
- data/lib/template/hologram_config.yml +2 -2
- data/spec/cli_spec.rb +37 -0
- data/spec/display_message_spec.rb +0 -17
- data/spec/doc_block_collection_spec.rb +4 -4
- data/spec/doc_builder_spec.rb +131 -48
- data/spec/doc_parser_spec.rb +64 -3
- data/spec/document_block_spec.rb +65 -4
- data/spec/fixtures/renderer/invalid_renderer.rb +2 -0
- data/spec/fixtures/renderer/valid_renderer.rb +2 -0
- data/spec/hologram_markdown_renderer_spec.rb +14 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/utils_spec.rb +52 -0
- metadata +36 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba28330eccb6f989b7d979e73c654ab2d70a34d7
|
4
|
+
data.tar.gz: d754bea437e55dee31fcb283f7957d85e1534b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdaf1aa34dd312b82c9fa26db208fc7106756096b30dc02b9050e0bb69ac2a7e5f68492faabe45466603da074e084f5374386db703ef8c73651b4b817167910a
|
7
|
+
data.tar.gz: 76d55b87389c39f9015d84ad0070b54d953cdcf1a5bda3faeb3ccd780846d155fd4ecc73d8dc3c35e27fa11ef9bae63a07bd1d8a8ee5191a3e95354b74589661
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,23 @@
|
|
1
|
-
# Hologram
|
1
|
+
# Hologram
|
2
|
+
[![Build Status](https://travis-ci.org/trulia/hologram.png)](https://travis-ci.org/trulia/hologram)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/trulia/hologram.png)](https://codeclimate.com/github/trulia/hologram)
|
2
4
|
|
3
|
-
Hologram is a Ruby gem that parses comments in your CSS and helps you
|
5
|
+
Hologram is a Ruby gem that parses comments in your CSS and helps you
|
6
|
+
turn them into a beautiful style guide.
|
4
7
|
|
5
8
|
There are two steps to building a great style guide:
|
6
9
|
|
7
|
-
1. Documenting your css and generating html examples.
|
10
|
+
1. Documenting your css and javascript, and generating html examples.
|
8
11
|
2. Styling the output of step 1.
|
9
12
|
|
10
|
-
The hologram gem itself is only concerned with step 1. This means you
|
13
|
+
The hologram gem itself is only concerned with step 1. This means you
|
14
|
+
are free to make your style guide look however you would like. If you
|
15
|
+
don't feel like going through this process yourself, you can take a look
|
16
|
+
at the
|
17
|
+
[templates](https://github.com/trulia/hologram-example/tree/master/templates)
|
18
|
+
in our [example repository](https://github.com/trulia/hologram-example),
|
19
|
+
and use the assets defined there instead.
|
20
|
+
|
11
21
|
|
12
22
|
## Installation
|
13
23
|
|
@@ -21,21 +31,29 @@ And then execute:
|
|
21
31
|
|
22
32
|
If you don't use bundler you can run `gem install hologram`.
|
23
33
|
|
24
|
-
##Quick Start
|
25
34
|
|
26
|
-
|
27
|
-
|
28
|
-
```
|
35
|
+
## Quick Start
|
36
|
+
|
37
|
+
``` hologram init ```
|
29
38
|
|
30
|
-
This will create a `hologram_config.yml` file (more on this below), and
|
31
|
-
`_header.html` and `_footer.html` file for you.
|
32
|
-
config values and start documenting your css.
|
39
|
+
This will create a `hologram_config.yml` file (more on this below), and
|
40
|
+
also create a starter `_header.html` and `_footer.html` file for you.
|
41
|
+
You can then tweak the config values and start documenting your css.
|
33
42
|
|
34
43
|
Building the documentation is simply:
|
35
44
|
|
36
|
-
```
|
37
|
-
|
38
|
-
|
45
|
+
``` hologram ```
|
46
|
+
|
47
|
+
|
48
|
+
###Command line flags
|
49
|
+
|
50
|
+
Hologram has a couple of command line flags:
|
51
|
+
|
52
|
+
* `-c` or `--config` - specify the config file, by default hologram
|
53
|
+
looks for `hologram_config.yml`
|
54
|
+
* `-r` or `--root` - specify the directory to use when processing files
|
55
|
+
(useful if you run hologram in a different directory than your assets.
|
56
|
+
Defaults to current working directory)
|
39
57
|
|
40
58
|
## Details
|
41
59
|
|
@@ -49,74 +67,90 @@ There are two things you need to do to start using hologram:
|
|
49
67
|
### Creating a YAML config file
|
50
68
|
|
51
69
|
Hologram needs a few configuration settings before it can begin to build
|
52
|
-
your documentation for you. Once this is set up you can execute hologram
|
53
|
-
simply running:
|
70
|
+
your documentation for you. Once this is set up, you can execute hologram
|
71
|
+
by simply running:
|
54
72
|
|
55
|
-
`hologram path/to/your/config.yml` or (using bundler) `bundle exec
|
73
|
+
`hologram path/to/your/config.yml` or (using bundler) `bundle exec
|
74
|
+
hologram path/to/your/config.yml`
|
56
75
|
|
57
76
|
Your config file needs to contain the following key/value pairs
|
58
77
|
|
59
78
|
* **source**: relative path to your source files
|
60
79
|
|
61
|
-
* **destination**: relative path
|
62
|
-
built
|
80
|
+
* **destination**: relative path where you want the documentation to be
|
81
|
+
built
|
63
82
|
|
64
83
|
* **documentation_assets**: The path that contains supporting assets for
|
65
|
-
the
|
66
|
-
(header/footer, etc),
|
84
|
+
the documentation page. This typically includes html fragments
|
85
|
+
(header/footer, etc), style guide specific CSS, javascript and any
|
67
86
|
images. Hologram specifically looks for two files: `_header.html` and
|
68
|
-
`_footer.html
|
87
|
+
`_footer.html`. These are used to start and end every html page
|
69
88
|
hologram generates.
|
70
89
|
|
71
|
-
Hologram treats `_header.html` and `_footer.html`
|
72
|
-
|
73
|
-
`
|
74
|
-
|
75
|
-
`blocks` is a list of each documenation block on the page. Each item in the list has a `title`,
|
76
|
-
`name`, `category`, and optionally a `parent`. This is useful for,
|
77
|
-
say, building a menu that lists each component.
|
90
|
+
Hologram treats `_header.html` and `_footer.html` as ERB files for
|
91
|
+
each page that is generated. You can access the `title`, `file_name`,
|
92
|
+
`blocks`, and `categories`.
|
78
93
|
|
79
|
-
`
|
94
|
+
`blocks` is a list of each documentation block on the page. Each item
|
95
|
+
in the list has a `title`, `name`, `category`, and optionally a
|
96
|
+
`parent`. This is useful for, say, building a menu that lists each
|
97
|
+
component.
|
80
98
|
|
81
|
-
|
99
|
+
`categories` is a list of all the categories found in the
|
100
|
+
documentation
|
82
101
|
|
102
|
+
**Nota Bene:** Filenames that begin with underscores will not be
|
103
|
+
copied into the destination folder.
|
83
104
|
|
84
105
|
* **custom_markdown**: (optional) this is the filename of a class that
|
85
106
|
extends RedCarpet::Render::HTML class. Use this for when you need
|
86
|
-
additional classes or html tags for different parts of the page.
|
107
|
+
additional classes or html tags for different parts of the page. See
|
108
|
+
`example_markdown_renderer.rb.example` for an example of what your
|
109
|
+
class can look like.
|
87
110
|
|
88
|
-
* **index**: (optional) this is a category (see **Documenting your
|
89
|
-
index.html.
|
111
|
+
* **index**: (optional) this is a category (see **Documenting your
|
112
|
+
styles** section below) that will be used as the index.html.
|
90
113
|
|
91
114
|
* **dependencies**: a **list** of relative paths to folders containing
|
92
115
|
any dependencies your style guide has. These folders will be copied
|
93
|
-
over into the documentation output directory.
|
94
|
-
ACTUALLY BEING DOCUMENTED HERE
|
116
|
+
over into the documentation output directory. ENSURE THE CSS/JS THAT IS
|
117
|
+
ACTUALLY BEING DOCUMENTED IS LISTED HERE. You will also need to ensure
|
118
|
+
that they are included on your pages. A simple way to do this is to add
|
119
|
+
`<link>` and `<script src=>` tags to the `_header.html` file.
|
120
|
+
|
95
121
|
|
96
122
|
##### Example config file
|
97
123
|
|
98
|
-
#
|
99
|
-
|
124
|
+
# Hologram will run from same directory where this config file resides
|
125
|
+
# All paths should be relative to there
|
100
126
|
|
101
|
-
# The directory
|
102
|
-
|
127
|
+
# The directory containing the source files to parse recursively
|
128
|
+
source: ./sass
|
103
129
|
|
104
|
-
# The
|
105
|
-
|
130
|
+
# The directory that hologram will build to
|
131
|
+
destination: ./docs
|
106
132
|
|
107
|
-
#
|
108
|
-
|
133
|
+
# The assets needed to build the docs (includes header.html,
|
134
|
+
# footer.html, etc)
|
135
|
+
# You may put doc related assets here too: images, css, etc.
|
136
|
+
documentation_assets: ./doc_assets
|
109
137
|
|
110
|
-
# Any other asset folders that need to be copied to the destination
|
111
|
-
#
|
138
|
+
# Any other asset folders that need to be copied to the destination
|
139
|
+
# folder. Typically this will include the css that you are trying to
|
140
|
+
# document. May also include additional folders as needed.
|
112
141
|
dependencies:
|
113
|
-
|
142
|
+
- ./build
|
114
143
|
|
144
|
+
# Mark which category should be the index page
|
145
|
+
# Alternatively, you may have an index.md in the documentation assets
|
146
|
+
# folder instead of specifying this config.
|
147
|
+
index: basics
|
115
148
|
|
116
|
-
###Documenting your styles
|
149
|
+
### Documenting your styles and components
|
117
150
|
|
118
|
-
Hologram will scan for stylesheets (.css, .scss, .sass, .less, or .styl)
|
119
|
-
|
151
|
+
Hologram will scan for stylesheets (.css, .scss, .sass, .less, or .styl)
|
152
|
+
and javascript source files (.js) within the **source** directory defined
|
153
|
+
in your configuration. It will look for comments that match the following:
|
120
154
|
|
121
155
|
/*doc
|
122
156
|
---
|
@@ -128,10 +162,8 @@ It will look for comments that match the following:
|
|
128
162
|
Button styles can be applied to any element. Typically you'll want
|
129
163
|
to use either a `<button>` or an `<a>` element:
|
130
164
|
|
131
|
-
```html_example
|
132
|
-
|
133
|
-
<a class="btn btnDefault" href="trulia.com">Trulia!</a>
|
134
|
-
```
|
165
|
+
```html_example <button class="btn btnDefault">Click</button> <a
|
166
|
+
class="btn btnDefault" href="trulia.com">Trulia!</a> ```
|
135
167
|
|
136
168
|
If your button is actually a link to another page, please use the
|
137
169
|
`<a>` element, while if your button performs an action, such as
|
@@ -140,43 +172,73 @@ It will look for comments that match the following:
|
|
140
172
|
|
141
173
|
*/
|
142
174
|
|
143
|
-
The first section of the comment is a
|
144
|
-
aspects of
|
145
|
-
markdown as defined by Redcarpet.
|
175
|
+
The first section of the comment is a YAML block that defines certain
|
176
|
+
aspects of this documentation block (more on that in the next
|
177
|
+
section). The second part is simply markdown as defined by Redcarpet.
|
146
178
|
|
147
|
-
Notice the use of `html_example`. This tells the markdown renderer that
|
179
|
+
Notice the use of `html_example`. This tells the markdown renderer that
|
180
|
+
it should treat the example as...well...html. If your project uses
|
181
|
+
[haml](http://haml.info/) you can also use `haml_example`. In that case
|
182
|
+
the output will be html for the example and the code block will show the
|
183
|
+
haml used to generate the html.
|
148
184
|
|
149
|
-
|
150
|
-
|
151
|
-
|
185
|
+
For components that require [javascript](https://www.destroyallsoftware.com/talks/wat)
|
186
|
+
you can use `js_example`. In addition to outputting the javascript in a
|
187
|
+
`<code>` block it will also wrap it in a `<script>` tag for execution.
|
152
188
|
|
153
|
-
* **title**: The title to display in the documents
|
154
|
-
* **category**: This is the broad category for the component, all
|
155
|
-
components in the same category will be written to the same page.
|
156
|
-
* **name**: This is used for grouping components, by assigning
|
157
|
-
a name a component can be referenced in another component as a parent.
|
158
|
-
* **parent**: (Optional.) This should be the **name** of another components. If this is set the current component will be displayed as a section within the **parent**'s documentation.
|
159
189
|
|
160
|
-
|
190
|
+
#### Document YAML section
|
161
191
|
|
162
|
-
|
192
|
+
The YAML in the documentation block can have any
|
193
|
+
key/value pairs you deem important, but it specifically looks for the
|
194
|
+
following keys:
|
163
195
|
|
164
|
-
|
165
|
-
|
196
|
+
* **title**: The title to display in the documents
|
197
|
+
* **category/categories**: This is the broad categories for the component, all
|
198
|
+
components in the same category will be written to the same page. It can be set to either a string or a YAML array. If you use an array, the component will be written to both pages.
|
199
|
+
Note: There is no need to set a category if this component has a **parent**.
|
200
|
+
* **name**: This is used for grouping components, by assigning a name, a
|
201
|
+
component can be referenced in another component as a parent. Note that items in
|
202
|
+
the same category are sorted alphabetically by name.
|
203
|
+
* **parent**: (Optional.) This should be the **name** of another
|
204
|
+
component. If this is set, the current component will be displayed as
|
205
|
+
a section within the **parent**'s documentation, but only if it specifies
|
206
|
+
the same **category**, or allows the **category** to be inherited from its **parent**.
|
207
|
+
|
208
|
+
For example, you might have a component with the **name** *buttons* and
|
209
|
+
another component named *buttonSkins*. You could set the **parent** for
|
210
|
+
the *buttonSkins* component to be *buttons*. It would then nest the
|
211
|
+
*buttonSkins* documentation inside the *buttons* documentation.
|
212
|
+
|
213
|
+
Each level of nesting (components are infinitely nestable) will have a
|
214
|
+
heading tag that represents its depth. In the above example *buttons*
|
215
|
+
would have an `<h1>` and *buttonSkins* would have an `<h2>`.
|
216
|
+
|
217
|
+
You can see [this exact example in our demo
|
218
|
+
repo](https://github.com/trulia/hologram-example/tree/master/components/button),
|
219
|
+
and the output of this nesting [in our demo
|
220
|
+
style guide](http://trulia.github.io/hologram-example/base_css.html#Buttons).
|
221
|
+
|
222
|
+
|
223
|
+
### Documentation Assets
|
166
224
|
|
167
225
|
The documentation assets folder contains the html, css, js and images
|
168
226
|
you'll need for making your style guide look beautiful.
|
169
227
|
|
170
|
-
Hologram doesn't care too much about
|
171
|
-
to be custom for your style guide.
|
228
|
+
Hologram doesn't care too much about what is in here as it is
|
229
|
+
intended to be custom for your style guide.
|
230
|
+
|
172
231
|
|
173
|
-
#####Styling Your Code Examples
|
232
|
+
##### Styling Your Code Examples
|
233
|
+
|
234
|
+
Hologram uses [pygments.rb](https://github.com/tmm1/pygments.rb) gem to
|
235
|
+
provide syntax highlighting for code examples. One of the assets that
|
236
|
+
you probably want to include in your documentation assets folder is a
|
237
|
+
css file that styles the "pygmentized" code examples. We use
|
238
|
+
`github.css` which can be found along with the css we use to style code
|
239
|
+
blocks
|
240
|
+
[here](https://github.com/trulia/hologram-example/tree/gh-pages/hologram_assets/doc_assets/css).
|
174
241
|
|
175
|
-
Hologram uses [pygments.rb](https://github.com/tmm1/pygments.rb) gem to provide
|
176
|
-
syntax highlighting for code examples. One of the assets that you probably want
|
177
|
-
to include in your documentation assets folder is a css file that styles the
|
178
|
-
"pygmentized" code examples. We use `github.css` which can be found along with the
|
179
|
-
css we use to style code blocks [here](https://github.com/trulia/hologram-example/tree/gh-pages/hologram_assets/doc_assets/css).
|
180
242
|
|
181
243
|
## Supported Preprocessors/File Types
|
182
244
|
|
@@ -188,8 +250,13 @@ The following preprocessors/file types are supported by Hologram:
|
|
188
250
|
- Javascript (.js)
|
189
251
|
- Markdown (.md, .markdown)
|
190
252
|
|
253
|
+
|
191
254
|
## Extensions and Plugins
|
192
|
-
|
255
|
+
|
256
|
+
- [Guard Hologram](https://github.com/kmayer/guard-hologram) is a sweet
|
257
|
+
little gem that uses guard to monitor changes to your hologram project
|
258
|
+
and rebuilds your style guide on the fly as you make changes.
|
259
|
+
|
193
260
|
|
194
261
|
## Contributing
|
195
262
|
|
@@ -200,7 +267,27 @@ The following preprocessors/file types are supported by Hologram:
|
|
200
267
|
5. Create new Pull Request
|
201
268
|
|
202
269
|
|
203
|
-
##
|
204
|
-
|
270
|
+
## Authors
|
271
|
+
|
272
|
+
Hologram is written and maintained by [August
|
273
|
+
Flanagan](http://github.com/aflanagan) and [JD
|
274
|
+
Cantrell](http://github.com/jdcantrell).
|
205
275
|
|
206
276
|
|
277
|
+
## Contributors
|
278
|
+
|
279
|
+
These fine people have also contributed to making hologram a better gem:
|
280
|
+
|
281
|
+
* [Rajan Agaskar](https://github.com/ragaskar)
|
282
|
+
* Louis Bennett
|
283
|
+
* [jho406](https://github.com/jho406)
|
284
|
+
* johny (wrote our initial tests!)
|
285
|
+
* [Elana Koren](https://github.com/elanakoren)
|
286
|
+
* [Ken Mayer](https://github.com/kmayer)
|
287
|
+
* [Roberto Ostinelli](https://github.com/ostinelli)
|
288
|
+
* [Nicole Sullivan](https://github.com/stubbornella)
|
289
|
+
|
290
|
+
|
291
|
+
## License
|
292
|
+
|
293
|
+
[Hologram is licensed under the MIT License](https://github.com/trulia/hologram/blob/master/LICENSE.txt)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class ExampleMarkdownRenderer < Redcarpet::Render::HTML
|
2
2
|
def block_code(code, language)
|
3
3
|
if language and language.include?('example')
|
4
4
|
if language.include?('js')
|
@@ -18,12 +18,16 @@ class HologramMarkdownRenderer < Redcarpet::Render::HTML
|
|
18
18
|
case language
|
19
19
|
when 'haml_example'
|
20
20
|
safe_require('haml', language)
|
21
|
-
return Haml::Engine.new(code.strip).render(
|
21
|
+
return Haml::Engine.new(code.strip).render(template_rendering_scope, {})
|
22
22
|
else
|
23
23
|
code
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def template_rendering_scope
|
28
|
+
Object.new
|
29
|
+
end
|
30
|
+
|
27
31
|
def get_lexer(language)
|
28
32
|
case language
|
29
33
|
when 'haml_example'
|
data/hologram.gemspec
CHANGED
@@ -13,9 +13,8 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "http://trulia.github.io/hologram"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.add_dependency "redcarpet", "~> 2.2
|
17
|
-
spec.add_dependency "pygments.rb", "~> 0.4
|
18
|
-
spec.add_dependency "rspec", "~> 2.14.1"
|
16
|
+
spec.add_dependency "redcarpet", "~> 2.2"
|
17
|
+
spec.add_dependency "pygments.rb", "~> 0.4"
|
19
18
|
|
20
19
|
spec.files = `git ls-files`.split($/)
|
21
20
|
spec.executables = ['hologram']
|
@@ -24,4 +23,5 @@ Gem::Specification.new do |spec|
|
|
24
23
|
|
25
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
26
25
|
spec.add_development_dependency "rake"
|
26
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
27
27
|
end
|
data/lib/hologram.rb
CHANGED
@@ -12,8 +12,12 @@ require 'hologram/doc_parser'
|
|
12
12
|
require 'hologram/doc_builder'
|
13
13
|
require 'hologram/template_variables'
|
14
14
|
require 'hologram/display_message'
|
15
|
+
require 'hologram/errors'
|
16
|
+
require 'hologram/utils'
|
17
|
+
require 'hologram/markdown_renderer'
|
15
18
|
|
16
|
-
|
19
|
+
Encoding.default_internal = Encoding::UTF_8
|
20
|
+
Encoding.default_external = Encoding::UTF_8
|
17
21
|
|
18
22
|
module Hologram
|
19
23
|
INIT_TEMPLATE_PATH = File.expand_path('./template/', File.dirname(__FILE__)) + '/'
|
@@ -22,3 +26,9 @@ module Hologram
|
|
22
26
|
INIT_TEMPLATE_PATH + '/doc_assets',
|
23
27
|
]
|
24
28
|
end
|
29
|
+
|
30
|
+
class HologramMarkdownRenderer < Hologram::MarkdownRenderer
|
31
|
+
def self.inherited(subclass)
|
32
|
+
puts "HologramMarkdownRenderer is deprecated, please inherit from Hologram::MarkdownRenderer"
|
33
|
+
end
|
34
|
+
end
|
data/lib/hologram/cli.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Hologram
|
4
|
+
class CLI
|
5
|
+
attr_reader :args
|
6
|
+
|
7
|
+
def initialize(args)
|
8
|
+
@args = args
|
9
|
+
end
|
10
|
+
|
11
|
+
def run
|
12
|
+
return setup if args[0] == 'init'
|
13
|
+
|
14
|
+
#support passing the config file with no command line flag
|
15
|
+
config = args[0].nil? ? 'hologram_config.yml' : args[0]
|
16
|
+
|
17
|
+
OptionParser.new do |opt|
|
18
|
+
opt.on_tail('-h', '--help', 'Show this message.') { puts opt; exit }
|
19
|
+
opt.on_tail('-v', '--version', 'Show version.') { puts "hologram #{Hologram::VERSION}"; exit }
|
20
|
+
opt.on('-c', '--config FILE', 'Path to config file. Default: hologram_config.yml') { |config_file| config = config_file }
|
21
|
+
opt.parse!(args)
|
22
|
+
end
|
23
|
+
|
24
|
+
config.nil? ? build : build(config)
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
def build(config = 'hologram_config.yml')
|
30
|
+
builder = DocBuilder.from_yaml(config)
|
31
|
+
DisplayMessage.error(builder.errors.first) if !builder.is_valid?
|
32
|
+
builder.build
|
33
|
+
rescue CommentLoadError, NoCategoryError => e
|
34
|
+
DisplayMessage.error(e.message)
|
35
|
+
rescue Errno::ENOENT
|
36
|
+
DisplayMessage.error("Could not load config file, try 'hologram init' to get started")
|
37
|
+
end
|
38
|
+
|
39
|
+
def setup
|
40
|
+
DocBuilder.setup_dir
|
41
|
+
rescue => e
|
42
|
+
DisplayMessage.error("#{e}")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|