idempotent_task

in release_tool_utils.rb [13:25]


def idempotent_task(task_def)
  task task_def do |task|
    ensure_release_dir
    task_checkpoint_file = ".release/#{task}.completed"
    if File.exist? task_checkpoint_file
      puts "#{task} has already run for this release.  Skipping"
    else
      yield
      FileUtils.touch task_checkpoint_file
    end
  end
end