docks_theme_base 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +15 -0
  2. data/.editorconfig +8 -0
  3. data/.gitignore +22 -0
  4. data/.rubocop.yml +14 -0
  5. data/.travis.yml +10 -0
  6. data/Gemfile +4 -0
  7. data/README.md +3 -0
  8. data/Rakefile +3 -0
  9. data/assets/images/icons.svg +63 -0
  10. data/assets/scripts/coffeescript/pattern_library_helpers.coffee +0 -0
  11. data/assets/scripts/javascript/pattern_library_helpers.js +0 -0
  12. data/assets/scripts/pattern_library.js +1 -0
  13. data/assets/scripts/pattern_library_demo.js +0 -0
  14. data/assets/styles/less/pattern-library-helpers.less +0 -0
  15. data/assets/styles/pattern-library-demo.css +0 -0
  16. data/assets/styles/pattern-library.css +0 -0
  17. data/assets/styles/sass/pattern-library-helpers.sass +0 -0
  18. data/assets/styles/scss/pattern-library-helpers.scss +0 -0
  19. data/assets/styles/stylus/pattern-library-helpers.styl +0 -0
  20. data/assets/templates/erb/demo.erb +1 -0
  21. data/assets/templates/erb/layouts/demo.erb +14 -0
  22. data/assets/templates/erb/layouts/pattern.erb +11 -0
  23. data/assets/templates/erb/partials/sidebar.erb +5 -0
  24. data/assets/templates/erb/pattern.erb +3 -0
  25. data/assets/templates/haml/demo.haml +1 -0
  26. data/assets/templates/haml/layouts/demo.haml +10 -0
  27. data/assets/templates/haml/layouts/pattern.haml +8 -0
  28. data/assets/templates/haml/partials/sidebar.haml +3 -0
  29. data/assets/templates/haml/pattern.haml +2 -0
  30. data/assets/templates/slim/demo.slim +1 -0
  31. data/assets/templates/slim/layouts/demo.slim +9 -0
  32. data/assets/templates/slim/layouts/pattern.slim +7 -0
  33. data/assets/templates/slim/partials/sidebar.slim +4 -0
  34. data/assets/templates/slim/pattern.slim +2 -0
  35. data/docks_theme_base.gemspec +34 -0
  36. data/lib/docks_theme_base.rb +1 -0
  37. data/lib/docks_theme_base/assets.rb +44 -0
  38. data/lib/docks_theme_base/theme.rb +48 -0
  39. data/spec/fixtures/assets/scripts/pattern_library.js +0 -0
  40. data/spec/fixtures/assets/styles/pattern-library.css +0 -0
  41. data/spec/lib/assets_spec.rb +65 -0
  42. data/spec/lib/theme_spec.rb +68 -0
  43. data/spec/spec_helper.rb +15 -0
  44. data/tasks/rspec.rake +7 -0
  45. data/tasks/rubocop.rake +8 -0
  46. data/tasks/templates.rake +51 -0
  47. metadata +234 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OGUyMzJmMGJiNjA5M2YyNjMxOGJmYjAzNGFjNDM3NTY1OTBhOWQ4YQ==
5
+ data.tar.gz: !binary |-
6
+ MDA5YTI5OWQ5MjVjZDRhZWE3NGQzYTRjYmQwMDg4MTZiYjMxMWE0MA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MGE2YTQ0NzYzNTE2ZWE4Zjc4NGU2NjdmZGYwNjU2YWY3NzIzM2YwYjAzNjNm
10
+ NjI3OTgzYTU1ODk5MTNhZjY3MzA2NmQ5NmYxYmI2ZDgwMGFkNmNhODQ5YjQ1
11
+ OWJhOTJjYzBkOGNhZjE3M2I0YzYxZGQxNjczYjVkMmE2NDk5YTA=
12
+ data.tar.gz: !binary |-
13
+ NTNlNTEyZTJhYTk4NGIzMmE5YzMxNDkxOTUxZTY2ZDJiY2JkNTE5ZDU1N2Rl
14
+ NTBmMTNiODY4ZDhiZGUxYjkzM2M0MWM5NTBlZjFlZTdjNjQxYjM4N2ZmNjdk
15
+ ZWRjZjYzZTEyNzQ3YjEzMzRiZmYxY2U2NTNlNzI2Zjk1OTMwMjQ=
data/.editorconfig ADDED
@@ -0,0 +1,8 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ trim_trailing_whitespace = true
7
+ end_of_line = lf
8
+ insert_final_newline = true
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .ruby-version
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ .docks
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ tmp
17
+ *.bundle
18
+ *.so
19
+ *.o
20
+ *.a
21
+ mkmf.log
22
+ */.*
data/.rubocop.yml ADDED
@@ -0,0 +1,14 @@
1
+ Documentation:
2
+ Enabled: false
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/MultilineOperationIndentation:
8
+ Enabled: false
9
+
10
+ Metrics/MethodLength:
11
+ Max: 12
12
+
13
+ Metrics/LineLength:
14
+ Max: 100
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1
6
+ - 2.2
7
+ - rbx-2
8
+ - ruby-head
9
+ notifications:
10
+ slack: lemon:SeSji4OVQ1qGtQ2Gg2iTLCge
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in docks.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Docks Theme - Base
2
+
3
+ [![Build Status](https://travis-ci.org/docks-app/base_theme.svg?branch=master)](https://travis-ci.org/docks-app/base_theme)
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Dir.glob('tasks/**/*.rake').each(&method(:import))
@@ -0,0 +1,63 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
2
+ <symbol id="icon--small" viewBox="0 0 24 24">
3
+ <g fill-rule="evenodd" stroke-width="0">
4
+ <path d="M6,3.99079514 C6,2.89130934 6.90195036,2 8.0085302,2 L15.9914698,2 C17.1007504,2 18,2.89821238 18,3.99079514 L18,20.0092049 C18,21.1086907 17.0980496,22 15.9914698,22 L8.0085302,22 C6.8992496,22 6,21.1017876 6,20.0092049 L6,3.99079514 Z M7,4.85714286 L17,4.85714286 L17,19.1428571 L7,19.1428571 L7,4.85714286 Z"></path>
5
+ </g>
6
+ </symbol>
7
+
8
+ <symbol id="icon--medium" viewBox="0 0 24 24">
9
+ <g fill-rule="evenodd" stroke-width="0">
10
+ <path d="M4,3.99079514 C4,2.89130934 4.89451376,2 5.99406028,2 L18.0059397,2 C19.1072288,2 20,2.89821238 20,3.99079514 L20,20.0092049 C20,21.1086907 19.1054862,22 18.0059397,22 L5.99406028,22 C4.8927712,22 4,21.1017876 4,20.0092049 L4,3.99079514 Z M5.81666667,5.85526316 L18.1833333,5.85526316 L18.1833333,18.1447368 L5.81666667,18.1447368 L5.81666667,5.85526316 Z"></path>
11
+ </g>
12
+ </symbol>
13
+
14
+ <symbol id="icon--large" viewBox="0 0 24 24">
15
+ <g fill-rule="evenodd" transform="translate(-1.000000, 2.000000)" stroke-width="0">
16
+ <path d="M1,2.23743875 C1,1.13300857 1.89702623,0.237691002 3.00494659,0.237691002 L22.9950534,0.237691002 C24.1023548,0.237691002 25,1.13184161 25,2.23743875 L25,14.0274169 C25,15.1318471 24.1029738,16.0271647 22.9950534,16.0271647 L3.00494659,16.0271647 C1.89764516,16.0271647 1,15.1330141 1,14.0274169 L1,2.23743875 Z M3,3.00247329 C3,2.44882258 3.45530558,2 3.99180311,2 L22.0081969,2 C22.5559546,2 23,2.45576096 23,3.00247329 L23,12.9975267 C23,13.5511774 22.5446944,14 22.0081969,14 L3.99180311,14 C3.44404538,14 3,13.544239 3,12.9975267 L3,3.00247329 Z"></path>
17
+ <path d="M7.91567568,18.9473684 C8.27128383,18.0676681 8.97945946,14.7368421 8.97945946,14.7368421 L16.4259459,14.7368421 C16.4259459,14.7368421 16.9944086,17.7220474 17.4897297,18.9473684 C17.7035978,19.4764333 17.7880593,19.3809366 17.7880593,19.3809366 C18.210808,19.7228359 18.109085,20 17.5558398,20 L7.84956557,20 C7.29856561,20 7.25119089,19.8016913 7.64361042,19.4267911 C7.64361042,19.4267911 7.56209464,19.8220541 7.91567568,18.9473684 Z"></path>
18
+ </g>
19
+ </symbol>
20
+
21
+ <symbol id="icon--full" viewBox="0 0 24 24">
22
+ <g stroke-linecap="round" transform="translate(3.000000, 3.000000)" fill="none">
23
+ <path d="M0.904761905,17.1000002 L17.8484848,0.551612906"></path>
24
+ <path d="M7.34937611,17.8411765 L0,17.8411765 L0,10.8"></path>
25
+ <path d="M18.206519,7.04117647 L10.8571429,7.04117647 L10.8571429,0" transform="translate(14.531831, 3.520588) scale(-1, -1) translate(-14.531831, -3.520588) "></path>
26
+ </g>
27
+ </symbol>
28
+
29
+ <symbol id="icon--github" viewBox="0 0 36 36">
30
+ <g stroke="none" fill-rule="evenodd">
31
+ <path d="M0,19.6892308 C0,22.6430769 0.45,25 1.35,26.76 C2.3125,28.6307692 3.80625,30.0153846 5.83125,30.9138462 C7.88125,31.8615385 9.975,32.4461538 12.1125,32.6676923 C14.0375,32.8892308 16.1125,33 18.3375,33 C19.3,33 20.50625,32.9630769 21.95625,32.8892308 C23.16875,32.8153846 24.459375,32.6523077 25.828125,32.4 C27.196875,32.1476923 28.375,31.8184615 29.3625,31.4123077 C30.4875,30.9446154 31.525,30.3138462 32.475,29.52 C33.425,28.7261538 34.1625,27.8061538 34.6875,26.76 C35.5625,25 36,22.6430769 36,19.6892308 C36,16.3169231 35.01875,13.4984615 33.05625,11.2338462 C33.44375,10.0892308 33.6375,8.88923077 33.6375,7.63384615 C33.6375,5.97230769 33.275,4.42769231 32.55,3 C31.0625,3 29.734375,3.25846154 28.565625,3.77538462 C27.396875,4.29230769 26.0125,5.16615385 24.4125,6.39692308 C22.45,5.94153846 20.425,5.71384615 18.3375,5.71384615 C16.0625,5.71384615 13.8375,5.96 11.6625,6.45230769 C10.025,5.18461538 8.621875,4.29230769 7.453125,3.77538462 C6.284375,3.25846154 4.95625,3 3.46875,3 C2.73125,4.41538462 2.3625,5.96 2.3625,7.63384615 C2.3625,8.90153846 2.55625,10.1138462 2.94375,11.2707692 C0.98125,13.5353846 9.2821925e-15,16.3415385 9.2821925e-15,19.6892308 L0,19.6892308 Z M4.8375,23.4369231 C4.8375,21.6892308 5.346875,20.2307692 6.365625,19.0615385 C7.384375,17.8923077 8.725,17.3076923 10.3875,17.3076923 C11.05,17.3076923 12.45625,17.4615385 14.60625,17.7692308 C15.70625,17.9292308 16.8375,18.0092308 18,18.0092308 C19.1625,18.0092308 20.3,17.9292308 21.4125,17.7692308 C23.6,17.4615385 25.00625,17.3076923 25.63125,17.3076923 C27.29375,17.3076923 28.63125,17.8923077 29.64375,19.0615385 C30.65625,20.2307692 31.1625,21.6892308 31.1625,23.4369231 C31.1625,24.68 30.93125,25.7753846 30.46875,26.7230769 C30.00625,27.6338462 29.428125,28.3569231 28.734375,28.8923077 C28.040625,29.4276923 27.15625,29.8553846 26.08125,30.1753846 C24.30625,30.7046154 22.21875,30.9692308 19.81875,30.9692308 L16.18125,30.9692308 C14.99375,30.9692308 13.91875,30.9138462 12.95625,30.8030769 C11.93125,30.7046154 10.9,30.4892308 9.8625,30.1569231 C8.825,29.8246154 7.96875,29.4061538 7.29375,28.9015385 C6.55625,28.3353846 5.9625,27.5815385 5.5125,26.64 C5.0625,25.6984615 4.8375,24.6307692 4.8375,23.4369231 L4.8375,23.4369231 Z M8.30625,23.4369231 C8.30625,24.0153846 8.4,24.6 8.5875,25.1907692 C8.775,25.8307692 9.096875,26.3815385 9.553125,26.8430769 C10.009375,27.3046154 10.51875,27.5353846 11.08125,27.5353846 C11.68125,27.5353846 12.20625,27.2953846 12.65625,26.8153846 C13.44375,25.9169231 13.8375,24.7907692 13.8375,23.4369231 C13.8375,22.8707692 13.75625,22.2923077 13.59375,21.7015385 C13.40625,21.0615385 13.084375,20.5107692 12.628125,20.0492308 C12.171875,19.5876923 11.65625,19.3569231 11.08125,19.3569231 C10.48125,19.3569231 9.95625,19.6030769 9.50625,20.0953846 C8.70625,20.9446154 8.30625,22.0584615 8.30625,23.4369231 L8.30625,23.4369231 Z M22.1625,23.4369231 C22.1625,24.0153846 22.25625,24.6 22.44375,25.1907692 C22.63125,25.8307692 22.95,26.3815385 23.4,26.8430769 C23.85,27.3046154 24.35625,27.5353846 24.91875,27.5353846 C25.53125,27.5353846 26.0625,27.2953846 26.5125,26.8153846 C27.3,25.9169231 27.69375,24.7907692 27.69375,23.4369231 C27.69375,22.9076923 27.60625,22.3292308 27.43125,21.7015385 C27.24375,21.0615385 26.921875,20.5107692 26.465625,20.0492308 C26.009375,19.5876923 25.49375,19.3569231 24.91875,19.3569231 C24.31875,19.3569231 23.80625,19.6030769 23.38125,20.0953846 C22.56875,20.9446154 22.1625,22.0584615 22.1625,23.4369231 L22.1625,23.4369231 Z"></path>
32
+ </g>
33
+ </symbol>
34
+
35
+ <symbol id="icon--search" viewBox="0 0 24 24">
36
+ <g id="search" fill="none" stroke-width="2">
37
+ <ellipse cx="14.3913043" cy="8.66666667" rx="6.60869565" ry="6.66666667"></ellipse>
38
+ <path d="M9.84782609,14.0833333 L2.41304348,21.5833333" stroke-linecap="round"></path>
39
+ </g>
40
+ </symbol>
41
+
42
+ <symbol id="icon--code" viewBox="0 0 36 36">
43
+ <g id="search" fill="none">
44
+ <path d="M16,11 L16,23 L4,23" transform="translate(10.000000, 17.000000) rotate(-225.000000) translate(-10.000000, -17.000000)"></path>
45
+ <path d="M32,11 L32,23 L20,23" transform="translate(26.000000, 17.000000) rotate(-45.000000) translate(-26.000000, -17.000000)"></path>
46
+ <path d="M12.5,30.5 L23.5,4.5"></path>
47
+ </g>
48
+ </symbol>
49
+
50
+ <symbol id="icon--script" viewBox="0 0 36 36">
51
+ <g stroke-width="0" fill-rule="evenodd">
52
+ <path d="M14.8691406,30.6054688 L13.8574219,30.6054688 C12.0982985,30.6054688 10.7903689,30.193038 9.93359375,29.3681641 C9.07681863,28.5432901 8.6484375,27.2923261 8.6484375,25.6152344 L8.6484375,20.9121094 C8.6484375,20.4654926 8.59830779,20.0667335 8.49804688,19.7158203 C8.39778596,19.3649071 8.22233198,19.0686861 7.97167969,18.8271484 C7.72102739,18.5856108 7.38834843,18.4010423 6.97363281,18.2734375 C6.5589172,18.1458327 6.03711252,18.0820312 5.40820312,18.0820312 L4.8203125,18.0820312 L4.8203125,16.1816406 L5.40820312,16.1816406 C6.07357104,16.1816406 6.61588332,16.1269537 7.03515625,16.0175781 C7.45442918,15.9082026 7.7825509,15.7418631 8.01953125,15.5185547 C8.2565116,15.2952463 8.42057246,15.0104184 8.51171875,14.6640625 C8.60286504,14.3177066 8.6484375,13.9075545 8.6484375,13.4335938 L8.6484375,10.1933594 C8.6484375,9.42773055 8.73958242,8.73730776 8.921875,8.12207031 C9.10416758,7.50683286 9.4026672,6.98274956 9.81738281,6.54980469 C10.2320984,6.11685981 10.7698535,5.78418085 11.4306641,5.55175781 C12.0914747,5.31933478 12.9003858,5.203125 13.8574219,5.203125 L14.8691406,5.203125 L14.8691406,8.12207031 L14.0625,8.12207031 C11.9479061,8.12207031 12,8.14256787 12,10.1933594 L12,13.3789062 C12,15.6028757 11.0384211,16.8561184 9.11523438,17.1386719 C11.0566503,17.3300791 12.0273438,18.5787645 12.0273438,20.8847656 L12.0273438,25.5605469 C12.0273438,27.6477969 11.9661354,28.6914062 14.0625,28.6914062 L14.8691406,28.6914062 L14.8691406,30.6054688 Z"></path>
53
+ <path d="M31.8691406,30.6054688 L30.8574219,30.6054688 C29.0982985,30.6054688 27.7903689,30.193038 26.9335937,29.3681641 C26.0768186,28.5432901 25.6484375,27.2923261 25.6484375,25.6152344 L25.6484375,20.9121094 C25.6484375,20.4654926 25.5983078,20.0667335 25.4980469,19.7158203 C25.397786,19.3649071 25.222332,19.0686861 24.9716797,18.8271484 C24.7210274,18.5856108 24.3883484,18.4010423 23.9736328,18.2734375 C23.5589172,18.1458327 23.0371125,18.0820312 22.4082031,18.0820312 L21.8203125,18.0820312 L21.8203125,16.1816406 L22.4082031,16.1816406 C23.073571,16.1816406 23.6158833,16.1269537 24.0351562,16.0175781 C24.4544292,15.9082026 24.7825509,15.7418631 25.0195312,15.5185547 C25.2565116,15.2952463 25.4205725,15.0104184 25.5117187,14.6640625 C25.602865,14.3177066 25.6484375,13.9075545 25.6484375,13.4335938 L25.6484375,10.1933594 C25.6484375,9.42773055 25.7395824,8.73730776 25.921875,8.12207031 C26.1041676,7.50683286 26.4026672,6.98274956 26.8173828,6.54980469 C27.2320984,6.11685981 27.7698535,5.78418085 28.4306641,5.55175781 C29.0914747,5.31933478 29.9003858,5.203125 30.8574219,5.203125 L31.8691406,5.203125 L31.8691406,8.12207031 L31.0625,8.12207031 C28.9479061,8.12207031 29,8.14256787 29,10.1933594 L29,13.3789062 C29,15.6028757 28.0384211,16.8561184 26.1152344,17.1386719 C28.0566503,17.3300791 29.0273437,18.5787645 29.0273437,20.8847656 L29.0273437,25.5605469 C29.0273437,27.6477969 28.9661354,28.6914062 31.0625,28.6914062 L31.8691406,28.6914062 L31.8691406,30.6054688 Z" transform="translate(26.844727, 17.904297) rotate(-180.000000) translate(-26.844727, -17.904297) "></path>
54
+ </g>
55
+ </symbol>
56
+
57
+ <symbol id="icon--eye" viewBox="0 0 24 24">
58
+ <g fill="none">
59
+ <path vector-effect="non-scaling-stroke" d="M12,20 C18.0751322,20 21.8566454,13.6189194 21.8566454,13.6189194 C22.4881027,12.7248149 22.5054618,11.2617188 21.8417669,10.361776 C21.8417669,10.361776 18.0751322,4 12,4 C5.92486775,4 2.14335456,10.3810806 2.14335456,10.3810806 C1.51189727,11.2751851 1.49453823,12.7382812 2.15823314,13.638224 C2.15823314,13.638224 5.92486775,20 12,20 Z"></path>
60
+ <circle cx="12" cy="12" r="4" vector-effect="non-scaling-stroke"></circle>
61
+ </g>
62
+ </symbol>
63
+ </svg>
@@ -0,0 +1 @@
1
+ alert("Using the Base theme!");
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ <%= demo %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= docks_stylesheet(:demo) %>
5
+ <%= compiled_style_tags %>
6
+ </head>
7
+
8
+ <body>
9
+ <%= yield %>
10
+
11
+ <%= docks_javascript(:demo) %>
12
+ <%= compiled_script_tags %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= docks_stylesheet %>
5
+ <%= compiled_style_tags %>
6
+ </head>
7
+
8
+ <body>
9
+ <%= yield %>
10
+ </body>
11
+ </html>
@@ -0,0 +1,5 @@
1
+ <ul>
2
+ <% @pattern_library.patterns.each do |patterns| %>
3
+ <li><%= patterns.name %></li>
4
+ <% end %>
5
+ </ul>
@@ -0,0 +1,3 @@
1
+ <% render_everything %>
2
+
3
+ <%= @pattern_library %>
@@ -0,0 +1 @@
1
+ = demo
@@ -0,0 +1,10 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{content: "text/html; charset=US-ASCII", "http-equiv" => "Content-Type"}/
5
+ = docks_stylesheet(:demo)
6
+ = compiled_style_tags
7
+ %body
8
+ = yield
9
+ = docks_javascript(:demo)
10
+ = compiled_script_tags
@@ -0,0 +1,8 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{content: "text/html; charset=US-ASCII", "http-equiv" => "Content-Type"}/
5
+ = docks_stylesheet
6
+ = compiled_style_tags
7
+ %body
8
+ = yield
@@ -0,0 +1,3 @@
1
+ %ul
2
+ - @pattern_library.patterns.each do |patterns|
3
+ %li= patterns.name
@@ -0,0 +1,2 @@
1
+ - render_everything
2
+ = @pattern_library
@@ -0,0 +1 @@
1
+ = demo
@@ -0,0 +1,9 @@
1
+ doctype html
2
+ html
3
+ head
4
+ = docks_stylesheet(:demo)
5
+ = compiled_style_tags
6
+ body
7
+ = yield
8
+ = docks_javascript(:demo)
9
+ = compiled_script_tags
@@ -0,0 +1,7 @@
1
+ doctype html
2
+ html
3
+ head
4
+ = docks_stylesheet
5
+ = compiled_style_tags
6
+ body
7
+ = yield
@@ -0,0 +1,4 @@
1
+ ul
2
+ - @pattern_library.patterns.each do |patterns|
3
+ li
4
+ = patterns.name
@@ -0,0 +1,2 @@
1
+ - render_everything
2
+ = @pattern_library
@@ -0,0 +1,34 @@
1
+ require "rubygems"
2
+
3
+ # -*- encoding: utf-8 -*-
4
+ $:.push File.expand_path("../lib", __FILE__)
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "docks_theme_base"
8
+ s.version = "1.0.2"
9
+ s.platform = Gem::Platform::RUBY
10
+ s.required_ruby_version = ">= 1.9.3"
11
+ s.authors = ["Chris Sauve"]
12
+ s.email = ["chrismsauve@gmail.com"]
13
+ s.license = "MIT"
14
+ s.homepage = "http://github.com/docks-app/docks_theme_base"
15
+ s.summary = "An base theme for Docks."
16
+ s.description = s.summary
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- spec/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_runtime_dependency "activesupport"
24
+ s.add_runtime_dependency "docks_app"
25
+
26
+ s.add_development_dependency "bundler", "~> 1.3"
27
+ s.add_development_dependency "rubocop", "< 1.0"
28
+ s.add_development_dependency "rake", "~> 10.4"
29
+ s.add_development_dependency "rspec", "~> 3.0"
30
+ s.add_development_dependency "awesome_print", "~> 1.6"
31
+ s.add_development_dependency "rspec-html-matchers", "~> 0.7"
32
+ s.add_development_dependency "html2haml", "~> 2.0"
33
+ s.add_development_dependency "html2slim", "~> 0.2"
34
+ end
@@ -0,0 +1 @@
1
+ require_relative "docks_theme_base/theme.rb"
@@ -0,0 +1,44 @@
1
+ require "pathname"
2
+ require "docks/errors"
3
+
4
+ module Docks
5
+ module Themes
6
+ class Assets
7
+ attr_reader :root, :source_root
8
+
9
+ def initialize(options)
10
+ @root = Pathname.new(options.fetch(:root))
11
+
12
+ source = options.fetch(:source_root, false)
13
+ @source_root = source && Pathname.new(source)
14
+ end
15
+
16
+ def path_for(*asset_path)
17
+ asset_path = File.join(*asset_path)
18
+ path = root + asset_path
19
+ source_path = source_root && source_root + asset_path
20
+
21
+ if path.exist?
22
+ path
23
+ elsif source_path && source_path.exist?
24
+ source_path
25
+ else
26
+ fail Docks::NoAssetError,
27
+ "No asset matching '#{asset_path}' was found in the asset folders."
28
+ end
29
+ end
30
+
31
+ def files_for(*asset_path)
32
+ Dir[root + File.join(asset_path)]
33
+ end
34
+
35
+ def scripts
36
+ files_for("scripts/*.js")
37
+ end
38
+
39
+ def styles
40
+ files_for("styles/*.css")
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,48 @@
1
+ require "singleton"
2
+
3
+ require_relative "assets.rb"
4
+
5
+ module Docks
6
+ module Themes
7
+ class Base
8
+ include Singleton
9
+
10
+ attr_reader :assets
11
+
12
+ def initialize
13
+ @assets = Assets.new(root: File.expand_path("../../../assets", __FILE__))
14
+ end
15
+
16
+ def styles
17
+ assets.styles
18
+ end
19
+
20
+ def scripts
21
+ assets.scripts
22
+ end
23
+
24
+ def setup(builder)
25
+ setup_styles(builder, builder.options.style_language)
26
+ setup_scripts(builder, builder.options.script_language)
27
+ setup_templates(builder, builder.options.template_language)
28
+ end
29
+
30
+ def configure(_config)
31
+ end
32
+
33
+ private
34
+
35
+ def setup_styles(builder, language)
36
+ builder.add_assets(assets.files_for("styles/#{language}/**/*.*"), type: :styles, root: assets.path_for("styles/#{language}"))
37
+ end
38
+
39
+ def setup_scripts(builder, language)
40
+ builder.add_assets(assets.files_for("scripts/#{language}/**/*.*"), type: :scripts, root: assets.path_for("scripts/#{language}"))
41
+ end
42
+
43
+ def setup_templates(builder, language)
44
+ builder.add_assets(assets.files_for("templates/#{language}/**/*.*"), type: :templates, root: assets.path_for("templates/#{language}"))
45
+ end
46
+ end
47
+ end
48
+ end
File without changes
File without changes
@@ -0,0 +1,65 @@
1
+ require "spec_helper"
2
+
3
+ describe Docks::Themes::Assets do
4
+ let(:root) { File.expand_path("../../fixtures/assets", __FILE__) }
5
+ let(:source_root) { File.expand_path("../source", root) }
6
+
7
+ subject { described_class.new(root: root, source_root: source_root) }
8
+
9
+ describe ".path_for" do
10
+ around do |example|
11
+ FileUtils.mkdir_p(source_root)
12
+ example.run
13
+ FileUtils.rm_rf(source_root)
14
+ end
15
+
16
+ it "returns a pathname object for the passed asset" do
17
+ path = subject.path_for("styles/pattern-library.css")
18
+ expect(path).to be_a Pathname
19
+ expect(path).to eq Pathname.new(File.join(root, "styles/pattern-library.css"))
20
+ end
21
+
22
+ it "returns a pathname for a directory" do
23
+ path = subject.path_for("styles")
24
+ expect(path).to eq Pathname.new(File.join(root, "styles"))
25
+ end
26
+
27
+ it "joins parts of the file that were passed" do
28
+ path = subject.path_for("styles", "pattern-library.css")
29
+ expect(path).to eq Pathname.new(File.join(root, "styles/pattern-library.css"))
30
+ end
31
+
32
+ it "throws when the requested file does not exist" do
33
+ expect { subject.path_for("foo/bar.js") }.to raise_error(Docks::NoAssetError)
34
+ end
35
+
36
+ it "provides links to source assets" do
37
+ expected = File.expand_path("components/avatar.scss", source_root)
38
+ FileUtils.mkdir_p(File.dirname(expected))
39
+ FileUtils.touch(expected)
40
+ expect(subject.path_for("components", "avatar.scss")).to eq Pathname.new File.expand_path("components/avatar.scss", source_root)
41
+ end
42
+ end
43
+
44
+ describe ".files_for" do
45
+ it "returns the list of files matching the path" do
46
+ expect(subject.files_for("styles/**/*")).to eq Dir[File.join(root, "styles/**/*")]
47
+ end
48
+ end
49
+
50
+ describe ".scripts" do
51
+ it "returns all compiled scripts" do
52
+ compiled_scripts = Dir[File.expand_path("scripts/*.js", root)]
53
+ expect(compiled_scripts).not_to be_empty
54
+ expect(subject.scripts).to eq compiled_scripts
55
+ end
56
+ end
57
+
58
+ describe ".styles" do
59
+ it "returns all compiled styles" do
60
+ compiled_styles = Dir[File.expand_path("styles/*.css", root)]
61
+ expect(compiled_styles).not_to be_empty
62
+ expect(subject.styles).to eq compiled_styles
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,68 @@
1
+ require "spec_helper"
2
+
3
+ describe Docks::Themes::Base do
4
+ subject { described_class.instance }
5
+
6
+ let(:asset_root) { File.expand_path("../../../assets", __FILE__) }
7
+
8
+ describe "#styles" do
9
+ it "has all of the compiled styles" do
10
+ expect(subject.styles).to eq Dir[File.join(asset_root, "styles/*.*")]
11
+ end
12
+ end
13
+
14
+ describe "#scripts" do
15
+ it "has all of the compiled scripts" do
16
+ expect(subject.scripts).to eq Dir[File.join(asset_root, "scripts/*.*")]
17
+ end
18
+ end
19
+
20
+ describe "#setup" do
21
+ let(:builder) do
22
+ double(options: OpenStruct.new(style_language: "scss", script_language: "javascript", template_language: "erb"))
23
+ end
24
+
25
+ before(:each) do
26
+ allow(builder).to receive(:add_assets)
27
+ end
28
+
29
+ it "adds style files" do
30
+ subject.setup(builder)
31
+ expect(builder).to have_received(:add_assets).with Dir[File.join(asset_root, "styles/scss/**/*.*")], type: :styles, root: Pathname.new(File.join(asset_root, "styles/scss"))
32
+ end
33
+
34
+ it "adds script files" do
35
+ subject.setup(builder)
36
+ expect(builder).to have_received(:add_assets).with Dir[File.join(asset_root, "scripts/javascript/**/*.*")], type: :scripts, root: Pathname.new(File.join(asset_root, "scripts/javascript"))
37
+ end
38
+
39
+ it "adds template files" do
40
+ subject.setup(builder)
41
+ expect(builder).to have_received(:add_assets).with Dir[File.join(asset_root, "templates/erb/**/*.*")], type: :templates, root: Pathname.new(File.join(asset_root, "templates/erb"))
42
+ end
43
+
44
+ it "adds style files of a custom language" do
45
+ builder.options.style_language = "less"
46
+ subject.setup(builder)
47
+ expect(builder).to have_received(:add_assets).with Dir[File.join(asset_root, "styles/less/**/*.*")], type: :styles, root: Pathname.new(File.join(asset_root, "styles/less"))
48
+ end
49
+
50
+ it "adds script files of a custom language" do
51
+ builder.options.script_language = "coffeescript"
52
+ subject.setup(builder)
53
+ expect(builder).to have_received(:add_assets).with Dir[File.join(asset_root, "scripts/coffeescript/**/*.*")], type: :scripts, root: Pathname.new(File.join(asset_root, "scripts/coffeescript"))
54
+ end
55
+
56
+ it "adds template files of a custom language" do
57
+ builder.options.template_language = "haml"
58
+ subject.setup(builder)
59
+ expect(builder).to have_received(:add_assets).with Dir[File.join(asset_root, "templates/haml/**/*.*")], type: :templates, root: Pathname.new(File.join(asset_root, "templates/haml"))
60
+ end
61
+ end
62
+
63
+ describe "#configure" do
64
+ it "has a #configure method" do
65
+ expect(subject).to respond_to(:configure)
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,15 @@
1
+ require "docks_theme_base"
2
+ require "fileutils"
3
+ require "ostruct"
4
+ require "awesome_print"
5
+ require "rspec-html-matchers"
6
+
7
+ RSpec.configure do |config|
8
+ config.include RSpecHtmlMatchers
9
+
10
+ config.order = "random"
11
+
12
+ config.mock_with :rspec do |c|
13
+ c.syntax = :expect
14
+ end
15
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,7 @@
1
+ require "rspec/core/rake_task"
2
+
3
+ RSpec::Core::RakeTask.new(:spec) do |task|
4
+ task.rspec_opts = "--color --tty"
5
+ end
6
+
7
+ task default: :spec
@@ -0,0 +1,8 @@
1
+ require "rubocop/rake_task"
2
+
3
+ desc "Run RuboCop on the lib directory"
4
+
5
+ RuboCop::RakeTask.new(:rubocop) do |task|
6
+ task.patterns = %w(lib/**/*.rb)
7
+ task.fail_on_error = false
8
+ end
@@ -0,0 +1,51 @@
1
+ require "html2haml"
2
+ require "html2slim"
3
+ require "fileutils"
4
+ require "docks/messenger"
5
+
6
+ def from_root(file)
7
+ file.sub(File.expand_path("../../", __FILE__), "").sub(/^#{File::SEPARATOR}/, "")
8
+ end
9
+
10
+ def erb_templates
11
+ Dir[File.expand_path("../../assets/templates/erb/**/*.erb", __FILE__)].sort
12
+ end
13
+
14
+ def corresponding_template(template, options = {})
15
+ language = options.fetch(:language)
16
+ template.sub("templates/erb", "templates/#{language}").sub(%r{\.erb$}, ".#{language}")
17
+ end
18
+
19
+ def convert_haml
20
+ erb_templates.each do |template|
21
+ haml_template = corresponding_template(template, language: :haml)
22
+ FileUtils.mkdir_p(File.dirname(haml_template))
23
+ `html2haml --ruby19-attributes '#{template}' '#{haml_template}'`
24
+
25
+ puts "Converted '#{from_root(template)}' to '#{from_root(haml_template)}'"
26
+ end
27
+ end
28
+
29
+ def convert_slim
30
+ erb_templates.each do |template|
31
+ slim_template = corresponding_template(template, language: :slim)
32
+ FileUtils.mkdir_p(File.dirname(slim_template))
33
+ File.open(slim_template, "w") { |file| file.write(HTML2Slim.convert!(template, :erb)) }
34
+
35
+ puts "Converted '#{from_root(template)}' to '#{from_root(slim_template)}'"
36
+ end
37
+ end
38
+
39
+ namespace :templates do
40
+ desc "convert all ERB templates that are available to the user to other template languages"
41
+
42
+ task :convert do
43
+ convert_haml
44
+ convert_slim
45
+
46
+ puts ""
47
+ Docks::Messenger.warn "Make sure to check the output of the above conversions to make sure that everything went OK!"
48
+ end
49
+ end
50
+
51
+
metadata ADDED
@@ -0,0 +1,234 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: docks_theme_base
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Chris Sauve
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: docks_app
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - <
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - <
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '10.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '10.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: awesome_print
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '1.6'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '1.6'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec-html-matchers
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '0.7'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '0.7'
125
+ - !ruby/object:Gem::Dependency
126
+ name: html2haml
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: '2.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ~>
137
+ - !ruby/object:Gem::Version
138
+ version: '2.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: html2slim
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ~>
144
+ - !ruby/object:Gem::Version
145
+ version: '0.2'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ~>
151
+ - !ruby/object:Gem::Version
152
+ version: '0.2'
153
+ description: An base theme for Docks.
154
+ email:
155
+ - chrismsauve@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - .editorconfig
161
+ - .gitignore
162
+ - .rubocop.yml
163
+ - .travis.yml
164
+ - Gemfile
165
+ - README.md
166
+ - Rakefile
167
+ - assets/images/icons.svg
168
+ - assets/scripts/coffeescript/pattern_library_helpers.coffee
169
+ - assets/scripts/javascript/pattern_library_helpers.js
170
+ - assets/scripts/pattern_library.js
171
+ - assets/scripts/pattern_library_demo.js
172
+ - assets/styles/less/pattern-library-helpers.less
173
+ - assets/styles/pattern-library-demo.css
174
+ - assets/styles/pattern-library.css
175
+ - assets/styles/sass/pattern-library-helpers.sass
176
+ - assets/styles/scss/pattern-library-helpers.scss
177
+ - assets/styles/stylus/pattern-library-helpers.styl
178
+ - assets/templates/erb/demo.erb
179
+ - assets/templates/erb/layouts/demo.erb
180
+ - assets/templates/erb/layouts/pattern.erb
181
+ - assets/templates/erb/partials/sidebar.erb
182
+ - assets/templates/erb/pattern.erb
183
+ - assets/templates/haml/demo.haml
184
+ - assets/templates/haml/layouts/demo.haml
185
+ - assets/templates/haml/layouts/pattern.haml
186
+ - assets/templates/haml/partials/sidebar.haml
187
+ - assets/templates/haml/pattern.haml
188
+ - assets/templates/slim/demo.slim
189
+ - assets/templates/slim/layouts/demo.slim
190
+ - assets/templates/slim/layouts/pattern.slim
191
+ - assets/templates/slim/partials/sidebar.slim
192
+ - assets/templates/slim/pattern.slim
193
+ - docks_theme_base.gemspec
194
+ - lib/docks_theme_base.rb
195
+ - lib/docks_theme_base/assets.rb
196
+ - lib/docks_theme_base/theme.rb
197
+ - spec/fixtures/assets/scripts/pattern_library.js
198
+ - spec/fixtures/assets/styles/pattern-library.css
199
+ - spec/lib/assets_spec.rb
200
+ - spec/lib/theme_spec.rb
201
+ - spec/spec_helper.rb
202
+ - tasks/rspec.rake
203
+ - tasks/rubocop.rake
204
+ - tasks/templates.rake
205
+ homepage: http://github.com/docks-app/docks_theme_base
206
+ licenses:
207
+ - MIT
208
+ metadata: {}
209
+ post_install_message:
210
+ rdoc_options: []
211
+ require_paths:
212
+ - lib
213
+ required_ruby_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ! '>='
216
+ - !ruby/object:Gem::Version
217
+ version: 1.9.3
218
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ requirements: []
224
+ rubyforge_project:
225
+ rubygems_version: 2.4.8
226
+ signing_key:
227
+ specification_version: 4
228
+ summary: An base theme for Docks.
229
+ test_files:
230
+ - spec/fixtures/assets/scripts/pattern_library.js
231
+ - spec/fixtures/assets/styles/pattern-library.css
232
+ - spec/lib/assets_spec.rb
233
+ - spec/lib/theme_spec.rb
234
+ - spec/spec_helper.rb