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
File without changes
@@ -1,6 +0,0 @@
1
- # Buttons
2
-
3
- ~~~
4
- <button class="button">A button</button>
5
- ~~~
6
-
@@ -1,4 +0,0 @@
1
- .button {
2
- background: red;
3
- }
4
-
File without changes
@@ -1,5 +0,0 @@
1
- $my-base-color: green;
2
-
3
- @import "compass";
4
- @import "modules/buttons";
5
-
@@ -1,9 +0,0 @@
1
- {
2
- "source": "style.scss",
3
- "title": "My Nice & Beautiful Living Style Guide",
4
- "javascript-before": ["modernizr.js"],
5
- "javascript-after": ["http://code.jquery.com/jquery-2.0.3.js", "application.js"],
6
- "header": "<h1>Super Style Guide</h1>",
7
- "footer": "<p>Made by me</p>"
8
- }
9
-
@@ -1,7 +0,0 @@
1
- source: "style.scss"
2
- title: "My Nice & Beautiful Living Style Guide"
3
- header: |
4
- <h1>Super Style Guide</h1>
5
- footer: |
6
- <p>Made by me</p>
7
-
@@ -1,8 +0,0 @@
1
- source: "style.scss"
2
- title: "My Nice & Beautiful Living Style Guide"
3
- javascript-before:
4
- - modernizr.js
5
- javascript-after:
6
- - http://code.jquery.com/jquery-2.0.3.js
7
- - application.js
8
-
@@ -1,6 +0,0 @@
1
- source: "style.scss"
2
- title: "My Nice & Beautiful Living Style Guide"
3
- styleguide-sass: |
4
- #test
5
- color: green
6
-
@@ -1,7 +0,0 @@
1
- source: "style.scss"
2
- title: "My Nice & Beautiful Living Style Guide"
3
- styleguide-scss: |
4
- #test {
5
- color: red;
6
- }
7
-
@@ -1,7 +0,0 @@
1
- source: "style.scss"
2
- title: "My Nice & Beautiful Living Style Guide"
3
- style:
4
- color: red
5
- border-radius: 3px
6
- code-color: darken($my-base-color, 10%)
7
-
@@ -1,3 +0,0 @@
1
- source: "style.scss"
2
- title: "My Nice & Beautiful Living Style Guide"
3
-
@@ -1,2 +0,0 @@
1
- $blue: blue
2
- $green: green
@@ -1,2 +0,0 @@
1
- $my-wonderful_red: red;
2
- $blue : "blue";
@@ -1,2 +0,0 @@
1
- $blue: blue
2
- $green: green
@@ -1,12 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe "LivingStyleGuide::CommandLineInterface" do
4
-
5
- it "should output the style guide" do
6
- `./bin/livingstyleguide compile test/fixtures/standalone/style.html.lsg`
7
- File.exists?('test/fixtures/standalone/style.html').must_equal true
8
- File.delete 'test/fixtures/standalone/style.html'
9
- end
10
-
11
- end
12
-
@@ -1,136 +0,0 @@
1
- require 'test_helper'
2
- require 'tilt'
3
-
4
- class MarkdownTest < Minitest::Test
5
-
6
- def render_markdown(file, options)
7
- engine = LivingStyleGuide::Engine.new('', options, {})
8
- engine.markdown = File.read(file)
9
- engine.html
10
- end
11
-
12
- def assert_markdown(expected, file, options = {})
13
- expected = expected.gsub(/\s+/m, ' ').gsub(/([\$\(\)\[\]])/) { |s| "\\#{s}" }.strip
14
- given = render_markdown(File.join(%W(test fixtures markdown #{file})), options)
15
- given = given.gsub(/\s+/m, ' ').strip
16
- assert_match /#{expected}/, given
17
- end
18
-
19
- def test_examples
20
- assert_markdown <<-HTML, 'example.md'
21
- <div class="livingstyleguide--example">
22
- <button class="button">Test</button>
23
- </div>
24
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">.+button.+Test.+button.+</code></pre>
25
- HTML
26
- end
27
-
28
- def test_full_width_examples
29
- assert_markdown <<-HTML, 'full-width-example.md'
30
- <div class="livingstyleguide--example -lsg-has-full-width">
31
- <button class="button">Test</button>
32
- </div>
33
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">.+button.+Test.+button.+</code></pre>
34
- HTML
35
- end
36
-
37
- def test_haml_example
38
- assert_markdown <<-HTML, 'haml-example.md'
39
- <div class="livingstyleguide--example">
40
- <button class="button">Test</button>
41
- </div>
42
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code"><em>%button</em><b>.button</b> Test</code></pre>
43
- HTML
44
- end
45
-
46
- def test_haml_example_with_highlight
47
- assert_markdown <<-HTML, 'haml-example-with-highlight.md'
48
- <div class="livingstyleguide--example">
49
- <button class="button">Test</button>
50
- </div>
51
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code"><em>%button</em><strong class="livingstyleguide--code-highlight">.button</strong> Test</code></pre>
52
- HTML
53
- end
54
-
55
- def test_text
56
- assert_markdown <<-HTML, 'text.md'
57
- <h2 class="livingstyleguide--headline" id="hello-world"><a class="livingstyleguide--anchor" href="#hello-world"></a>Hello World</h2>
58
- <p class="livingstyleguide--paragraph">Lorem ipsum <strong>dolor</strong> sit amet,
59
- <code class="livingstyleguide--code-span livingstyleguide--code">&lt;consectetur&gt; adipiscing</code> elit.
60
- Sed a pulvinar turpis.</p>
61
- <ul class="livingstyleguide--unordered-list">
62
- <li class="livingstyleguide--unordered-list-item">Lorem</li>
63
- <li class="livingstyleguide--unordered-list-item">Ipsum</li>
64
- <li class="livingstyleguide--unordered-list-item">Dolor</li>
65
- </ul>
66
- <h3 class="livingstyleguide--sub-headline" id="more-lorem"><a class="livingstyleguide--anchor" href="#more-lorem"></a>More Lorem</h3>
67
- <ol class="livingstyleguide--ordered-list">
68
- <li class="livingstyleguide--ordered-list-item">Lorem</li>
69
- <li class="livingstyleguide--ordered-list-item">Ipsum</li>
70
- <li class="livingstyleguide--ordered-list-item">Dolor</li>
71
- </ol>
72
- <h4 class="livingstyleguide--sub-sub-headline" id="even-more-lorem"><a class="livingstyleguide--anchor" href="#even-more-lorem"></a>Even More Lorem</h4>
73
- HTML
74
- end
75
-
76
- def test_code
77
- assert_markdown <<-HTML, 'code.md'
78
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code"><b><i>.my-class</i></b> {
79
- <b>color:</b> <b>red</b>;
80
- }</code></pre>
81
- HTML
82
- end
83
-
84
- def test_code_with_highlight
85
- assert_markdown <<-HTML, 'code-with-highlight.md'
86
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">.+<strong class="livingstyleguide--code-highlight">example</strong>.+</code></pre>
87
- HTML
88
- end
89
-
90
- def test_code_with_highlight_block
91
- assert_markdown <<-HTML, 'code-with-highlight-block.md'
92
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">.+<strong class="livingstyleguide--code-highlight-block">.+Block example.+</strong>.+</code></pre>
93
- HTML
94
- end
95
-
96
- def test_example_with_highlight
97
- assert_markdown <<-HTML, 'example-with-highlight.md'
98
- <div class="livingstyleguide--example">
99
- <img class="inline example">
100
- <img class="inline ex-1 ex-2">
101
- </div>
102
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">.+<strong class="livingstyleguide--code-highlight">example</strong>.+
103
- <strong class="livingstyleguide--code-highlight">ex-1</strong> <strong class="livingstyleguide--code-highlight">ex-2</strong>.+</code></pre>
104
- HTML
105
- end
106
-
107
- def test_variables
108
- assert_markdown <<-HTML, 'variables.md'
109
- <ul class="livingstyleguide--color-swatches -lsg-2-columns">
110
- <li class="livingstyleguide--color-swatch $blue">$blue</li>
111
- <li class="livingstyleguide--color-swatch $green">$green</li>
112
- </ul>
113
- HTML
114
- end
115
-
116
- def test_font_example
117
- assert_markdown <<-HTML, 'font-example.md'
118
- <div class="livingstyleguide--font-example" style="font: 16px Courier">
119
- ABCDEFGHIJKLMNOPQRSTUVWXYZ<br>
120
- abcdefghijklmnopqrstuvwxyz<br>
121
- 0123456789<br>
122
- !&/()$=@;:,.
123
- </div>
124
- HTML
125
- end
126
-
127
- def test_resetting_language
128
- assert_markdown <<-HTML, 'code-block-and-example.md', default_language: 'code'
129
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">Normal code block</code></pre><div class="livingstyleguide--example">
130
- Example
131
- </div>
132
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">Example</code></pre>
133
- HTML
134
- end
135
-
136
- end
@@ -1,19 +0,0 @@
1
- require 'test_helper'
2
- require 'tilt'
3
-
4
- describe "Sprockets integration" do
5
-
6
- describe "sprockets should know when to invalidate cache" do
7
- template = Tilt.new('test/fixtures/standalone/styleguide.html.lsg')
8
- context = Minitest::Mock.new
9
- %w(style.scss modules/_buttons.scss modules/_buttons.md styleguide.html.lsg).each do |file|
10
- context.expect :depend_on, nil, ["test/fixtures/standalone/#{file}"]
11
- end
12
-
13
- template.render context
14
-
15
- context.verify
16
- end
17
-
18
- end
19
-
@@ -1,68 +0,0 @@
1
- require 'test_helper'
2
- require 'tilt'
3
-
4
- class MarkdownTest < Minitest::Test
5
-
6
- def test_standalone_project
7
- html = render('test/fixtures/standalone/styleguide.html.lsg')
8
- assert_match %r(background: red), html
9
- assert_match %r(<button class="button">), html
10
- assert_match %r(<title>My Nice &amp; Beautiful Living Style Guide</title>), html
11
- end
12
-
13
- def test_default_source
14
- html = render('test/fixtures/standalone/style.html.lsg')
15
- assert_match %r(background: red), html
16
- assert_match %r(<button class="button">), html
17
- end
18
-
19
- def test_custom_styles
20
- html = render('test/fixtures/standalone/styleguide-with-style.html.lsg')
21
- assert_match %r(.livingstyleguide--ordered-list { color: red;), html
22
- assert_match %r(border-radius: 3px), html
23
- assert_match %r(em { color: green;), html
24
- end
25
-
26
- def test_javascript_includes
27
- html = render('test/fixtures/standalone/styleguide-with-javascript.html.lsg')
28
- assert_match %r(<script src="modernizr.js"></script>.*</head>), html
29
- assert_match %r(<script src="http://code.jquery.com/jquery-2.0.3.js"></script> <script src="application.js"></script> </body>), html
30
- end
31
-
32
- def test_additional_scss_code
33
- html = render('test/fixtures/standalone/styleguide-with-scss.html.lsg')
34
- assert_match %r(#test { color: red; }), html
35
- end
36
-
37
- def test_additional_sass_code
38
- html = render('test/fixtures/standalone/styleguide-with-sass.html.lsg')
39
- assert_match %r(#test { color: green; }), html
40
- end
41
-
42
- def test_header_footer
43
- html = render('test/fixtures/standalone/styleguide-with-header-footer.html.lsg')
44
- assert_match %r(<h1>Super Style Guide</h1>), html
45
- assert_match %r(<p>Made by me</p>), html
46
- end
47
-
48
- def test_json
49
- html = render('test/fixtures/standalone/styleguide-as-json.html.lsg')
50
- assert_match %r(<title>My Nice &amp; Beautiful Living Style Guide</title>), html
51
- assert_match %r(<script src="modernizr.js"></script>.*</head>), html
52
- assert_match %r(<script src="http://code.jquery.com/jquery-2.0.3.js"></script> <script src="application.js"></script> </body>), html
53
- assert_match %r(<h1>Super Style Guide</h1>), html
54
- assert_match %r(<p>Made by me</p>), html
55
- end
56
-
57
- def test_variables
58
- html = render('test/fixtures/standalone/styleguide.html.lsg')
59
- assert_match %r(\.\\\$my-base-color), html
60
- end
61
-
62
- private
63
- def render(file)
64
- Tilt.new(file).render.gsub(/\s+/, ' ')
65
- end
66
-
67
- end
68
-
@@ -1,33 +0,0 @@
1
- require 'test_helper'
2
- require 'fileutils'
3
- require 'compass'
4
- require 'compass/logger'
5
- require 'sass/plugin'
6
-
7
- class VariablesImporterTest < Minitest::Test
8
-
9
- def setup
10
- Compass.configure_sass_plugin!
11
- end
12
-
13
- def render(scss)
14
- scss = %Q(@import "compass"; #{scss})
15
- options = Compass.sass_engine_options
16
- options[:line_comments] = false
17
- options[:style] = :expanded
18
- options[:syntax] = :scss
19
- options[:compass] ||= {}
20
- options[:compass][:logger] ||= Compass::NullLogger.new
21
- css = Sass::Engine.new(scss, options).render
22
- format_css(css)
23
- end
24
-
25
- def format_css(css)
26
- css.gsub! %Q(@charset "UTF-8";), ''
27
- css.gsub! %r(\n), "\n "
28
- css.gsub! %r( +$), ''
29
- css.gsub! %r(\n\n+), "\n"
30
- css.strip!
31
- %Q( #{css}\n)
32
- end
33
- end
data/test/test_helper.rb DELETED
@@ -1,28 +0,0 @@
1
- require 'minitest/autorun'
2
- require 'compass'
3
- require 'livingstyleguide'
4
- require 'heredoc_unindent'
5
-
6
- Compass.configuration.add_import_path File.join(%w(test fixtures stylesheets))
7
-
8
- def parse_file(filename)
9
- filename = File.join(File.dirname(__FILE__), 'fixtures', filename.split('/'))
10
- syntax = filename[-4..-1].to_sym
11
- syntax = :scss unless [:scss, :sass].include?(syntax)
12
- options = {
13
- :filename => filename,
14
- :load_paths => [File.dirname(filename), LivingStyleGuide::Importer.instance],
15
- :syntax => syntax,
16
- :cache => false,
17
- :read_cache => false
18
- }
19
- Sass::Engine.new(File.read(filename), options)
20
- end
21
-
22
- def normalize(html)
23
- html.gsub! /\s+/, ' '
24
- html.gsub! '><', '> <'
25
- html.strip!
26
- html
27
- end
28
-
@@ -1,53 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe LivingStyleGuide::CodeBlock do
4
-
5
- before do
6
- @code_block = Class.new(LivingStyleGuide::CodeBlock)
7
- end
8
-
9
- describe "when no language is given" do
10
- it "should output the code" do
11
- @code_block.new("My Code").render.must_equal <<-HTML.unindent.strip
12
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">My Code</code></pre>
13
- HTML
14
- end
15
-
16
- it "should html escape the code" do
17
- @code_block.new("1 < 2 > 0 &\"").render.must_equal <<-HTML.unindent.strip
18
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">1 &lt; 2 &gt; 0 &amp;"</code></pre>
19
- HTML
20
- end
21
- end
22
-
23
- describe "when a language is given" do
24
- it "should output the code with syntax highlighting" do
25
- @code_block.new("<my-code>", :html).render.must_equal <<-HTML.unindent.strip
26
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code"><b>&lt;<em>my-code</em></b><b>&gt;</b></code></pre>
27
- HTML
28
- end
29
- end
30
-
31
- describe "when filters are set" do
32
- it "should filter the code" do
33
- @code_block.filter_code do |code|
34
- code.gsub(/ugly/, 'beautiful')
35
- end
36
-
37
- @code_block.new("my ugly code").render.must_equal <<-HTML.unindent.strip
38
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">my beautiful code</code></pre>
39
- HTML
40
- end
41
-
42
- it "should use own syntax highlighter" do
43
- @code_block.syntax_highlight do |code|
44
- code.gsub(/language/, language)
45
- end
46
-
47
- @code_block.new("my ugly language code", "html").render.must_equal <<-HTML.unindent.strip
48
- <pre class="livingstyleguide--code-block"><code class="livingstyleguide--code">my ugly html code</code></pre>
49
- HTML
50
- end
51
- end
52
- end
53
-