lib/settings.rb in capucine-0.2.3 vs lib/settings.rb in capucine-0.2.4
- old
+ new
@@ -3,11 +3,10 @@
class Settings
require 'rubygems'
require 'yaml'
- attr_accessor :current_dir
attr_accessor :working_dir
attr_accessor :external_config
attr_accessor :project_name
attr_accessor :root_dir
attr_accessor :content_dir
@@ -46,16 +45,38 @@
if self.user_config_file
additional = YAML::load_file(self.user_config_file)
end
+
if additional
additional.each do |k, v|
self.conf[k] = v
end
end
+ check_valid
return self
+ end
+
+ def check_valid
+
+ expand_coffee_out = File.expand_path File.join self.working_dir, self.conf['coffeescript_output_dir']
+ expand_coffee_in = File.expand_path File.join self.working_dir, self.conf['coffeescript_files_dir']
+
+ expand_sass_out = File.expand_path File.join self.working_dir, self.conf['sass_output_dir']
+ expand_sass_in = File.expand_path File.join self.working_dir, self.conf['sass_files_dir']
+
+ if expand_coffee_out == self.working_dir or expand_coffee_in == self.working_dir or expand_coffee_in == expand_coffee_out
+ puts 'Illegal path for CoffeeScript'
+ Process.exit
+ end
+
+
+ if expand_sass_out == self.working_dir or expand_sass_in == self.working_dir or expand_sass_in == expand_sass_out
+ puts 'Illegal path for Sass'
+ Process.exit
+ end
end
end
end