Class: Polytrix::Command::Generate::Code2Doc
Instance Method Summary
collapse
#find_file, #relativize
included
#ansi2html, #escape_html, #highlight, #slugify
included
#logger
Instance Method Details
#code2doc ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/polytrix/command/generators/code2doc.rb', line 51
def code2doc
@scenarios.each do | scenario |
source_file = scenario.source_file
if source_file.nil?
warn "No code sample available for #{scenario.slug}, no documentation will be generated."
next
end
target_file_name = scenario.slug + ".#{options[:format]}"
begin
doc = Polytrix::DocumentationGenerator.new.code2doc(scenario.absolute_source_file)
create_file(target_file_name, doc)
rescue Polytrix::Documentation::CommentStyles::UnknownStyleError
warn "Could not generated documentation for #{source_file}, because the language couldn't be detected."
end
end
end
|
#set_destination_root ⇒ Object
47
48
49
|
# File 'lib/polytrix/command/generators/code2doc.rb', line 47
def set_destination_root
self.destination_root = options[:destination]
end
|
#setup ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/polytrix/command/generators/code2doc.rb', line 37
def setup
command_options = {
shell: shell
}.merge(options)
command = Polytrix::Command::Base.new(args, options, command_options)
command.send(:setup)
@scenarios = command.send(:parse_subcommand, args.pop)
end
|