Make framework plugins actually work.

This commit is contained in:
Chris Eppstein 2009-01-01 23:18:21 -08:00
parent ebb22c1060
commit 8b8ad95c15
4 changed files with 19 additions and 8 deletions

View File

@ -67,7 +67,7 @@ module Compass
# returns the path to the templates directory and caches it
def templates_directory
@templates_directory ||= File.expand_path(File.join(File.dirname(__FILE__), separate("../../../frameworks/#{options[:framework]}/templates")))
@templates_directory ||= Compass::Frameworks[options[:framework]].templates_directory
end
# Write paths like we're on unix and then fix it

View File

@ -21,9 +21,13 @@ module Compass
css_dir = options[:css_dir] || "stylesheets"
directory src_dir, options.merge(:force => true)
directory css_dir, options.merge(:force => true)
template 'project/screen.sass', "#{src_dir}/screen.sass", options
template 'project/print.sass', "#{src_dir}/print.sass", options
template 'project/ie.sass', "#{src_dir}/ie.sass", options
project_dir = File.join(templates_directory, "project")
templates = Dir.chdir(project_dir) do
Dir.glob("*")
end
templates.each do |t|
template "project/#{t}", "#{src_dir}/#{t}", options
end
UpdateProject.new(working_directory, options).perform
end

View File

@ -119,6 +119,10 @@ END
opts.on('-s STYLE', '--output-style STYLE', [:nested, :expanded, :compact, :compressed], 'Select a CSS output mode (nested, expanded, compact, compressed)') do |style|
self.options[:style] = style
end
opts.on('-r LIBRARY', '--require LIBRARY', "Require LIBRARY before running commands. This is used to access compass plugins.") do |library|
require library
end
opts.on('--rails', "Install compass into your Ruby on Rails project found in the current directory.") do
self.options[:command] = :install_rails

View File

@ -9,13 +9,16 @@ module Compass
path = options[:path] || arguments.shift
@name = name
@templates_directory = options[:templates_directory] || File.join(path, 'templates')
@stylesheets_directory = options[:stylesheets_directory] || File.join(self.path, 'stylesheets')
@stylesheets_directory = options[:stylesheets_directory] || File.join(path, 'stylesheets')
end
end
def register(name, path)
ALL << Framework.new(name, path)
def register(name, *arguments)
ALL << Framework.new(name, *arguments)
end
module_function :register
def [](name)
ALL.detect{|f| f.name == name}
end
module_function :register, :[]
end
end