Created
December 7, 2014 03:54
-
-
Save gam0022/dee78dd5c0d4294fee42 to your computer and use it in GitHub Desktop.
Octopressで最後に編集した記事だけをgenerate ref: http://qiita.com/gam0022/items/7b5a6e4492c90583706f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage rake generate_only[my-post] | |
# thanks to http://rcmdnk.github.io/blog/2013/12/06/blog-octopress-rake/ | |
desc "Generate only the specified post (much faster)" | |
task :generate_only, :filename do |t, args| | |
if args.filename | |
filename = args.filename | |
else | |
filename = Dir.glob("#{source_dir}/#{posts_dir}/*.#{new_post_ext}").sort_by{|f| File.mtime(f)}.last | |
end | |
puts "## Test build for #{filename}" | |
puts "## Stashing other posts" | |
Rake::Task[:isolate].invoke(filename) | |
Rake::Task[:generate].execute | |
puts "## Restoring stashed posts" | |
Rake::Task[:integrate].execute | |
end | |
task go: :generate_only |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment