### Home Classes Methods

### In Files

- lib/compass/app_integration/stand_alone/installer.rb
- lib/compass/installers/base.rb

### Parent

Object

### Methods

- ::installer
- ::new
- #compilation_required?
- #finalize
- #install
- #install_directory
- #install_html
- #install_html_without_haml
- #install_stylesheet
- #pattern_name_as_dir
- #prepare
- #run
- #stylesheet_links
- #targetize
- #templatize

### Included Modules

- Compass::Actions

### Class/Module Index

Quicksearch

- Compass
- Compass::Actions
- Compass::AppIntegration
- Compass::AppIntegration::Helpers
- Compass::AppIntegration::Rails
- Compass::AppIntegration::StandAlone
- Compass::AppIntegration::StandAlone::ConfigurationDefaults
- Compass::AppIntegration::StandAlone::Installer
- Compass::BrowserSupport
- 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::GenerateGridBackground
- Compass::Commands::GridBackgroundOptionsParser
- Compass::Commands::Help
- Compass::Commands::HelpOptionsParser
- Compass::Commands::Imports
- Compass::Commands::InstallerCommand
- Compass::Commands::Interactive
- Compass::Commands::InteractiveOptionsParser
- Compass::Commands::ListFrameworks
- Compass::Commands::MemoryDebugger
- 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::WatchProject
- Compass::Commands::WatchProjectOptionsParser
- Compass::Commands::WriteConfiguration
- Compass::Compiler
- Compass::Configuration
- Compass::Configuration::Adapters
- Compass::Configuration::Comments
- Compass::Configuration::Data
- Compass::Configuration::Defaults
- Compass::Configuration::FileData
- Compass::Configuration::Helpers
- Compass::Configuration::Inheritance
- Compass::Configuration::Inheritance::ClassMethods
- Compass::Configuration::Inheritance::ClassMethods::ArrayProxy
- Compass::Configuration::Inheritance::InstanceMethods
- Compass::Configuration::Paths
- Compass::Configuration::Serialization
- Compass::Error
- Compass::Exec
- Compass::Exec::CommandOptionParser
- Compass::Exec::GlobalOptionsParser
- Compass::Exec::Helpers
- Compass::Exec::ProjectOptionsParser
- Compass::Exec::SubCommandUI
- Compass::Exec::SwitchUI
- Compass::FilesystemConflict
- Compass::Frameworks
- Compass::Frameworks::Framework
- Compass::GridBuilder
- 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::PNG
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::SassExtensions::Functions::Colors
- Compass::SassExtensions::Functions::Constants
- Compass::SassExtensions::Functions::CrossBrowserSupport
- Compass::SassExtensions::Functions::CrossBrowserSupport::CSS2FallbackValue
- Compass::SassExtensions::Functions::Display
- Compass::SassExtensions::Functions::Enumerate
- Compass::SassExtensions::Functions::Env
- Compass::SassExtensions::Functions::FontFiles
- Compass::SassExtensions::Functions::GradientSupport
- Compass::SassExtensions::Functions::GradientSupport::Assertions
- Compass::SassExtensions::Functions::GradientSupport::ColorStop
- Compass::SassExtensions::Functions::GradientSupport::Functions
- Compass::SassExtensions::Functions::GradientSupport::Gradient
- Compass::SassExtensions::Functions::GradientSupport::Gradient::ClassMethods
- Compass::SassExtensions::Functions::GradientSupport::LinearGradient
- Compass::SassExtensions::Functions::GradientSupport::RadialGradient
- Compass::SassExtensions::Functions::ImageSize
- Compass::SassExtensions::Functions::ImageSize::ImageProperties
- Compass::SassExtensions::Functions::ImageSize::JPEG
- Compass::SassExtensions::Functions::InlineImage
- Compass::SassExtensions::Functions::Lists
- Compass::SassExtensions::Functions::Math
- Compass::SassExtensions::Functions::Selectors
- Compass::SassExtensions::Functions::Sprites
- Compass::SassExtensions::Functions::Sprites::VariableReader
- Compass::SassExtensions::Functions::Urls
- Compass::SassExtensions::Functions::Urls::FontUrl
- Compass::SassExtensions::Functions::Urls::GeneratedImageUrl
- Compass::SassExtensions::Functions::Urls::ImageUrl
- Compass::SassExtensions::Functions::Urls::StylesheetUrl
- 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::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::Util
- Compass::Version
- Sass
- Sass::Script
- Sass::Script::CrossBrowserFunctionCall
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::HasSimpleCrossBrowserFunctionSupport
- Sass::Script::List
- Sass::Tree
- Sass::Tree::Node
- QuickCache

No matching classes.

# Compass::Installers::Base

### Attributes

options[RW]
target_path[RW]
template_path[RW]
working_path[RW]

### Public Class Methods

installer(type, installer_opts = {}, &locator) click to toggle source

    # File lib/compass/installers/base.rb, line 60
    def self.installer(type, installer_opts = {}, &locator)
      locator ||= lambda{|to| to}
      loc_method = "install_location_for_#{type}".to_sym
      define_method("simple_#{loc_method}", locator)
      define_method(loc_method) do |to, options|
        if options[:like] && options[:like] != type
          send("install_location_for_#{options[:like]}", to, options)
        else
          send("simple_#{loc_method}", to)
        end
      end
      define_method "install_#{type}" do |from, to, options|
        from = templatize(from)
        to = targetize(send(loc_method, to, options))
        is_binary = installer_opts[:binary] || options[:binary]
        if is_binary
          copy from, to, nil, is_binary
        else
          contents = File.new(from).read
          if options.delete(:erb)
            ctx = TemplateContext.ctx(:to => to, :options => options)
            contents = process_erb(contents, ctx)
          end
          write_file to, contents
        end
      end
    end

new(template_path, target_path, options = {}) click to toggle source

    # File lib/compass/installers/base.rb, line 11
    def initialize(template_path, target_path, options = {})
      @template_path = template_path
      @target_path = target_path
      @working_path = Dir.getwd
      @options = options
      self.logger = options[:logger]
    end

### Public Instance Methods

compilation_required?() click to toggle source

    # File lib/compass/installers/base.rb, line 52
    def compilation_required?
      false
    end

finalize(options = {}) click to toggle source

The default finalize method -- it is a no-op. This could print out a message or something.

    # File lib/compass/installers/base.rb, line 49
    def finalize(options = {})
    end

install() click to toggle source

The install method override this to install

    # File lib/compass/installers/base.rb, line 43
    def install
      raise "Not Yet Implemented"
    end

install_directory(from, to, options) click to toggle source

    # File lib/compass/installers/base.rb, line 133
    def install_directory(from, to, options)
      d = if within = options[:within]
        if respond_to?(within)
          targetize("#{send(within)}/#{to}")
        else
          raise Compass::Error, "Unrecognized location: #{within}"
        end
      else
        targetize(to)
      end
      directory d
    end

install_html(from, to, options) click to toggle source

    # File lib/compass/installers/base.rb, line 147
    def install_html(from, to, options)
      if to =~ /\.haml$/
        require 'haml'
        to = to[0..-(".haml".length+1)]
        if respond_to?(:install_location_for_html)
          to = install_location_for_html(to, options)
        end
        contents = File.read(templatize(from))
        if options.delete(:erb)
          ctx = TemplateContext.ctx(:to => to, :options => options)
          contents = process_erb(contents, ctx)
        end
        Compass.configure_sass_plugin!
        html = Haml::Engine.new(contents, :filename => templatize(from)).render
        write_file(targetize(to), html, options)
      else
        install_html_without_haml(from, to, options)
      end
    end

Also aliased as: install_html_without_haml
install_html_without_haml(from, to, options) click to toggle source
Alias for: install_html
install_stylesheet(from, to, options) click to toggle source

    # File lib/compass/installers/base.rb, line 92
    def install_stylesheet(from, to, options)
      from = templatize(from)
      to = targetize(install_location_for_stylesheet(to, options))
      contents = File.new(from).read
      if options.delete(:erb)
        ctx = TemplateContext.ctx(:to => to, :options => options)
        contents = process_erb(contents, ctx)
      end
      if preferred_syntax.to_s != from[-4..-1]
        # logger.record :convert, basename(from)
        tree = Sass::Engine.new(contents, Compass.sass_engine_options.merge(:syntax => from[-4..-1].intern)).to_tree
        contents = tree.send("to_#{preferred_syntax}")
        to[-4..-1] = preferred_syntax.to_s
      end
      write_file to, contents
    end

pattern_name_as_dir() click to toggle source

    # File lib/compass/installers/base.rb, line 56
    def pattern_name_as_dir
      "#{options[:pattern_name]}/" if options[:pattern_name]
    end

prepare() click to toggle source

The default prepare method -- it is a no-op. Generally you would create required directories, etc.

    # File lib/compass/installers/base.rb, line 39
    def prepare
    end

run(run_options = {}) click to toggle source

Runs the installer. Every installer must conform to the installation strategy of prepare, install, and then finalize. A default implementation is provided for each step.

    # File lib/compass/installers/base.rb, line 31
    def run(run_options = {})
      prepare unless run_options[:skip_preparation]
      install unless options[:prepare]
      finalize(options.merge(run_options)) unless options[:prepare] || run_options[:skip_finalization]
    end

stylesheet_links() click to toggle source

Emits an HTML fragment that can be used to link to the compiled css files

    # File lib/compass/installers/base.rb, line 180
    def stylesheet_links
      ""
    end

targetize(path) click to toggle source

returns an absolute path given a path relative to the current installation target. Paths can use unix style "/" and will be corrected for the current platform.

    # File lib/compass/installers/base.rb, line 169
    def targetize(path)
      strip_trailing_separator File.join(target_path, separate(path))
    end

templatize(path) click to toggle source

returns an absolute path given a path relative to the current template. Paths can use unix style "/" and will be corrected for the current platform.

    # File lib/compass/installers/base.rb, line 175
    def templatize(path)
      strip_trailing_separator File.join(template_path, separate(path))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.