primary()
click to toggle source
# File lib/compass/commands/update_project.rb, line 119 def primary; true; end
ProjectBase
# File lib/compass/commands/update_project.rb, line 141 def absolutize(*paths) paths.map {|path| File.expand_path(path) } end
# File lib/compass/commands/update_project.rb, line 121 def description(command) "Compile Sass stylesheets to CSS" end
# File lib/compass/commands/update_project.rb, line 40 def initialize(working_path, options) super assert_project_directory_exists! end
# 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
# 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
# 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
# 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
# File lib/compass/commands/update_project.rb, line 96 def compiler_options transfer_options(options, {}, :time, :debug_info, :only_sass_files, :force, :quiet) end
# File lib/compass/commands/update_project.rb, line 92 def new_compiler_instance Compass::SassCompiler.new(compiler_options) end
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
# 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
# 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
Generated with the Darkfish Rdoc Generator 2.