archetype 0.0.1.pre.12 → 0.0.1.pre.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/lib/archetype.rb +4 -0
  3. data/lib/archetype/actions/help.rb +16 -0
  4. data/lib/archetype/actions/theme.rb +73 -0
  5. data/lib/archetype/executor.rb +27 -0
  6. data/lib/archetype/functions/hash.rb +28 -12
  7. data/lib/archetype/functions/helpers.rb +46 -13
  8. data/lib/archetype/functions/styleguide_memoizer.rb +10 -2
  9. data/lib/archetype/sass_extensions/functions/lists.rb +36 -42
  10. data/lib/archetype/sass_extensions/functions/locale.rb +32 -16
  11. data/lib/archetype/sass_extensions/functions/styleguide.rb +127 -38
  12. data/lib/archetype/sass_extensions/functions/ui.rb +3 -2
  13. data/lib/archetype/sass_extensions/functions/version.rb +11 -6
  14. data/lib/archetype/sass_extensions/monkey_patches.rb +1 -1
  15. data/lib/archetype/version.rb +2 -2
  16. data/stylesheets/archetype/_base.scss +7 -2
  17. data/stylesheets/archetype/_config.scss +8 -1
  18. data/stylesheets/archetype/_hacks.scss +51 -17
  19. data/stylesheets/archetype/_ui.scss +16 -5
  20. data/stylesheets/archetype/base/_h5bp.scss +12 -12
  21. data/stylesheets/archetype/base/_normalize.scss +178 -139
  22. data/stylesheets/archetype/grid/_grid.scss +13 -13
  23. data/stylesheets/archetype/styleguide/components/_buttons.scss +1 -0
  24. data/stylesheets/archetype/util/_debug.scss +4 -4
  25. data/stylesheets/archetype/util/_lists.scss +1 -1
  26. data/stylesheets/archetype/util/_misc.scss +1 -1
  27. data/stylesheets/archetype/util/_rtl.scss +1 -1
  28. data/stylesheets/archetype/util/_spacing.scss +6 -6
  29. data/stylesheets/archetype/util/_styles.scss +21 -10
  30. data/stylesheets/archetype/util/_targeting.scss +1 -1
  31. data/test/fixtures/stylesheets/archetype/assets/images/vendor/archetype/animations/loaders-s7889ccc8c1.png +0 -0
  32. data/test/fixtures/stylesheets/archetype/config.rb +2 -0
  33. data/test/fixtures/stylesheets/archetype/source/base.scss +3 -0
  34. data/test/fixtures/stylesheets/archetype/source/hacks/transparent_focusable.scss +5 -0
  35. data/test/fixtures/stylesheets/archetype/source/locale.scss +43 -0
  36. data/test/fixtures/stylesheets/archetype/source/styleguide/alerts.scss +21 -0
  37. data/test/fixtures/stylesheets/archetype/source/styleguide/buttons.scss +5 -1
  38. data/test/fixtures/stylesheets/archetype/source/styleguide/drop.scss +101 -0
  39. data/test/fixtures/stylesheets/archetype/source/styleguide/extend.scss +24 -0
  40. data/test/fixtures/stylesheets/archetype/source/styleguide/invalid_structures.scss +85 -0
  41. data/test/fixtures/stylesheets/archetype/source/styleguide/multi_value.scss +18 -0
  42. data/test/fixtures/stylesheets/archetype/source/styleguide/nested_styleguides.scss +1 -1
  43. data/test/fixtures/stylesheets/archetype/source/styleguide/selective_state.scss +1 -1
  44. data/test/fixtures/stylesheets/archetype/source/ui/glyph_icon.scss +30 -0
  45. data/test/fixtures/stylesheets/archetype/source/utilities/associative.scss +24 -0
  46. data/test/fixtures/stylesheets/archetype/source/utilities/custom_output_styler.scss +4 -3
  47. data/test/fixtures/stylesheets/archetype/source/utilities/targeting/target-browser.scss +8 -1
  48. data/test/fixtures/stylesheets/archetype/tmp/b.css +14 -0
  49. data/test/fixtures/stylesheets/archetype/tmp/base.css +349 -0
  50. data/test/fixtures/stylesheets/archetype/tmp/hacks/ie_pseudo.css +11 -0
  51. data/test/fixtures/stylesheets/archetype/tmp/hacks/transparent_focusable.css +4 -0
  52. data/test/fixtures/stylesheets/archetype/tmp/locale.css +23 -0
  53. data/test/fixtures/stylesheets/archetype/tmp/styleguide/alerts.css +711 -0
  54. data/test/fixtures/stylesheets/archetype/tmp/styleguide/buttons.css +2119 -0
  55. data/test/fixtures/stylesheets/archetype/tmp/styleguide/drop.css +63 -0
  56. data/test/fixtures/stylesheets/archetype/tmp/styleguide/extend.css +11 -0
  57. data/test/fixtures/stylesheets/archetype/tmp/styleguide/fallback_styles.css +10 -0
  58. data/test/fixtures/stylesheets/archetype/tmp/styleguide/invalid_structures.css +21 -0
  59. data/test/fixtures/stylesheets/archetype/tmp/styleguide/multi_value.css +13 -0
  60. data/test/fixtures/stylesheets/archetype/tmp/styleguide/nested_styleguides.css +28 -0
  61. data/test/fixtures/stylesheets/archetype/tmp/styleguide/selective_state.css +177 -0
  62. data/test/fixtures/stylesheets/archetype/tmp/ui/glyph_icon.css +127 -0
  63. data/test/fixtures/stylesheets/archetype/tmp/ui/hide_element.css +8 -0
  64. data/test/fixtures/stylesheets/archetype/tmp/ui/stroke.css +17 -0
  65. data/test/fixtures/stylesheets/archetype/tmp/ui/triangle.css +35 -0
  66. data/test/fixtures/stylesheets/archetype/tmp/utilities/associative.css +9 -0
  67. data/test/fixtures/stylesheets/archetype/tmp/utilities/custom_output_styler.css +8 -0
  68. data/test/fixtures/stylesheets/archetype/tmp/utilities/if-set.css +9 -0
  69. data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/horizontal-spacing.css +29 -0
  70. data/test/fixtures/stylesheets/archetype/tmp/utilities/spacing/vertical-spacing.css +29 -0
  71. data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/filter.css +11 -0
  72. data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/font-family.css +16 -0
  73. data/test/fixtures/stylesheets/archetype/tmp/utilities/styles/z-index.css +15 -0
  74. data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-browser.css +105 -0
  75. data/test/fixtures/stylesheets/archetype/tmp/utilities/targeting/target-os.css +55 -0
  76. data/test/helpers/test_case.rb +2 -2
  77. data/test/integrations/archetype_test.rb +3 -1
  78. data/test/units/sass_extensions_test.rb +18 -25
  79. metadata +81 -3
@@ -0,0 +1,8 @@
1
+ .hide-element {
2
+ position: absolute !important;
3
+ height: 1px;
4
+ width: 1px;
5
+ overflow: hidden;
6
+ *clip: rect(1px 1px 1px 1px);
7
+ clip: rect(1px, 1px, 1px, 1px);
8
+ }
@@ -0,0 +1,17 @@
1
+ .stroke {
2
+ -webkit-box-shadow: 0 1px 0 black, 0 -1px 0 black, 1px 0 0 black, -1px 0 0 black;
3
+ -moz-box-shadow: 0 1px 0 black, 0 -1px 0 black, 1px 0 0 black, -1px 0 0 black;
4
+ box-shadow: 0 1px 0 black, 0 -1px 0 black, 1px 0 0 black, -1px 0 0 black;
5
+ }
6
+
7
+ .stroke-fat {
8
+ -webkit-box-shadow: 0 10px 0 black, 0 -10px 0 black, 10px 0 0 black, -10px 0 0 black;
9
+ -moz-box-shadow: 0 10px 0 black, 0 -10px 0 black, 10px 0 0 black, -10px 0 0 black;
10
+ box-shadow: 0 10px 0 black, 0 -10px 0 black, 10px 0 0 black, -10px 0 0 black;
11
+ }
12
+
13
+ .stroke-colorful {
14
+ -webkit-box-shadow: 0 10px 0 red, 0 -10px 0 red, 10px 0 0 red, -10px 0 0 red;
15
+ -moz-box-shadow: 0 10px 0 red, 0 -10px 0 red, 10px 0 0 red, -10px 0 0 red;
16
+ box-shadow: 0 10px 0 red, 0 -10px 0 red, 10px 0 0 red, -10px 0 0 red;
17
+ }
@@ -0,0 +1,35 @@
1
+ .a {
2
+ height: 0;
3
+ width: 0;
4
+ _font-size: 0;
5
+ _line-height: 0;
6
+ border-style: dashed;
7
+ border-color: transparent;
8
+ border-width: 1em 0.5em 0;
9
+ border-top-color: #aaaaaa;
10
+ border-top-style: solid;
11
+ }
12
+
13
+ .b {
14
+ height: 0;
15
+ width: 0;
16
+ _font-size: 0;
17
+ _line-height: 0;
18
+ border-style: dashed;
19
+ border-color: transparent;
20
+ border-width: 0 5px 5px;
21
+ border-bottom-color: black;
22
+ border-bottom-style: solid;
23
+ }
24
+
25
+ .c {
26
+ height: 0;
27
+ width: 0;
28
+ _font-size: 0;
29
+ _line-height: 0;
30
+ border-style: dashed;
31
+ border-color: transparent;
32
+ border-width: 0 10px 5px 0;
33
+ border-bottom-color: black;
34
+ border-bottom-style: solid;
35
+ }
@@ -0,0 +1,9 @@
1
+ .test {
2
+ a: "1";
3
+ b: "2";
4
+ c: "5";
5
+ d: "6";
6
+ e: "5";
7
+ f: "6";
8
+ g: "1";
9
+ }
@@ -0,0 +1,8 @@
1
+ .test {
2
+ font-size: 13px;
3
+ line-height: 17px;
4
+ /* post override */
5
+ color: #222222;
6
+ /* pre override */
7
+ font-weight: normal;
8
+ }
@@ -0,0 +1,9 @@
1
+ a {
2
+ margin: 5px;
3
+ border: 1px solid #cccccc;
4
+ }
5
+
6
+ b {
7
+ margin: 5px;
8
+ border: 1px solid #cccccc;
9
+ }
@@ -0,0 +1,29 @@
1
+ a {
2
+ padding-left: 20px;
3
+ padding-right: 20px;
4
+ margin-left: 20px;
5
+ margin-right: 20px;
6
+ }
7
+
8
+ b {
9
+ padding-right: 20px;
10
+ margin-right: 20px;
11
+ }
12
+
13
+ c {
14
+ padding-left: 20px;
15
+ margin-left: 20px;
16
+ }
17
+
18
+ d {
19
+ padding-right: 15px;
20
+ padding-right: 13px;
21
+ margin-right: 13px;
22
+ }
23
+
24
+ e {
25
+ padding-left: 0px;
26
+ padding-right: 0px;
27
+ margin-left: 0px;
28
+ margin-right: 0px;
29
+ }
@@ -0,0 +1,29 @@
1
+ a {
2
+ padding-top: 10px;
3
+ padding-bottom: 10px;
4
+ margin-top: 10px;
5
+ margin-bottom: 10px;
6
+ }
7
+
8
+ b {
9
+ padding-bottom: 10px;
10
+ margin-bottom: 10px;
11
+ }
12
+
13
+ c {
14
+ padding-top: 10px;
15
+ margin-top: 10px;
16
+ }
17
+
18
+ d {
19
+ padding-bottom: 15px;
20
+ padding-bottom: 13px;
21
+ margin-bottom: 13px;
22
+ }
23
+
24
+ e {
25
+ padding-top: 0px;
26
+ padding-bottom: 0px;
27
+ margin-top: 0px;
28
+ margin-bottom: 0px;
29
+ }
@@ -0,0 +1,11 @@
1
+ a {
2
+ -webkit-filter: Shadow(Strength=2, Direction=135, Color="#CCCCCC");
3
+ -moz-filter: Shadow(Strength=2, Direction=135, Color="#CCCCCC");
4
+ filter: Shadow(Strength=2, Direction=135, Color="#CCCCCC");
5
+ }
6
+
7
+ b {
8
+ -webkit-filter: gradient(enabled=false);
9
+ -moz-filter: gradient(enabled=false);
10
+ filter: gradient(enabled=false);
11
+ }
@@ -0,0 +1,16 @@
1
+ a {
2
+ font-family: Georgia, serif;
3
+ }
4
+
5
+ b {
6
+ font-family: sans-serif;
7
+ }
8
+ .os-win b {
9
+ font-family: Arial, sans-serif;
10
+ }
11
+ .os-mac b {
12
+ font-family: Helvetica, Arial, sans-serif;
13
+ }
14
+ .os-linux b {
15
+ font-family: Helvetica, FreeSans, "Liberation Sans", Helmet, Arial, sans-serif;
16
+ }
@@ -0,0 +1,15 @@
1
+ a {
2
+ z-index: -1;
3
+ }
4
+
5
+ b {
6
+ z-index: 1;
7
+ }
8
+
9
+ c {
10
+ z-index: 101;
11
+ }
12
+
13
+ d {
14
+ z-index: 10021;
15
+ }
@@ -0,0 +1,105 @@
1
+ .target-ie-6 {
2
+ _vertical-align: -5px;
3
+ _background-position: 6px -2170px;
4
+ _overflow: hidden;
5
+ }
6
+
7
+ .target-ie-lte-7 {
8
+ *margin-top: 1px;
9
+ *padding: 0;
10
+ *width: 195px;
11
+ *font-size: 0.01em;
12
+ *height: 18px;
13
+ }
14
+
15
+ .ie.ie6 .target-ie-6-7, .ie.ie7 .target-ie-6-7 {
16
+ display: inline;
17
+ }
18
+ .ie.ie6 .target-ie-6-7, .ie.ie7 .target-ie-6-7 {
19
+ zoom: 1;
20
+ }
21
+ .ie.ie6 .target-ie-6-7, .ie.ie7 .target-ie-6-7 {
22
+ margin-left: 0;
23
+ }
24
+
25
+ .ie.ie7 .target-ie-7 {
26
+ vertical-align: -5px;
27
+ }
28
+ .ie.ie7 .target-ie-7 {
29
+ background-position: 6px -2170px;
30
+ }
31
+ .ie.ie7 .target-ie-7 {
32
+ overflow: hidden;
33
+ }
34
+
35
+ .ie.ie7 .target-ie-7-8, .ie.ie8 .target-ie-7-8 {
36
+ min-height: 250px !important;
37
+ height: auto !important;
38
+ height: 250px !important;
39
+ }
40
+
41
+ .ie.lte8 .target-ie-lte-8 {
42
+ filter: BasicImage(rotation=3);
43
+ }
44
+ .ie.lte8 .target-ie-lte-8 {
45
+ padding-bottom: 8px;
46
+ }
47
+ .ie.lte8 .target-ie-lte-8 {
48
+ line-height: 1.6;
49
+ }
50
+
51
+ .ie.ie8 .target-ie-8 {
52
+ margin-top: 2px;
53
+ }
54
+ .ie.ie8 .target-ie-8 {
55
+ min-height: 170px;
56
+ height: auto !important;
57
+ height: 170px;
58
+ }
59
+
60
+ .ie.lte9 .target-ie-lte-9 {
61
+ border-color: #111111;
62
+ }
63
+ .ie.lte9 .target-ie-lte-9 {
64
+ background: #2c2c2b;
65
+ }
66
+
67
+ .ie.ie7 .target-ie-7-8-9, .ie.ie8 .target-ie-7-8-9, .ie.ie9 .target-ie-7-8-9 {
68
+ width: 250px;
69
+ }
70
+
71
+ .ie.ie9 .target-ie-9 {
72
+ right: -83px;
73
+ }
74
+ .ie.ie9 .target-ie-9 {
75
+ top: 17px;
76
+ }
77
+
78
+ @media screen and (-webkit-min-device-pixel-ratio: 0) {
79
+ .target-webkit {
80
+ line-height: 16px;
81
+ }
82
+ }
83
+ @media screen and (-webkit-min-device-pixel-ratio: 0) {
84
+ .target-webkit {
85
+ padding-top: 10px;
86
+ }
87
+ }
88
+ @media screen and (-webkit-min-device-pixel-ratio: 0) {
89
+ .target-webkit {
90
+ width: 151px;
91
+ }
92
+ }
93
+
94
+ .target-firefox, .target-firefox x:-moz-any-link {
95
+ margin-top: 16px;
96
+ }
97
+
98
+ .target-opera, .target-opera x:-o-prefocus {
99
+ width: 82%;
100
+ }
101
+
102
+ .ie.lte8 .target-with-content-block {
103
+ /* testing content block */
104
+ color: red;
105
+ }
@@ -0,0 +1,55 @@
1
+ .os-linux .target-linux {
2
+ top: -3px;
3
+ }
4
+ .os-linux .target-linux {
5
+ width: 300px;
6
+ }
7
+
8
+ .os-mac .target-apple {
9
+ top: -3px;
10
+ }
11
+ .os-mac .target-apple {
12
+ width: 300px;
13
+ }
14
+
15
+ .os-mac .target-mac {
16
+ top: -3px;
17
+ }
18
+ .os-mac .target-mac {
19
+ width: 300px;
20
+ }
21
+
22
+ .os-mac .target-osx {
23
+ top: -3px;
24
+ }
25
+ .os-mac .target-osx {
26
+ width: 300px;
27
+ }
28
+
29
+ .os-win .target-windows {
30
+ top: -3px;
31
+ }
32
+ .os-win .target-windows {
33
+ width: 300px;
34
+ }
35
+
36
+ .os-win .target-win {
37
+ top: -3px;
38
+ }
39
+ .os-win .target-win {
40
+ width: 300px;
41
+ }
42
+
43
+ .os-win .target-winxp {
44
+ top: -3px;
45
+ }
46
+ .os-win .target-winxp {
47
+ width: 300px;
48
+ }
49
+
50
+ .os-win .target-win7 {
51
+ top: -3px;
52
+ }
53
+ .os-win .target-win7 {
54
+ width: 300px;
55
+ }
@@ -24,7 +24,7 @@ module Compass
24
24
  assert false, diff_as_string(before.inspect, after.inspect)
25
25
  end
26
26
  end
27
-
27
+
28
28
  module ClassMethods
29
29
 
30
30
  def let(method, &block)
@@ -51,7 +51,7 @@ module Compass
51
51
  end
52
52
  end
53
53
 
54
- private
54
+ private
55
55
 
56
56
  def underscore(string)
57
57
  string.gsub(' ', '_')
@@ -1,9 +1,11 @@
1
1
  # this is all take from Compass because they already did the awesome testing framework
2
2
  require 'test_helper'
3
- require 'fileutils'
4
3
  require 'compass'
5
4
  require 'compass/logger'
6
5
  require 'sass/plugin'
6
+ unless ENV['CI']
7
+ require 'fileutils'
8
+ end
7
9
 
8
10
  class ArchetypeTest < Test::Unit::TestCase
9
11
 
@@ -4,6 +4,7 @@ require 'archetype'
4
4
  class SassExtensionsTest < Test::Unit::TestCase
5
5
  setup do
6
6
  Compass.reset_configuration!
7
+ Compass.configuration.testing = true
7
8
  end
8
9
 
9
10
  ## VERSION
@@ -16,20 +17,20 @@ class SassExtensionsTest < Test::Unit::TestCase
16
17
  assert_equal "true", evaluate("archetype-version('Compass >= 0.12')")
17
18
  assert_equal "false", evaluate("archetype-version('Sass >= 99.0.0')")
18
19
  assert_equal "true", evaluate("archetype-version('Sass gt 3.0')")
19
- assert_equal "false", evaluate("archetype-version(Archetype ne 99)")
20
+ assert_equal "true", evaluate("archetype-version(Archetype ne 99)")
20
21
  end
21
22
 
22
23
 
23
24
  ## ENVIRONMENT
24
25
  # test that archetype-env() is working correctly
25
26
  def test_env
26
- Compass.reset_configuration!
27
+ reset
27
28
  assert_equal "development", evaluate("archetype-env()")
28
29
  Compass.configuration.environment = :production
29
30
  assert_equal "production", evaluate("archetype-env()")
30
31
  Compass.configuration.environment = :staging
31
32
  assert_equal "staging", evaluate("archetype-env()")
32
- Compass.reset_configuration!
33
+ reset
33
34
  end
34
35
 
35
36
 
@@ -49,19 +50,6 @@ class SassExtensionsTest < Test::Unit::TestCase
49
50
  # TODO
50
51
  end
51
52
 
52
- # list-sort
53
- #def test_list_sort
54
- # assert_equal "1 2 3 4", evaluate("list-sort(2 4 3 1)")
55
- # assert_equal "4 3 2 1", evaluate("list-sort(2 4 3 1, true)")
56
- # assert_equal "a b c d", evaluate("list-sort(d a b c)")
57
- #end
58
-
59
- # list-reverse
60
- #def test_list_reverse
61
- # assert_equal "4 3 2 1", evaluate("list-reverse(1 2 3 4)")
62
- # assert_equal "d c b a", evaluate("list-reverse(a b c d)")
63
- #end
64
-
65
53
  # list-add
66
54
  def test_list_add
67
55
  assert_equal "2 3 4", evaluate("list-add(1 2 3, 1)")
@@ -127,16 +115,16 @@ class SassExtensionsTest < Test::Unit::TestCase
127
115
  ## LOCALE
128
116
  # locale
129
117
  def test_locale
130
- Compass.reset_configuration!
118
+ reset
131
119
  assert_equal "en_US", evaluate("locale()")
132
120
  Compass.configuration.locale = "ja_JP"
133
121
  assert_equal "ja_JP", evaluate("locale()")
134
- Compass.reset_configuration!
122
+ reset
135
123
  end
136
124
 
137
125
  # lang
138
126
  def test_lang
139
- Compass.reset_configuration!
127
+ reset
140
128
  assert_equal "true", evaluate("lang(en_US)")
141
129
  assert_equal "true", evaluate("lang(fr_FR en_US)")
142
130
  assert_equal "false", evaluate("lang(fr_FR)")
@@ -145,7 +133,7 @@ class SassExtensionsTest < Test::Unit::TestCase
145
133
  assert_equal "true", evaluate("lang(ja_JP)")
146
134
  assert_equal "true", evaluate("lang(CJK)")
147
135
  assert_equal "true", evaluate("lang(CJK en_US)")
148
- Compass.reset_configuration!
136
+ reset
149
137
  end
150
138
 
151
139
 
@@ -183,11 +171,11 @@ class SassExtensionsTest < Test::Unit::TestCase
183
171
  ## UI
184
172
  # test generating unique tokens
185
173
  def test_unique
186
- assert_equal ".archetype-uid-1", evaluate("unique(class)")
187
- assert_equal ".archetype-uid-2", evaluate("unique(class)")
188
- assert_equal "\#archetype-uid-3", evaluate("unique(id)")
189
- assert_equal "my-prefix-archetype-uid-4", evaluate("unique(my-prefix-)")
190
- assert_equal ".testing-archetype-uid-5", evaluate("unique('.testing-')")
174
+ assert_equal ".archetype-uid-RANDOM_UID", evaluate("unique(class)")
175
+ assert_equal ".archetype-uid-RANDOM_UID", evaluate("unique(class)")
176
+ assert_equal "\#archetype-uid-RANDOM_UID", evaluate("unique(id)")
177
+ assert_equal "my-prefix-archetype-uid-RANDOM_UID", evaluate("unique(my-prefix-)")
178
+ assert_equal ".testing-archetype-uid-RANDOM_UID", evaluate("unique('.testing-')")
191
179
  end
192
180
 
193
181
  # test pseudo content escaping and formatting for innerHTML
@@ -204,4 +192,9 @@ protected
204
192
  def evaluate(value)
205
193
  Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s
206
194
  end
195
+
196
+ def reset
197
+ Compass.reset_configuration!
198
+ Compass.configuration.testing = true
199
+ end
207
200
  end