Class: Machinery::ManTask
Overview
Copyright © 2013-2016 SUSE LLC
This program is free software; you can redistribute it and/or modify it under the terms of version 3 of the GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, contact SUSE LLC.
To contact SUSE about this file by physical or electronic mail, you may find current contact information at www.suse.com
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.compile_documentation ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/man_task.rb', line 19 def self.compile_documentation docs = "# Scopes\n\n" docs += Machinery::Inspector.all_scopes.map do |scope| scope_doc = "* #{scope.tr("_", "-")}\n\n" scope_doc += YAML.load_file( File.join(Machinery::ROOT, "plugins/#{scope}/#{scope}.yml") )[:description] scope_doc + "\n" end.join File.write("manual/docs/docs/machinery_main_scopes.1.md", docs) Dir.chdir(File.join(Machinery::ROOT, "manual")) do Cheetah.run("mkdocs", "build") end end |
Instance Method Details
#man(options) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/man_task.rb', line 34 def man() if [:html] man_html() else man_system end end |
#man_html(options) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/man_task.rb', line 47 def man_html() unless File.exist?(File.join(Machinery::ROOT, "manual/site")) Machinery::Ui.warn( "The documentation was not generated yet. Please make sure that `mkdocs` is installed on " \ "your system and run `rake man_pages:compile_documentation` from the machinery directory." ) return end Machinery::LocalSystem.validate_existence_of_command("xdg-open", "xdg-utils") url = "http://#{[:ip]}:#{[:port]}/site/docs/index.html" Machinery::Ui.use_pager = false Machinery::Ui.puts <<EOF Trying to start a web server for serving the documentation on #{url}. The server can be closed with Ctrl+C. EOF server = Machinery::Html.run_server( Machinery::SystemDescriptionStore.new, port: [:port], ip: [:ip] ) do Machinery::LoggedCheetah.run("xdg-open", url) end server.join # Wait until the user cancelled the blocking webserver end |
#man_system ⇒ Object
42 43 44 45 |
# File 'lib/man_task.rb', line 42 def man_system Machinery::LocalSystem.validate_existence_of_package("man") system("man", File.join(Machinery::ROOT, "man/generated/machinery.1.gz")) end |