aprescott/serif

View on GitHub
rakefile

Summary

Maintainability
Test Coverage
require "rake"
require "time"
require "benchmark"

task :stress, [:n] do |t, args|
  iterations = args[:n] || 250
  iterations = iterations.to_i

  d = Dir.pwd
  cd "/tmp"
  rm_rf ".test-site"
  mkdir ".test-site"
  cd ".test-site"
  `#{d}/bin/serif new`

  File.open("_layouts/default.html", "a") { |f| f.puts "\n\ndigest: {% file_digest style.css prefix:- %}" }
  File.open("style.css", "w") { |f| f.puts("body {}") }

  iterations.times do |n|
    File.open("_posts/#{Date.today + n}-sample-post-#{n}", "w") do |f|
      f.puts %Q{title: sample-post
created: #{(Time.now + 60*n).xmlschema}

Dummy content #{n}}
    end
  end

  puts Benchmark.realtime { system({ "ENV" => ENV["ENV"] }, "#{d}/bin/serif generate") }
end

task :console do
  require 'irb'
  require 'irb/completion'
  require 'serif'
  ARGV.clear
  IRB.start
end