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 # returns the path to the templates directory and caches it
def templates_directory 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 end
# Write paths like we're on unix and then fix it # 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" css_dir = options[:css_dir] || "stylesheets"
directory src_dir, options.merge(:force => true) directory src_dir, options.merge(:force => true)
directory css_dir, options.merge(:force => true) directory css_dir, options.merge(:force => true)
template 'project/screen.sass', "#{src_dir}/screen.sass", options project_dir = File.join(templates_directory, "project")
template 'project/print.sass', "#{src_dir}/print.sass", options templates = Dir.chdir(project_dir) do
template 'project/ie.sass', "#{src_dir}/ie.sass", options Dir.glob("*")
end
templates.each do |t|
template "project/#{t}", "#{src_dir}/#{t}", options
end
UpdateProject.new(working_directory, options).perform UpdateProject.new(working_directory, options).perform
end end

View File

@ -120,6 +120,10 @@ END
self.options[:style] = style self.options[:style] = style
end 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 opts.on('--rails', "Install compass into your Ruby on Rails project found in the current directory.") do
self.options[:command] = :install_rails self.options[:command] = :install_rails
end end

View File

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