More flexible manifests that can see the installation options and might

not even have any stylesheets or require a project configuration file.
This commit is contained in:
Chris Eppstein 2009-07-27 00:12:36 -07:00
parent 9105d5a8de
commit 92464c5f6a
4 changed files with 33 additions and 9 deletions

View File

@ -14,7 +14,7 @@ module Compass
@target_path = target_path @target_path = target_path
@working_path = Dir.getwd @working_path = Dir.getwd
@options = options @options = options
@manifest = Manifest.new(manifest_file) if template_path @manifest = Manifest.new(manifest_file, options) if template_path
self.logger = options[:logger] self.logger = options[:logger]
end end

View File

@ -11,8 +11,12 @@ module Compass
end end
end end
def initialize(manifest_file = nil) attr_reader :options
def initialize(manifest_file = nil, options = {})
@entries = [] @entries = []
@options = options
@generate_config = true
@compile_after_generation = true
parse(manifest_file) if manifest_file parse(manifest_file) if manifest_file
end end
@ -41,8 +45,24 @@ module Compass
@entries.each {|e| yield e} @entries.each {|e| yield e}
end end
def generate_config?
@generate_config
end
def compile?
@compile_after_generation
end
protected protected
def no_configuration_file!
@generate_config = false
end
def skip_compilation!
@compile_after_generation = false
end
# parses a manifest file which is a ruby script # parses a manifest file which is a ruby script
# evaluated in a Manifest instance context # evaluated in a Manifest instance context
def parse(manifest_file) def parse(manifest_file)

View File

@ -62,10 +62,12 @@ page request and keep them up to date when they change.
Make sure you restart your server! Make sure you restart your server!
NEXTSTEPS NEXTSTEPS
end end
if manifest.has_stylesheet?
puts "\nNext add these lines to the head of your layouts:\n\n" puts "\nNext add these lines to the head of your layouts:\n\n"
puts stylesheet_links puts stylesheet_links
puts "\n(You are using haml, aren't you?)" puts "\n(You are using haml, aren't you?)"
end end
end
def install_location_for_html(to, options) def install_location_for_html(to, options)

View File

@ -43,7 +43,7 @@ module Compass
end end
def prepare def prepare
write_configuration_files unless config_files_exist? write_configuration_files unless config_files_exist? || !@manifest.generate_config?
end end
def default_configuration def default_configuration
@ -69,12 +69,14 @@ This can be done in one of the following ways:
compass --watch [path/to/project] compass --watch [path/to/project]
NEXTSTEPS NEXTSTEPS
end end
if manifest.has_stylesheet?
puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:" puts "\nTo import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:"
puts stylesheet_links puts stylesheet_links
end end
end
def compilation_required? def compilation_required?
true @manifest.compile?
end end
end end
end end