Debug configuration with compass config --debug

This commit is contained in:
Chris Eppstein 2009-11-01 09:59:48 -08:00
parent d1a6490f2c
commit c40982c533
2 changed files with 18 additions and 3 deletions

View File

@ -17,6 +17,9 @@ module Compass
Options: Options:
}.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n") }.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n")
opts.on("--debug [PROPERTY]", "Debug your configuration by printing out details.") do |prop|
self.options[:debug] = prop.nil? ? true : prop.to_sym
end
super super
end end
@ -37,8 +40,20 @@ module Compass
end end
def perform def perform
directory projectize(File.dirname(options[:configuration_file])) if options[:debug]
installer.write_configuration_files(options[:configuration_file]) Compass.configuration.debug.each do |prop, values|
if options[:debug].is_a?(Symbol)
next unless prop == options[:debug]
end
puts "***** #{prop} = #{values.first[:resolved].inspect} *****"
[:default, :value, :raw, :resolved].each do |kind|
puts "#{kind}: " + values.inject([]){|m, v| m << v[kind]}.map{|v| v.nil? ? '-' : v.inspect}.join(", ")
end
end
else
directory projectize(File.dirname(options[:configuration_file]))
installer.write_configuration_files(options[:configuration_file])
end
end end
def installer_args def installer_args

View File

@ -156,7 +156,7 @@ module Compass
:raw => (instance.send("raw_#{prop}") rescue nil), :raw => (instance.send("raw_#{prop}") rescue nil),
:value => (instance.send("#{prop}_without_default") rescue nil), :value => (instance.send("#{prop}_without_default") rescue nil),
:default => (instance.send("default_#{prop}") rescue nil), :default => (instance.send("default_#{prop}") rescue nil),
:resoved => instance.send(prop) :resolved => instance.send(prop)
} }
end end
normalized_attrs[prop] = values normalized_attrs[prop] = values