Class: Compass::Frameworks::Framework

Inherits:
Object
  • Object
show all
Defined in:
lib/compass/frameworks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, *arguments) ⇒ Framework

Returns a new instance of Framework.



12
13
14
15
16
17
18
19
20
# File 'lib/compass/frameworks.rb', line 12

def initialize(name, *arguments)
  options = arguments.last.is_a?(Hash) ? arguments.pop : {}
  self.path = path = options[:path] || arguments.shift
  @name = name
  @templates_directory = options[:templates_directory]
  @templates_directory ||= File.join(path, 'templates') if path
  @stylesheets_directory = options[:stylesheets_directory]
  @stylesheets_directory ||= File.join(path, 'stylesheets') if path
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



9
10
11
# File 'lib/compass/frameworks.rb', line 9

def name
  @name
end

#pathObject

Returns the value of attribute path.



10
11
12
# File 'lib/compass/frameworks.rb', line 10

def path
  @path
end

#stylesheets_directoryObject

Returns the value of attribute stylesheets_directory.



11
12
13
# File 'lib/compass/frameworks.rb', line 11

def stylesheets_directory
  @stylesheets_directory
end

#templates_directoryObject

Returns the value of attribute templates_directory.



11
12
13
# File 'lib/compass/frameworks.rb', line 11

def templates_directory
  @templates_directory
end

Instance Method Details

#manifest(pattern, options = {}) ⇒ Object



31
32
33
34
# File 'lib/compass/frameworks.rb', line 31

def manifest(pattern, options = {})
  options[:pattern_name] ||= pattern
  Compass::Installers::Manifest.new(manifest_file(pattern), options)
end

#manifest_file(pattern) ⇒ Object



28
29
30
# File 'lib/compass/frameworks.rb', line 28

def manifest_file(pattern)
  File.join(templates_directory, pattern.to_s, "manifest.rb")
end

#template_directoriesObject



21
22
23
24
25
26
27
# File 'lib/compass/frameworks.rb', line 21

def template_directories
  if templates_directory
    Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)}
  else
    []
  end
end