Method: Compass::Actions#directory

Defined in:
lib/compass/actions.rb

#directory(dir, options = nil) ⇒ Object

create a directory and all the directories necessary to reach it.



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/compass/actions.rb', line 22

def directory(dir, options = nil)
  options ||= self.options if self.respond_to?(:options)
  options ||= {}
  if File.exists?(dir) && File.directory?(dir)
      # do nothing
  elsif File.exists?(dir)
    msg = "#{basename(dir)} already exists and is not a directory."
    raise Compass::FilesystemConflict.new(msg)
  else
    log_action :directory, separate("#{basename(dir)}/"), options
    FileUtils.mkdir_p(dir)
  end
end