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
@working_path = Dir.getwd
@options = options
@manifest = Manifest.new(manifest_file) if template_path
@manifest = Manifest.new(manifest_file, options) if template_path
self.logger = options[:logger]
end

View File

@ -11,8 +11,12 @@ module Compass
end
end
def initialize(manifest_file = nil)
attr_reader :options
def initialize(manifest_file = nil, options = {})
@entries = []
@options = options
@generate_config = true
@compile_after_generation = true
parse(manifest_file) if manifest_file
end
@ -41,8 +45,24 @@ module Compass
@entries.each {|e| yield e}
end
def generate_config?
@generate_config
end
def compile?
@compile_after_generation
end
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
# evaluated in a Manifest instance context
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!
NEXTSTEPS
end
if manifest.has_stylesheet?
puts "\nNext add these lines to the head of your layouts:\n\n"
puts stylesheet_links
puts "\n(You are using haml, aren't you?)"
end
end
def install_location_for_html(to, options)

View File

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