hologram 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -1
- data/lib/hologram.rb +32 -10
- data/lib/hologram/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44fd37424aab536da5370b6abfbc8c5a68822f13
|
4
|
+
data.tar.gz: 04896bbf8a01403e51749ba13b2f090fb2472c10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a356a2e50be8c1e95c3912482d29cfb400a6bff706343fd69a1791d37cab3f4224d1084094634303b714a11967b1c60d07a9946bc45928149104c392acb9ccc
|
7
|
+
data.tar.gz: c6a79b44f60c67445b05f084c4d6efe62a7442f136c2596e9c9db571f536fb95b615b99bc3db528bd695b9516b64e481bc0e4542232fefedf6dba49a43d805e8
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Hologram is a Ruby gem that parses comments in your CSS and helps you turns them
|
|
4
4
|
|
5
5
|
There are two steps to building a great style guide: 1.) documenting your css and generating html examples, and 2.) actually styling the output of step 1.
|
6
6
|
|
7
|
-
The hologram gem itself is only concerned with step 1. This means you are free to make your style guide look however you would like. If you don't feel like going through this process yourself you can take a look at the templates in our [example repository](https://github.com/trulia/hologram-example
|
7
|
+
The hologram gem itself is only concerned with step 1. This means you are free to make your style guide look however you would like. If you don't feel like going through this process yourself you can take a look at the [templates](https://github.com/trulia/hologram-example/tree/master/templates) in our [example repository](https://github.com/trulia/hologram-example) and use the assets defined there instead.
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
@@ -143,6 +143,16 @@ to include in your documentation assets folder is a css file that styles the
|
|
143
143
|
"pygmentized" code examples. We use `github.css` which can be found along with the
|
144
144
|
css we use to style code blocks [here](https://github.com/trulia/hologram-example/tree/gh-pages/hologram_assets/doc_assets/css).
|
145
145
|
|
146
|
+
## Supported Preprocessors/File Types
|
147
|
+
|
148
|
+
The following preprocessors/file types are supported by Hologram:
|
149
|
+
- Sass (.scss, .sass)
|
150
|
+
- Less (.less)
|
151
|
+
- Stylus (.styl)
|
152
|
+
- Vanilla CSS (.css)
|
153
|
+
- Javascript (.js)
|
154
|
+
- Markdown (.md, .markdown)
|
155
|
+
|
146
156
|
## Contributing
|
147
157
|
|
148
158
|
1. Fork it
|
data/lib/hologram.rb
CHANGED
@@ -64,6 +64,8 @@ module Hologram
|
|
64
64
|
|
65
65
|
def init(args)
|
66
66
|
@doc_blocks, @pages = {}, {}
|
67
|
+
@supported_extensions = ['.css', '.scss', '.less', '.sass', '.styl', '.js', '.md', '.markdown' ]
|
68
|
+
|
67
69
|
begin
|
68
70
|
@config = args ? YAML::load_file(args[0]) : YAML::load_file('hologram_config.yml')
|
69
71
|
validate_config
|
@@ -92,7 +94,12 @@ module Hologram
|
|
92
94
|
|
93
95
|
input_directory = Pathname.new(config['source']).realpath
|
94
96
|
output_directory = Pathname.new(config['destination']).realpath
|
95
|
-
|
97
|
+
|
98
|
+
doc_assets = Pathname.new(config['documentation_assets']).realpath unless !File.directory?(config['documentation_assets'])
|
99
|
+
|
100
|
+
if doc_assets.nil?
|
101
|
+
display_warning "Could not find documentation assets at #{config['documentation_assets']}"
|
102
|
+
end
|
96
103
|
|
97
104
|
process_dir(input_directory)
|
98
105
|
|
@@ -110,11 +117,13 @@ module Hologram
|
|
110
117
|
end
|
111
118
|
end
|
112
119
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
120
|
+
if !doc_assets.nil?
|
121
|
+
Dir.foreach(doc_assets) do |item|
|
122
|
+
# ignore . and .. directories
|
123
|
+
next if item == '.' or item == '..'
|
124
|
+
`rm -rf #{output_directory}/#{item}`
|
125
|
+
`cp -R #{doc_assets}/#{item} #{output_directory}/#{item}`
|
126
|
+
end
|
118
127
|
end
|
119
128
|
end
|
120
129
|
|
@@ -149,8 +158,14 @@ module Hologram
|
|
149
158
|
|
150
159
|
def process_file(file)
|
151
160
|
file_str = File.read(file)
|
152
|
-
# get any comment blocks that match the
|
153
|
-
|
161
|
+
# get any comment blocks that match the patterns:
|
162
|
+
# .sass: //doc (follow by other lines proceeded by a space)
|
163
|
+
# other types: /*doc ... */
|
164
|
+
if file.end_with?('.sass')
|
165
|
+
hologram_comments = file_str.scan(/\s*\/\/doc\s*((( [^\n]*\n)|\n)+)/)
|
166
|
+
else
|
167
|
+
hologram_comments = file_str.scan(/^\s*\/\*doc(.*?)\*\//m)
|
168
|
+
end
|
154
169
|
return unless hologram_comments
|
155
170
|
|
156
171
|
hologram_comments.each do |comment_block|
|
@@ -228,6 +243,8 @@ module Hologram
|
|
228
243
|
# generate doc nav html
|
229
244
|
if File.exists?("#{doc_assets}/header.html")
|
230
245
|
fh.write(File.read("#{doc_assets}/header.html"))
|
246
|
+
else
|
247
|
+
display_warning "No header.html found in documentation assets. Without this your css/header will not be included on the generated pages."
|
231
248
|
end
|
232
249
|
|
233
250
|
# write the docs
|
@@ -236,6 +253,8 @@ module Hologram
|
|
236
253
|
# write the footer
|
237
254
|
if File.exists?("#{doc_assets}/footer.html")
|
238
255
|
fh.write(File.read("#{doc_assets}/footer.html"))
|
256
|
+
else
|
257
|
+
display_warning "No footer.html found in documentation assets. This might be okay to ignore..."
|
239
258
|
end
|
240
259
|
fh.close()
|
241
260
|
end
|
@@ -277,8 +296,7 @@ module Hologram
|
|
277
296
|
|
278
297
|
|
279
298
|
def is_supported_file_type?(file)
|
280
|
-
supported_extensions
|
281
|
-
supported_extensions.include?(File.extname(file))
|
299
|
+
@supported_extensions.include?(File.extname(file))
|
282
300
|
end
|
283
301
|
|
284
302
|
def display_error(message)
|
@@ -291,6 +309,10 @@ module Hologram
|
|
291
309
|
exit 1
|
292
310
|
end
|
293
311
|
|
312
|
+
def display_warning(message)
|
313
|
+
puts "Warning: ".yellow + message
|
314
|
+
end
|
315
|
+
|
294
316
|
|
295
317
|
def get_file_name(str)
|
296
318
|
str = str.gsub(' ', '_').downcase + '.html'
|
data/lib/hologram/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hologram
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JD Cantrell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06
|
12
|
+
date: 2013-11-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redcarpet
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.0.
|
122
|
+
rubygems_version: 2.0.3
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: Build document type things.
|