The compass watcher is in quiet mode except for important actions.
This commit is contained in:
parent
3bb88271e7
commit
dc8d8cd765
@ -19,12 +19,12 @@ module Compass
|
||||
options ||= self.options if self.respond_to?(:options)
|
||||
options ||= {}
|
||||
if File.exists?(dir) && File.directory?(dir)
|
||||
# logger.record :exists, basename(dir) unless options[:quiet]
|
||||
# do nothing
|
||||
elsif File.exists?(dir)
|
||||
msg = "#{basename(dir)} already exists and is not a directory."
|
||||
raise Compass::FilesystemConflict.new(msg)
|
||||
else
|
||||
logger.record(:directory, separate("#{basename(dir)}/")) unless options[:quiet]
|
||||
log_action :directory, separate("#{basename(dir)}/"), options
|
||||
FileUtils.mkdir_p(dir) unless options[:dry_run]
|
||||
end
|
||||
end
|
||||
@ -34,20 +34,19 @@ module Compass
|
||||
options ||= self.options if self.respond_to?(:options)
|
||||
skip_write = options[:dry_run]
|
||||
contents = process_erb(contents, options[:erb]) if options[:erb]
|
||||
extra = options[:extra] || ""
|
||||
if File.exists?(file_name)
|
||||
existing_contents = IO.read(file_name)
|
||||
if existing_contents == contents
|
||||
logger.record(:identical, basename(file_name), extra) unless options[:quiet]
|
||||
log_action :identical, basename(file_name), options
|
||||
skip_write = true
|
||||
elsif options[:force]
|
||||
logger.record(:overwrite, basename(file_name), extra) unless options[:quiet]
|
||||
log_action :overwrite, basename(file_name), options
|
||||
else
|
||||
msg = "File #{basename(file_name)} already exists. Run with --force to force overwrite."
|
||||
raise Compass::FilesystemConflict.new(msg)
|
||||
end
|
||||
else
|
||||
logger.record(:create, basename(file_name), extra) unless options[:quiet]
|
||||
log_action :create, basename(file_name), options
|
||||
end
|
||||
if skip_write
|
||||
FileUtils.touch file_name unless options[:dry_run]
|
||||
@ -68,7 +67,7 @@ module Compass
|
||||
def remove(file_name)
|
||||
if File.exists?(file_name)
|
||||
File.unlink file_name
|
||||
logger.record(:remove, basename(file_name)) unless options[:quiet]
|
||||
log_action :remove, basename(file_name), options
|
||||
end
|
||||
end
|
||||
|
||||
@ -96,5 +95,14 @@ module Compass
|
||||
(path[-1..-1] == File::SEPARATOR) ? path[0..-2] : path
|
||||
end
|
||||
|
||||
def log_action(action, file, options)
|
||||
quiet = !!options[:quiet]
|
||||
quiet = false if options[:loud] && options[:loud] == true
|
||||
quiet = false if options[:loud] && options[:loud].is_a?(Array) && options[:loud].include?(action)
|
||||
unless quiet
|
||||
logger.record(action, file, options[:extra].to_s)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -135,7 +135,7 @@ module Compass
|
||||
|
||||
def recompile(base = nil, relative = nil)
|
||||
@memory_cache.reset! if @memory_cache
|
||||
compiler = new_compiler_instance(:quiet => true)
|
||||
compiler = new_compiler_instance(:quiet => true, :loud => [:identical, :overwrite, :create])
|
||||
if file = compiler.out_of_date?
|
||||
begin
|
||||
puts ">>> Change detected to: #{relative || compiler.relative_stylesheet_name(file)}"
|
||||
|
Loading…
Reference in New Issue
Block a user