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
21
# 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
  @version = options[:version]
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#pathObject

Returns the value of attribute path.



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

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

#versionObject

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

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



35
36
37
38
# File 'lib/compass/frameworks.rb', line 35

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

#manifest_file(pattern) ⇒ Object



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

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

#template_directoriesObject



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

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