Permalink
Browse files

Add isolate/integrate rake tasks to allow for working only on a singl…

…e post at a time.
  • Loading branch information...
1 parent 2771472 commit d98fc14418b8c41ba2ea08e98b14649107510b12 @rwdaigle rwdaigle committed Jan 23, 2010
Showing with 20 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +19 −2 Rakefile
View
@@ -1,3 +1,4 @@
site
.sass-cache
test
+source/_stash
View
@@ -5,6 +5,8 @@ site_url = "http://#{domain}" # deployed site url for sitemap.xml generator
port = "4000" # preview project port eg. http://localhost:4000
site = "site" # compiled site directory
source = "source" # source file directory
+stash = "_stash"
+posts = "_posts"
## -- Rsync Deploy config -- ##
ssh_user = "deploy@#{domain}" # for rsync deployment
@@ -48,6 +50,21 @@ task :post, :filename do |t, args|
end
end
+# usage rake isolate[my-post]
+desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much quicker."
+task :isolate, :filename do |t, args|
+ stash_dir = "#{source}/#{stash}"
+ FileUtils.mkdir(stash_dir) unless File.exist?(stash_dir)
+ Dir.glob("#{source}/#{posts}/*.*") do |post|
+ FileUtils.mv post, stash_dir unless post.include?(args.filename)
+ end
+end
+
+desc "Move all stashed posts back into the posts directory, ready for site generation."
+task :integrate do
+ FileUtils.mv Dir.glob("#{source}/#{stash}/*.*"), "#{source}/#{posts}/"
+end
+
desc "list tasks"
task :list do
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
@@ -110,13 +127,13 @@ task :watch do
end
desc "generate and deploy website via rsync"
-multitask :deploy_rsync => [:default, :clean_debug] do
+multitask :deploy_rsync => [:integrate, :default, :clean_debug] do
puts ">>> Deploying website to #{site_url} <<<"
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
end
desc "generate and deploy website to github user pages"
-multitask :deploy_github => [:default, :clean_debug] do
+multitask :deploy_github => [:integrate, :default, :clean_debug] do
puts ">>> Deploying #{deploy_branch} branch to Github Pages <<<"
require 'git'
repo = Git.open('.')

0 comments on commit d98fc14

Please sign in to comment.