Class: PhariDocGen

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

Class Method Summary collapse

Class Method Details

.generate(project, outputPath) ⇒ Object

Generate documentation for standard projects



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
42
43
# File 'lib/phari_doc_gen.rb', line 17

def self.generate (project, outputPath)
    generate = FileHandler.new
    # Ask for project name if nil
    if project.nil?
        puts "Insert project which generate documentation"
        project = gets.chomp
        while project == ''
            project = gets.chomp
        end
    end
    # Verify the existence of the project
    projectPath = generate.packageExistis?(project)
    # Get description from README.md
    projectDescription = generate.readProject(projectPath)
    # Get models with their methods and routes
    models = generate.readFiles(projectPath)
    # Specify the output path
    if outputPath.nil?
        outputPath = ''
    else
        outputPath += '/' unless outputPath.end_with?('/')
    end
    # Write documentation
    projectName = generate.nameFormat(project)
    generate.writeFiles(models, projectName, projectDescription, outputPath)
    puts 'Done!'
end