12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/docster/doc_generator.rb', line 12
def self.generate!(project_name, groups, ruby_version)
begin
@@groups = groups
create_docs_directory! unless Dir.exists?(docs_dir)
create_projects_directory! unless Dir.exists?(projects_path)
changes = false
gems.each do |name, info|
unless Dir.exists?(doc_path_for name, info[:version])
generate_sdoc_for :type => :gem, :name => name, :version => info[:version], :path => info[:path]
changes = true
end
end
unless ruby_version.nil? || Dir.exists?(doc_path_for 'ruby', ruby_version)
generate_sdoc_for :name => 'ruby', :version => ruby_version, :path => download_ruby(ruby_version)
changes = true
end
if changes || !File.exists?(File.join(project_path_for(project_name), 'index.html'))
FileUtils.rm_rf project_path_for project_name
sdoc_merge project_name, ruby_version
end
`open #{File.join project_path_for(project_name), 'index.html'}`
ensure
cleanup!
end
end
|