refactored the previous change

This commit is contained in:
Scott Davis 2012-01-30 22:32:05 -05:00
parent 7198a69909
commit f11e5a3205
3 changed files with 10 additions and 9 deletions

View File

@ -9,15 +9,15 @@ module Compass
}
def init
@project_types ||= DEAFULT_PROJECT_TYPES
@project_types ||= DEAFULT_PROJECT_TYPES.dup
end
def project_types
@project_types
end
def any?
@project_types == DEAFULT_PROJECT_TYPES
def default?
@project_types.keys === DEAFULT_PROJECT_TYPES.keys
end
def lookup(type)

View File

@ -94,7 +94,7 @@ module Compass
configuration_file_path = args.shift || detect_configuration_file
raise ArgumentError, "Too many arguments" if args.any?
if data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
if AppIntegration.default? && data = configuration_for(configuration_file_path, nil, configuration_for(options[:defaults]))
if data.raw_project_type
add_configuration(data.raw_project_type.to_sym)
elsif options[:project_type]
@ -103,9 +103,9 @@ module Compass
add_configuration(:stand_alone)
end
unless AppIntegration.any?
add_configuration(data)
end
else
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
end

View File

@ -11,7 +11,8 @@ class SpriteCommandTest < Test::Unit::TestCase
@before_dir = ::Dir.pwd
create_temp_cli_dir
create_sprite_temp
File.open(File.join(@test_dir, 'config.rb'), 'w') do |f|
@config_file = File.join(@test_dir, 'config.rb')
File.open(@config_file, 'w') do |f|
f << config_data
end
end