Class: RdocBuilder

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/rdoc_builder.rb

Overview

Construction de la tache rdoc (apidoc)
author: Vincent Dubois
date: 06 fevrier 2009

Instance Method Summary collapse

Methods included from Utils

build_name, erb_run, flog_caracteristics, flog_score_to_css_style, percent_to_css_style, run_command, verify_gem_presence

Instance Method Details

#build(project_name, auto_install, proxy_option) ⇒ Object

Implementation de la construction de la tache



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rdoc_builder.rb', line 10

def build(project_name, auto_install, proxy_option)
  # On lance la generation
  puts " Building rdoc api and rdoc generation report..."
  if !File.exist?("#{RAILS_ROOT}/doc")
    FileUtils.mkdir("#{RAILS_ROOT}/doc")
  end
  if !File.exist?("#{RAILS_ROOT}/doc/README_FOR_APP")
    if File.exist?("#{RAILS_ROOT}/README")
      FileUtils.copy_file("#{RAILS_ROOT}/README", "#{RAILS_ROOT}/doc/README_FOR_APP")
    else
      FileUtils.touch("#{RAILS_ROOT}/doc/README_FOR_APP")
    end
  end
  File.delete("rdoc.log") if File.exist?("rdoc.log")
  rdoc_pass = system("rake doc:app > rdoc.log")
  if !rdoc_pass
    raise " Execution of rdoc failed with command 'rake doc:reapp'.\n BUILD FAILED."
  end
  # On recupere la documentation et le fichier de log generes
  Dir.mkdir "#{Continuous4r::WORK_DIR}/rdoc"
  FileUtils.mv("doc/app/", "#{Continuous4r::WORK_DIR}/rdoc/")
  FileUtils.mv("rdoc.log", "#{Continuous4r::WORK_DIR}/rdoc/")
end