livingstyleguide 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/lib/livingstyleguide/version.rb +1 -1
  3. data/stylesheets/_livingstyleguide.scss +26 -0
  4. data/stylesheets/livingstyleguide/_code.scss +8 -5
  5. data/stylesheets/livingstyleguide/_color-swatches.scss +8 -9
  6. data/stylesheets/livingstyleguide/_content.scss +11 -8
  7. data/stylesheets/livingstyleguide/_layout.scss +6 -2
  8. metadata +31 -161
  9. data/.gitignore +0 -19
  10. data/.travis.yml +0 -5
  11. data/CHANGELOG.md +0 -95
  12. data/Gemfile +0 -4
  13. data/MIT-LICENSE.md +0 -11
  14. data/README.md +0 -111
  15. data/Rakefile +0 -25
  16. data/livingstyleguide.gemspec +0 -33
  17. data/sache.json +0 -6
  18. data/test/example_test_helper.rb +0 -22
  19. data/test/fixtures/markdown/code-block-and-example.md +0 -8
  20. data/test/fixtures/markdown/code-with-highlight-block.md +0 -6
  21. data/test/fixtures/markdown/code-with-highlight.md +0 -4
  22. data/test/fixtures/markdown/code.md +0 -6
  23. data/test/fixtures/markdown/example-with-highlight.md +0 -5
  24. data/test/fixtures/markdown/example.md +0 -4
  25. data/test/fixtures/markdown/font-example.md +0 -4
  26. data/test/fixtures/markdown/full-width-example.md +0 -5
  27. data/test/fixtures/markdown/haml-example-with-highlight.md +0 -5
  28. data/test/fixtures/markdown/haml-example.md +0 -5
  29. data/test/fixtures/markdown/text.md +0 -15
  30. data/test/fixtures/markdown/variables.md +0 -4
  31. data/test/fixtures/standalone/config.rb +0 -0
  32. data/test/fixtures/standalone/modules/_buttons.md +0 -6
  33. data/test/fixtures/standalone/modules/_buttons.scss +0 -4
  34. data/test/fixtures/standalone/style.html.lsg +0 -0
  35. data/test/fixtures/standalone/style.scss +0 -5
  36. data/test/fixtures/standalone/styleguide-as-json.html.lsg +0 -9
  37. data/test/fixtures/standalone/styleguide-with-header-footer.html.lsg +0 -7
  38. data/test/fixtures/standalone/styleguide-with-javascript.html.lsg +0 -8
  39. data/test/fixtures/standalone/styleguide-with-sass.html.lsg +0 -6
  40. data/test/fixtures/standalone/styleguide-with-scss.html.lsg +0 -7
  41. data/test/fixtures/standalone/styleguide-with-style.html.lsg +0 -7
  42. data/test/fixtures/standalone/styleguide.html.lsg +0 -3
  43. data/test/fixtures/stylesheets/variables/_more-other-colors.sass +0 -2
  44. data/test/fixtures/stylesheets/variables/colors.scss +0 -2
  45. data/test/fixtures/stylesheets/variables/other-colors.sass +0 -2
  46. data/test/integration/command_line_test.rb +0 -12
  47. data/test/integration/markdown_test.rb +0 -136
  48. data/test/integration/sprockets_test.rb +0 -19
  49. data/test/integration/standalone_test.rb +0 -68
  50. data/test/integration/variables_test.rb +0 -33
  51. data/test/test_helper.rb +0 -28
  52. data/test/unit/code_block_test.rb +0 -53
  53. data/test/unit/example_test.rb +0 -142
  54. data/test/unit/filter_hooks_test.rb +0 -46
  55. data/test/unit/filters/add_wrapper_class_test.rb +0 -15
  56. data/test/unit/filters/coffee_script_test.rb +0 -19
  57. data/test/unit/filters/colors_test.rb +0 -65
  58. data/test/unit/filters/font_example_test.rb +0 -47
  59. data/test/unit/filters/full_width_test.rb +0 -16
  60. data/test/unit/filters/haml_test.rb +0 -20
  61. data/test/unit/filters/highlights_test.rb +0 -26
  62. data/test/unit/filters/javascript_test.rb +0 -18
  63. data/test/unit/sass_extensions_test.rb +0 -28
  64. data/website/.gitignore +0 -22
  65. data/website/Gemfile +0 -13
  66. data/website/README.md +0 -32
  67. data/website/config.rb +0 -37
  68. data/website/source/.htaccess +0 -144
  69. data/website/source/changelog.html.md +0 -95
  70. data/website/source/images/graphics-2x/example-project.png +0 -0
  71. data/website/source/images/graphics-2x/github.png +0 -0
  72. data/website/source/images/graphics-2x/hagenburger.png +0 -0
  73. data/website/source/images/graphics-2x/issues.png +0 -0
  74. data/website/source/images/graphics-2x/livingstyleguide.png +0 -0
  75. data/website/source/images/graphics-2x/made-in-berlin.png +0 -0
  76. data/website/source/images/graphics-2x/rubygems.png +0 -0
  77. data/website/source/images/graphics-2x/twitter.png +0 -0
  78. data/website/source/images/graphics/example-project.png +0 -0
  79. data/website/source/images/graphics/github.png +0 -0
  80. data/website/source/images/graphics/hagenburger.png +0 -0
  81. data/website/source/images/graphics/issues.png +0 -0
  82. data/website/source/images/graphics/livingstyleguide.png +0 -0
  83. data/website/source/images/graphics/made-in-berlin.png +0 -0
  84. data/website/source/images/graphics/rubygems.png +0 -0
  85. data/website/source/images/graphics/twitter.png +0 -0
  86. data/website/source/index.html.haml +0 -49
  87. data/website/source/layouts/markdown.html.haml +0 -40
  88. data/website/source/style/components/_markdown.md +0 -23
  89. data/website/source/style/components/_markdown.sass +0 -52
  90. data/website/source/style/styles.sass +0 -286
  91. data/website/source/styleguide.html.lsg +0 -11
@@ -1,142 +0,0 @@
1
- require 'example_test_helper'
2
-
3
- class ExampleTest < ExampleTestCase
4
-
5
- def test_default
6
- assert_render_equals <<-INPUT, <<-OUTPUT
7
- <button>Hello World</button>
8
- INPUT
9
- <div class="livingstyleguide--example"> <button>Hello World</button> </div>
10
- <pre class="livingstyleguide--code-block">
11
- <code class="livingstyleguide--code">
12
- <b>&lt;<em>button</em></b><b>&gt;</b>Hello World<b>&lt;/<em>button</em>&gt</b>
13
- </code>
14
- </pre>
15
- OUTPUT
16
- end
17
-
18
- def test_filters_with_underscore_and_dash_case
19
- @class.add_filter :test_filter do
20
- filter_before do |html|
21
- "TEST"
22
- end
23
- end
24
- %w(test_filter test-filter).each do |filter|
25
- assert_render_equals <<-INPUT, <<-OUTPUT
26
- @#{filter}
27
- <button>Hello World</button>
28
- INPUT
29
- <div class="livingstyleguide--example"> TEST </div>
30
- <pre class="livingstyleguide--code-block">
31
- <code class="livingstyleguide--code">
32
- <b>&lt;<em>button</em></b><b>&gt;</b>Hello World<b>&lt;/<em>button</em>&gt</b>
33
- </code>
34
- </pre>
35
- OUTPUT
36
- end
37
- end
38
-
39
- def test_filters
40
- @class.add_filter do
41
- filter_before do |html|
42
- "TEST"
43
- end
44
- end
45
- assert_render_equals <<-INPUT, <<-OUTPUT
46
- <button>Hello World</button>
47
- INPUT
48
- <div class="livingstyleguide--example"> TEST </div>
49
- <pre class="livingstyleguide--code-block">
50
- <code class="livingstyleguide--code">
51
- <b>&lt;<em>button</em></b><b>&gt;</b>Hello World<b>&lt;/<em>button</em>&gt</b>
52
- </code>
53
- </pre>
54
- OUTPUT
55
- end
56
-
57
- def test_filters_with_argument
58
- @class.add_filter :test_filter do |argument|
59
- filter_before do |html|
60
- argument
61
- end
62
- end
63
- assert_render_equals <<-INPUT, <<-OUTPUT
64
- @test_filter Another Test
65
- <button>Hello World</button>
66
- INPUT
67
- <div class="livingstyleguide--example"> Another Test </div>
68
- <pre class="livingstyleguide--code-block">
69
- <code class="livingstyleguide--code">
70
- <b>&lt;<em>button</em></b><b>&gt;</b>Hello World<b>&lt;/<em>button</em>&gt</b>
71
- </code>
72
- </pre>
73
- OUTPUT
74
- end
75
-
76
- def test_default_filters
77
- @class.add_filter :test_filter do
78
- filter_before do |html|
79
- "TEST"
80
- end
81
- end
82
- assert_render_equals <<-INPUT, <<-OUTPUT, { default_filters: ['@test-filter'] }
83
- <button>Hello World</button>
84
- INPUT
85
- <div class="livingstyleguide--example"> TEST </div>
86
- <pre class="livingstyleguide--code-block">
87
- <code class="livingstyleguide--code">
88
- <b>&lt;<em>button</em></b><b>&gt;</b>Hello World<b>&lt;/<em>button</em>&gt</b>
89
- </code>
90
- </pre>
91
- OUTPUT
92
- end
93
-
94
- def test_outer_html
95
- @class.html do |c|
96
- "<span>#{c}</span>"
97
- end
98
- assert_render_equals <<-INPUT, <<-OUTPUT
99
- <button>Hello World</button>
100
- INPUT
101
- <span> <button>Hello World</button> </span>
102
- <pre class="livingstyleguide--code-block">
103
- <code class="livingstyleguide--code">
104
- <b>&lt;<em>button</em></b><b>&gt;</b>Hello World<b>&lt;/<em>button</em>&gt</b>
105
- </code>
106
- </pre>
107
- OUTPUT
108
- end
109
-
110
- def test_hide_code_block
111
- @class.add_filter :suppress_code_block do
112
- suppress_code_block
113
- end
114
- assert_render_equals <<-INPUT, <<-OUTPUT
115
- @suppress-code-block
116
- <button>Hello World</button>
117
- INPUT
118
- <div class="livingstyleguide--example"> <button>Hello World</button> </div>
119
- OUTPUT
120
- end
121
-
122
- def test_pre_processor
123
- @class.add_filter :pre_processor_one do
124
- pre_processor { |source| 'fail' }
125
- end
126
- @class.add_filter :pre_processor_two do
127
- pre_processor { |source| source.gsub(/World/, 'Moon') }
128
- end
129
- assert_render_equals <<-INPUT, <<-OUTPUT
130
- @pre-processor-one
131
- @pre-processor-two
132
- Hello World
133
- INPUT
134
- <div class="livingstyleguide--example"> Hello Moon </div>
135
- <pre class="livingstyleguide--code-block">
136
- <code class="livingstyleguide--code">Hello World</code>
137
- </pre>
138
- OUTPUT
139
- end
140
-
141
- end
142
-
@@ -1,46 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe LivingStyleGuide::FilterHooks do
4
-
5
- before do
6
- @class = Class.new
7
- @class.class_eval do
8
- include Hooks
9
- include Hooks::InstanceHooks
10
- include LivingStyleGuide::FilterHooks
11
- define_hook :filter
12
- end
13
- end
14
-
15
- describe "running filters after each other" do
16
- it "should filter one filter" do
17
- @class.filter { |text| text * 2 }
18
- @class.run_filter_hook(:filter, "hello world").must_equal "hello worldhello world"
19
- end
20
-
21
- it "should filter several filter in a row" do
22
- @class.filter { |text| text * 2 }
23
- @class.filter { |text| text.gsub(/worldhello/, 'beautiful') }
24
- @class.run_filter_hook(:filter, "hello world").must_equal "hello beautiful world"
25
- end
26
-
27
- it "should work on instances" do
28
- @class.filter { |text| text * 2 }
29
- @class.new.run_filter_hook(:filter, "hello world").must_equal "hello worldhello world"
30
- end
31
- end
32
-
33
- describe "run only the latest added filter" do
34
- it "should should run only one filter" do
35
- @class.filter { |text| text.gsub(/animal/, 'fish') }
36
- @class.filter { |text| text.gsub(/animal/, 'bird') }
37
- @class.run_last_filter_hook(:filter, "the animal").must_equal "the bird"
38
- end
39
-
40
- it "should return the original string if no hooks are defined" do
41
- @class.run_last_filter_hook(:filter, "the animal").must_equal "the animal"
42
- end
43
- end
44
-
45
- end
46
-
@@ -1,15 +0,0 @@
1
- require 'example_test_helper'
2
-
3
- class AddWrapperClassTest < ExampleTestCase
4
-
5
- def test_add_wrapper_class
6
- assert_render_match <<-INPUT, <<-OUTPUT
7
- @add-wrapper-class my-class
8
- <section>Something wide</section>
9
- INPUT
10
- <div class="livingstyleguide--example my-class">
11
- OUTPUT
12
- end
13
-
14
- end
15
-
@@ -1,19 +0,0 @@
1
- require 'example_test_helper'
2
-
3
- class CoffeeScriptTest < ExampleTestCase
4
-
5
- def test_coffee_script
6
- assert_render_equals <<-INPUT, <<-OUTPUT
7
- @coffee-script
8
- alert "Hello world!"
9
- INPUT
10
- <div class="livingstyleguide--example -lsg-for-javascript"> <script>(function() { alert("Hello world!"); }).call(this); </script> </div>
11
- <pre class="livingstyleguide--code-block">
12
- <code class="livingstyleguide--code">alert "Hello world!"</code>
13
- </pre>
14
- OUTPUT
15
- end
16
-
17
- end
18
-
19
-
@@ -1,65 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require 'example_test_helper'
4
-
5
- class ColorsTest < ExampleTestCase
6
-
7
- def test_colors_of_file
8
- LivingStyleGuide::VariablesImporter.stub :variables, %w(red blue) do
9
- assert_render_equals <<-INPUT, <<-OUTPUT
10
- @colors variables/colors
11
- INPUT
12
- <ul class="livingstyleguide--color-swatches -lsg-2-columns">
13
- <li class="livingstyleguide--color-swatch $red">$red</li>
14
- <li class="livingstyleguide--color-swatch $blue">$blue</li>
15
- </ul>
16
- OUTPUT
17
- end
18
- end
19
-
20
- def test_defined_colors
21
- assert_render_equals <<-INPUT, <<-OUTPUT
22
- @colors
23
- $orange $green
24
- INPUT
25
- <ul class="livingstyleguide--color-swatches -lsg-2-columns">
26
- <li class="livingstyleguide--color-swatch $orange">$orange</li>
27
- <li class="livingstyleguide--color-swatch $green">$green</li>
28
- </ul>
29
- OUTPUT
30
- end
31
-
32
- def test_rows
33
- assert_render_equals <<-INPUT, <<-OUTPUT
34
- @colors
35
- $pink $purple $gray
36
- $turquoise $cyan $black
37
- INPUT
38
- <ul class="livingstyleguide--color-swatches -lsg-3-columns">
39
- <li class="livingstyleguide--color-swatch $pink">$pink</li>
40
- <li class="livingstyleguide--color-swatch $purple">$purple</li>
41
- <li class="livingstyleguide--color-swatch $gray">$gray</li>
42
- <li class="livingstyleguide--color-swatch $turquoise">$turquoise</li>
43
- <li class="livingstyleguide--color-swatch $cyan">$cyan</li>
44
- <li class="livingstyleguide--color-swatch $black">$black</li>
45
- </ul>
46
- OUTPUT
47
- end
48
-
49
- def test_skipped_cells
50
- assert_render_equals <<-INPUT, <<-OUTPUT
51
- @colors
52
- $pink $purple
53
- - $turquoise
54
- INPUT
55
- <ul class="livingstyleguide--color-swatches -lsg-2-columns">
56
- <li class="livingstyleguide--color-swatch $pink">$pink</li>
57
- <li class="livingstyleguide--color-swatch $purple">$purple</li>
58
- <li class="livingstyleguide--color-swatch -lsg-empty">-</li>
59
- <li class="livingstyleguide--color-swatch $turquoise">$turquoise</li>
60
- </ul>
61
- OUTPUT
62
- end
63
-
64
- end
65
-
@@ -1,47 +0,0 @@
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
-
@@ -1,16 +0,0 @@
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
-
@@ -1,20 +0,0 @@
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
-
@@ -1,26 +0,0 @@
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
-
@@ -1,18 +0,0 @@
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,28 +0,0 @@
1
- require 'test_helper'
2
-
3
- class SassExtensionsTest < Minitest::Test
4
- def test_list_variables_for_file
5
- assert_equal 'my-wonderful_red blue', evaluate(%Q(list-variables("variables/colors.scss")))
6
- end
7
-
8
- def test_list_variables_for_scss_files_without_extension
9
- assert_equal 'my-wonderful_red blue', evaluate(%Q(list-variables("variables/colors")))
10
- end
11
-
12
- def test_list_variables_for_sass_files_without_extension
13
- assert_equal 'blue green', evaluate(%Q(list-variables("variables/other-colors")))
14
- end
15
-
16
- def test_list_variables_for_files_starting_with_underscore
17
- assert_equal 'blue green', evaluate(%Q(list-variables("variables/more-other-colors")))
18
- end
19
-
20
- def test_list_variables_for_directories
21
- assert_equal 'blue green my-wonderful_red', evaluate(%Q(list-variables("variables/*")))
22
- end
23
-
24
- protected
25
- def evaluate(value)
26
- Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s
27
- end
28
- end