Browse code

updated rakefile and config to support url mapping in previous commit

Brandon Mathis authored on 22/07/2011 at 04:03:11
Showing 2 changed files
... ...
@@ -201,12 +201,14 @@ task :set_root_dir, :dir do |t, args|
201 201
     end
202 202
     jekyll_config = IO.read('_config.yml')
203 203
     jekyll_config.sub!(/^destination:.+$/, "destination: public#{dir}")
204
-    jekyll_config.sub!(/^subscribe_rss:.+$/, "subscribe_rss: #{dir}/atom.xml")
205
-    jekyll_config.sub!(/^root:.*$/, "root: #{dir}")
204
+    jekyll_config.sub!(/^subscribe_rss:\s*\/.+$/, "subscribe_rss: #{dir}/atom.xml")
205
+    jekyll_config.sub!(/^root:.*$/, "root: /#{dir.sub(/^\//, '')}")
206 206
     File.open('_config.yml', 'w') do |f|
207 207
       f.write jekyll_config
208 208
     end
209
-    mkdir_p "public#{dir}"
209
+    rm_rf public_dir
210
+    mkdir_p "#{public_dir}#{dir}"
211
+    puts "## Site's root directory is now '/#{dir.sub(/^\//, '')}' ##"
210 212
   end
211 213
 end
212 214
 
... ...
@@ -19,9 +19,7 @@ email:
19 19
 # ----------------------- #
20 20
 
21 21
 # If publishing to a subdirectory as in http://site.com/project set 'root: /project'
22
-# If blank, urls will be mapped to '/'
23
-root:
24
-
22
+root: /
25 23
 port: 4000
26 24
 permalink: /blog/:year/:month/:day/:title
27 25
 source: source