Class: Omnitest::Command::Generate::Code2Doc
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Omnitest::Command::Generate::Code2Doc
- Includes:
- Core::DefaultLogger, Omnitest::Core::FileSystem, Omnitest::Core::Logging, Omnitest::Core::Util::String, Thor::Actions
- Defined in:
- lib/omnitest/command/generators/code2doc.rb
Instance Method Summary collapse
Instance Method Details
#code2doc ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/omnitest/command/generators/code2doc.rb', line 59 def code2doc @source_files.each do |slug, source_file| if source_file.nil? warn "No code sample available for #{slug}, no documentation will be generated." next end target_file_name = slug + ".#{options[:format]}" begin doc = Omnitest::DocumentationGenerator.new.code2doc(source_file) create_file(target_file_name, doc) rescue Omnitest::Psychic::Code2Doc::CommentStyles::UnknownStyleError warn "Could not generated documentation for #{source_file}, because the language couldn't be detected." end end end |
#set_destination_root ⇒ Object
49 50 51 |
# File 'lib/omnitest/command/generators/code2doc.rb', line 49 def set_destination_root self.destination_root = [:destination] end |
#setup ⇒ Object
42 43 44 45 46 47 |
# File 'lib/omnitest/command/generators/code2doc.rb', line 42 def setup Omnitest.update_config!() Omnitest.setup @scenarios = Omnitest.scenarios(project_regexp, scenario_regexp, ) abort "No scenarios for regex `#{scenario_regexp}', try running `omnitest list'" if @scenarios.empty? end |
#source_files ⇒ Object
53 54 55 56 57 |
# File 'lib/omnitest/command/generators/code2doc.rb', line 53 def source_files @source_files = @scenarios.map do |scenario| [scenario.slug, scenario.absolute_source_file] end end |