class Doc::Tasks

Attributes

documentor[R]

Public Class Methods

new(*arguments, &block) click to toggle source
# File lib/doc/tasks.rb, line 8
def initialize(*arguments, &block)
  @documentor = Documentor.new(*arguments, &block)
  define
end

Public Instance Methods

count_time() { || ... } click to toggle source
# File lib/doc/tasks.rb, line 24
def count_time
  start = Time.now
  yield
  $stderr.puts "It took #{humanize_time(Time.now - start)}"
end
humanize_time(seconds) click to toggle source
# File lib/doc/tasks.rb, line 13
def humanize_time(seconds)
  case seconds
  when 0...60
    '%.1fs' % seconds
  when 60...3600
    '%.1fm' % (seconds / 60)
  else
    '%.1fh' % (seconds / 3600)
  end
end

Private Instance Methods

define() click to toggle source
# File lib/doc/tasks.rb, line 32
def define
  task :default => :build

  task :config do
    count_time{ documentor.config }
  end

  desc 'build documentation'
  task :build do
    count_time{ documentor.build }
  end

  namespace :build do
    desc 'force update and build documentation'
    task :update do
      count_time{ documentor.build(true) }
    end
  end
end