refactored the previous change
This commit is contained in:
parent
7198a69909
commit
f11e5a3205
@ -9,15 +9,15 @@ module Compass
|
|||||||
}
|
}
|
||||||
|
|
||||||
def init
|
def init
|
||||||
@project_types ||= DEAFULT_PROJECT_TYPES
|
@project_types ||= DEAFULT_PROJECT_TYPES.dup
|
||||||
end
|
end
|
||||||
|
|
||||||
def project_types
|
def project_types
|
||||||
@project_types
|
@project_types
|
||||||
end
|
end
|
||||||
|
|
||||||
def any?
|
def default?
|
||||||
@project_types == DEAFULT_PROJECT_TYPES
|
@project_types.keys === DEAFULT_PROJECT_TYPES.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
def lookup(type)
|
def lookup(type)
|
||||||
|
@ -94,7 +94,7 @@ module Compass
|
|||||||
configuration_file_path = args.shift || detect_configuration_file
|
configuration_file_path = args.shift || detect_configuration_file
|
||||||
|
|
||||||
raise ArgumentError, "Too many arguments" if args.any?
|
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
|
if data.raw_project_type
|
||||||
add_configuration(data.raw_project_type.to_sym)
|
add_configuration(data.raw_project_type.to_sym)
|
||||||
elsif options[:project_type]
|
elsif options[:project_type]
|
||||||
@ -102,10 +102,10 @@ module Compass
|
|||||||
else
|
else
|
||||||
add_configuration(:stand_alone)
|
add_configuration(:stand_alone)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless AppIntegration.any?
|
|
||||||
add_configuration(data)
|
add_configuration(data)
|
||||||
end
|
|
||||||
else
|
else
|
||||||
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
|
add_configuration(options[:project_type] || configuration.project_type_without_default || (yield if block_given?) || :stand_alone)
|
||||||
end
|
end
|
||||||
|
@ -11,7 +11,8 @@ class SpriteCommandTest < Test::Unit::TestCase
|
|||||||
@before_dir = ::Dir.pwd
|
@before_dir = ::Dir.pwd
|
||||||
create_temp_cli_dir
|
create_temp_cli_dir
|
||||||
create_sprite_temp
|
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
|
f << config_data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user