[Command Line] Respect the -q (quiet) option during compilation. Set the quiet option when watching a project for changes.

This commit is contained in:
Chris Eppstein 2009-04-22 12:50:18 -07:00
parent be594d2b1f
commit 531c90a1a4
3 changed files with 5 additions and 4 deletions

View File

@ -18,7 +18,7 @@ module Compass
def directory(dir, options = nil) def directory(dir, options = nil)
options ||= self.options if self.respond_to?(:options) options ||= self.options if self.respond_to?(:options)
if File.exists?(dir) && File.directory?(dir) if File.exists?(dir) && File.directory?(dir)
logger.record :exists, basename(dir) logger.record :exists, basename(dir) unless options[:quiet]
elsif File.exists?(dir) elsif File.exists?(dir)
msg = "#{basename(dir)} already exists and is not a directory." msg = "#{basename(dir)} already exists and is not a directory."
raise Compass::FilesystemConflict.new(msg) raise Compass::FilesystemConflict.new(msg)
@ -58,7 +58,7 @@ module Compass
# Compile one Sass file # Compile one Sass file
def compile(sass_filename, css_filename, options) def compile(sass_filename, css_filename, options)
if Sass::Plugin.exact_stylesheet_needs_update?(css_filename, sass_filename) if Sass::Plugin.exact_stylesheet_needs_update?(css_filename, sass_filename)
logger.record :compile, basename(sass_filename) logger.record :compile, basename(sass_filename) unless options[:quiet]
engine = ::Sass::Engine.new(open(sass_filename).read, engine = ::Sass::Engine.new(open(sass_filename).read,
:filename => sass_filename, :filename => sass_filename,
:line_comments => options[:line_comments], :line_comments => options[:line_comments],
@ -68,7 +68,7 @@ module Compass
css_content = engine.render css_content = engine.render
write_file(css_filename, css_content, options.merge(:force => true)) write_file(css_filename, css_content, options.merge(:force => true))
else else
logger.record :unchanged, basename(sass_filename) logger.record :unchanged, basename(sass_filename) unless options[:quiet]
end end
end end

View File

@ -14,7 +14,7 @@ module Compass
Compass::Compiler.new(working_path, Compass::Compiler.new(working_path,
projectize(Compass.configuration.sass_dir), projectize(Compass.configuration.sass_dir),
projectize(Compass.configuration.css_dir), projectize(Compass.configuration.css_dir),
Compass.sass_engine_options).run Compass.sass_engine_options.merge(:quiet => options[:quiet])).run
end end
end end

View File

@ -98,6 +98,7 @@ END
opts.on('-w', '--watch', :NONE, 'Monitor the current project for changes and update') do opts.on('-w', '--watch', :NONE, 'Monitor the current project for changes and update') do
self.options[:command] = :watch_project self.options[:command] = :watch_project
self.options[:quiet] = true
end end
opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir| opts.on('--sass-dir SRC_DIR', "The source directory where you keep your sass stylesheets.") do |sass_dir|