compass 0.8.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. data/CHANGELOG.markdown +551 -0
  2. data/LICENSE.markdown +29 -0
  3. data/README.markdown +44 -0
  4. data/REVISION +1 -0
  5. data/Rakefile +127 -0
  6. data/VERSION.yml +4 -0
  7. data/bin/compass +8 -0
  8. data/deps.rip +1 -0
  9. data/examples/README.markdown +4 -0
  10. data/examples/blueprint_default/config.rb +7 -0
  11. data/examples/blueprint_default/images/grid.png +0 -0
  12. data/examples/blueprint_default/index.html.haml +85 -0
  13. data/examples/blueprint_default/parts/elements.html.haml +282 -0
  14. data/examples/blueprint_default/parts/forms.html.haml +190 -0
  15. data/examples/blueprint_default/parts/grid.html.haml +274 -0
  16. data/examples/blueprint_default/parts/test-small.jpg +0 -0
  17. data/examples/blueprint_default/parts/test.jpg +0 -0
  18. data/examples/blueprint_default/parts/valid.png +0 -0
  19. data/examples/blueprint_default/src/ie.sass +3 -0
  20. data/examples/blueprint_default/src/images/grid.png +0 -0
  21. data/examples/blueprint_default/src/print.sass +3 -0
  22. data/examples/blueprint_default/src/screen.sass +8 -0
  23. data/examples/blueprint_plugins/config.rb +8 -0
  24. data/examples/blueprint_plugins/images/buttons/cross.png +0 -0
  25. data/examples/blueprint_plugins/images/buttons/key.png +0 -0
  26. data/examples/blueprint_plugins/images/buttons/tick.png +0 -0
  27. data/examples/blueprint_plugins/images/grid.png +0 -0
  28. data/examples/blueprint_plugins/images/link_icons/doc.png +0 -0
  29. data/examples/blueprint_plugins/images/link_icons/email.png +0 -0
  30. data/examples/blueprint_plugins/images/link_icons/external.png +0 -0
  31. data/examples/blueprint_plugins/images/link_icons/feed.png +0 -0
  32. data/examples/blueprint_plugins/images/link_icons/im.png +0 -0
  33. data/examples/blueprint_plugins/images/link_icons/pdf.png +0 -0
  34. data/examples/blueprint_plugins/images/link_icons/visited.png +0 -0
  35. data/examples/blueprint_plugins/images/link_icons/xls.png +0 -0
  36. data/examples/blueprint_plugins/images/test-small.jpg +0 -0
  37. data/examples/blueprint_plugins/images/test.jpg +0 -0
  38. data/examples/blueprint_plugins/images/valid.png +0 -0
  39. data/examples/blueprint_plugins/index.html.haml +96 -0
  40. data/examples/blueprint_plugins/plugins/buttons.html.haml +67 -0
  41. data/examples/blueprint_plugins/plugins/fancy_type.html.haml +100 -0
  42. data/examples/blueprint_plugins/plugins/link_icons.html.haml +61 -0
  43. data/examples/blueprint_plugins/plugins/rtl.html.haml +100 -0
  44. data/examples/blueprint_plugins/src/buttons.sass +49 -0
  45. data/examples/blueprint_plugins/src/ie.sass +3 -0
  46. data/examples/blueprint_plugins/src/images/grid.png +0 -0
  47. data/examples/blueprint_plugins/src/link_icons.sass +13 -0
  48. data/examples/blueprint_plugins/src/print.sass +3 -0
  49. data/examples/blueprint_plugins/src/rtl_screen.sass +13 -0
  50. data/examples/blueprint_plugins/src/screen.sass +11 -0
  51. data/examples/blueprint_scoped/images/grid.png +0 -0
  52. data/examples/blueprint_scoped/src/ie.sass +3 -0
  53. data/examples/blueprint_scoped/src/print.sass +3 -0
  54. data/examples/blueprint_scoped/src/screen.sass +4 -0
  55. data/examples/blueprint_scoped_form/images/grid.png +0 -0
  56. data/examples/blueprint_scoped_form/src/ie.sass +3 -0
  57. data/examples/blueprint_scoped_form/src/print.sass +3 -0
  58. data/examples/blueprint_scoped_form/src/screen.sass +10 -0
  59. data/examples/blueprint_semantic/config.rb +7 -0
  60. data/examples/blueprint_semantic/images/grid.png +0 -0
  61. data/examples/blueprint_semantic/index.html.haml +86 -0
  62. data/examples/blueprint_semantic/parts/fancy_type.html.haml +100 -0
  63. data/examples/blueprint_semantic/parts/liquid.html.haml +100 -0
  64. data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
  65. data/examples/blueprint_semantic/parts/test.jpg +0 -0
  66. data/examples/blueprint_semantic/parts/valid.png +0 -0
  67. data/examples/blueprint_semantic/src/ie.sass +3 -0
  68. data/examples/blueprint_semantic/src/images/grid.png +0 -0
  69. data/examples/blueprint_semantic/src/liquid.sass +70 -0
  70. data/examples/blueprint_semantic/src/print.sass +3 -0
  71. data/examples/blueprint_semantic/src/screen.sass +71 -0
  72. data/examples/compass/compass.html.haml +39 -0
  73. data/examples/compass/config.rb +7 -0
  74. data/examples/compass/images/blue_arrow.gif +0 -0
  75. data/examples/compass/src/compass.sass +47 -0
  76. data/examples/compass/src/images/blue_arrow.gif +0 -0
  77. data/examples/compass/src/sticky_footer.sass +11 -0
  78. data/examples/compass/src/utilities.sass +108 -0
  79. data/examples/compass/sticky_footer.html.haml +14 -0
  80. data/examples/compass/utilities.html.haml +189 -0
  81. data/examples/logo/logo.html.haml +40 -0
  82. data/examples/logo/src/ie.sass +6 -0
  83. data/examples/logo/src/print.sass +6 -0
  84. data/examples/logo/src/screen.sass +29 -0
  85. data/examples/yui/divisions.html.haml +179 -0
  86. data/examples/yui/index.html.haml +19 -0
  87. data/examples/yui/src/screen.sass +13 -0
  88. data/examples/yui/sub_divisions.html.haml +169 -0
  89. data/examples/yui/templates.html.haml +54 -0
  90. data/examples/yui/test.jpg +0 -0
  91. data/examples/yui/typography.html.haml +132 -0
  92. data/frameworks/blueprint.rb +2 -0
  93. data/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
  94. data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +93 -0
  95. data/frameworks/blueprint/stylesheets/blueprint/_print.sass +83 -0
  96. data/frameworks/blueprint/stylesheets/blueprint/_reset.sass +3 -0
  97. data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
  98. data/frameworks/blueprint/stylesheets/blueprint/modules/_buttons.sass +84 -0
  99. data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +33 -0
  100. data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
  101. data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +82 -0
  102. data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +55 -0
  103. data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +178 -0
  104. data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
  105. data/frameworks/blueprint/stylesheets/blueprint/modules/_link_icons.sass +44 -0
  106. data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +141 -0
  107. data/frameworks/blueprint/stylesheets/blueprint/modules/_reset.sass +56 -0
  108. data/frameworks/blueprint/stylesheets/blueprint/modules/_rtl.sass +104 -0
  109. data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +47 -0
  110. data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +155 -0
  111. data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
  112. data/frameworks/blueprint/templates/buttons/buttons.sass +49 -0
  113. data/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
  114. data/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
  115. data/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
  116. data/frameworks/blueprint/templates/buttons/manifest.rb +5 -0
  117. data/frameworks/blueprint/templates/link_icons/link_icons.sass +13 -0
  118. data/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
  119. data/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
  120. data/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
  121. data/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
  122. data/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
  123. data/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
  124. data/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
  125. data/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
  126. data/frameworks/blueprint/templates/link_icons/manifest.rb +10 -0
  127. data/frameworks/blueprint/templates/project/grid.png +0 -0
  128. data/frameworks/blueprint/templates/project/ie.sass +15 -0
  129. data/frameworks/blueprint/templates/project/manifest.rb +6 -0
  130. data/frameworks/blueprint/templates/project/partials/_base.sass +11 -0
  131. data/frameworks/blueprint/templates/project/print.sass +3 -0
  132. data/frameworks/blueprint/templates/project/screen.sass +40 -0
  133. data/frameworks/compass.rb +2 -0
  134. data/frameworks/compass/stylesheets/_compass.sass +1 -0
  135. data/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
  136. data/frameworks/compass/stylesheets/compass/_misc.sass +24 -0
  137. data/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
  138. data/frameworks/compass/stylesheets/compass/_utilities.sass +6 -0
  139. data/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +17 -0
  140. data/frameworks/compass/stylesheets/compass/utilities/_general.sass +6 -0
  141. data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
  142. data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
  143. data/frameworks/compass/stylesheets/compass/utilities/_print.sass +24 -0
  144. data/frameworks/compass/stylesheets/compass/utilities/_sprites.sass +1 -0
  145. data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +3 -0
  146. data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
  147. data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +24 -0
  148. data/frameworks/compass/stylesheets/compass/utilities/general/_float.sass +17 -0
  149. data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.sass +6 -0
  150. data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
  151. data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +134 -0
  152. data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
  153. data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
  154. data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
  155. data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
  156. data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
  157. data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
  158. data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +52 -0
  159. data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
  160. data/frameworks/compass/stylesheets/compass/utilities/sprites/_sprite_img.sass +12 -0
  161. data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +20 -0
  162. data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +27 -0
  163. data/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +9 -0
  164. data/frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass +13 -0
  165. data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
  166. data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +17 -0
  167. data/frameworks/compass/templates/ellipsis/ellipsis.sass +6 -0
  168. data/frameworks/compass/templates/ellipsis/manifest.rb +2 -0
  169. data/frameworks/compass/templates/ellipsis/xml/ellipsis.xml +14 -0
  170. data/frameworks/compass/templates/project/ie.sass +6 -0
  171. data/frameworks/compass/templates/project/manifest.rb +3 -0
  172. data/frameworks/compass/templates/project/print.sass +6 -0
  173. data/frameworks/compass/templates/project/screen.sass +13 -0
  174. data/frameworks/yui.rb +2 -0
  175. data/frameworks/yui/stylesheets/_yui.sass +7 -0
  176. data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
  177. data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
  178. data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
  179. data/frameworks/yui/stylesheets/yui/modules/_reset.sass +61 -0
  180. data/frameworks/yui/templates/project/manifest.rb +1 -0
  181. data/frameworks/yui/templates/project/screen.sass +4 -0
  182. data/lib/compass.rb +23 -0
  183. data/lib/compass/actions.rb +110 -0
  184. data/lib/compass/app_integration.rb +5 -0
  185. data/lib/compass/app_integration/merb.rb +43 -0
  186. data/lib/compass/app_integration/rails.rb +12 -0
  187. data/lib/compass/app_integration/rails/action_controller.rb +15 -0
  188. data/lib/compass/app_integration/rails/sass_plugin.rb +5 -0
  189. data/lib/compass/app_integration/rails/templates/compass-install-rails.rb +80 -0
  190. data/lib/compass/app_integration/rails/urls.rb +14 -0
  191. data/lib/compass/commands/base.rb +33 -0
  192. data/lib/compass/commands/create_project.rb +19 -0
  193. data/lib/compass/commands/generate_grid_background.rb +24 -0
  194. data/lib/compass/commands/installer_command.rb +31 -0
  195. data/lib/compass/commands/list_frameworks.rb +16 -0
  196. data/lib/compass/commands/print_version.rb +23 -0
  197. data/lib/compass/commands/project_base.rb +112 -0
  198. data/lib/compass/commands/stamp_pattern.rb +33 -0
  199. data/lib/compass/commands/update_project.rb +34 -0
  200. data/lib/compass/commands/validate_project.rb +21 -0
  201. data/lib/compass/commands/watch_project.rb +64 -0
  202. data/lib/compass/commands/write_configuration.rb +28 -0
  203. data/lib/compass/compiler.rb +54 -0
  204. data/lib/compass/configuration.rb +324 -0
  205. data/lib/compass/core_ext.rb +14 -0
  206. data/lib/compass/dependencies.rb +10 -0
  207. data/lib/compass/errors.rb +7 -0
  208. data/lib/compass/exec.rb +251 -0
  209. data/lib/compass/frameworks.rb +29 -0
  210. data/lib/compass/grid_builder.rb +72 -0
  211. data/lib/compass/installers.rb +5 -0
  212. data/lib/compass/installers/base.rb +158 -0
  213. data/lib/compass/installers/manifest.rb +58 -0
  214. data/lib/compass/installers/rails.rb +135 -0
  215. data/lib/compass/installers/stand_alone.rb +60 -0
  216. data/lib/compass/logger.rb +42 -0
  217. data/lib/compass/sass_extensions.rb +5 -0
  218. data/lib/compass/sass_extensions/functions.rb +19 -0
  219. data/lib/compass/sass_extensions/functions/display.rb +22 -0
  220. data/lib/compass/sass_extensions/functions/enumerate.rb +6 -0
  221. data/lib/compass/sass_extensions/functions/inline_image.rb +35 -0
  222. data/lib/compass/sass_extensions/functions/selectors.rb +39 -0
  223. data/lib/compass/sass_extensions/functions/urls.rb +105 -0
  224. data/lib/compass/sass_extensions/monkey_patches.rb +3 -0
  225. data/lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb +23 -0
  226. data/lib/compass/test_case.rb +38 -0
  227. data/lib/compass/validator.rb +10 -0
  228. data/lib/compass/version.rb +57 -0
  229. data/lib/vendor/fssm.rb +41 -0
  230. data/lib/vendor/fssm/backends/fsevents.rb +37 -0
  231. data/lib/vendor/fssm/backends/polling.rb +26 -0
  232. data/lib/vendor/fssm/cache.rb +193 -0
  233. data/lib/vendor/fssm/ext.rb +37 -0
  234. data/lib/vendor/fssm/fsevents.rb +129 -0
  235. data/lib/vendor/fssm/monitor.rb +25 -0
  236. data/lib/vendor/fssm/path.rb +91 -0
  237. data/lib/vendor/fssm/state.rb +54 -0
  238. data/lib/vendor/fssm/support.rb +22 -0
  239. data/lib/vendor/fssm/tree.rb +176 -0
  240. data/test/command_line_helper.rb +102 -0
  241. data/test/command_line_test.rb +66 -0
  242. data/test/compass_test.rb +141 -0
  243. data/test/configuration_test.rb +118 -0
  244. data/test/fixtures/stylesheets/blueprint/config.rb +9 -0
  245. data/test/fixtures/stylesheets/blueprint/css/typography.css +158 -0
  246. data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
  247. data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -0
  248. data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -0
  249. data/test/fixtures/stylesheets/blueprint/sass/screen.sass +17 -0
  250. data/test/fixtures/stylesheets/blueprint/sass/typography.sass +3 -0
  251. data/test/fixtures/stylesheets/compass/config.rb +9 -0
  252. data/test/fixtures/stylesheets/compass/css/layout.css +13 -0
  253. data/test/fixtures/stylesheets/compass/css/print.css +18 -0
  254. data/test/fixtures/stylesheets/compass/css/reset.css +60 -0
  255. data/test/fixtures/stylesheets/compass/css/utilities.css +17 -0
  256. data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
  257. data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
  258. data/test/fixtures/stylesheets/compass/sass/reset.sass +10 -0
  259. data/test/fixtures/stylesheets/compass/sass/utilities.sass +6 -0
  260. data/test/fixtures/stylesheets/image_urls/config.rb +17 -0
  261. data/test/fixtures/stylesheets/image_urls/css/screen.css +3 -0
  262. data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
  263. data/test/fixtures/stylesheets/image_urls/sass/screen.sass +6 -0
  264. data/test/fixtures/stylesheets/yui/config.rb +9 -0
  265. data/test/fixtures/stylesheets/yui/css/mixins.css +13 -0
  266. data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
  267. data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
  268. data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
  269. data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
  270. data/test/rails_integration_test.rb +83 -0
  271. data/test/sass_extensions_test.rb +31 -0
  272. data/test/test_case_helper.rb +13 -0
  273. data/test/test_helper.rb +21 -0
  274. data/test/test_rails_helper.rb +20 -0
  275. metadata +372 -0
@@ -0,0 +1,102 @@
1
+ module Compass::CommandLineHelper
2
+ def compass(*arguments)
3
+ options = arguments.last.is_a?(Hash) ? arguments.pop : {}
4
+ options[:wait] = 0.25
5
+ if block_given?
6
+ responder = Responder.new
7
+ yield responder
8
+ IO.popen("-", "w+") do |io|
9
+ if io
10
+ #parent process
11
+ output = ""
12
+ eof_at = nil
13
+ while !eof_at || (Time.now - eof_at < options[:wait])
14
+ if io.eof?
15
+ eof_at ||= Time.now
16
+ sleep 0.1
17
+ else
18
+ eof_at = nil
19
+ timeout(1) do
20
+ output << io.readpartial(1024)
21
+ end
22
+ prompt = output.split("\n").last
23
+ if response = responder.response_for(prompt)
24
+ io.puts response
25
+ end
26
+ end
27
+ end
28
+ responder.assert_required_responses!
29
+ @last_result = output
30
+ else
31
+ #child process
32
+ execute *arguments
33
+ end
34
+ end
35
+ else
36
+ @last_result = capture_output do
37
+ execute *arguments
38
+ end
39
+ end
40
+ rescue Timeout::Error
41
+ fail "Read from child process timed out"
42
+ end
43
+
44
+ class Responder
45
+ Response = Struct.new(:prompt, :text, :required, :responded)
46
+ def initialize
47
+ @responses = []
48
+ end
49
+ def respond_to(prompt, options = {})
50
+ @responses << Response.new(prompt, options[:with], options[:required])
51
+ end
52
+ def response_for(prompt)
53
+ response = @responses.detect{|r| r.prompt == prompt}
54
+ if response
55
+ response.responded = true
56
+ response.text
57
+ end
58
+ end
59
+ def assert_required_responses!
60
+ @responses.each do |response|
61
+ if response.required && !response.responded
62
+ raise "Prompt not encountered: \"#{response.prompt}\""
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ def assert_action_performed(action, path)
69
+ actions_found = []
70
+ @last_result.split("\n").each do |line|
71
+ line = line.split
72
+ return if line.first == action.to_s && line.last == path
73
+ actions_found << line.first if line.last == path
74
+ end
75
+ message = "Action #{action.inspect} was not performed on: #{path}."
76
+ message += "The following actions were performed: #{actions_found.join(", ")}" if actions_found.any?
77
+ puts @last_result
78
+ fail message
79
+ end
80
+
81
+ def within_tmp_directory(dir = "tmp")
82
+ d = absolutize(dir)
83
+ FileUtils.mkdir_p(d)
84
+ Dir.chdir(d) do
85
+ yield
86
+ end
87
+ ensure
88
+ FileUtils.rm_rf(d)
89
+ end
90
+
91
+ def capture_output
92
+ real_stdout, $stdout = $stdout, StringIO.new
93
+ yield
94
+ $stdout.string
95
+ ensure
96
+ $stdout = real_stdout
97
+ end
98
+
99
+ def execute(*arguments)
100
+ Compass::Exec::Compass.new(arguments).run!
101
+ end
102
+ end
@@ -0,0 +1,66 @@
1
+ require File.dirname(__FILE__)+'/test_helper'
2
+ require 'fileutils'
3
+ require 'compass'
4
+ require 'compass/exec'
5
+ require 'timeout'
6
+
7
+ class CommandLineTest < Test::Unit::TestCase
8
+ include Compass::TestCaseHelper
9
+ include Compass::CommandLineHelper
10
+
11
+ def teardown
12
+ Compass.configuration.reset!
13
+ end
14
+
15
+ def test_print_version
16
+ compass "-vq"
17
+ assert_match /\d+\.\d+\.\d+( [0-9a-f]+)?/, @last_result
18
+ end
19
+
20
+ def test_list_frameworks
21
+ compass "--list-frameworks"
22
+ assert_equal(%w(blueprint compass yui), @last_result.split.sort)
23
+ end
24
+
25
+ def test_basic_install
26
+ within_tmp_directory do
27
+ compass "basic"
28
+ assert File.exists?("basic/src/screen.sass")
29
+ assert File.exists?("basic/stylesheets/screen.css")
30
+ assert_action_performed :directory, "basic/"
31
+ assert_action_performed :create, "basic/src/screen.sass"
32
+ assert_action_performed :compile, "basic/src/screen.sass"
33
+ assert_action_performed :create, "basic/stylesheets/screen.css"
34
+ end
35
+ end
36
+
37
+ def test_framework_installs
38
+ Compass::Frameworks::ALL.each do |framework|
39
+ within_tmp_directory do
40
+ compass *%W(--framework #{framework.name} #{framework.name}_project)
41
+ assert File.exists?("#{framework.name}_project/src/screen.sass")
42
+ assert File.exists?("#{framework.name}_project/stylesheets/screen.css")
43
+ assert_action_performed :directory, "#{framework.name}_project/"
44
+ assert_action_performed :create, "#{framework.name}_project/src/screen.sass"
45
+ assert_action_performed :compile, "#{framework.name}_project/src/screen.sass"
46
+ assert_action_performed :create, "#{framework.name}_project/stylesheets/screen.css"
47
+ end
48
+ end
49
+ end
50
+
51
+ def test_basic_update
52
+ within_tmp_directory do
53
+ compass "basic"
54
+ Dir.chdir "basic" do
55
+ # basic update with timestamp caching
56
+ compass
57
+ assert_action_performed :unchanged, "src/screen.sass"
58
+ # basic update with force option set
59
+ compass "--force"
60
+ assert_action_performed :compile, "src/screen.sass"
61
+ assert_action_performed :identical, "stylesheets/screen.css"
62
+ end
63
+ end
64
+ end
65
+
66
+ end
@@ -0,0 +1,141 @@
1
+ require File.dirname(__FILE__)+'/test_helper'
2
+ require 'fileutils'
3
+ require 'compass'
4
+
5
+ class CompassTest < Test::Unit::TestCase
6
+ include Compass::TestCaseHelper
7
+ def setup
8
+ Compass.configuration.reset!
9
+ end
10
+
11
+ def teardown
12
+ teardown_fixtures :blueprint, :yui, :empty, :compass, :image_urls
13
+ end
14
+
15
+ def teardown_fixtures(*project_names)
16
+ project_names.each do |project_name|
17
+ FileUtils.rm_rf tempfile_path(project_name)
18
+ end
19
+ end
20
+
21
+ def test_empty_project
22
+ # With no sass files, we should have no css files.
23
+ within_project(:empty) do |proj|
24
+ return unless proj.css_path && File.exists?(proj.css_path)
25
+ Dir.new(proj.css_path).each do |f|
26
+ fail "This file should not have been generated: #{f}" unless f == "." || f == ".."
27
+ end
28
+ end
29
+ end
30
+
31
+ def test_blueprint
32
+ within_project(:blueprint) do |proj|
33
+ each_css_file(proj.css_path) do |css_file|
34
+ assert_no_errors css_file, :blueprint
35
+ end
36
+ assert_renders_correctly :typography
37
+ end
38
+ end
39
+
40
+ def test_yui
41
+ within_project('yui') do |proj|
42
+ each_css_file(proj.css_path) do |css_file|
43
+ assert_no_errors css_file, 'yui'
44
+ end
45
+ assert_renders_correctly :mixins
46
+ end
47
+ end
48
+
49
+ def test_compass
50
+ within_project('compass') do |proj|
51
+ each_css_file(proj.css_path) do |css_file|
52
+ assert_no_errors css_file, 'compass'
53
+ end
54
+ assert_renders_correctly :reset, :layout, :utilities
55
+ end
56
+ end
57
+
58
+ def test_image_urls
59
+ within_project('image_urls') do |proj|
60
+ each_css_file(proj.css_path) do |css_file|
61
+ assert_no_errors css_file, 'image_urls'
62
+ end
63
+ assert_renders_correctly :screen
64
+ end
65
+ end
66
+
67
+ private
68
+ def assert_no_errors(css_file, project_name)
69
+ file = css_file[(tempfile_path(project_name).size+1)..-1]
70
+ msg = "Syntax Error found in #{file}. Results saved into #{save_path(project_name)}/#{file}"
71
+ assert_equal 0, open(css_file).readlines.grep(/Sass::SyntaxError/).size, msg
72
+ end
73
+
74
+ def assert_renders_correctly(*arguments)
75
+ options = arguments.last.is_a?(Hash) ? arguments.pop : {}
76
+ for name in arguments
77
+ actual_result_file = "#{tempfile_path(@current_project)}/#{name}.css"
78
+ expected_result_file = "#{result_path(@current_project)}/#{name}.css"
79
+ actual_lines = File.read(actual_result_file).split("\n")
80
+ expected_lines = File.read(expected_result_file).split("\n")
81
+ expected_lines.zip(actual_lines).each_with_index do |pair, line|
82
+ message = "template: #{name}\nline: #{line + 1}"
83
+ assert_equal(pair.first, pair.last, message)
84
+ end
85
+ if expected_lines.size < actual_lines.size
86
+ assert(false, "#{actual_lines.size - expected_lines.size} Trailing lines found in #{actual_result_file}.css: #{actual_lines[expected_lines.size..-1].join('\n')}")
87
+ end
88
+ end
89
+ end
90
+
91
+ def within_project(project_name)
92
+ @current_project = project_name
93
+ Compass.configuration.parse(configuration_file(project_name)) if File.exists?(configuration_file(project_name))
94
+ Compass.configuration.project_path = project_path(project_name)
95
+ args = Compass.configuration.to_compiler_arguments(:logger => Compass::NullLogger.new)
96
+ if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path)
97
+ compiler = Compass::Compiler.new *args
98
+ compiler.run
99
+ end
100
+ yield Compass.configuration
101
+ rescue
102
+ save_output(project_name)
103
+ raise
104
+ end
105
+
106
+ def each_css_file(dir)
107
+ Dir.glob("#{dir}/**/*.css").each do |css_file|
108
+ yield css_file
109
+ end
110
+ end
111
+
112
+ def save_output(dir)
113
+ FileUtils.rm_rf(save_path(dir))
114
+ FileUtils.cp_r(tempfile_path(dir), save_path(dir)) if File.exists?(tempfile_path(dir))
115
+ end
116
+
117
+ def project_path(project_name)
118
+ absolutize("fixtures/stylesheets/#{project_name}")
119
+ end
120
+
121
+ def configuration_file(project_name)
122
+ File.join(project_path(project_name), "config.rb")
123
+ end
124
+
125
+ def tempfile_path(project_name)
126
+ File.join(project_path(project_name), "tmp")
127
+ end
128
+
129
+ def template_path(project_name)
130
+ File.join(project_path(project_name), "sass")
131
+ end
132
+
133
+ def result_path(project_name)
134
+ File.join(project_path(project_name), "css")
135
+ end
136
+
137
+ def save_path(project_name)
138
+ File.join(project_path(project_name), "saved")
139
+ end
140
+
141
+ end
@@ -0,0 +1,118 @@
1
+ require File.dirname(__FILE__)+'/test_helper'
2
+ require 'compass'
3
+
4
+ class ConfigurationTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ Compass.configuration.reset!
8
+ end
9
+
10
+ def test_parse_and_serialize
11
+ contents = <<-CONFIG
12
+ require 'compass'
13
+ # Require any additional compass plugins here.
14
+
15
+ project_type = :stand_alone
16
+ # Set this to the root of your project when deployed:
17
+ http_path = "/"
18
+ css_dir = "css"
19
+ sass_dir = "sass"
20
+ images_dir = "img"
21
+ javascripts_dir = "js"
22
+ output_style = :nested
23
+ # To enable relative paths to assets via compass helper functions. Uncomment:
24
+ # relative_assets = true
25
+ CONFIG
26
+
27
+ Compass.configuration.parse_string(contents, "test_parse")
28
+
29
+ assert_equal 'sass', Compass.configuration.sass_dir
30
+ assert_equal 'css', Compass.configuration.css_dir
31
+ assert_equal 'img', Compass.configuration.images_dir
32
+ assert_equal 'js', Compass.configuration.javascripts_dir
33
+
34
+ expected_lines = contents.split("\n").map{|l|l.strip}
35
+ actual_lines = Compass.configuration.serialize.split("\n").map{|l|l.strip}
36
+ assert_equal expected_lines, actual_lines
37
+ end
38
+
39
+ def test_serialization_fails_with_asset_host_set
40
+ contents = <<-CONFIG
41
+ asset_host do |path|
42
+ "http://example.com"
43
+ end
44
+ CONFIG
45
+
46
+ Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_host_set")
47
+
48
+ assert_raise Compass::Error do
49
+ Compass.configuration.serialize
50
+ end
51
+ end
52
+
53
+ def test_serialization_fails_with_asset_cache_buster_set
54
+ contents = <<-CONFIG
55
+ asset_cache_buster do |path|
56
+ "http://example.com"
57
+ end
58
+ CONFIG
59
+
60
+ Compass.configuration.parse_string(contents, "test_serialization_fails_with_asset_cache_buster_set")
61
+
62
+ assert_raise Compass::Error do
63
+ Compass.configuration.serialize
64
+ end
65
+ end
66
+
67
+ def test_additional_import_paths
68
+ contents = <<-CONFIG
69
+ http_path = "/"
70
+ project_path = "/home/chris/my_compass_project"
71
+ css_dir = "css"
72
+ additional_import_paths = ["../foo"]
73
+ add_import_path "/path/to/my/framework"
74
+ CONFIG
75
+
76
+ Compass.configuration.parse_string(contents, "test_additional_import_paths")
77
+
78
+ assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/home/chris/my_compass_project/../foo")
79
+ assert Compass.configuration.to_sass_engine_options[:load_paths].include?("/path/to/my/framework"), Compass.configuration.to_sass_engine_options[:load_paths].inspect
80
+ assert_equal "/home/chris/my_compass_project/css/framework", Compass.configuration.to_sass_plugin_options[:template_location]["/path/to/my/framework"]
81
+ assert_equal "/home/chris/my_compass_project/css/foo", Compass.configuration.to_sass_plugin_options[:template_location]["/home/chris/my_compass_project/../foo"]
82
+
83
+ expected_serialization = <<EXPECTED
84
+ # Require any additional compass plugins here.
85
+ project_path = "/home/chris/my_compass_project"
86
+ # Set this to the root of your project when deployed:
87
+ http_path = "/"
88
+ css_dir = "css"
89
+ # To enable relative paths to assets via compass helper functions. Uncomment:
90
+ # relative_assets = true
91
+ additional_import_paths = ["../foo", "/path/to/my/framework"]
92
+ EXPECTED
93
+ assert_equal "/", Compass.configuration.http_path
94
+ assert_equal expected_serialization, Compass.configuration.serialize
95
+ end
96
+
97
+ def test_sass_options
98
+ contents = <<-CONFIG
99
+ sass_options = {:foo => 'bar'}
100
+ CONFIG
101
+
102
+ Compass.configuration.parse_string(contents, "test_sass_options")
103
+
104
+ assert_equal 'bar', Compass.configuration.to_sass_engine_options[:foo]
105
+ assert_equal 'bar', Compass.configuration.to_sass_plugin_options[:foo]
106
+
107
+ expected_serialization = <<EXPECTED
108
+ # Require any additional compass plugins here.
109
+ # Set this to the root of your project when deployed:
110
+ # To enable relative paths to assets via compass helper functions. Uncomment:
111
+ # relative_assets = true
112
+ sass_options = {:foo=>"bar"}
113
+ EXPECTED
114
+
115
+ assert_equal expected_serialization, Compass.configuration.serialize
116
+ end
117
+
118
+ end
@@ -0,0 +1,9 @@
1
+ # Require any additional compass plugins here.
2
+ project_type = :stand_alone
3
+ css_dir = "tmp"
4
+ sass_dir = "sass"
5
+ images_dir = "images"
6
+ output_style = :nested
7
+ # To enable relative image paths using the images_url() function:
8
+ # http_images_path = :relative
9
+ http_images_path = "/images"
@@ -0,0 +1,158 @@
1
+ body {
2
+ line-height: 1.5;
3
+ font-family: Helvetica Neue, Arial, Helvetica, sans-serif;
4
+ color: #333333;
5
+ font-size: 75%; }
6
+
7
+ h1 {
8
+ font-weight: normal;
9
+ color: #222222;
10
+ font-size: 3em;
11
+ line-height: 1;
12
+ margin-bottom: 0.5em; }
13
+ h1 img {
14
+ margin: 0; }
15
+
16
+ h2 {
17
+ font-weight: normal;
18
+ color: #222222;
19
+ font-size: 2em;
20
+ margin-bottom: 0.75em; }
21
+
22
+ h3 {
23
+ font-weight: normal;
24
+ color: #222222;
25
+ font-size: 1.5em;
26
+ line-height: 1;
27
+ margin-bottom: 1em; }
28
+
29
+ h4 {
30
+ font-weight: normal;
31
+ color: #222222;
32
+ font-size: 1.2em;
33
+ line-height: 1.25;
34
+ margin-bottom: 1.25em; }
35
+
36
+ h5 {
37
+ font-weight: normal;
38
+ color: #222222;
39
+ font-size: 1em;
40
+ font-weight: bold;
41
+ margin-bottom: 1.5em; }
42
+
43
+ h6 {
44
+ font-weight: normal;
45
+ color: #222222;
46
+ font-size: 1em;
47
+ font-weight: bold; }
48
+
49
+ h2 img, h3 img, h4 img, h5 img, h6 img {
50
+ margin: 0; }
51
+
52
+ p {
53
+ margin: 0 0 1.5em; }
54
+ p img.left {
55
+ display: inline;
56
+ float: left;
57
+ margin: 1.5em 1.5em 1.5em 0;
58
+ padding: 0; }
59
+ p img.right {
60
+ display: inline;
61
+ float: right;
62
+ margin: 1.5em 0 1.5em 1.5em;
63
+ padding: 0; }
64
+
65
+ a {
66
+ text-decoration: underline;
67
+ color: #000099; }
68
+ a:visited {
69
+ color: #000066; }
70
+ a:focus {
71
+ color: black; }
72
+ a:hover {
73
+ color: black; }
74
+ a:active {
75
+ color: #cc0099; }
76
+
77
+ blockquote {
78
+ margin: 1.5em;
79
+ color: #666;
80
+ font-style: italic; }
81
+
82
+ strong {
83
+ font-weight: bold; }
84
+
85
+ em {
86
+ font-style: italic; }
87
+
88
+ dfn {
89
+ font-style: italic;
90
+ font-weight: bold; }
91
+
92
+ sup, sub {
93
+ line-height: 0; }
94
+
95
+ abbr, acronym {
96
+ border-bottom: 1px dotted #666; }
97
+
98
+ address {
99
+ margin: 0 0 1.5em;
100
+ font-style: italic; }
101
+
102
+ del {
103
+ color: #666; }
104
+
105
+ pre {
106
+ margin: 1.5em 0;
107
+ white-space: pre; }
108
+
109
+ pre, code, tt {
110
+ font: 1em 'andale mono', 'lucida console', monospace;
111
+ line-height: 1.5; }
112
+
113
+ li ul, li ol {
114
+ margin: 0 1.5em; }
115
+
116
+ ul {
117
+ margin: 0 1.5em 1.5em 1.5em;
118
+ list-style-type: disc; }
119
+
120
+ ol {
121
+ margin: 0 1.5em 1.5em 1.5em;
122
+ list-style-type: decimal; }
123
+
124
+ dl {
125
+ margin: 0 0 1.5em 0; }
126
+ dl dt {
127
+ font-weight: bold; }
128
+
129
+ dd {
130
+ margin-left: 1.5em; }
131
+
132
+ table {
133
+ margin-bottom: 1.4em;
134
+ width: 100%; }
135
+
136
+ th {
137
+ font-weight: bold; }
138
+
139
+ thead th {
140
+ background: #c3d9ff; }
141
+
142
+ th, td, caption {
143
+ padding: 4px 10px 4px 5px; }
144
+
145
+ tr.even td {
146
+ background: #e5ecf9; }
147
+
148
+ tfoot {
149
+ font-style: italic; }
150
+
151
+ caption {
152
+ background: #eee; }
153
+
154
+ .quiet {
155
+ color: #666666; }
156
+
157
+ .loud {
158
+ color: #111111; }