bsherman-compass 0.5.2

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 (155) hide show
  1. data/Manifest +178 -0
  2. data/README.markdown +17 -0
  3. data/Rakefile +98 -0
  4. data/VERSION +1 -0
  5. data/bin/compass +8 -0
  6. data/compass.gemspec +37 -0
  7. data/examples/blueprint_default/index.html +73 -0
  8. data/examples/blueprint_default/parts/elements.html +246 -0
  9. data/examples/blueprint_default/parts/forms.html +100 -0
  10. data/examples/blueprint_default/parts/grid.html +206 -0
  11. data/examples/blueprint_default/parts/test-small.jpg +0 -0
  12. data/examples/blueprint_default/parts/test.jpg +0 -0
  13. data/examples/blueprint_default/parts/valid.png +0 -0
  14. data/examples/blueprint_plugins/index.html +60 -0
  15. data/examples/blueprint_plugins/parts/fancy_type.html +84 -0
  16. data/examples/blueprint_plugins/parts/test-small.jpg +0 -0
  17. data/examples/blueprint_plugins/parts/test.jpg +0 -0
  18. data/examples/blueprint_plugins/parts/valid.png +0 -0
  19. data/examples/blueprint_semantic/index.html +68 -0
  20. data/examples/blueprint_semantic/parts/fancy_type.html +84 -0
  21. data/examples/blueprint_semantic/parts/liquid.html +84 -0
  22. data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
  23. data/examples/blueprint_semantic/parts/test.jpg +0 -0
  24. data/examples/blueprint_semantic/parts/valid.png +0 -0
  25. data/examples/compass/compass.html +19 -0
  26. data/examples/compass/sticky_footer.html.haml +14 -0
  27. data/examples/compass/utilities.html.haml +141 -0
  28. data/examples/yui/divisions.html.haml +179 -0
  29. data/examples/yui/index.html.haml +19 -0
  30. data/examples/yui/sub_divisions.html.haml +169 -0
  31. data/examples/yui/templates.html.haml +54 -0
  32. data/examples/yui/test.jpg +0 -0
  33. data/examples/yui/typography.html.haml +132 -0
  34. data/frameworks/blueprint.rb +2 -0
  35. data/frameworks/blueprint/lib/blueprint/constants.rb +17 -0
  36. data/frameworks/blueprint/lib/blueprint/grid_builder.rb +54 -0
  37. data/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
  38. data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +49 -0
  39. data/frameworks/blueprint/stylesheets/blueprint/_print.sass +82 -0
  40. data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
  41. data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +30 -0
  42. data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
  43. data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +81 -0
  44. data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +43 -0
  45. data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +141 -0
  46. data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
  47. data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +137 -0
  48. data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +46 -0
  49. data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +154 -0
  50. data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
  51. data/frameworks/blueprint/templates/project/grid.png +0 -0
  52. data/frameworks/blueprint/templates/project/ie.sass +3 -0
  53. data/frameworks/blueprint/templates/project/manifest.rb +5 -0
  54. data/frameworks/blueprint/templates/project/print.sass +3 -0
  55. data/frameworks/blueprint/templates/project/screen.sass +8 -0
  56. data/frameworks/compass.rb +2 -0
  57. data/frameworks/compass/stylesheets/_compass.sass +1 -0
  58. data/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
  59. data/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
  60. data/frameworks/compass/stylesheets/compass/_utilities.sass +5 -0
  61. data/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +17 -0
  62. data/frameworks/compass/stylesheets/compass/utilities/_general.sass +4 -0
  63. data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
  64. data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
  65. data/frameworks/compass/stylesheets/compass/utilities/_print.sass +24 -0
  66. data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +3 -0
  67. data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
  68. data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +11 -0
  69. data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
  70. data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +56 -0
  71. data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
  72. data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
  73. data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
  74. data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
  75. data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
  76. data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
  77. data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +20 -0
  78. data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
  79. data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +20 -0
  80. data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass +27 -0
  81. data/frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass +9 -0
  82. data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
  83. data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -0
  84. data/frameworks/compass/templates/project/ie.sass +6 -0
  85. data/frameworks/compass/templates/project/manifest.rb +3 -0
  86. data/frameworks/compass/templates/project/print.sass +6 -0
  87. data/frameworks/compass/templates/project/screen.sass +7 -0
  88. data/frameworks/yui.rb +2 -0
  89. data/frameworks/yui/COPYRIGHT +15 -0
  90. data/frameworks/yui/stylesheets/_yui.sass +7 -0
  91. data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
  92. data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
  93. data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
  94. data/frameworks/yui/templates/project/manifest.rb +1 -0
  95. data/frameworks/yui/templates/project/screen.sass +4 -0
  96. data/lib/compass.rb +39 -0
  97. data/lib/compass/actions.rb +92 -0
  98. data/lib/compass/commands/base.rb +29 -0
  99. data/lib/compass/commands/create_project.rb +41 -0
  100. data/lib/compass/commands/list_frameworks.rb +16 -0
  101. data/lib/compass/commands/print_version.rb +23 -0
  102. data/lib/compass/commands/project_base.rb +82 -0
  103. data/lib/compass/commands/update_project.rb +25 -0
  104. data/lib/compass/commands/watch_project.rb +53 -0
  105. data/lib/compass/commands/write_configuration.rb +37 -0
  106. data/lib/compass/compiler.rb +40 -0
  107. data/lib/compass/configuration.rb +167 -0
  108. data/lib/compass/core_ext.rb +12 -0
  109. data/lib/compass/errors.rb +7 -0
  110. data/lib/compass/exec.rb +184 -0
  111. data/lib/compass/frameworks.rb +29 -0
  112. data/lib/compass/installers.rb +5 -0
  113. data/lib/compass/installers/base.rb +135 -0
  114. data/lib/compass/installers/manifest.rb +57 -0
  115. data/lib/compass/installers/rails.rb +118 -0
  116. data/lib/compass/installers/stand_alone.rb +76 -0
  117. data/lib/compass/logger.rb +34 -0
  118. data/lib/compass/merb.rb +43 -0
  119. data/lib/compass/test_case.rb +37 -0
  120. data/lib/compass/validate.rb +13 -0
  121. data/lib/compass/validate/COPYRIGHT.html +93 -0
  122. data/lib/compass/validate/JIGSAW_COPYRIGHT +64 -0
  123. data/lib/compass/validate/README.html +83 -0
  124. data/lib/compass/validate/XERCES_COPYING.txt +56 -0
  125. data/lib/compass/validate/css-validator-javadoc.jar +0 -0
  126. data/lib/compass/validate/css-validator.jar +0 -0
  127. data/lib/compass/validate/jigsaw.jar +0 -0
  128. data/lib/compass/validate/xerces.jar +0 -0
  129. data/lib/compass/validator.rb +59 -0
  130. data/lib/compass/version.rb +66 -0
  131. data/lib/sass_extensions.rb +13 -0
  132. data/test/command_line_test.rb +147 -0
  133. data/test/compass_test.rb +148 -0
  134. data/test/configuration_test.rb +29 -0
  135. data/test/fixtures/stylesheets/blueprint/css/typography.css +159 -0
  136. data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -0
  137. data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -0
  138. data/test/fixtures/stylesheets/blueprint/sass/screen.sass +17 -0
  139. data/test/fixtures/stylesheets/blueprint/sass/typography.sass +3 -0
  140. data/test/fixtures/stylesheets/compass/css/layout.css +14 -0
  141. data/test/fixtures/stylesheets/compass/css/print.css +19 -0
  142. data/test/fixtures/stylesheets/compass/css/reset.css +66 -0
  143. data/test/fixtures/stylesheets/compass/css/utilities.css +23 -0
  144. data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
  145. data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
  146. data/test/fixtures/stylesheets/compass/sass/reset.sass +1 -0
  147. data/test/fixtures/stylesheets/compass/sass/utilities.sass +5 -0
  148. data/test/fixtures/stylesheets/yui/css/mixins.css +16 -0
  149. data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
  150. data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
  151. data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
  152. data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
  153. data/test/sass_extensions_test.rb +26 -0
  154. data/test/test_helper.rb +47 -0
  155. metadata +295 -0
@@ -0,0 +1,135 @@
1
+ module Compass
2
+ module Installers
3
+
4
+ class Base
5
+
6
+ include Actions
7
+
8
+ attr_accessor :template_path, :target_path, :working_path
9
+ attr_accessor :options
10
+ attr_accessor :manifest
11
+ attr_accessor :css_dir, :sass_dir, :images_dir, :javascripts_dir
12
+
13
+ def initialize(template_path, target_path, options = {})
14
+ @template_path = template_path
15
+ @target_path = target_path
16
+ @working_path = Dir.getwd
17
+ @options = options
18
+ @manifest = Manifest.new(manifest_file)
19
+ self.logger = options[:logger]
20
+ configure
21
+ end
22
+
23
+ def manifest_file
24
+ @manifest_file ||= File.join(template_path, "manifest.rb")
25
+ end
26
+
27
+ # Initializes the project to work with compass
28
+ def init
29
+ end
30
+
31
+ # Runs the installer.
32
+ # Every installer must conform to the installation strategy of prepare, install, and then finalize.
33
+ # A default implementation is provided for each step.
34
+ def run(options = {})
35
+ prepare
36
+ install
37
+ finalize unless options[:skip_finalization]
38
+ end
39
+
40
+ # The default configure method -- it sets up directories from the options
41
+ # and corresponding default_* methods for those not found in the options hash.
42
+ # It can be overridden it or augmented for reading config files,
43
+ # prompting the user for more information, etc.
44
+ def configure
45
+ unless @configured
46
+ [:css_dir, :sass_dir, :images_dir, :javascripts_dir].each do |opt|
47
+ configure_option_with_default opt
48
+ end
49
+ end
50
+ ensure
51
+ @configured = true
52
+ end
53
+
54
+ # The default prepare method -- it is a no-op.
55
+ # Generally you would create required directories, etc.
56
+ def prepare
57
+ end
58
+
59
+ def configure_option_with_default(opt)
60
+ value = options[opt]
61
+ value ||= begin
62
+ default_method = "default_#{opt}".to_sym
63
+ send(default_method) if respond_to?(default_method)
64
+ end
65
+ send("#{opt}=", value)
66
+ end
67
+
68
+ # The default install method. Calls install_<type> methods in the order specified by the manifest.
69
+ def install
70
+ manifest.each do |entry|
71
+ send("install_#{entry.type}", entry.from, entry.to, entry.options)
72
+ end
73
+ end
74
+
75
+ # The default finalize method -- it is a no-op.
76
+ # This could print out a message or something.
77
+ def finalize
78
+ end
79
+
80
+ def compilation_required?
81
+ false
82
+ end
83
+
84
+ def self.installer(type, &locator)
85
+ locator ||= lambda{|to| to}
86
+ loc_method = "install_location_for_#{type}".to_sym
87
+ define_method loc_method, locator
88
+ define_method "install_#{type}" do |from, to, options|
89
+ copy templatize(from), targetize(send(loc_method, to))
90
+ end
91
+ end
92
+
93
+ installer :stylesheet do |to|
94
+ "#{sass_dir}/#{to}"
95
+ end
96
+
97
+ installer :image do |to|
98
+ "#{images_dir}/#{to}"
99
+ end
100
+
101
+ installer :script do |to|
102
+ "#{javascripts_dir}/#{to}"
103
+ end
104
+
105
+ installer :file
106
+
107
+ # returns an absolute path given a path relative to the current installation target.
108
+ # Paths can use unix style "/" and will be corrected for the current platform.
109
+ def targetize(path)
110
+ strip_trailing_separator File.join(target_path, separate(path))
111
+ end
112
+
113
+ # returns an absolute path given a path relative to the current template.
114
+ # Paths can use unix style "/" and will be corrected for the current platform.
115
+ def templatize(path)
116
+ strip_trailing_separator File.join(template_path, separate(path))
117
+ end
118
+
119
+ def stylesheet_links
120
+ html = "<head>\n"
121
+ manifest.each_stylesheet do |stylesheet|
122
+ media = if stylesheet.options[:media]
123
+ %Q{ media="#{stylesheet.options[:media]}"}
124
+ end
125
+ ss_line = %Q{ <link href="/stylesheets/#{stylesheet.to.sub(/\.sass$/,'.css')}"#{media} rel="stylesheet" type="text/css" />}
126
+ if stylesheet.options[:ie]
127
+ ss_line = " <!--[if IE]>\n #{ss_line}\n <![endif]-->"
128
+ end
129
+ html << ss_line + "\n"
130
+ end
131
+ html << "</head>"
132
+ end
133
+ end
134
+ end
135
+ end
@@ -0,0 +1,57 @@
1
+ module Compass
2
+ module Installers
3
+
4
+ class Manifest
5
+
6
+ # A Manifest entry
7
+ class Entry < Struct.new(:type, :from, :options)
8
+ def to
9
+ options[:to] || from
10
+ end
11
+ end
12
+
13
+ def initialize(manifest_file = nil)
14
+ @entries = []
15
+ parse(manifest_file) if manifest_file
16
+ end
17
+
18
+ def self.type(t)
19
+ eval <<-END
20
+ def #{t}(from, options = {})
21
+ @entries << Entry.new(:#{t}, from, options)
22
+ end
23
+ def has_#{t}?
24
+ @entries.detect {|e| e.type == :#{t}}
25
+ end
26
+ def each_#{t}
27
+ @entries.select {|e| e.type == :#{t}}.each {|e| yield e}
28
+ end
29
+ END
30
+ end
31
+
32
+ type :stylesheet
33
+ type :image
34
+ type :javascript
35
+ type :file
36
+
37
+ # Enumerates over the manifest files
38
+ def each
39
+ @entries.each {|e| yield e}
40
+ end
41
+
42
+
43
+ protected
44
+ # parses a manifest file which is a ruby script
45
+ # evaluated in a Manifest instance context
46
+ def parse(manifest_file)
47
+ open(manifest_file) do |f|
48
+ eval(f.read, instance_binding, manifest_file)
49
+ end
50
+ end
51
+ def instance_binding
52
+ binding
53
+ end
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,118 @@
1
+ module Compass
2
+ module Installers
3
+
4
+ class RailsInstaller < Base
5
+
6
+ def configure
7
+ configuration_file = targetize('config/initializers/compass.rb')
8
+ if File.exists?(configuration_file)
9
+ open(configuration_file) do |config|
10
+ eval(config.read, nil, configuration_file)
11
+ end
12
+ end
13
+ Compass.configuration.set_maybe(options)
14
+ end
15
+
16
+ def init
17
+ set_sass_dir unless sass_dir
18
+ set_css_dir unless css_dir
19
+ directory targetize(css_dir)
20
+ directory targetize(sass_dir)
21
+ write_file targetize('config/initializers/compass.rb'), initializer_contents
22
+ end
23
+
24
+ def prepare
25
+ end
26
+
27
+ def finalize(options = {})
28
+ if options[:create]
29
+ puts <<-NEXTSTEPS
30
+
31
+ Congratulations! Your rails project has been configured to use Compass.
32
+ Sass will automatically compile your stylesheets during the next
33
+ page request and keep them up to date when they change.
34
+ Make sure you restart your server!
35
+
36
+ Next add these lines to the head of your layouts:
37
+
38
+ NEXTSTEPS
39
+ end
40
+ puts stylesheet_links
41
+ puts "\n(You are using haml, aren't you?)"
42
+ end
43
+
44
+ def sass_dir
45
+ Compass.configuration.sass_dir
46
+ end
47
+
48
+ def css_dir
49
+ Compass.configuration.css_dir
50
+ end
51
+
52
+ def images_dir
53
+ separate "public/images"
54
+ end
55
+
56
+ def javascripts_dir
57
+ separate "public/javascripts"
58
+ end
59
+
60
+ def set_sass_dir
61
+ recommended_location = separate('app/stylesheets')
62
+ default_location = separate('public/stylesheets/sass')
63
+ print %Q{Compass recommends that you keep your stylesheets in #{recommended_location}
64
+ instead of the Sass default location of #{default_location}.
65
+ Is this OK? (Y/n) }
66
+ answer = gets.downcase[0]
67
+ Compass.configuration.sass_dir = answer == ?n ? default_location : recommended_location
68
+ end
69
+
70
+ def set_css_dir
71
+ recommended_location = separate("public/stylesheets/compiled")
72
+ default_location = separate("public/stylesheets")
73
+ puts
74
+ print %Q{Compass recommends that you keep your compiled css in #{recommended_location}/
75
+ instead the Sass default of #{default_location}/.
76
+ However, if you're exclusively using Sass, then #{default_location}/ is recommended.
77
+ Emit compiled stylesheets to #{recommended_location}/? (Y/n) }
78
+ answer = gets.downcase[0]
79
+ Compass.configuration.css_dir = answer == ?n ? default_location : recommended_location
80
+ end
81
+
82
+ def initializer_contents
83
+ %Q{require 'compass'
84
+ # If you have any compass plugins, require them here.
85
+ Compass.configuration do |config|
86
+ config.project_path = RAILS_ROOT
87
+ config.sass_dir = "#{sass_dir}"
88
+ config.css_dir = "#{css_dir}"
89
+ end
90
+ Compass.configure_sass_plugin!
91
+ }
92
+ end
93
+
94
+ def stylesheet_prefix
95
+ if css_dir.length >= 19
96
+ "#{css_dir[19..-1]}/"
97
+ else
98
+ nil
99
+ end
100
+ end
101
+
102
+ def stylesheet_links
103
+ html = "%head\n"
104
+ manifest.each_stylesheet do |stylesheet|
105
+ ss_line = " = stylesheet_link_tag '#{stylesheet_prefix}#{stylesheet.to.sub(/\.sass$/,'.css')}'"
106
+ if stylesheet.options[:media]
107
+ ss_line += ", :media => '#{stylesheet.options[:media]}'"
108
+ end
109
+ if stylesheet.options[:ie]
110
+ ss_line = " /[if IE]\n " + ss_line
111
+ end
112
+ html << ss_line + "\n"
113
+ end
114
+ html
115
+ end
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,76 @@
1
+ module Compass
2
+ module Installers
3
+
4
+ class StandAloneInstaller < Base
5
+
6
+ def configure
7
+ if File.exists?(config_file)
8
+ Compass.configuration.parse(config_file)
9
+ elsif File.exists?(old_config_file)
10
+ Compass.configuration.parse(old_config_file)
11
+ end
12
+ super
13
+ end
14
+
15
+ def init
16
+ directory targetize("")
17
+ directory targetize(css_dir)
18
+ directory targetize(sass_dir)
19
+ end
20
+
21
+ def prepare
22
+ directory targetize(images_dir) if manifest.has_image?
23
+ directory targetize(javascripts_dir) if manifest.has_javascript?
24
+ end
25
+
26
+ def default_css_dir
27
+ Compass.configuration.css_dir || "stylesheets"
28
+ end
29
+
30
+ def default_sass_dir
31
+ Compass.configuration.sass_dir ||"src"
32
+ end
33
+
34
+ def default_images_dir
35
+ Compass.configuration.images_dir || "images"
36
+ end
37
+
38
+ def default_javascripts_dir
39
+ Compass.configuration.javascripts_dir || "javascripts"
40
+ end
41
+
42
+ # Read the configuration file for this project
43
+ def config_file
44
+ @config_file ||= targetize('config.rb')
45
+ end
46
+
47
+ def old_config_file
48
+ @old_config_file ||= targetize('src/config.rb')
49
+ end
50
+
51
+ def finalize(options = {})
52
+ if options[:create]
53
+ puts <<-NEXTSTEPS
54
+
55
+ Congratulations! Your compass project has been created.
56
+ You must recompile your sass stylesheets when they change.
57
+ This can be done in one of the following ways:
58
+ 1. From within your project directory run:
59
+ compass
60
+ 2. From any directory run:
61
+ compass -u path/to/project
62
+ 3. To monitor your project for changes and automatically recompile:
63
+ compass --watch [path/to/project]
64
+
65
+ NEXTSTEPS
66
+ end
67
+ puts "To import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:"
68
+ puts stylesheet_links
69
+ end
70
+
71
+ def compilation_required?
72
+ true
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,34 @@
1
+ module Compass
2
+ class Logger
3
+
4
+ DEFAULT_ACTIONS = [:directory, :exists, :remove, :create, :overwrite, :compile]
5
+
6
+ attr_accessor :actions, :options
7
+
8
+ def initialize(*actions)
9
+ self.options = actions.last.is_a?(Hash) ? actions.pop : {}
10
+ @actions = DEFAULT_ACTIONS.dup
11
+ @actions += actions
12
+ end
13
+
14
+ # Record an action that has occurred
15
+ def record(action, *arguments)
16
+ log "#{action_padding(action)}#{action} #{arguments.join(' ')}"
17
+ end
18
+
19
+ # Emit a log message
20
+ def log(msg)
21
+ puts msg
22
+ end
23
+
24
+ # add padding to the left of an action that was performed.
25
+ def action_padding(action)
26
+ ' ' * [(max_action_length - action.to_s.length), 0].max
27
+ end
28
+
29
+ # the maximum length of all the actions known to the logger.
30
+ def max_action_length
31
+ @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,43 @@
1
+ # To configure Merb to use compass do the following:
2
+ # Merb::BootLoader.after_app_loads do
3
+ # require 'merb-haml'
4
+ # require 'compass'
5
+ # end
6
+ #
7
+ # To use a different sass stylesheets locations as is recommended by compass
8
+ # add this configuration to your configuration block:
9
+ #
10
+ # Merb::Config.use do |c|
11
+ # c[:compass] = {
12
+ # :stylesheets => 'app/stylesheets',
13
+ # :compiled_stylesheets => 'public/stylesheets/compiled'
14
+ # }
15
+ # end
16
+
17
+ Merb::BootLoader.after_app_loads do
18
+ #set up sass if haml load didn't do it -- this happens when using a non-default stylesheet location.
19
+ unless defined?(Sass::Plugin)
20
+ require "sass/plugin"
21
+ Sass::Plugin.options = Merb::Config[:sass] if Merb::Config[:sass]
22
+ end
23
+
24
+ # default the compass configuration if they didn't set it up yet.
25
+ Merb::Config[:compass] ||= {}
26
+
27
+ # default sass stylesheet location unless configured to something else
28
+ Merb::Config[:compass][:stylesheets] ||= Merb.dir_for(:stylesheet) / "sass"
29
+
30
+ # default sass css location unless configured to something else
31
+ Merb::Config[:compass][:compiled_stylesheets] ||= Merb.dir_for(:stylesheet)
32
+
33
+ #define the template hash for the project stylesheets as well as the framework stylesheets.
34
+ template_location = {
35
+ Merb::Config[:compass][:stylesheets] => Merb::Config[:compass][:compiled_stylesheets]
36
+ }
37
+ Compass::Frameworks::ALL.each do |framework|
38
+ template_location[framework.stylesheets_directory] = Merb::Config[:compass][:compiled_stylesheets]
39
+ end
40
+
41
+ #configure Sass to know about all these sass locations.
42
+ Sass::Plugin.options[:template_location] = template_location
43
+ end