Class: Compass::Commands::UpdateProject

### Home Classes Methods

### In Files

- lib/compass/commands/update_project.rb

### Parent

Compass::Commands::ProjectBase

### Methods

- ::absolutize
- ::description
- ::new
- ::option_parser
- ::parse!
- ::parse_arguments!
- ::primary
- ::usage
- #check_for_sass_files!
- #compiler_options
- #new_compiler_instance
- #new_config?
- #perform
- #prepare_project!
- #transfer_options

### Class/Module Index

Quicksearch

- Compass
- Compass::Actions
- Compass::AppIntegration
- Compass::AppIntegration::Helpers
- Compass::AppIntegration::StandAlone
- Compass::AppIntegration::StandAlone::ConfigurationDefaults
- Compass::AppIntegration::StandAlone::Installer
- Compass::Commands
- Compass::Commands::Base
- Compass::Commands::CleanProject
- Compass::Commands::CleanProjectOptionsParser
- Compass::Commands::CompileProjectOptionsParser
- Compass::Commands::ConfigurationOptionsParser
- Compass::Commands::CreateProject
- Compass::Commands::CreateProjectOptionsParser
- Compass::Commands::Default
- Compass::Commands::DefaultOptionsParser
- Compass::Commands::ExtensionCommand
- Compass::Commands::ExtensionOptionsParser
- Compass::Commands::ExtensionsOptionParser
- Compass::Commands::Help
- Compass::Commands::HelpOptionsParser
- Compass::Commands::Imports
- Compass::Commands::InstallerCommand
- Compass::Commands::Interactive
- Compass::Commands::InteractiveOptionsParser
- Compass::Commands::ListFrameworks
- Compass::Commands::PrintVersion
- Compass::Commands::ProjectBase
- Compass::Commands::ProjectStats
- Compass::Commands::Registry
- Compass::Commands::Sprite
- Compass::Commands::SpriteOptionsParser
- Compass::Commands::StampPattern
- Compass::Commands::StampPatternOptionsParser
- Compass::Commands::StatsOptionsParser
- Compass::Commands::StructureOptionsParser
- Compass::Commands::UnpackExtension
- Compass::Commands::UpdateProject
- Compass::Commands::ValidateProject
- Compass::Commands::ValidationOptionsParser
- Compass::Commands::VersionOptionsParser
- Compass::Commands::WriteConfiguration
- Compass::Compiler
- Compass::Configuration
- Compass::Configuration::Comments
- Compass::Configuration::Data
- Compass::Configuration::FileData
- Compass::Configuration::Helpers
- Compass::Configuration::Serialization
- Compass::Deprecation
- Compass::Exec
- Compass::Exec::CommandOptionParser
- Compass::Exec::GlobalOptionsParser
- Compass::Exec::Helpers
- Compass::Exec::ProjectOptionsParser
- Compass::Exec::SubCommandUI
- Compass::FilesystemConflict
- Compass::Installers
- Compass::Installers::BareInstaller
- Compass::Installers::Base
- Compass::Installers::Manifest
- Compass::Installers::Manifest::Entry
- Compass::Installers::ManifestInstaller
- Compass::Installers::TemplateContext
- Compass::Logger
- Compass::MissingDependency
- Compass::NullLogger
- Compass::SassCompiler
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::SassExtensions::Functions::SassDeclarationHelper
- Compass::SassExtensions::Functions::Sprites
- Compass::SassExtensions::Functions::Sprites::VariableReader
- Compass::SassExtensions::Sprites
- Compass::SassExtensions::Sprites::ChunkyPngEngine
- Compass::SassExtensions::Sprites::Engine
- Compass::SassExtensions::Sprites::Image
- Compass::SassExtensions::Sprites::ImageMethods
- Compass::SassExtensions::Sprites::ImageRow
- Compass::SassExtensions::Sprites::Images
- Compass::SassExtensions::Sprites::Layout
- Compass::SassExtensions::Sprites::Layout::Diagonal
- Compass::SassExtensions::Sprites::Layout::Horizontal
- Compass::SassExtensions::Sprites::Layout::Smart
- Compass::SassExtensions::Sprites::Layout::SpriteLayout
- Compass::SassExtensions::Sprites::Layout::Vertical
- Compass::SassExtensions::Sprites::LayoutMethods
- Compass::SassExtensions::Sprites::RowFitter
- Compass::SassExtensions::Sprites::SpriteMap
- Compass::SassExtensions::Sprites::SpriteMethods
- Compass::SpriteException
- Compass::SpriteImporter
- Compass::Sprites
- Compass::Sprites::Binding
- Compass::Stats
- Compass::Stats::CssFile
- Compass::Stats::SassFile
- Compass::Stats::StatsVisitor
- Compass::TestCase
- Compass::Version
- Sass
- Sass::Script
- Sass::Script::Functions
- QuickCache

No matching classes.

# Compass::Commands::UpdateProject

### Public Class Methods

absolutize(*paths) click to toggle source

    # File lib/compass/commands/update_project.rb, line 141
    def absolutize(*paths)
      paths.map {|path| File.expand_path(path) }
    end

description(command) click to toggle source

    # File lib/compass/commands/update_project.rb, line 121
    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 40
    def initialize(working_path, options)
      super
      assert_project_directory_exists!
    end

option_parser(arguments) click to toggle source

    # File lib/compass/commands/update_project.rb, line 108
    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 125
    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 132
    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[:only_sass_files] = absolutize(*arguments)
        end
      end
    end

primary() click to toggle source

    # File lib/compass/commands/update_project.rb, line 119
    def primary; true; end

usage() click to toggle source

    # File lib/compass/commands/update_project.rb, line 115
    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 81
    def check_for_sass_files!(compiler)
      file_list = compiler.file_list
      if file_list.empty?
        message = "Compass can't find any Sass files to compile.\nIs your compass configuration correct?.\nIf 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
      elsif missing = file_list.find {|(sass_file, _, _)| !File.exist?(sass_file)}
        raise Compass::Error, "File not found: #{missing[0]}"
      end
    end

compiler_options() click to toggle source

    # File lib/compass/commands/update_project.rb, line 96
    def compiler_options
      transfer_options(options, {}, :time, :debug_info, :only_sass_files, :force, :quiet)
    end

new_compiler_instance() click to toggle source

    # File lib/compass/commands/update_project.rb, line 92
    def new_compiler_instance
      Compass::SassCompiler.new(compiler_options)
    end

new_config?(compiler) click to toggle source

Determines if the configuration file is newer than any css file

    # File lib/compass/commands/update_project.rb, line 71
    def new_config?(compiler)
      config_file = Compass.detect_configuration_file
      return false unless config_file
      config_mtime = File.mtime(config_file)
      compiler.file_list.each do |(_, css_filename, _)|
        return config_file if File.exists?(css_filename) && config_mtime > File.mtime(css_filename)
      end
      nil
    end

perform() click to toggle source

    # File lib/compass/commands/update_project.rb, line 45
    def perform
      compiler = new_compiler_instance
      check_for_sass_files!(compiler)
      prepare_project!(compiler)
      compiler.compile!
      if compiler.error_count > 0
        compiler.logger.red do
          compiler.logger.log "Compilation failed in #{compiler.error_count} files."
        end
        failed!
      end
    end

prepare_project!(compiler) click to toggle source

    # File lib/compass/commands/update_project.rb, line 58
    def prepare_project!(compiler)
      if options[:project_name]
        Compass.configuration.project_path = File.expand_path(options[:project_name])
      end

      if config_file = new_config?(compiler)
        compiler.logger.record :modified, relativize(config_file)
        compiler.logger.record :clean, relativize(Compass.configuration.css_path)
        compiler.clean!
      end
    end

transfer_options(from, to, *keys) click to toggle source

    # File lib/compass/commands/update_project.rb, line 100
    def transfer_options(from, to, *keys)
      keys.each do |k|
        to[k] = from[k] unless from[k].nil?
      end
      to
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.