livingstyleguide 0.6.0.alpha.2 → 1.0.0.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/CHANGELOG.md +20 -0
  4. data/MIT-LICENSE.md +11 -0
  5. data/README.md +44 -6
  6. data/lib/livingstyleguide.rb +6 -27
  7. data/lib/livingstyleguide/code_block.rb +35 -0
  8. data/lib/livingstyleguide/engine.rb +93 -0
  9. data/lib/livingstyleguide/example.rb +86 -0
  10. data/lib/livingstyleguide/filter_hooks.rb +34 -0
  11. data/lib/livingstyleguide/filters.rb +8 -0
  12. data/lib/livingstyleguide/filters/add_wrapper_class.rb +4 -0
  13. data/lib/livingstyleguide/filters/coffee_script.rb +18 -0
  14. data/lib/livingstyleguide/filters/font_example.rb +20 -0
  15. data/lib/livingstyleguide/filters/full_width.rb +4 -0
  16. data/lib/livingstyleguide/filters/haml.rb +16 -0
  17. data/lib/livingstyleguide/filters/highlights.rb +9 -0
  18. data/lib/livingstyleguide/filters/javascript.rb +10 -0
  19. data/lib/livingstyleguide/importer.rb +19 -6
  20. data/lib/livingstyleguide/markdown_extensions.rb +24 -59
  21. data/lib/livingstyleguide/tilt_template.rb +30 -7
  22. data/lib/livingstyleguide/version.rb +1 -1
  23. data/livingstyleguide.gemspec +4 -1
  24. data/stylesheets/_livingstyleguide.scss +1 -1
  25. data/stylesheets/livingstyleguide/_content.scss +9 -8
  26. data/templates/layouts/default.html.erb +6 -6
  27. data/test/example_test_helper.rb +22 -0
  28. data/test/fixtures/markdown/code-block-and-example.md +8 -0
  29. data/test/fixtures/markdown/example-with-highlight.md +1 -1
  30. data/test/fixtures/markdown/example.md +1 -1
  31. data/test/fixtures/markdown/font-example.md +4 -1
  32. data/test/fixtures/markdown/{layout-example.md → full-width-example.md} +2 -1
  33. data/test/fixtures/markdown/haml-example-with-highlight.md +2 -1
  34. data/test/fixtures/markdown/haml-example.md +2 -1
  35. data/test/fixtures/standalone/modules/_buttons.md +1 -1
  36. data/test/integration/markdown_test.rb +17 -14
  37. data/test/integration/sprockets_test.rb +19 -0
  38. data/test/integration/standalone_test.rb +1 -1
  39. data/test/integration/variables_test.rb +1 -1
  40. data/test/test_helper.rb +9 -1
  41. data/test/unit/code_block_test.rb +53 -0
  42. data/test/unit/example_test.rb +142 -0
  43. data/test/unit/filter_hooks_test.rb +46 -0
  44. data/test/unit/filters/add_wrapper_class_test.rb +15 -0
  45. data/test/unit/filters/coffee_script_test.rb +19 -0
  46. data/test/unit/filters/font_example_test.rb +47 -0
  47. data/test/unit/filters/full_width_test.rb +16 -0
  48. data/test/unit/filters/haml_test.rb +20 -0
  49. data/test/unit/filters/highlights_test.rb +26 -0
  50. data/test/unit/filters/javascript_test.rb +18 -0
  51. data/test/unit/sass_extensions_test.rb +1 -1
  52. metadata +87 -10
  53. data/LICENSE.txt +0 -22
  54. data/lib/livingstyleguide/renderer.rb +0 -36
  55. data/test/fixtures/markdown/javascript-example.md +0 -4
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ require 'example_test_helper'
4
+
5
+ class FontExampleTest < ExampleTestCase
6
+
7
+ def test_default_font_example
8
+ assert_render_equals <<-INPUT, <<-OUTPUT
9
+ @font-example 42px Comic Sans
10
+ INPUT
11
+ <div class="livingstyleguide--font-example" style="font: 42px Comic Sans">
12
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ<br>
13
+ abcdefghijklmnopqrstuvwxyz<br>
14
+ 0123456789<br>
15
+ !&/()$=@;:,.
16
+ </div>
17
+ OUTPUT
18
+ end
19
+
20
+ def test_default_font_example_with_custom_text
21
+ assert_render_equals <<-INPUT, <<-OUTPUT
22
+ @font-example 14px Helvetica
23
+ Schweißgequält zündet Typograf Jakob
24
+ verflixt öde Pangramme an.
25
+ INPUT
26
+ <div class="livingstyleguide--font-example" style="font: 14px Helvetica">
27
+ Schweißgequält zündet Typograf Jakob<br>
28
+ verflixt öde Pangramme an.
29
+ </div>
30
+ OUTPUT
31
+ end
32
+
33
+ def test_default_font_example_with_defaut_custom_text
34
+ assert_render_equals <<-INPUT, <<-OUTPUT, font_example: { text: "zażółć\ngęślą\njaźń" }
35
+ @font-example 72px Drogowskaz
36
+ INPUT
37
+ <div class="livingstyleguide--font-example" style="font: 72px Drogowskaz">
38
+ zażółć<br>
39
+ gęślą<br>
40
+ jaźń
41
+ </div>
42
+ OUTPUT
43
+ end
44
+
45
+ end
46
+
47
+
@@ -0,0 +1,16 @@
1
+ require 'example_test_helper'
2
+
3
+ class FullWidthTest < ExampleTestCase
4
+
5
+ def test_full_width
6
+ assert_render_match <<-INPUT, <<-OUTPUT
7
+ @full-width
8
+ <section>Something wide</section>
9
+ INPUT
10
+ <div class="livingstyleguide--example -lsg-has-full-width">
11
+ OUTPUT
12
+ end
13
+
14
+ end
15
+
16
+
@@ -0,0 +1,20 @@
1
+ require 'example_test_helper'
2
+
3
+ class HamlTest < ExampleTestCase
4
+
5
+ def test_haml
6
+ assert_render_match <<-INPUT, <<-OUTPUT
7
+ @haml
8
+ %div
9
+ .lorem Ipsum
10
+ INPUT
11
+ <div class="livingstyleguide--example"> <div> <div class="lorem">Ipsum</div> </div> </div>
12
+ <pre class="livingstyleguide--code-block">
13
+ <code class="livingstyleguide--code">
14
+ <em>%div</em> <b>.lorem</b> Ipsum</code>
15
+ </pre>
16
+ OUTPUT
17
+ end
18
+
19
+ end
20
+
@@ -0,0 +1,26 @@
1
+ require 'example_test_helper'
2
+
3
+ class HightlightsTest < ExampleTestCase
4
+
5
+ def test_one_line
6
+ assert_render_match <<-INPUT, <<-OUTPUT
7
+ This is ***highlighted*** text.
8
+ INPUT
9
+ This is <strong class="livingstyleguide--code-highlight">highlighted</strong> text.
10
+ OUTPUT
11
+ end
12
+
13
+ def test_multi_line
14
+ assert_render_match <<-INPUT, <<-OUTPUT
15
+ This is
16
+ ***
17
+ highlighted
18
+ ***
19
+ text.
20
+ INPUT
21
+ This is <strong class="livingstyleguide--code-highlight-block">highlighted</strong> text.
22
+ OUTPUT
23
+ end
24
+
25
+ end
26
+
@@ -0,0 +1,18 @@
1
+ require 'example_test_helper'
2
+
3
+ class JavaScriptTest < ExampleTestCase
4
+
5
+ def test_javascript
6
+ assert_render_equals <<-INPUT, <<-OUTPUT
7
+ @javascript
8
+ alert("Hello world!");
9
+ INPUT
10
+ <div class="livingstyleguide--example -lsg-for-javascript"> <script>alert("Hello world!");</script> </div>
11
+ <pre class="livingstyleguide--code-block">
12
+ <code class="livingstyleguide--code">alert(<q>"<b>Hello</b> world!"</q>);</code>
13
+ </pre>
14
+ OUTPUT
15
+ end
16
+
17
+ end
18
+
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class SassExtensionsTest < Test::Unit::TestCase
3
+ class SassExtensionsTest < Minitest::Test
4
4
  def test_list_variables_for_file
5
5
  assert_equal 'my-wonderful_red blue', evaluate(%Q(list-variables("variables/colors.scss")))
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livingstyleguide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.alpha.2
4
+ version: 1.0.0.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nico Hagenburger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-09 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minisyntax
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: activesupport
84
+ name: thor
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '>='
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: thor
98
+ name: hooks
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '>='
@@ -136,6 +136,48 @@ dependencies:
136
136
  - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: heredoc_unindent
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: minitest
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: coffee-script
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
139
181
  description: Living Style Guide
140
182
  email:
141
183
  - nico@hagenburger.net
@@ -148,19 +190,30 @@ files:
148
190
  - .travis.yml
149
191
  - CHANGELOG.md
150
192
  - Gemfile
151
- - LICENSE.txt
193
+ - MIT-LICENSE.md
152
194
  - README.md
153
195
  - Rakefile
154
196
  - assets/javascripts/livingstyleguide.js
155
197
  - bin/livingstyleguide
156
198
  - lib/livingstyleguide.rb
199
+ - lib/livingstyleguide/code_block.rb
157
200
  - lib/livingstyleguide/command_line_interface.rb
201
+ - lib/livingstyleguide/engine.rb
202
+ - lib/livingstyleguide/example.rb
203
+ - lib/livingstyleguide/filter_hooks.rb
204
+ - lib/livingstyleguide/filters.rb
205
+ - lib/livingstyleguide/filters/add_wrapper_class.rb
206
+ - lib/livingstyleguide/filters/coffee_script.rb
207
+ - lib/livingstyleguide/filters/font_example.rb
208
+ - lib/livingstyleguide/filters/full_width.rb
209
+ - lib/livingstyleguide/filters/haml.rb
210
+ - lib/livingstyleguide/filters/highlights.rb
211
+ - lib/livingstyleguide/filters/javascript.rb
158
212
  - lib/livingstyleguide/importer.rb
159
213
  - lib/livingstyleguide/integration.rb
160
214
  - lib/livingstyleguide/integration/compass.rb
161
215
  - lib/livingstyleguide/integration/rails.rb
162
216
  - lib/livingstyleguide/markdown_extensions.rb
163
- - lib/livingstyleguide/renderer.rb
164
217
  - lib/livingstyleguide/sass_extensions.rb
165
218
  - lib/livingstyleguide/sass_extensions/functions.rb
166
219
  - lib/livingstyleguide/tilt_template.rb
@@ -174,16 +227,17 @@ files:
174
227
  - stylesheets/livingstyleguide/_content.scss
175
228
  - stylesheets/livingstyleguide/_layout.scss
176
229
  - templates/layouts/default.html.erb
230
+ - test/example_test_helper.rb
231
+ - test/fixtures/markdown/code-block-and-example.md
177
232
  - test/fixtures/markdown/code-with-highlight-block.md
178
233
  - test/fixtures/markdown/code-with-highlight.md
179
234
  - test/fixtures/markdown/code.md
180
235
  - test/fixtures/markdown/example-with-highlight.md
181
236
  - test/fixtures/markdown/example.md
182
237
  - test/fixtures/markdown/font-example.md
238
+ - test/fixtures/markdown/full-width-example.md
183
239
  - test/fixtures/markdown/haml-example-with-highlight.md
184
240
  - test/fixtures/markdown/haml-example.md
185
- - test/fixtures/markdown/javascript-example.md
186
- - test/fixtures/markdown/layout-example.md
187
241
  - test/fixtures/markdown/text.md
188
242
  - test/fixtures/markdown/variables.md
189
243
  - test/fixtures/standalone/config.rb
@@ -200,9 +254,20 @@ files:
200
254
  - test/fixtures/stylesheets/variables/colors.scss
201
255
  - test/fixtures/stylesheets/variables/other-colors.sass
202
256
  - test/integration/markdown_test.rb
257
+ - test/integration/sprockets_test.rb
203
258
  - test/integration/standalone_test.rb
204
259
  - test/integration/variables_test.rb
205
260
  - test/test_helper.rb
261
+ - test/unit/code_block_test.rb
262
+ - test/unit/example_test.rb
263
+ - test/unit/filter_hooks_test.rb
264
+ - test/unit/filters/add_wrapper_class_test.rb
265
+ - test/unit/filters/coffee_script_test.rb
266
+ - test/unit/filters/font_example_test.rb
267
+ - test/unit/filters/full_width_test.rb
268
+ - test/unit/filters/haml_test.rb
269
+ - test/unit/filters/highlights_test.rb
270
+ - test/unit/filters/javascript_test.rb
206
271
  - test/unit/sass_extensions_test.rb
207
272
  homepage: ''
208
273
  licenses: []
@@ -228,16 +293,17 @@ signing_key:
228
293
  specification_version: 4
229
294
  summary: Living Style Guide
230
295
  test_files:
296
+ - test/example_test_helper.rb
297
+ - test/fixtures/markdown/code-block-and-example.md
231
298
  - test/fixtures/markdown/code-with-highlight-block.md
232
299
  - test/fixtures/markdown/code-with-highlight.md
233
300
  - test/fixtures/markdown/code.md
234
301
  - test/fixtures/markdown/example-with-highlight.md
235
302
  - test/fixtures/markdown/example.md
236
303
  - test/fixtures/markdown/font-example.md
304
+ - test/fixtures/markdown/full-width-example.md
237
305
  - test/fixtures/markdown/haml-example-with-highlight.md
238
306
  - test/fixtures/markdown/haml-example.md
239
- - test/fixtures/markdown/javascript-example.md
240
- - test/fixtures/markdown/layout-example.md
241
307
  - test/fixtures/markdown/text.md
242
308
  - test/fixtures/markdown/variables.md
243
309
  - test/fixtures/standalone/config.rb
@@ -254,7 +320,18 @@ test_files:
254
320
  - test/fixtures/stylesheets/variables/colors.scss
255
321
  - test/fixtures/stylesheets/variables/other-colors.sass
256
322
  - test/integration/markdown_test.rb
323
+ - test/integration/sprockets_test.rb
257
324
  - test/integration/standalone_test.rb
258
325
  - test/integration/variables_test.rb
259
326
  - test/test_helper.rb
327
+ - test/unit/code_block_test.rb
328
+ - test/unit/example_test.rb
329
+ - test/unit/filter_hooks_test.rb
330
+ - test/unit/filters/add_wrapper_class_test.rb
331
+ - test/unit/filters/coffee_script_test.rb
332
+ - test/unit/filters/font_example_test.rb
333
+ - test/unit/filters/full_width_test.rb
334
+ - test/unit/filters/haml_test.rb
335
+ - test/unit/filters/highlights_test.rb
336
+ - test/unit/filters/javascript_test.rb
260
337
  - test/unit/sass_extensions_test.rb
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2012 Nico Hagenburger
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,36 +0,0 @@
1
- require 'erb'
2
-
3
- module LivingStyleGuide::Renderer
4
-
5
- def render_living_style_guide
6
- data = Class.new do
7
- attr_accessor :css, :html, :title, :head, :header, :footer
8
- include ERB::Util
9
- def get_binding; binding end
10
- end.new
11
- data.css = self.render
12
- markdown = LivingStyleGuide.markdown || ''
13
- data.html = LivingStyleGuide::RedcarpetTemplate.new{ markdown }.render
14
- data.title = @options[:living_style_guide][:title]
15
-
16
- head = (@options[:living_style_guide][:javascript_before] || []).map do |src|
17
- %Q(<script src="#{src}"></script>)
18
- end
19
- data.head = head.join("\n")
20
-
21
- header = [@options[:living_style_guide][:header]]
22
- data.header = header.join("\n")
23
-
24
- footer = [@options[:living_style_guide][:footer]]
25
- footer << (@options[:living_style_guide][:javascript_after] || []).map do |src|
26
- %Q(<script src="#{src}"></script>)
27
- end
28
- data.footer = footer.join("\n")
29
-
30
- LivingStyleGuide.reset
31
- template = File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'layouts', 'default.html.erb'))
32
- ERB.new(template).result(data.get_binding)
33
- end
34
-
35
- end
36
-
@@ -1,4 +0,0 @@
1
- ~~~ javascript-example
2
- alert("Hello world!");
3
- ~~~
4
-