Better followup messages after installation.

This commit is contained in:
Chris Eppstein 2009-02-03 10:01:06 -08:00
parent 1da3b3ae9b
commit 94f4471ad5
7 changed files with 57 additions and 13 deletions

View File

@ -1,5 +1,5 @@
stylesheet 'screen.sass'
stylesheet 'print.sass'
stylesheet 'ie.sass'
stylesheet 'screen.sass', :media => 'screen, projection'
stylesheet 'print.sass', :media => 'print'
stylesheet 'ie.sass', :media => 'screen, projection', :ie => true
image 'grid.png'

View File

@ -1,3 +1,3 @@
stylesheet 'screen.sass'
stylesheet 'print.sass'
stylesheet 'ie.sass'
stylesheet 'screen.sass', :media => 'screen, projection'
stylesheet 'print.sass', :media => 'print'
stylesheet 'ie.sass', :media => 'screen, projection', :ie => true

View File

@ -1 +1 @@
stylesheet 'screen.sass'
stylesheet 'screen.sass', :media => "screen, projection"

View File

@ -15,12 +15,13 @@ module Compass
# all commands must implement perform
def perform
installer.run
UpdateProject.new(working_directory, options).perform
installer.run(:skip_finalization => true)
UpdateProject.new(working_directory, options).perform if installer.compilation_required?
installer.finalize(:create => true)
end
def installer
StandAloneInstaller.new(project_template_directory, project_directory, options)
@installer ||= StandAloneInstaller.new(project_template_directory, project_directory, options)
end
def project_template_directory

View File

@ -24,11 +24,11 @@ module Compass
# Runs the installer.
# Every installer must conform to the installation strategy of configure, prepare, install, and then finalize.
# A default implementation is provided for each step.
def run
def run(options = {})
configure
prepare
install
finalize
finalize unless options[:skip_finalization]
end
# The default configure method -- it sets up directories from the options
@ -67,6 +67,9 @@ module Compass
def finalize
end
def compilation_required?
false
end
def install_stylesheet(from, to, options)
copy from, "#{sass_dir}/#{to}"
@ -170,6 +173,20 @@ module Compass
end
end
def stylesheet_links
html = "<head>\n"
manifest.each_stylesheet do |stylesheet|
media = if stylesheet.options[:media]
%Q{ media="#{stylesheet.options[:media]}"}
end
ss_line = %Q{ <link href="/stylesheets/#{stylesheet.to.sub(/\.sass$/,'.css')}"#{media} rel="stylesheet" type="text/css" />}
if stylesheet.options[:ie]
ss_line = " <!--[if IE]>\n #{ss_line}\n <![endif]-->"
end
html << ss_line + "\n"
end
html << "</head>"
end
end
end
end

View File

@ -23,6 +23,9 @@ module Compass
def has_#{t}?
@entries.detect {|e| e.type == :#{t}}
end
def each_#{t}
@entries.select {|e| e.type == :#{t}}.each {|e| yield e}
end
END
end

View File

@ -44,7 +44,30 @@ module Compass
def old_config_file
@old_config_file ||= targetize('src/config.rb')
end
end
def finalize(options = {})
if options[:create]
puts <<-NEXTSTEPS
Congratulations! Your compass project has been created.
You must recompile your sass stylesheets when they change.
This can be done in one of the following ways:
1. From within your project directory run:
compass
2. From any directory run:
compass -u path/to/project
3. To monitor your project for changes and automatically recompile:
compass --watch [path/to/project]
NEXTSTEPS
end
puts "To import your new stylesheets add the following lines of HTML (or equivalent) to your webpage:"
puts stylesheet_links
end
def compilation_required?
true
end
end
end
end