From 44e810e8405935b3fc582d6889eff68a043ddb6c Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Sun, 26 Jul 2009 22:47:59 -0700 Subject: [PATCH] Allow stand-alone projects to have their own extensions directory. --- lib/compass/commands/installer_command.rb | 3 +++ lib/compass/commands/list_frameworks.rb | 4 ++-- lib/compass/commands/project_base.rb | 5 ++++- lib/compass/configuration.rb | 2 ++ lib/compass/configuration/defaults.rb | 11 +++++++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/compass/commands/installer_command.rb b/lib/compass/commands/installer_command.rb index 4e19e4c0..41915d36 100644 --- a/lib/compass/commands/installer_command.rb +++ b/lib/compass/commands/installer_command.rb @@ -10,6 +10,9 @@ module Compass read_project_configuration Compass.add_configuration(options) Compass.add_configuration(installer.completed_configuration) + if File.exists?(Compass.configuration.extensions_path) + Compass::Frameworks.discover(Compass.configuration.extensions_path) + end end def installer diff --git a/lib/compass/commands/list_frameworks.rb b/lib/compass/commands/list_frameworks.rb index 27801945..e9ffb409 100644 --- a/lib/compass/commands/list_frameworks.rb +++ b/lib/compass/commands/list_frameworks.rb @@ -1,9 +1,9 @@ module Compass module Commands - class ListFrameworks + class ListFrameworks < ProjectBase attr_accessor :options def initialize(working_path, options) - self.options = options + super end def execute diff --git a/lib/compass/commands/project_base.rb b/lib/compass/commands/project_base.rb index 0065721a..21776373 100644 --- a/lib/compass/commands/project_base.rb +++ b/lib/compass/commands/project_base.rb @@ -12,10 +12,10 @@ module Compass super(working_path, options) self.project_name = determine_project_name(working_path, options) Compass.configuration.project_path = determine_project_directory(working_path, options) + configure! end def execute - configure! super end @@ -23,6 +23,9 @@ module Compass def configure! read_project_configuration + if File.exists?(Compass.configuration.extensions_path) + Compass::Frameworks.discover(Compass.configuration.extensions_path) + end end def projectize(path) diff --git a/lib/compass/configuration.rb b/lib/compass/configuration.rb index a495a1fa..1d8203c9 100644 --- a/lib/compass/configuration.rb +++ b/lib/compass/configuration.rb @@ -8,10 +8,12 @@ module Compass :sass_dir, :images_dir, :javascripts_dir, + :extensions_dir, :css_path, :sass_path, :images_path, :javascripts_path, + :extensions_path, :http_path, :http_images_dir, :http_stylesheets_dir, diff --git a/lib/compass/configuration/defaults.rb b/lib/compass/configuration/defaults.rb index 400cccde..83da5c2e 100644 --- a/lib/compass/configuration/defaults.rb +++ b/lib/compass/configuration/defaults.rb @@ -10,6 +10,10 @@ module Compass "/" end + def default_extensions_dir + "extensions" + end + def default_output_style if top_level.environment == :development :expanded @@ -46,6 +50,13 @@ module Compass end end + def default_extensions_path + if (pp = top_level.project_path) && (dir = top_level.extensions_dir) + File.join(pp, dir) + end + end + + def default_http_images_dir top_level.images_dir end