Class: HtmlLog

Inherits:
Object
  • Object
show all
Defined in:
lib/htmllog.rb

Instance Method Summary collapse

Constructor Details

#initializeHtmlLog

Returns a new instance of HtmlLog.



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/htmllog.rb', line 2

def initialize
  FileUtils.mkdir("#{Environment.dev_root}/log") if !File.exists?("#{Environment.dev_root}/log")
  @file=File.open("#{Environment.dev_root}/log/rake.html",'w')
  @file.write '<html>'
  @file.write '<body>'
  @file.write '<h1>'
  @file.write "rake"
  ARGV.each do|a|
      puts " #{a}"
  end
  @file.write '</h1>'
  @file.write '<h2>directory:' + File.dirname(__FILE__) + '</h2>'
  @file.write '<h2>time:' + Time.now.to_s + '</h2>'
  @current_task=nil
  @task_commands=Hash.new
end

Instance Method Details

#end_command(command) ⇒ Object



50
51
52
# File 'lib/htmllog.rb', line 50

def end_command command
  #@task_commands[@current_task][:command_results] << result

end

#end_task(task) ⇒ Object



40
41
42
43
44
# File 'lib/htmllog.rb', line 40

def end_task task

  @current_task=nil
  #@file

end

#finalizeObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/htmllog.rb', line 19

def finalize
  @file.write('<ul>')
  @task_commands.each{|k,v|
    
    @file.write('<li>')
    @file.write(k)
    @file.write('</li>')
    
  }
  @file.write '</ul>'
  @file.write '</body>'
  @file.write '</html>'
  @file.close
end

#start_command(command) ⇒ Object



46
47
48
# File 'lib/htmllog.rb', line 46

def start_command command

end

#start_task(task) ⇒ Object



34
35
36
37
38
# File 'lib/htmllog.rb', line 34

def start_task task
  @current_task=task
  @task_commands[task]=Hash.new
  @task_commands[task][:command_results]=Array.new
end