Allow help, welcome message, and description of an extension to be specified in the manifest file.

This commit is contained in:
Chris Eppstein 2009-11-01 16:49:44 -08:00
parent 8bcdd7360d
commit 353a225ac5
4 changed files with 40 additions and 2 deletions

View File

@ -71,6 +71,7 @@ More Resources:
NEXTSTEPS
end
puts manifest.welcome_message if manifest.welcome_message
if manifest.has_stylesheet?
puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:"
puts stylesheet_links

View File

@ -26,7 +26,11 @@ Available commands:
Compass::Frameworks::ALL.each do |framework|
banner << " * #{framework.name}\n"
framework.template_directories.each do |pattern|
banner << " - #{framework.name}/#{pattern}\n"
banner << " - #{framework.name}/#{pattern}"
if description = framework.manifest(pattern).description
banner << "\t- #{description}"
end
banner << "\n"
end
end

View File

@ -18,6 +18,13 @@ module Compass
def template_directories
Dir.glob(File.join(templates_directory, "*")).map{|f| File.basename(f)}
end
def manifest_file(pattern)
File.join(templates_directory, pattern.to_s, "manifest.rb")
end
def manifest(pattern, options = {})
options[:pattern_name] ||= pattern
Compass::Installers::Manifest.new(manifest_file(pattern), options)
end
end
def register(name, *arguments)
@ -66,6 +73,8 @@ module Compass
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
<<-END.gsub(/^ {8}/, '')
No Usage!

View File

@ -40,6 +40,30 @@ module Compass
type :file
type :html
def help(value = nil)
if value
@help = value
else
@help
end
end
def welcome_message(value = nil)
if value
@welcome_message = value
else
@welcome_message
end
end
def description(value = nil)
if value
@description = value
else
@description
end
end
# Enumerates over the manifest files
def each
@entries.each {|e| yield e}
@ -76,4 +100,4 @@ module Compass
end
end
end
end