From bf34ddb0ddf55bd508d005ff0520097cb5f14f39 Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 7 Apr 2010 09:00:49 -0700 Subject: [PATCH] Allow hidden frameworks. --- lib/compass/commands/help.rb | 1 + lib/compass/commands/list_frameworks.rb | 2 +- lib/compass/frameworks.rb | 3 ++- test/command_line_test.rb | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/compass/commands/help.rb b/lib/compass/commands/help.rb index 2f5067e2..ae0b1d17 100644 --- a/lib/compass/commands/help.rb +++ b/lib/compass/commands/help.rb @@ -24,6 +24,7 @@ To get help on a particular command please specify the command. banner << "\nAvailable Frameworks & Patterns:\n\n" Compass::Frameworks::ALL.each do |framework| + next if framework.name =~ /^_/ banner << " * #{framework.name}\n" framework.template_directories.each do |pattern| banner << " - #{framework.name}/#{pattern}" diff --git a/lib/compass/commands/list_frameworks.rb b/lib/compass/commands/list_frameworks.rb index e9ffb409..4639ee5e 100644 --- a/lib/compass/commands/list_frameworks.rb +++ b/lib/compass/commands/list_frameworks.rb @@ -8,7 +8,7 @@ module Compass def execute Compass::Frameworks::ALL.each do |framework| - puts framework.name + puts framework.name unless framework.name =~ /^_/ end end end diff --git a/lib/compass/frameworks.rb b/lib/compass/frameworks.rb index fef3e333..57e9bcd6 100644 --- a/lib/compass/frameworks.rb +++ b/lib/compass/frameworks.rb @@ -51,7 +51,8 @@ module Compass def discover(frameworks_directory) frameworks_directory = DEFAULT_FRAMEWORKS_PATH if frameworks_directory == :defaults frameworks_directory = Dir.new(frameworks_directory) unless frameworks_directory.is_a?(Dir) - frameworks_directory.entries.reject{|e| e[0] == ?.}.each do |framework| + dirs = frameworks_directory.entries.reject{|e| e =~ /^\./}.sort_by{|n| n =~ /^_/ ? n[1..-1] : n} + dirs.each do |framework| register_directory File.join(frameworks_directory.path, framework) end end diff --git a/test/command_line_test.rb b/test/command_line_test.rb index 456e635f..36d1942d 100644 --- a/test/command_line_test.rb +++ b/test/command_line_test.rb @@ -36,6 +36,7 @@ class CommandLineTest < Test::Unit::TestCase end Compass::Frameworks::ALL.each do |framework| + next if framework.name =~ /^_/ define_method "test_#{framework.name}_installation" do within_tmp_directory do compass *%W(--boring --framework #{framework.name} #{framework.name}_project)