lib/buildmaster/site/site.rb in BuildMaster-0.8.1 vs lib/buildmaster/site/site.rb in BuildMaster-0.9.0

- old
+ new

@@ -58,37 +58,26 @@ ensure @server.stop end end - def ensure_directory_exists(dir_name) - if (not File.exist?(dir_name)) - ensure_directory_exists(File.join(dir_name, '..')) - Dir.mkdir dir_name - end - end - def build_directory(out_dir, content_dir, template) - ensure_directory_exists(out_dir) - Dir.foreach(content_dir) do |item| - content_path = File.join(content_dir, item) - if (item == '.' || item == '..' || item == '.svn' || item == 'CVS') - elsif (File.directory? content_path) - build_directory(File.join(out_dir, item), content_path, template) - else - @current_file_name = content_path - process_file(content_path, out_dir, content_dir, item) + out_dir.mkdirs + content_dir.list.each do |item| + if (item.name == '.svn' || item.name == 'CVS' || item.name == '_svn') + elsif (item.respond_to? 'list') + build_directory(out_dir.dir(item.name), item, template) + elsif (item.respond_to? 'read') + @current_file_name = item + process_file(item, out_dir, content_dir, item) @count = @count + 1 end end end - def process_file(path_to_content, out_dir, content_dir, item) - print ">> #{path_to_content}\n" - extension = File.extname(path_to_content) - isIndex = @current_file_name =~ /^index/ - file_processor = FileProcessor.new(@template, path_to_content, @spec) - file_processor.write_to_target + def process_file(content_file, out_dir, content_dir, item) + print ">> #{content_file.path.to_s}\n" + FileProcessor.new(@template, content_file, @spec).write_to_target end end end