Parent

Class/Module Index [+]

Quicksearch

Compass::Commands::UpdateProject

Public Class Methods

description(command) click to toggle source
# File lib/compass/commands/update_project.rb, line 116
def description(command)
  "Compile Sass stylesheets to CSS"
end
new(working_path, options) click to toggle source
# File lib/compass/commands/update_project.rb, line 36
def initialize(working_path, options)
  super
  assert_project_directory_exists! unless dry_run?
end
option_parser(arguments) click to toggle source
# File lib/compass/commands/update_project.rb, line 103
def option_parser(arguments)
  parser = Compass::Exec::CommandOptionParser.new(arguments)
  parser.extend(Compass::Exec::GlobalOptionsParser)
  parser.extend(Compass::Exec::ProjectOptionsParser)
  parser.extend(CompileProjectOptionsParser)
end
parse!(arguments) click to toggle source
# File lib/compass/commands/update_project.rb, line 120
def parse!(arguments)
  parser = option_parser(arguments)
  parser.parse!
  parse_arguments!(parser, arguments)
  parser.options
end
parse_arguments!(parser, arguments) click to toggle source
# File lib/compass/commands/update_project.rb, line 127
def parse_arguments!(parser, arguments)
  if arguments.size > 0
    parser.options[:project_name] = arguments.shift if File.directory?(arguments.first)
    unless arguments.empty?
      parser.options[:sass_files] = arguments.dup
      parser.options[:force] = true
    end
  end
end
primary() click to toggle source
# File lib/compass/commands/update_project.rb, line 114
def primary; true; end
usage() click to toggle source
# File lib/compass/commands/update_project.rb, line 110
def usage
  option_parser([]).to_s
end

Public Instance Methods

check_for_sass_files!(compiler) click to toggle source
# File lib/compass/commands/update_project.rb, line 49
def check_for_sass_files!(compiler)
  if compiler.sass_files.empty? && !dry_run?
    message = "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\n"
    message << "Run \"compass -h\" to get help."
    raise Compass::Error, message
  end
end
determine_cache_location() click to toggle source
# File lib/compass/commands/update_project.rb, line 98
def determine_cache_location
  Compass.configuration.cache_path || Sass::Plugin.options[:cache_location] || File.join(working_path, ".sass-cache")
end
dry_run?() click to toggle source
# File lib/compass/commands/update_project.rb, line 57
def dry_run?
  options[:dry_run]
end
explicit_sass_files() click to toggle source
# File lib/compass/commands/update_project.rb, line 87
def explicit_sass_files
  return unless options[:sass_files]
  options[:sass_files].map do |sass_file|
    if absolute_path? sass_file
      sass_file
    else
      File.join(Dir.pwd, sass_file)
    end
  end
end
new_compiler_instance(additional_options = {}) click to toggle source
# File lib/compass/commands/update_project.rb, line 61
def new_compiler_instance(additional_options = {})
  @compiler_opts ||= begin
    compiler_opts = {:sass => Compass.sass_engine_options}
    compiler_opts.merge!(options)
    compiler_opts[:sass_files] = explicit_sass_files
    compiler_opts[:cache_location] = determine_cache_location
    if options.include?(:debug_info) && options[:debug_info]
      compiler_opts[:sass][:debug_info] = options.delete(:debug_info)
    end
    compiler_opts
  end

  @memory_store ||= Sass::CacheStores::Memory.new
  @backing_store ||= compiler_opts[:cache_store]
  @backing_store ||= Sass::CacheStores::Filesystem.new(determine_cache_location)
  @cache_store ||= Sass::CacheStores::Chain.new(@memory_store, @backing_store)
  @memory_store.reset!

  Compass::Compiler.new(
    working_path,
    Compass.configuration.sass_path,
    Compass.configuration.css_path,
    @compiler_opts.merge(:cache_store => @cache_store).merge(additional_options)
  )
end
perform() click to toggle source
# File lib/compass/commands/update_project.rb, line 41
def perform
  compiler = new_compiler_instance
  check_for_sass_files!(compiler)
  compiler.clean! if compiler.new_config?
  error_count = compiler.run
  failed! if error_count > 0
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.