compass 0.12.2 → 0.13.alpha.4

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 (257) hide show
  1. data/README.markdown +5 -5
  2. data/Rakefile +14 -9
  3. data/VERSION.yml +5 -4
  4. data/features/command_line.feature +8 -50
  5. data/features/step_definitions/command_line_steps.rb +3 -2
  6. data/frameworks/compass/stylesheets/compass/_css3.scss +3 -0
  7. data/frameworks/compass/stylesheets/compass/_support.scss +4 -4
  8. data/frameworks/compass/stylesheets/compass/css3/_animation.scss +121 -0
  9. data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +14 -9
  10. data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +32 -36
  11. data/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +32 -35
  12. data/frameworks/compass/stylesheets/compass/css3/_background-size.scss +12 -15
  13. data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +27 -48
  14. data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +22 -35
  15. data/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +12 -8
  16. data/frameworks/compass/stylesheets/compass/css3/_box.scss +58 -83
  17. data/frameworks/compass/stylesheets/compass/css3/_columns.scss +113 -71
  18. data/frameworks/compass/stylesheets/compass/css3/_filter.scss +38 -18
  19. data/frameworks/compass/stylesheets/compass/css3/_flexbox.scss +294 -0
  20. data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +13 -22
  21. data/frameworks/compass/stylesheets/compass/css3/_images.scss +45 -48
  22. data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +1 -1
  23. data/frameworks/compass/stylesheets/compass/css3/_regions.scss +12 -8
  24. data/frameworks/compass/stylesheets/compass/css3/_selection.scss +31 -0
  25. data/frameworks/compass/stylesheets/compass/css3/_shared.scss +226 -2
  26. data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +21 -26
  27. data/frameworks/compass/stylesheets/compass/css3/_transform-legacy.scss +3 -3
  28. data/frameworks/compass/stylesheets/compass/css3/_transform.scss +8 -8
  29. data/frameworks/compass/stylesheets/compass/css3/_transition.scss +3 -3
  30. data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +43 -4
  31. data/frameworks/compass/stylesheets/compass/typography/_units.scss +152 -0
  32. data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +180 -102
  33. data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +5 -3
  34. data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +6 -3
  35. data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +1 -1
  36. data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +7 -3
  37. data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +2 -2
  38. data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +32 -13
  39. data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +14 -9
  40. data/lib/compass/actions.rb +5 -1
  41. data/lib/compass/commands/project_base.rb +7 -1
  42. data/lib/compass/commands/update_project.rb +2 -3
  43. data/lib/compass/commands/watch_project.rb +11 -113
  44. data/lib/compass/commands.rb +1 -1
  45. data/lib/compass/compiler.rb +6 -0
  46. data/lib/compass/configuration/data.rb +1 -1
  47. data/lib/compass/configuration/helpers.rb +2 -0
  48. data/lib/compass/exec/global_options_parser.rb +1 -1
  49. data/lib/compass/exec/project_options_parser.rb +13 -1
  50. data/lib/compass/logger.rb +2 -0
  51. data/lib/compass/sass_extensions/functions/cross_browser_support.rb +1 -1
  52. data/lib/compass/sass_extensions/functions/env.rb +18 -0
  53. data/lib/compass/sass_extensions/functions/gradient_support.rb +101 -29
  54. data/lib/compass/sass_extensions/functions/image_size.rb +2 -1
  55. data/lib/compass/sass_extensions/functions/math.rb +14 -2
  56. data/lib/compass/sass_extensions/functions/sprites.rb +82 -22
  57. data/lib/compass/sass_extensions/functions/urls.rb +37 -6
  58. data/lib/compass/sass_extensions/functions/utility.rb +10 -0
  59. data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +5 -1
  60. data/lib/compass/sass_extensions/sprites/engines.rb +3 -3
  61. data/lib/compass/sass_extensions/sprites/image.rb +7 -2
  62. data/lib/compass/sass_extensions/sprites/image_methods.rb +5 -1
  63. data/lib/compass/sass_extensions/sprites/images.rb +29 -0
  64. data/lib/compass/sass_extensions/sprites/layout/diagonal.rb +42 -0
  65. data/lib/compass/sass_extensions/sprites/layout/horizontal.rb +66 -0
  66. data/lib/compass/sass_extensions/sprites/layout/smart.rb +33 -0
  67. data/lib/compass/sass_extensions/sprites/layout/vertical.rb +68 -0
  68. data/lib/compass/sass_extensions/sprites/layout.rb +39 -0
  69. data/lib/compass/sass_extensions/sprites/layout_methods.rb +9 -115
  70. data/lib/compass/sass_extensions/sprites/sprite_map.rb +5 -1
  71. data/lib/compass/sass_extensions/sprites/sprite_methods.rb +9 -14
  72. data/lib/compass/sass_extensions/sprites.rb +2 -0
  73. data/lib/compass/sprite_importer/content.erb +29 -24
  74. data/lib/compass/sprite_importer.rb +7 -11
  75. data/lib/compass/watcher/compiler.rb +59 -0
  76. data/lib/compass/watcher/project_watcher.rb +111 -0
  77. data/lib/compass/watcher/watch.rb +33 -0
  78. data/lib/compass/watcher.rb +11 -0
  79. data/lib/compass.rb +2 -2
  80. data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
  81. data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
  82. data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +7 -0
  83. data/test/fixtures/stylesheets/busted_font_urls/fonts/grid.ttf +0 -0
  84. data/test/fixtures/stylesheets/busted_font_urls/fonts/sub/dk.ttf +0 -0
  85. data/test/fixtures/stylesheets/busted_font_urls/sass/screen.sass +11 -0
  86. data/test/fixtures/stylesheets/busted_font_urls/tmp/screen.css +7 -0
  87. data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +33 -0
  88. data/test/fixtures/stylesheets/compass/css/animation.css +33 -0
  89. data/test/fixtures/stylesheets/compass/css/background-clip.css +5 -0
  90. data/test/fixtures/stylesheets/compass/css/background-origin.css +15 -0
  91. data/test/fixtures/stylesheets/compass/css/background-size.css +24 -0
  92. data/test/fixtures/stylesheets/compass/css/columns.css +32 -61
  93. data/test/fixtures/stylesheets/compass/css/flexbox.css +121 -0
  94. data/test/fixtures/stylesheets/compass/css/gradients.css +65 -37
  95. data/test/fixtures/stylesheets/compass/css/grid_background.css +10 -17
  96. data/test/fixtures/stylesheets/compass/css/hyphenation.css +4 -2
  97. data/test/fixtures/stylesheets/compass/css/lists.css +5 -5
  98. data/test/fixtures/stylesheets/compass/css/pie.css +0 -3
  99. data/test/fixtures/stylesheets/compass/css/regions.css +4 -2
  100. data/test/fixtures/stylesheets/compass/css/selection.css +13 -0
  101. data/test/fixtures/stylesheets/compass/css/sprites.css +251 -250
  102. data/test/fixtures/stylesheets/compass/css/text_shadow.css +6 -6
  103. data/test/fixtures/stylesheets/compass/css/transition.css +6 -0
  104. data/test/fixtures/stylesheets/compass/css/units.css +30 -0
  105. data/test/fixtures/stylesheets/compass/css/user-interface.css +22 -1
  106. data/test/fixtures/stylesheets/compass/css/utilities.css +15 -0
  107. data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +196 -27
  108. data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
  109. data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +19 -0
  110. data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
  111. data/test/fixtures/stylesheets/compass/sass/background-clip.scss +4 -2
  112. data/test/fixtures/stylesheets/compass/sass/background-origin.scss +10 -0
  113. data/test/fixtures/stylesheets/compass/sass/background-size.scss +12 -0
  114. data/test/fixtures/stylesheets/compass/sass/columns.scss +10 -9
  115. data/test/fixtures/stylesheets/compass/sass/flexbox.scss +44 -0
  116. data/test/fixtures/stylesheets/compass/sass/gradients.sass +32 -3
  117. data/test/fixtures/stylesheets/compass/sass/selection.scss +13 -0
  118. data/test/fixtures/stylesheets/compass/sass/transition.scss +1 -1
  119. data/test/fixtures/stylesheets/compass/sass/units.scss +45 -0
  120. data/test/fixtures/stylesheets/compass/sass/user-interface.scss +13 -1
  121. data/test/fixtures/stylesheets/compass/sass/utilities.scss +10 -0
  122. data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +208 -7
  123. data/test/fixtures/stylesheets/envtest/css/env.css +8 -0
  124. data/test/fixtures/stylesheets/envtest/sass/env.scss +16 -0
  125. data/test/fixtures/stylesheets/envtest/tmp/env.css +4 -4
  126. data/test/fixtures/stylesheets/valid/css/simple.css +4 -0
  127. data/test/helpers/diff.rb +1 -1
  128. data/test/integrations/compass_test.rb +23 -14
  129. data/test/integrations/sprites_test.rb +305 -63
  130. data/test/test_helper.rb +4 -13
  131. data/test/units/command_line_test.rb +0 -2
  132. data/test/units/compass_module_test.rb +1 -1
  133. data/test/units/configuration_test.rb +12 -0
  134. data/test/units/regressions_test.rb +8 -8
  135. data/test/units/sass_extensions_test.rb +13 -11
  136. data/test/units/sass_extenstions/gradients_test.rb +33 -0
  137. data/test/units/sprites/image_test.rb +5 -0
  138. data/test/units/sprites/images_test.rb +46 -0
  139. data/test/units/sprites/layout_test.rb +29 -4
  140. data/test/units/watcher/compiler_test.rb +39 -0
  141. data/test/units/watcher/project_watcher_test.rb +73 -0
  142. data/test/units/watcher/watch_test.rb +42 -0
  143. metadata +137 -241
  144. data/examples/compass/images/emblem-a043c4f148.png +0 -0
  145. data/examples/compass/images/flag-03c3b29b35.png +0 -0
  146. data/examples/compass/images/flag-21cfbfbfc8.png +0 -0
  147. data/examples/css3/extensions/fancy-fonts/templates/project/Prociono.otf +0 -0
  148. data/examples/css3/extensions/fancy-fonts/templates/project/bgrove.otf +0 -0
  149. data/frameworks/blueprint/stylesheets/_blueprint.scss +0 -37
  150. data/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +0 -101
  151. data/frameworks/blueprint/stylesheets/blueprint/_colors.scss +0 -36
  152. data/frameworks/blueprint/stylesheets/blueprint/_debug.scss +0 -28
  153. data/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +0 -88
  154. data/frameworks/blueprint/stylesheets/blueprint/_form.scss +0 -66
  155. data/frameworks/blueprint/stylesheets/blueprint/_grid.scss +0 -258
  156. data/frameworks/blueprint/stylesheets/blueprint/_ie.scss +0 -111
  157. data/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +0 -66
  158. data/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +0 -37
  159. data/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +0 -152
  160. data/frameworks/blueprint/stylesheets/blueprint/_print.scss +0 -86
  161. data/frameworks/blueprint/stylesheets/blueprint/_reset.scss +0 -3
  162. data/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +0 -121
  163. data/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +0 -52
  164. data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +0 -90
  165. data/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +0 -37
  166. data/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +0 -83
  167. data/frameworks/blueprint/templates/basic/grid.png +0 -0
  168. data/frameworks/blueprint/templates/basic/ie.sass +0 -4
  169. data/frameworks/blueprint/templates/basic/manifest.rb +0 -30
  170. data/frameworks/blueprint/templates/basic/partials/_base.sass +0 -10
  171. data/frameworks/blueprint/templates/basic/print.sass +0 -4
  172. data/frameworks/blueprint/templates/basic/screen.sass +0 -12
  173. data/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
  174. data/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
  175. data/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
  176. data/frameworks/blueprint/templates/buttons/buttons.sass +0 -49
  177. data/frameworks/blueprint/templates/buttons/manifest.rb +0 -17
  178. data/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
  179. data/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
  180. data/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
  181. data/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
  182. data/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
  183. data/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
  184. data/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
  185. data/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
  186. data/frameworks/blueprint/templates/link_icons/link_icons.sass +0 -13
  187. data/frameworks/blueprint/templates/link_icons/manifest.rb +0 -23
  188. data/frameworks/blueprint/templates/project/grid.png +0 -0
  189. data/frameworks/blueprint/templates/project/ie.sass +0 -16
  190. data/frameworks/blueprint/templates/project/manifest.rb +0 -30
  191. data/frameworks/blueprint/templates/project/partials/_base.sass +0 -11
  192. data/frameworks/blueprint/templates/project/print.sass +0 -8
  193. data/frameworks/blueprint/templates/project/screen.sass +0 -46
  194. data/frameworks/blueprint/templates/semantic/grid.png +0 -0
  195. data/frameworks/blueprint/templates/semantic/ie.sass +0 -16
  196. data/frameworks/blueprint/templates/semantic/manifest.rb +0 -33
  197. data/frameworks/blueprint/templates/semantic/partials/_base.sass +0 -10
  198. data/frameworks/blueprint/templates/semantic/partials/_form.sass +0 -6
  199. data/frameworks/blueprint/templates/semantic/partials/_page.sass +0 -17
  200. data/frameworks/blueprint/templates/semantic/partials/_two_col.sass +0 -38
  201. data/frameworks/blueprint/templates/semantic/print.sass +0 -5
  202. data/frameworks/blueprint/templates/semantic/screen.sass +0 -14
  203. data/lib/compass/commands/generate_grid_background.rb +0 -96
  204. data/lib/compass/grid_builder.rb +0 -102
  205. data/test/fixtures/stylesheets/blueprint/config.rb +0 -14
  206. data/test/fixtures/stylesheets/blueprint/css/ie.css +0 -76
  207. data/test/fixtures/stylesheets/blueprint/css/print.css +0 -56
  208. data/test/fixtures/stylesheets/blueprint/css/screen.css +0 -815
  209. data/test/fixtures/stylesheets/blueprint/css/single-imports/buttons.css +0 -56
  210. data/test/fixtures/stylesheets/blueprint/css/single-imports/colors.css +0 -80
  211. data/test/fixtures/stylesheets/blueprint/css/single-imports/debug.css +0 -11
  212. data/test/fixtures/stylesheets/blueprint/css/single-imports/fancy-type.css +0 -30
  213. data/test/fixtures/stylesheets/blueprint/css/single-imports/form.css +0 -42
  214. data/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css +0 -435
  215. data/test/fixtures/stylesheets/blueprint/css/single-imports/ie.css +0 -76
  216. data/test/fixtures/stylesheets/blueprint/css/single-imports/interaction.css +0 -46
  217. data/test/fixtures/stylesheets/blueprint/css/single-imports/link-icons.css +0 -40
  218. data/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css +0 -651
  219. data/test/fixtures/stylesheets/blueprint/css/single-imports/print.css +0 -60
  220. data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +0 -69
  221. data/test/fixtures/stylesheets/blueprint/css/single-imports/reset.css +0 -42
  222. data/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css +0 -437
  223. data/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css +0 -45
  224. data/test/fixtures/stylesheets/blueprint/css/single-imports/typography.css +0 -146
  225. data/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css +0 -35
  226. data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
  227. data/test/fixtures/stylesheets/blueprint/images/link_icons/doc.png +0 -0
  228. data/test/fixtures/stylesheets/blueprint/images/link_icons/email.png +0 -0
  229. data/test/fixtures/stylesheets/blueprint/images/link_icons/external.png +0 -0
  230. data/test/fixtures/stylesheets/blueprint/images/link_icons/feed.png +0 -0
  231. data/test/fixtures/stylesheets/blueprint/images/link_icons/im.png +0 -0
  232. data/test/fixtures/stylesheets/blueprint/images/link_icons/pdf.png +0 -0
  233. data/test/fixtures/stylesheets/blueprint/images/link_icons/visited.png +0 -0
  234. data/test/fixtures/stylesheets/blueprint/images/link_icons/xls.png +0 -0
  235. data/test/fixtures/stylesheets/blueprint/sass/ie.sass +0 -3
  236. data/test/fixtures/stylesheets/blueprint/sass/print.sass +0 -3
  237. data/test/fixtures/stylesheets/blueprint/sass/screen.sass +0 -18
  238. data/test/fixtures/stylesheets/blueprint/sass/single-imports/buttons.scss +0 -4
  239. data/test/fixtures/stylesheets/blueprint/sass/single-imports/colors.scss +0 -34
  240. data/test/fixtures/stylesheets/blueprint/sass/single-imports/debug.scss +0 -3
  241. data/test/fixtures/stylesheets/blueprint/sass/single-imports/fancy-type.scss +0 -3
  242. data/test/fixtures/stylesheets/blueprint/sass/single-imports/form.scss +0 -5
  243. data/test/fixtures/stylesheets/blueprint/sass/single-imports/grid.scss +0 -3
  244. data/test/fixtures/stylesheets/blueprint/sass/single-imports/ie.scss +0 -3
  245. data/test/fixtures/stylesheets/blueprint/sass/single-imports/interaction.scss +0 -3
  246. data/test/fixtures/stylesheets/blueprint/sass/single-imports/link-icons.scss +0 -13
  247. data/test/fixtures/stylesheets/blueprint/sass/single-imports/liquid.scss +0 -3
  248. data/test/fixtures/stylesheets/blueprint/sass/single-imports/print.scss +0 -5
  249. data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset-utilities.scss +0 -5
  250. data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset.scss +0 -1
  251. data/test/fixtures/stylesheets/blueprint/sass/single-imports/rtl.scss +0 -3
  252. data/test/fixtures/stylesheets/blueprint/sass/single-imports/scaffolding.scss +0 -5
  253. data/test/fixtures/stylesheets/blueprint/sass/single-imports/typography.scss +0 -3
  254. data/test/fixtures/stylesheets/blueprint/sass/single-imports/utilities.scss +0 -3
  255. data/test/fixtures/stylesheets/compass/images/flag-s4798b5a210.png +0 -0
  256. data/test/units/compass_png_test.rb +0 -46
  257. /data/{examples/css3/extensions/fancy-fonts/templates/project/bgrove.ttf → test/fixtures/stylesheets/busted_font_urls/fonts/feed.ttf} +0 -0
@@ -9,7 +9,7 @@ module Compass
9
9
  Usage: compass compile [path/to/project] [path/to/project/src/file.sass ...] [options]
10
10
 
11
11
  Description:
12
- compile project at the path specified or the current director if not specified.
12
+ compile project at the path specified or the current directory if not specified.
13
13
 
14
14
  Options:
15
15
  }.split("\n").map{|l| l.gsub(/^ */,'')}.join("\n")
@@ -48,7 +48,7 @@ module Compass
48
48
 
49
49
  def check_for_sass_files!(compiler)
50
50
  if compiler.sass_files.empty? && !dry_run?
51
- message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n"
51
+ message = "Compass can't find any Sass files to compile.\nIs your compass configuration correct?.\nIf you're trying to start a new project, you have left off the directory argument.\n"
52
52
  message << "Run \"compass -h\" to get help."
53
53
  raise Compass::Error, message
54
54
  end
@@ -129,7 +129,6 @@ module Compass
129
129
  parser.options[:project_name] = arguments.shift if File.directory?(arguments.first)
130
130
  unless arguments.empty?
131
131
  parser.options[:sass_files] = arguments.dup
132
- parser.options[:force] = true
133
132
  end
134
133
  end
135
134
  end
@@ -2,6 +2,7 @@ require 'fileutils'
2
2
  require 'pathname'
3
3
  require 'compass/commands/base'
4
4
  require 'compass/commands/update_project'
5
+ require 'compass/watcher'
5
6
  require 'sass/plugin'
6
7
 
7
8
  module Compass
@@ -25,131 +26,28 @@ module Compass
25
26
 
26
27
  end
27
28
  end
28
- module MemoryDebugger
29
- def report_on_instances(type, options = {})
30
- @@runs ||= 0
31
- @@runs += 1
32
- @@object_id_tracker ||= {}
33
- @@object_id_tracker[type] ||= []
34
- GC.start
35
- sleep options.fetch(:gc_pause, 1)
36
- count = ObjectSpace.each_object(type) do |obj|
37
- if options.fetch(:verbose, true)
38
- if @@runs > 2
39
- if !@@object_id_tracker[type].include?(obj.object_id)
40
- begin
41
- puts obj.inspect
42
- rescue
43
- end
44
- puts "#{obj.class.name}:#{obj.object_id}"
45
- end
46
- end
47
- @@object_id_tracker[type] << obj.object_id
48
- end
49
- end
50
- puts "#{type}: #{count} instances."
51
- end
52
- end
29
+
53
30
  class WatchProject < UpdateProject
54
31
 
55
32
  register :watch
56
33
 
57
34
  attr_accessor :last_update_time, :last_sass_files
58
35
 
59
- include MemoryDebugger
60
-
61
36
  def perform
62
- Signal.trap("INT") do
63
- puts ""
64
- exit 0
37
+ # '.' assumes you are in the executing directory. so get the full path to the directory
38
+ if options[:project_name] == '.'
39
+ Compass.configuration.project_path = Dir.pwd
65
40
  end
41
+
42
+ project_watcher = Compass::Watcher::ProjectWatcher.new(Compass.configuration.project_path, Compass.configuration.watches, options, options[:poll])
66
43
 
67
- check_for_sass_files!(new_compiler_instance)
68
- recompile
69
-
70
- require 'fssm'
71
-
72
-
73
- if options[:poll]
74
- require "fssm/backends/polling"
75
- # have to silence the ruby warning about chaning a constant.
76
- stderr, $stderr = $stderr, StringIO.new
77
- FSSM::Backends.const_set("Default", FSSM::Backends::Polling)
78
- $stderr = stderr
79
- end
80
-
81
- action = FSSM::Backends::Default.to_s == "FSSM::Backends::Polling" ? "polling" : "watching"
82
-
83
- puts ">>> Compass is #{action} for changes. Press Ctrl-C to Stop."
44
+ puts ">>> Compass is watching for changes. Press Ctrl-C to Stop."
84
45
  $stdout.flush
46
+
47
+ project_watcher.compile
48
+ project_watcher.watch!
85
49
 
86
- begin
87
- FSSM.monitor do |monitor|
88
- Compass.configuration.sass_load_paths.each do |load_path|
89
- load_path = load_path.root if load_path.respond_to?(:root)
90
- next unless load_path.is_a? String
91
- monitor.path load_path do |path|
92
- path.glob '**/*.s[ac]ss'
93
50
 
94
- path.update &method(:recompile)
95
- path.delete {|base, relative| remove_obsolete_css(base,relative); recompile(base, relative)}
96
- path.create &method(:recompile)
97
- end
98
- end
99
- Compass.configuration.watches.each do |glob, callback|
100
- monitor.path Compass.configuration.project_path do |path|
101
- path.glob glob
102
- path.update do |base, relative|
103
- puts ">>> Change detected to: #{relative}"
104
- $stdout.flush
105
- callback.call(base, relative)
106
- end
107
- path.create do |base, relative|
108
- puts ">>> New file detected: #{relative}"
109
- $stdout.flush
110
- callback.call(base, relative)
111
- end
112
- path.delete do |base, relative|
113
- puts ">>> File Removed: #{relative}"
114
- $stdout.flush
115
- callback.call(base, relative)
116
- end
117
- end
118
- end
119
-
120
- end
121
- rescue FSSM::CallbackError => e
122
- # FSSM catches exit? WTF.
123
- if e.message =~ /exit/
124
- exit
125
- end
126
- end
127
- end
128
-
129
- def remove_obsolete_css(base = nil, relative = nil)
130
- compiler = new_compiler_instance(:quiet => true)
131
- sass_files = compiler.sass_files
132
- deleted_sass_files = (last_sass_files || []) - sass_files
133
- deleted_sass_files.each do |deleted_sass_file|
134
- css_file = compiler.corresponding_css_file(deleted_sass_file)
135
- remove(css_file) if File.exists?(css_file)
136
- end
137
- self.last_sass_files = sass_files
138
- end
139
-
140
- def recompile(base = nil, relative = nil)
141
- @memory_cache.reset! if @memory_cache
142
- compiler = new_compiler_instance(:quiet => true, :loud => [:identical, :overwrite, :create])
143
- if file = compiler.out_of_date?
144
- begin
145
- puts ">>> Change detected at "+Time.now.strftime("%T")+" to: #{relative || compiler.relative_stylesheet_name(file)}"
146
- $stdout.flush
147
- compiler.run
148
- GC.start
149
- rescue StandardError => e
150
- ::Compass::Exec::Helpers.report_error(e, options)
151
- end
152
- end
153
51
  end
154
52
 
155
53
  class << self
@@ -3,7 +3,7 @@ end
3
3
 
4
4
  require 'compass/commands/registry'
5
5
 
6
- %w(base generate_grid_background default help list_frameworks project_base
6
+ %w(base project_base default help list_frameworks
7
7
  update_project watch_project create_project clean_project extension_command
8
8
  imports installer_command print_version project_stats stamp_pattern
9
9
  sprite validate_project write_configuration interactive unpack_extension
@@ -19,6 +19,12 @@ module Compass
19
19
  self.sass_options[:compass] ||= {}
20
20
  self.sass_options[:compass][:logger] = self.logger
21
21
  self.sass_options[:compass][:environment] = Compass.configuration.environment
22
+ reset_staleness_checker!
23
+ end
24
+
25
+ def reset_staleness_checker!
26
+ self.staleness_checker = nil
27
+ #Sass::Plugin::StalenessChecker.dependencies_cache = {}
22
28
  self.staleness_checker = Sass::Plugin::StalenessChecker.new(sass_options)
23
29
  end
24
30
 
@@ -142,7 +142,7 @@ module Compass
142
142
 
143
143
  def watch(glob, &block)
144
144
  @watches ||= []
145
- @watches << [glob, block]
145
+ @watches << Watcher::Watch.new(glob, &block)
146
146
  end
147
147
 
148
148
  def watches
@@ -33,6 +33,8 @@ module Compass
33
33
  nil
34
34
  elsif config.is_a?(Compass::Configuration::Data)
35
35
  config
36
+ elsif config.instance_of?(Hash)
37
+ Compass::Configuration::Data.new(filename, config)
36
38
  elsif config.respond_to?(:read)
37
39
  filename ||= config.to_s if config.is_a?(Pathname)
38
40
  Compass::Configuration::FileData.new_from_string(config.read, filename, defaults)
@@ -26,7 +26,7 @@ module Compass::Exec::GlobalOptionsParser
26
26
  ::Compass.configuration.discover Pathname.new(frameworks_dir).realpath
27
27
  end
28
28
 
29
- opts.on('-I IMPORT_PATH',
29
+ opts.on('-I IMPORT_PATH', '--import-path IMPORT_PATH',
30
30
  "Makes files under the IMPORT_PATH folder findable by Sass's @import directive."
31
31
  ) do |import_path|
32
32
  require 'pathname'
@@ -20,6 +20,10 @@ module Compass::Exec::ProjectOptionsParser
20
20
  self.options[:project_type] = project_type.to_sym
21
21
  end
22
22
 
23
+ opts.on('--app-dir PATH', 'The base directory for your application.') do |project_path|
24
+ self.options[:project_path] = project_path
25
+ end
26
+
23
27
  opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir|
24
28
  set_dir_or_path(:sass, sass_dir)
25
29
  end
@@ -35,7 +39,7 @@ module Compass::Exec::ProjectOptionsParser
35
39
  opts.on('--javascripts-dir JS_DIR', "The directory where you keep your javascripts.") do |javascripts_dir|
36
40
  set_dir_or_path(:javascripts, javascripts_dir)
37
41
  end
38
-
42
+
39
43
  opts.on('--fonts-dir FONTS_DIR', "The directory where you keep your fonts.") do |fonts_dir|
40
44
  set_dir_or_path(:fonts, fonts_dir)
41
45
  end
@@ -57,6 +61,14 @@ module Compass::Exec::ProjectOptionsParser
57
61
  opts.on('--no-line-comments', :NONE, 'Disable line comments.') do
58
62
  self.options[:line_comments] = false
59
63
  end
64
+
65
+ opts.on('--http-path HTTP_PATH', 'Set this to the root of your project when deployed') do |http_path|
66
+ self.options[:http_path] = http_path
67
+ end
68
+
69
+ opts.on('--generated-images-path GENERATED_IMAGES_PATH', 'The path where you generate your images') do |generated_images_path|
70
+ self.options[:generated_images_path] = generated_images_path
71
+ end
60
72
  end
61
73
 
62
74
  end
@@ -9,6 +9,7 @@ module Compass
9
9
  ACTION_COLORS = {
10
10
  :error => :red,
11
11
  :warning => :yellow,
12
+ :info => :green,
12
13
  :compile => :green,
13
14
  :overwrite => :yellow,
14
15
  :create => :green,
@@ -76,6 +77,7 @@ module Compass
76
77
  # Emit a log message
77
78
  def log(msg)
78
79
  puts msg
80
+ $stdout.flush
79
81
  end
80
82
 
81
83
  # add padding to the left of an action that was performed.
@@ -33,7 +33,7 @@ module Compass::SassExtensions::Functions::CrossBrowserSupport
33
33
  Sass::Script::Bool.new(needed)
34
34
  end
35
35
 
36
- %w(webkit moz o ms svg pie css2 owg).each do |prefix|
36
+ %w(webkit moz o ms svg pie css2).each do |prefix|
37
37
  class_eval <<-RUBY, __FILE__, __LINE__ + 1
38
38
  # Syntactic sugar to apply the given prefix
39
39
  # -moz($arg) is the same as calling prefix(-moz, $arg)
@@ -1,5 +1,23 @@
1
1
  module Compass::SassExtensions::Functions::Env
2
+
2
3
  def compass_env
3
4
  Sass::Script::String.new((options[:compass][:environment] || "development").to_s)
4
5
  end
6
+
7
+ def current_time(format)
8
+ time = Time.now.strftime(format.to_s)
9
+
10
+ Sass::Script::String.new(time.to_s)
11
+ end
12
+
13
+ alias :current_date :current_time
14
+
15
+ def current_source_file
16
+ Sass::Script::String.new(options[:filename].to_s)
17
+ end
18
+
19
+ def current_output_file
20
+ Sass::Script::String.new(options[:css_filename].to_s)
21
+ end
22
+
5
23
  end
@@ -10,6 +10,7 @@ module Compass::SassExtensions::Functions::GradientSupport
10
10
  def initialize(color, stop = nil)
11
11
  unless Sass::Script::Color === color ||
12
12
  Sass::Script::Funcall === color ||
13
+ (Sass::Script::String === color && color.value == "currentColor")||
13
14
  (Sass::Script::String === color && color.value == "transparent")
14
15
  raise Sass::SyntaxError, "Expected a color. Got: #{color}"
15
16
  end
@@ -21,6 +22,31 @@ module Compass::SassExtensions::Functions::GradientSupport
21
22
  def inspect
22
23
  to_s
23
24
  end
25
+
26
+ def self.color_to_svg_s(c)
27
+ # svg doesn't support the "transparent" keyword; we need to manually
28
+ # refactor it into "transparent black"
29
+ if c.is_a?(Sass::Script::String) && c.value == "transparent"
30
+ "black"
31
+ elsif c.is_a?(Sass::Script::String)
32
+ c.value.dup
33
+ else
34
+ self.color_to_s(c.with(:alpha => 1))
35
+ end
36
+ end
37
+
38
+ def self.color_to_svg_alpha(c)
39
+ # svg doesn't support the "transparent" keyword; we need to manually
40
+ # refactor it into "transparent black"
41
+ if c.is_a?(Sass::Script::String) && c.value == "transparent"
42
+ 0
43
+ elsif c.is_a?(Sass::Script::String) && c.value == "currentColor"
44
+ 1
45
+ else
46
+ c.alpha
47
+ end
48
+ end
49
+
24
50
  def self.color_to_s(c)
25
51
  if c.is_a?(Sass::Script::String)
26
52
  c.value.dup
@@ -53,7 +79,7 @@ module Compass::SassExtensions::Functions::GradientSupport
53
79
  def standardized_prefix(prefix)
54
80
  class_eval %Q{
55
81
  def to_#{prefix}(options = self.options)
56
- Sass::Script::String.new("-#{prefix}-\#{to_s(options)}")
82
+ Sass::Script::String.new("-#{prefix}-\#{to_s_prefixed(options)}")
57
83
  end
58
84
  }
59
85
  end
@@ -108,22 +134,14 @@ module Compass::SassExtensions::Functions::GradientSupport
108
134
  s << color_stops.to_s(options)
109
135
  s << ")"
110
136
  end
137
+
138
+ def to_s_prefixed(options = self.options)
139
+ to_s(options)
140
+ end
111
141
 
112
142
  standardized_prefix :webkit
113
143
  standardized_prefix :moz
114
144
  standardized_prefix :o
115
-
116
- def to_owg(options = self.options)
117
- args = [
118
- grad_point(position || _center_position),
119
- Sass::Script::String.new("0"),
120
- grad_point(position || _center_position),
121
- grad_end_position(color_stops, Sass::Script::Bool.new(true)),
122
- grad_color_stops(color_stops)
123
- ]
124
- args.each {|a| a.options = options}
125
- Sass::Script::String.new("-webkit-gradient(radial, #{args.join(', ')})")
126
- end
127
145
 
128
146
  def to_svg(options = self.options)
129
147
  # XXX Add shape support if possible
@@ -143,23 +161,48 @@ module Compass::SassExtensions::Functions::GradientSupport
143
161
  class LinearGradient < Sass::Script::Literal
144
162
  include Gradient
145
163
 
146
- attr_accessor :color_stops, :position_or_angle
164
+ attr_accessor :color_stops, :position_or_angle, :legacy
147
165
 
148
166
  def children
149
167
  [color_stops, position_or_angle].compact
150
168
  end
151
169
 
152
- def initialize(position_or_angle, color_stops)
170
+ def initialize(position_or_angle, color_stops, legacy=false)
153
171
  unless color_stops.value.size >= 2
154
172
  raise Sass::SyntaxError, "At least two color stops are required for a linear-gradient"
155
173
  end
156
174
  self.position_or_angle = position_or_angle
157
175
  self.color_stops = color_stops
176
+ self.legacy = legacy
158
177
  end
159
178
 
160
- def to_s(options = self.options)
179
+ def to_s_prefixed(options = self.options)
161
180
  s = "linear-gradient("
162
- s << position_or_angle.to_s(options) << ", " if position_or_angle
181
+ if legacy
182
+ s << position_or_angle.to_s(options) << ", " if position_or_angle
183
+ else
184
+ s << convert_to_or_from_legacy(position_or_angle, options) << ", " if position_or_angle
185
+ end
186
+ s << color_stops.to_s(options)
187
+ s << ")"
188
+ end
189
+
190
+ def convert_to_or_from_legacy(position_or_angle, options = self.options)
191
+ input = if position_or_angle.is_a?(Sass::Script::Number)
192
+ position_or_angle
193
+ else
194
+ Sass::Script::List.new(position_or_angle.to_s.split(' ').map {|s| Sass::Script::String.new(s) }, :space)
195
+ end
196
+ return convert_angle_from_offical(input).to_s(options)
197
+ end
198
+
199
+ def to_s(options = self.options)
200
+ s = 'linear-gradient('
201
+ if legacy
202
+ s << convert_to_or_from_legacy(position_or_angle, options) << ", " if position_or_angle
203
+ else
204
+ s << position_or_angle.to_s(options) << ", " if position_or_angle
205
+ end
163
206
  s << color_stops.to_s(options)
164
207
  s << ")"
165
208
  end
@@ -177,16 +220,6 @@ module Compass::SassExtensions::Functions::GradientSupport
177
220
  end
178
221
  end
179
222
 
180
- # Output the original webkit gradient syntax
181
- def to_owg(options = self.options)
182
- args = []
183
- args << grad_point(position_or_angle || Sass::Script::String.new("top"))
184
- args << linear_end_position(position_or_angle, color_stops)
185
- args << grad_color_stops(color_stops)
186
- args.each{|a| a.options = options}
187
- Sass::Script::String.new("-webkit-gradient(linear, #{args.join(', ')})")
188
- end
189
-
190
223
  def to_svg(options = self.options)
191
224
  linear_svg_gradient(color_stops, position_or_angle || Sass::Script::String.new("top"))
192
225
  end
@@ -203,6 +236,29 @@ module Compass::SassExtensions::Functions::GradientSupport
203
236
  end
204
237
 
205
238
  module Functions
239
+
240
+ def convert_angle_from_offical(deg)
241
+ if deg.is_a?(Sass::Script::Number)
242
+ return Sass::Script::Number.new((deg.value.to_f - 450).abs % 360, ['deg'])
243
+ else
244
+ args = deg.value
245
+ direction = []
246
+ if args[0] == Sass::Script::String.new('to')
247
+ if args.size < 2
248
+ direction = args
249
+ else
250
+ direction << opposite_position(args[1])
251
+ end
252
+ else
253
+ direction << Sass::Script::String.new('to')
254
+ args.each do |pos|
255
+ direction << opposite_position(pos)
256
+ end
257
+ end
258
+ return Sass::Script::String.new(direction.join(' '))
259
+ end
260
+ end
261
+
206
262
  # given a position list, return a corresponding position in percents
207
263
  # otherwise, returns the original argument
208
264
  def grad_point(position)
@@ -252,6 +308,8 @@ module Compass::SassExtensions::Functions::GradientSupport
252
308
  ColorStop.new(*arg.value)
253
309
  elsif Sass::Script::String === arg && arg.value == "transparent"
254
310
  ColorStop.new(arg)
311
+ elsif Sass::Script::String === arg && arg.value == "currentColor"
312
+ ColorStop.new(arg)
255
313
  else
256
314
  raise Sass::SyntaxError, "Not a valid color stop: #{arg.class.name}: #{arg}"
257
315
  end
@@ -286,7 +344,7 @@ module Compass::SassExtensions::Functions::GradientSupport
286
344
  RadialGradient.new(position_or_angle, shape_and_size, send(:color_stops, *color_stops))
287
345
  end
288
346
 
289
- def linear_gradient(position_or_angle, *color_stops)
347
+ def _build_linear_gradient(position_or_angle, *color_stops)
290
348
  if color_stop?(position_or_angle)
291
349
  color_stops.unshift(position_or_angle)
292
350
  position_or_angle = nil
@@ -300,9 +358,19 @@ module Compass::SassExtensions::Functions::GradientSupport
300
358
  if color_stops.size == 1 && (stops = list_of_color_stops?(color_stops.first))
301
359
  color_stops = stops
302
360
  end
361
+ return [position_or_angle, color_stops]
362
+ end
363
+
364
+ def _linear_gradient(position_or_angle, *color_stops)
365
+ position_or_angle, color_stops = _build_linear_gradient(position_or_angle, *color_stops)
303
366
  LinearGradient.new(position_or_angle, send(:color_stops, *color_stops))
304
367
  end
305
368
 
369
+ def _linear_gradient_legacy(position_or_angle, *color_stops)
370
+ position_or_angle, color_stops = _build_linear_gradient(position_or_angle, *color_stops)
371
+ LinearGradient.new(position_or_angle, send(:color_stops, *color_stops), true)
372
+ end
373
+
306
374
  # returns color-stop() calls for use in webkit.
307
375
  def grad_color_stops(color_list)
308
376
  stops = color_stops_in_percentages(color_list).map do |stop, color|
@@ -495,7 +563,11 @@ module Compass::SassExtensions::Functions::GradientSupport
495
563
  # color_stops = array of: [stop, color]
496
564
  def color_stops_svg(color_stops)
497
565
  color_stops.each.map{ |stop, color|
498
- %{<stop offset="#{stop.to_s}" stop-color="#{color.inspect}"/>}
566
+ s = %{<stop offset="#{stop.to_s}"}
567
+ s << %{ stop-color="#{ColorStop.color_to_svg_s(color)}"}
568
+ alpha = ColorStop.color_to_svg_alpha(color)
569
+ s << %{ stop-opacity="#{alpha}"} if alpha != 1
570
+ s << "/>"
499
571
  }.join
500
572
  end
501
573
 
@@ -45,9 +45,10 @@ module Compass::SassExtensions::Functions::ImageSize
45
45
  private
46
46
 
47
47
  def image_dimensions(image_file)
48
+ image_file = image_file.respond_to?(:value) ? image_file.value : image_file
48
49
  options[:compass] ||= {}
49
50
  options[:compass][:image_dimensions] ||= {}
50
- options[:compass][:image_dimensions][image_file.value] = ImageProperties.new(image_path_for_size(image_file.value)).size
51
+ options[:compass][:image_dimensions][image_file] = ImageProperties.new(image_path_for_size(image_file)).size
51
52
  end
52
53
 
53
54
  def image_path_for_size(image_file)
@@ -5,6 +5,18 @@ module Compass::SassExtensions::Functions::Math
5
5
  end
6
6
  Sass::Script::Functions.declare :pi, []
7
7
 
8
+ def random(*args)
9
+ value = if args.length == 1
10
+ rand(args.pop.value)
11
+ else
12
+ range = (args.first.value..args.last.value).to_a
13
+ range[rand(range.length)]
14
+ end
15
+ Sass::Script::Number.new(value)
16
+ end
17
+ Sass::Script::Functions.declare :random, [:limit]
18
+ Sass::Script::Functions.declare :random, [:start, :limit]
19
+
8
20
  def sin(number)
9
21
  trig(:sin, number)
10
22
  end
@@ -20,10 +32,10 @@ module Compass::SassExtensions::Functions::Math
20
32
  end
21
33
  Sass::Script::Functions.declare :tan, [:number]
22
34
 
23
- def e()
35
+ def e
24
36
  Sass::Script::Number.new(Math::E)
25
37
  end
26
- Sass::Script::Functions.declare :pi, []
38
+ Sass::Script::Functions.declare :e, []
27
39
 
28
40
  def logarithm(number, base = e )
29
41
  assert_type number, :Number