ansible.rb 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. module Docs
  2. class Ansible < UrlScraper
  3. self.name = 'Ansible'
  4. self.type = 'sphinx'
  5. self.links = {
  6. home: 'https://www.ansible.com/',
  7. code: 'https://github.com/ansible/ansible'
  8. }
  9. html_filters.push 'ansible/entries', 'sphinx/clean_html', 'ansible/clean_html'
  10. options[:attribution] = <<-HTML
  11. &copy; 2012&ndash;2018 Michael DeHaan<br>
  12. &copy; 2018&ndash;2019 Red Hat, Inc.<br>
  13. Licensed under the GNU General Public License version 3.
  14. HTML
  15. options[:skip] = %w(
  16. installation_guide/index.html
  17. reference_appendices/glossary.html
  18. reference_appendices/faq.html
  19. reference_appendices/tower.html
  20. user_guide/quickstart.html
  21. modules/modules_by_category.html
  22. modules/list_of_all_modules.html)
  23. options[:skip_patterns] = [
  24. /\Acommunity.*/i,
  25. /\Adev_guide.*/i,
  26. /\Aroadmap.*/i,
  27. ]
  28. version '2.9' do
  29. self.release = '2.9.1'
  30. self.base_url = "https://docs.ansible.com/ansible/#{version}/"
  31. end
  32. version '2.8' do
  33. self.release = '2.8.7'
  34. self.base_url = "https://docs.ansible.com/ansible/#{version}/"
  35. end
  36. version '2.7' do
  37. self.release = '2.7.15'
  38. self.base_url = "https://docs.ansible.com/ansible/#{version}/"
  39. end
  40. version '2.6' do
  41. self.release = '2.6.20'
  42. self.base_url = "https://docs.ansible.com/ansible/#{version}/"
  43. end
  44. version '2.5' do
  45. self.release = '2.5.15'
  46. self.base_url = "https://docs.ansible.com/ansible/#{version}/"
  47. end
  48. version '2.4' do
  49. self.release = '2.4.6'
  50. self.base_url = "https://docs.ansible.com/ansible/#{version}/"
  51. options[:skip] = %w(
  52. glossary.html
  53. faq.html
  54. community.html
  55. tower.html
  56. quickstart.html
  57. list_of_all_modules.html)
  58. options[:skip_patterns] = []
  59. end
  60. def get_latest_version(opts)
  61. doc = fetch_doc('https://docs.ansible.com/ansible/latest/index.html', opts)
  62. doc.at_css('.DocSiteProduct-CurrentVersion').content.strip
  63. end
  64. end
  65. end