The long way through Software Craftsmanship

Faster site generation with a native Octopress 2

Apr 17, 2016 - 2 minute read - Comments - metaoctopress-2octopressnative-octopressrakefilereinventing-the-wheel

Note: this article is an answer to a previous one, about the same topic: a tool for a faster site generation while developing / writing articles, using octopress 2.

Introduction

Octopress 2 packs, out of the box, some tasks to speed up the site generation while you’re writing articles:

Isolate a post:

# 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 more quickly."
task :isolate, :filename do |t, args|
  stash_dir = "#{source_dir}/#{stash_dir}"
  FileUtils.mkdir(stash_dir) unless File.exist?(stash_dir)
  Dir.glob("#{source_dir}/#{posts_dir}/*.*") do |post|
    system "git update-index --assume-unchanged #{post}" unless post.include?(args.filename)
    FileUtils.mv post, stash_dir unless post.include?(args.filename)
  end
end

Integrate with the rest of the posts:

desc "Move all stashed posts back into the posts directory, ready for site generation."
task :integrate do
  posts_dir = "#{source_dir}/#{posts_dir}/"
  Dir.glob("#{source_dir}/#{stash_dir}/*.*") do |post|
    FileUtils.mv post, posts_dir
    full_path = "#{posts_dir}/#{post.split("/").reverse.first}"
    system "git update-index --no-assume-unchanged #{full_path}"
  end
end

Usage

(at the folder where the Rakefile is located)

  • isolate the selected file. Specify the pattern to keep.
rake isolate["draft"]
  • write the new content
  • commit to git
  • integrate with the rest of the files
rake integrate
  • git push

Conclusion

When I needed this tool, to speed up my feedback cycle, I didn’t find any that did this job, so I created a small tool for this same purpose. Unfortunately, there was one, so close to my nose that I could not find it. I was reinventing the wheel.

It is better to switch to a tool that has been tested by more users, that has received the community’s approval than a custom-made tool.

Disclaimer about AI/GenAI

As of 2026-05-06, the text in these articles and blog entries has been written without AI/GenAI, except I sometimes use a spellchecker to fix errors. Think Word's spellchecker, not ChatGPT.

Notes, as of today (2026-05-06):

  • No code snippet has been automatically generated, nor vibe-coded, nor generated and reviewed.
  • I don’t have any article with AI contribution.

For future entries:

  • I may have used GenAI for the code in the repo. The code I exemplify/copy in the article will always be reviewed and tested, not vibe-coded. I will specify it in each snippet or at the top/bottom of the article.
  • I normally don't use it for the text contents, although if I have used it for the article text, it would be indicated as such.

Any entry before 2026-05-06 does not contain any AI/GenAI.

For more information, read the AI/GenAI Policy

Self-Study in April 2016 Brownish Greenfield Gilded Rose Kata