Class: Compass::Installers::ManifestInstaller
- Defined in:
- lib/compass/installers/manifest_installer.rb,
lib/compass/app_integration/stand_alone/installer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#manifest ⇒ Object
Returns the value of attribute manifest.
Attributes inherited from Base
#options, #target_path, #template_path, #working_path
Attributes included from Actions
Instance Method Summary collapse
-
#init ⇒ Object
Initializes the project to work with compass.
-
#initialize(template_path, target_path, options = {}) ⇒ ManifestInstaller
constructor
A new instance of ManifestInstaller.
-
#install ⇒ Object
The default install method.
- #manifest_file ⇒ Object
- #stylesheet_links ⇒ Object
Methods inherited from Base
#compilation_required?, #finalize, #install_directory, #install_html, #install_html_without_haml, #install_stylesheet, installer, #pattern_name_as_dir, #prepare, #run, #targetize, #templatize
Methods included from Actions
#basename, #copy, #directory, #log_action, #process_erb, #relativize, #remove, #separate, #strip_trailing_separator, #write_file
Constructor Details
#initialize(template_path, target_path, options = {}) ⇒ ManifestInstaller
Returns a new instance of ManifestInstaller.
8 9 10 11 |
# File 'lib/compass/installers/manifest_installer.rb', line 8 def initialize(template_path, target_path, = {}) super @manifest = Manifest.new(manifest_file, ) if template_path end |
Instance Attribute Details
#manifest ⇒ Object
Returns the value of attribute manifest.
6 7 8 |
# File 'lib/compass/installers/manifest_installer.rb', line 6 def manifest @manifest end |
Instance Method Details
#init ⇒ Object
Initializes the project to work with compass
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/compass/installers/manifest_installer.rb', line 18 def init dirs = manifest.map do |entry| unless entry.type == :directory loc = send("install_location_for_#{entry.type}", entry.to, entry.) File.dirname(loc) end end.compact if manifest.has_stylesheet? dirs << sass_dir dirs << css_dir end dirs.uniq.sort.each do |dir| directory targetize(dir) end end |
#install ⇒ Object
The default install method. Calls install_<type> methods in the order specified by the manifest.
37 38 39 40 41 |
# File 'lib/compass/installers/manifest_installer.rb', line 37 def install manifest.each do |entry| send("install_#{entry.type}", entry.from, entry.to, entry.) end end |
#manifest_file ⇒ Object
13 14 15 |
# File 'lib/compass/installers/manifest_installer.rb', line 13 def manifest_file @manifest_file ||= File.join(template_path, "manifest.rb") end |
#stylesheet_links ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/compass/installers/manifest_installer.rb', line 43 def stylesheet_links html = "<head>\n" manifest.each_stylesheet do |stylesheet| # Skip partials. next if File.basename(stylesheet.from)[0..0] == "_" media = if stylesheet.[:media] %Q{ media="#{stylesheet.[:media]}"} end ss_line = %Q{ <link href="#{http_stylesheets_path}/#{stylesheet.to.sub(/\.s[ac]ss$/,'.css')}"#{media} rel="stylesheet" type="text/css" />} if stylesheet.[:condition] ss_line = " <!--[if #{stylesheet.[:condition]}]>\n #{ss_line}\n <![endif]-->" end html << ss_line + "\n" end html << "</head>" end |