hologram 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 76d2ba97aebf57d28a1af14bb938face091b9f7a
4
- data.tar.gz: 4c257fc06a73984a890d15d11e42f46ae5150203
3
+ metadata.gz: df438fa1f7fdc30768d2cb9981932488d74ca9ae
4
+ data.tar.gz: cd01a07f936c9750d9a13146684bc9740a0723fc
5
5
  SHA512:
6
- metadata.gz: 21c7f40342561dd6ea32edaf1e76390f08d0b7dfbb2c64fce8e60596227e2a562e90cde16478e052930a4205dbcae738385943da5eec8eeb23bdf06209f7a323
7
- data.tar.gz: 56dc6706a6ff01a7bcbfbe874f27d6c5bd5723cd809c9fe976be6027b0f92a1fff4610f20f34280ffaf13f1c7fe001cafa3a725a0ce6fdcb9613ed6c61f8808f
6
+ metadata.gz: 57a3a103b3f2af2580d0228c39f1ac74cf82d54e55e8cf6fc7b35b6a185c7d156e14809bdb0cc7111d409322e2179606fd3f0c95ab025d86139412ba5eac844d
7
+ data.tar.gz: 9dc0380bfce972458b69743ba4002ce376de9c1a335c8c65979203f9714bd93d4505e8b5b6ee635868c490b16a3154df19fbc2c40a3ab40ed42e3a8ddb6734a6
@@ -0,0 +1,10 @@
1
+ script: "bundle exec rake spec"
2
+
3
+ rvm:
4
+ - 1.9.3
5
+ - 2.0.0
6
+ - 2.1.0
7
+ - rbx
8
+
9
+ notifications:
10
+ email: false
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Hologram
1
+ # Hologram [![Build Status](https://travis-ci.org/trulia/hologram.png)](https://travis-ci.org/trulia/hologram)
2
2
 
3
3
  Hologram is a Ruby gem that parses comments in your CSS and helps you turn them into a beautiful style guide.
4
4
 
@@ -69,10 +69,15 @@ Your config file needs to contain the following key/value pairs
69
69
  hologram generates.
70
70
 
71
71
  Hologram treats `_header.html` and `_footer.html`
72
- as ERB files for each page that is generated you can access the
73
- `title`, `file_name`, and `blocks`. `blocks` is a list of each
74
- documenation block on the page. Each item in the list has a `title`,
75
- `name`, `category`, and optionally a `parent`. This is useful for, say, building a menu that lists each component.
72
+ as ERB files for each page that is generated. You can access the
73
+ `title`, `file_name`, `blocks`, and `categories`.
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.
78
+
79
+ `categories` is a list of all the categories found in the documentation
80
+
76
81
  **Nota Bene:** Filenames that begin with underscores will not be copied into the destination folder.
77
82
 
78
83
 
@@ -110,7 +115,7 @@ Your config file needs to contain the following key/value pairs
110
115
 
111
116
  ###Documenting your styles
112
117
 
113
- Hologram will scan your .css|.scss|.sass|.less|.styl files within your **source** directory.
118
+ Hologram will scan for stylesheets (.css, .scss, .sass, .less, or .styl) within the **source** directory defined in you configuraiton.
114
119
  It will look for comments that match the following:
115
120
 
116
121
  /*doc
@@ -139,10 +144,10 @@ The first section of the comment is a yaml block that defines certain
139
144
  aspects of the this documentation block (more on that in the next section). The second part is simply
140
145
  markdown as defined by Redcarpet.
141
146
 
142
- Notice the use of `html_example`. This tells the markdown renderer that it should treat the example as...well...html. If your project uses [haml](http://haml.info/) you can also use `haml_example`. In that case the output will be html for the example and the code block will show the haml used to generate the html. For components that require [javascript](https://www.destroyallsoftware.com/talks/wat) you can use `js_example` for your js. In addtion to outputing the js in a `<code>` block it will also wrap it in a `<script>` tag for execution.
147
+ Notice the use of `html_example`. This tells the markdown renderer that it should treat the example as...well...html. If your project uses [haml](http://haml.info/) you can also use `haml_example`. In that case the output will be html for the example and the code block will show the haml used to generate the html. For components that require [javascript](https://www.destroyallsoftware.com/talks/wat) you can use `js_example` for your javascript. In addition to outputing the javascript in a `<code>` block it will also wrap it in a `<script>` tag for execution.
143
148
 
144
149
  ####Document YAML section
145
- The yaml in the doc block can have any key value pair you deem important
150
+ The yaml in the documention block can have any key value pair you deem important
146
151
  but it specifically looks for the following keys:
147
152
 
148
153
  * **title**: The title to display in the documents
@@ -20,21 +20,28 @@ module Hologram
20
20
 
21
21
  begin
22
22
  @config = YAML::load_file(config_file)
23
+ rescue SyntaxError => e
24
+ DisplayMessage.error("Could not load config file, check the syntax or try 'hologram init' to get started")
23
25
  rescue
24
26
  DisplayMessage.error("Could not load config file, try 'hologram init' to get started")
25
27
  end
26
28
 
27
- validate_config
29
+ if @config.is_a? Hash
28
30
 
29
- current_path = Dir.pwd
30
- base_path = Pathname.new(config_file)
31
- Dir.chdir(base_path.dirname)
31
+ validate_config
32
32
 
33
- # the real work happens here.
34
- build_docs
33
+ current_path = Dir.pwd
34
+ base_path = Pathname.new(config_file)
35
+ Dir.chdir(base_path.dirname)
35
36
 
36
- Dir.chdir(current_path)
37
- DisplayMessage.success("Build completed. (-: ")
37
+ # the real work happens here.
38
+ build_docs
39
+
40
+ Dir.chdir(current_path)
41
+ DisplayMessage.success("Build completed. (-: ")
42
+ else
43
+ DisplayMessage.error("Could not read config file, check the syntax or try 'hologram init' to get started")
44
+ end
38
45
  rescue RuntimeError => e
39
46
  DisplayMessage.error("#{e}")
40
47
  end
@@ -25,5 +25,5 @@
25
25
  # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
26
 
27
27
  module Hologram
28
- VERSION = "1.0.0"
28
+ VERSION = "1.0.1"
29
29
  end
@@ -62,7 +62,7 @@ describe Hologram::DisplayMessage do
62
62
  end
63
63
 
64
64
  it 'displays an error in red' do
65
- expect(display).to receive(:puts).with("\e[32m(╯°□°)╯\e[0m\e[31m ┻━┻ \e[0m\e[31m Build not complete.\e[0m")
65
+ expect(display).to receive(:puts).with("\e[32m(\u{256F}\u{00B0}\u{25A1}\u{00B0}\u{FF09}\u{256F}\e[0m\e[31m\u{FE35} \u{253B}\u{2501}\u{253B} \e[0m\e[31m Build not complete.\e[0m")
66
66
  expect(display).to receive(:puts).with(" foo")
67
67
 
68
68
  begin
@@ -35,11 +35,15 @@ eos
35
35
 
36
36
  context '#parse' do
37
37
  let(:result) { parser.parse }
38
+ let(:pages) { result[0] }
39
+ let(:categories) { result[1] }
38
40
 
39
- it 'builds and returns a hash of pages' do
40
- expect(result).to be_a Hash
41
+ it 'builds and returns a hash of pages and a hash of categories' do
42
+ expect(pages).to be_a Hash
43
+ expect(categories).to be_a Hash
41
44
  end
42
45
 
46
+
43
47
  context 'when an index page is specified' do
44
48
  subject(:parser) { Hologram::DocParser.new('spec/fixtures/source', 'foo') }
45
49
 
@@ -50,7 +54,7 @@ eos
50
54
  end
51
55
 
52
56
  it 'uses that page as the index' do
53
- expect(result['index.html'][:md]).to include 'Markdown stuff'
57
+ expect(pages['index.html'][:md]).to include 'Markdown stuff'
54
58
  end
55
59
  end
56
60
 
@@ -62,7 +66,7 @@ eos
62
66
  end
63
67
 
64
68
  it 'takes the category in a collection and treats them as the page names' do
65
- expect(result.keys).to include 'foo.html'
69
+ expect(pages.keys).to include 'foo.html'
66
70
  end
67
71
  end
68
72
 
@@ -78,11 +82,11 @@ eos
78
82
  end
79
83
 
80
84
  it 'appends the child doc to the category page' do
81
- expect(result['base_css.html'][:md]).to include 'Some other style'
85
+ expect(pages['base_css.html'][:md]).to include 'Some other style'
82
86
  end
83
87
 
84
88
  it 'assigns the child doc a deeper header' do
85
- expect(result['base_css.html'][:md]).to include '<h2 id="otherStyle">Some other style</h2>'
89
+ expect(pages['base_css.html'][:md]).to include '<h2 id="otherStyle">Some other style</h2>'
86
90
  end
87
91
  end
88
92
  end
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: 1.0.0
4
+ version: 1.0.1
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: 2014-02-27 00:00:00.000000000 Z
12
+ date: 2014-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redcarpet
@@ -90,6 +90,7 @@ extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
92
  - .gitignore
93
+ - .travis.yml
93
94
  - Gemfile
94
95
  - LICENSE.txt
95
96
  - README.md