Module: Compass::Frameworks

### Home Classes Methods

### In Files

- lib/compass/frameworks.rb

### Namespace

- CLASS Compass::Frameworks::Framework

### Methods

- #[]
- #detect_registration
- #discover
- #guess_gem_version
- #pretty_print
- #register
- #register_directory
- #template_exists?
- #template_usage

### Class/Module Index

Quicksearch

- Compass
- Compass::BrowserSupport
- Compass::Configuration
- Compass::Configuration::Adapters
- Compass::Configuration::Data
- Compass::Configuration::Defaults
- Compass::Configuration::Inheritance
- Compass::Configuration::Inheritance::ClassMethods
- Compass::Configuration::Inheritance::ClassMethods::ArrayProxy
- Compass::Configuration::Inheritance::InstanceMethods
- Compass::Configuration::Paths
- Compass::Configuration::Watch
- Compass::Core
- Compass::Core::CanIUse
- Compass::Core::SassExtensions
- Compass::Core::SassExtensions::Functions
- Compass::Core::SassExtensions::Functions::Colors
- Compass::Core::SassExtensions::Functions::Configuration
- Compass::Core::SassExtensions::Functions::Constants
- Compass::Core::SassExtensions::Functions::CrossBrowserSupport
- Compass::Core::SassExtensions::Functions::CrossBrowserSupport::CSS2FallbackValue
- Compass::Core::SassExtensions::Functions::Display
- Compass::Core::SassExtensions::Functions::Enumerate
- Compass::Core::SassExtensions::Functions::Env
- Compass::Core::SassExtensions::Functions::Files
- Compass::Core::SassExtensions::Functions::FontFiles
- Compass::Core::SassExtensions::Functions::GradientSupport
- Compass::Core::SassExtensions::Functions::GradientSupport::Assertions
- Compass::Core::SassExtensions::Functions::GradientSupport::CSS3AngleToSVGConverter
- Compass::Core::SassExtensions::Functions::GradientSupport::ColorStop
- Compass::Core::SassExtensions::Functions::GradientSupport::Functions
- Compass::Core::SassExtensions::Functions::GradientSupport::Gradient
- Compass::Core::SassExtensions::Functions::GradientSupport::Gradient::ClassMethods
- Compass::Core::SassExtensions::Functions::GradientSupport::LinearGradient
- Compass::Core::SassExtensions::Functions::GradientSupport::RadialGradient
- Compass::Core::SassExtensions::Functions::ImageSize
- Compass::Core::SassExtensions::Functions::ImageSize::ImageProperties
- Compass::Core::SassExtensions::Functions::ImageSize::JPEG
- Compass::Core::SassExtensions::Functions::InlineImage
- Compass::Core::SassExtensions::Functions::Lists
- Compass::Core::SassExtensions::Functions::Math
- Compass::Core::SassExtensions::Functions::SassDeclarationHelper
- Compass::Core::SassExtensions::Functions::Selectors
- Compass::Core::SassExtensions::Functions::Urls
- Compass::Core::SassExtensions::Functions::Urls::FontUrl
- Compass::Core::SassExtensions::Functions::Urls::GeneratedImageUrl
- Compass::Core::SassExtensions::Functions::Urls::ImageUrl
- Compass::Core::SassExtensions::Functions::Urls::StylesheetUrl
- Compass::Error
- Compass::Frameworks
- Compass::Frameworks::Framework
- Compass::HasDeprecatedConstantsFromCore
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::Util
- Sass
- Sass::Script
- Sass::Script::CrossBrowserFunctionCall
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::HasSimpleCrossBrowserFunctionSupport
- Sass::Script::List
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Tree
- Sass::Tree::Node

No matching classes.

# Compass::Frameworks

### Constants

ALL

### Public Instance Methods

[](name) click to toggle source

    # File lib/compass/frameworks.rb, line 66
    def [](name)
      ALL.detect{|f| f.name.to_s == name.to_s}
    end

detect_registration() click to toggle source

    # File lib/compass/frameworks.rb, line 41
    def detect_registration
      @registered = nil
      yield
      @registered
    ensure
      @registered = nil
    end

discover(frameworks_directory) click to toggle source

    # File lib/compass/frameworks.rb, line 79
    def discover(frameworks_directory)
      if frameworks_directory == :defaults
        warn("The :defaults argument to Compass::Frameworks.discover is no longer necessary")
        return
      end
      frameworks_directory = Dir.new(frameworks_directory) unless frameworks_directory.is_a?(Dir)
      dirs = frameworks_directory.entries.reject{|e| e =~ /^\./}.sort_by{|n| n =~ /^_/ ? n[1..-1] : n}
      dirs.each do |framework|
        register_directory File.join(frameworks_directory.path, framework)
      end
    end

guess_gem_version(line_reference) click to toggle source

    # File lib/compass/frameworks.rb, line 70
    def guess_gem_version(line_reference)
      if line_reference =~ %{/gems/([^/]*-[^/]*)/}
        split_at = $1.rindex("-")
        name = $1[1...split_at]
        version = $1[(split_at + 1)..-1]
        version unless name == "compass"
      end
    end

pretty_print(skip_patterns = false) click to toggle source

    # File lib/compass/frameworks.rb, line 131
    def pretty_print(skip_patterns = false)
      result = ""
      max = Compass::Frameworks::ALL.inject(0) do |gm, framework|
        fm = framework.template_directories.inject(0) do |lm,pattern|
          [lm, 7 + framework.name.size + pattern.size].max
        end
        [gm, fm].max
      end
      Compass::Frameworks::ALL.each do |framework|
        next if framework.name =~ /^_/
        result << "  * #{framework.name}\n"
        unless skip_patterns
          framework.template_directories.each do |pattern|
            result << "    - #{framework.name}/#{pattern}".ljust(max)
            if description = framework.manifest(pattern).description
              result << " - #{description}"
            end
            result << "\n"
          end
        end
      end
      result
    end

register(name, *arguments) click to toggle source

    # File lib/compass/frameworks.rb, line 49
    def register(name, *arguments)
      opts = if arguments.last.is_a?(Hash)
               arguments.last
             else
               o = {}
               arguments << o
               o
             end
      opts[:version] ||= guess_gem_version(caller[0])
      @registered = Framework.new(name, *arguments)
      if idx = ALL.index(self[name])
        ALL[idx] = @registered
      else
        ALL << @registered
      end
    end

register_directory(directory) click to toggle source

    # File lib/compass/frameworks.rb, line 91
    def register_directory(directory)
      loaders = [
        File.join(directory, "compass_init.rb"),
        File.join(directory, 'lib', File.basename(directory)+".rb"),
        File.join(directory, File.basename(directory)+".rb")
      ]
      loader = loaders.detect{|l| File.exists?(l)}
      registered_framework = detect_registration do
        require loader if loader
      end
      unless registered_framework
        register File.basename(directory), directory
      end
    end

template_exists?(template) click to toggle source

    # File lib/compass/frameworks.rb, line 106
    def template_exists?(template)
      framework_name, template = template.split(%{/}, 2)
      template ||= "project"
      if (framework = self[framework_name]) && framework.templates_directory
        return File.directory?(File.join(framework.templates_directory, template))
      end
      false
    end

template_usage(template) click to toggle source

    # File lib/compass/frameworks.rb, line 115
    def template_usage(template)
      framework_name, template = template.split(%{/}, 2)
      framework = self[framework_name]
      template ||= "project"
      usage_file = File.join(framework.templates_directory, template, "USAGE.markdown")
      if File.exists?(usage_file)
        File.read(usage_file)
      elsif help = framework.manifest(template).help
        help
      else
                  No Usage!.gsub(/^ {8}/, '')
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.