aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormasukomi <masukomi@masukomi.org>2011-08-23 22:45:29 -0400
committerBrandon Mathis <brandon@imathis.com>2011-08-25 12:35:06 -0400
commite20e68139cafc04ee54c57942731bcfbec9be346 (patch)
tree97dc82a4adbfcc5f2a52097bdda2cd18e5652c24 /plugins
parent35a158dd14351c501b4353b4ea3d69ec6a8d8698 (diff)
downloadmy_new_personal_website-e20e68139cafc04ee54c57942731bcfbec9be346.tar.xz
my_new_personal_website-e20e68139cafc04ee54c57942731bcfbec9be346.zip
sitemap_generator dies if public dir doesn't exist yet
this tests for the presence of the public dir and creates it if needed. This situation can arise in a new install.
Diffstat (limited to '')
-rw-r--r--plugins/sitemap_generator.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/sitemap_generator.rb b/plugins/sitemap_generator.rb
index 8b6cf78c..b63e9423 100644
--- a/plugins/sitemap_generator.rb
+++ b/plugins/sitemap_generator.rb
@@ -37,6 +37,7 @@
# Modified for Octopress by John W. Long
#
require 'rexml/document'
+require 'fileutils'
module Jekyll
@@ -122,6 +123,9 @@ module Jekyll
sitemap.add_element(urlset)
# File I/O: create sitemap.xml file and write out pretty-printed XML
+ unless File.exists?(site.dest)
+ FileUtils.mkdir_p(site.dest)
+ end
file = File.new(File.join(site.dest, SITEMAP_FILE_NAME), "w")
formatter = REXML::Formatters::Pretty.new(4)
formatter.compact = true