Update to rakefile to allow working on a single post at a time (and saving regeneration time)
This commit is contained in:
parent
de113ecfeb
commit
2f41517191
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
site
|
site
|
||||||
*/.sass-cache
|
.sass-cache
|
||||||
.DS_Store
|
test
|
||||||
|
source/_stash
|
||||||
|
21
Rakefile
21
Rakefile
@ -4,6 +4,8 @@ site_url = "http://yoursite.com" # deployed site url for sitemap.xml generato
|
|||||||
port = "4000" # preview project port eg. http://localhost:4000
|
port = "4000" # preview project port eg. http://localhost:4000
|
||||||
site = "site" # compiled site directory
|
site = "site" # compiled site directory
|
||||||
source = "source" # source file directory
|
source = "source" # source file directory
|
||||||
|
stash = "_stash"
|
||||||
|
posts = "_posts"
|
||||||
|
|
||||||
## -- Rsync Deploy config -- ##
|
## -- Rsync Deploy config -- ##
|
||||||
ssh_user = "user@host.com" # for rsync deployment
|
ssh_user = "user@host.com" # for rsync deployment
|
||||||
@ -47,6 +49,21 @@ task :post, :filename do |t, args|
|
|||||||
end
|
end
|
||||||
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"
|
desc "list tasks"
|
||||||
task :list do
|
task :list do
|
||||||
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
|
puts "Tasks: #{(Rake::Task.tasks - [Rake::Task[:list]]).to_sentence}"
|
||||||
@ -109,13 +126,13 @@ task :watch do
|
|||||||
end
|
end
|
||||||
|
|
||||||
desc "generate and deploy website via rsync"
|
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} <<<"
|
puts ">>> Deploying website to #{site_url} <<<"
|
||||||
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
|
ok_failed system("rsync -avz --delete #{site}/ #{ssh_user}:#{document_root}")
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "generate and deploy website to github user pages"
|
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 <<<"
|
puts ">>> Deploying #{deploy_branch} branch to Github Pages <<<"
|
||||||
require 'git'
|
require 'git'
|
||||||
repo = Git.open('.')
|
repo = Git.open('.')
|
||||||
|
Loading…
Reference in New Issue
Block a user