chef.rb 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. module Docs
  2. class Chef < UrlScraper
  3. self.type = 'sphinx_simple'
  4. self.base_url = 'https://docs.chef.io'
  5. self.links = {
  6. home: 'https://www.chef.io/',
  7. code: 'https://github.com/chef/chef'
  8. }
  9. options[:skip_patterns] = [
  10. /release_notes/,
  11. /feedback/
  12. ]
  13. options[:attribution] = <<-HTML
  14. &copy; Chef Software, Inc.<br>
  15. Licensed under the Creative Commons Attribution 3.0 Unported License.<br>
  16. The Chef&trade; Mark and Chef Logo are either registered trademarks/service marks or trademarks/service
  17. marks of Chef, in the United States and other countries and are used with Chef Inc's permission.<br>
  18. We are not affiliated with, endorsed or sponsored by Chef Inc.
  19. HTML
  20. version '16' do
  21. self.release = '16.7.61'
  22. options[:container] = '.off-canvas-wrapper'
  23. options[:skip] = [
  24. '/automate/api/',
  25. '/habitat/supervisor_api/',
  26. '/habitat/builder_api/'
  27. ]
  28. html_filters.push 'chef/entries', 'chef/clean_html'
  29. end
  30. version '12' do
  31. self.release = '12.13'
  32. self.base_url = 'https://docs-archive.chef.io/release/'
  33. html_filters.push 'chef/entries_old', 'chef/clean_html_old'
  34. options[:client_path] = client_path = '12-13'
  35. options[:server_path] = server_path = 'server_12-8'
  36. options[:skip_patterns] = [
  37. /\A[^\/]+\/\z/,
  38. /\A[^\/]+\/index\.html\z/,
  39. /\A[^\/]+\/release_notes\.html\z/,
  40. /\Aserver[^\/]+\/chef_overview\.html\z/,
  41. /\A[\d\-]+\/server_components\.html\z/
  42. ]
  43. self.root_path = "#{client_path}/chef_overview.html"
  44. self.initial_paths = ["#{server_path}/server_components.html"]
  45. options[:only_patterns] = [/\A#{client_path}\//, /\A#{server_path}\//]
  46. end
  47. version '11' do
  48. self.release = '11.18'
  49. self.base_url = 'https://docs-archive.chef.io/release/'
  50. html_filters.push 'chef/entries_old', 'chef/clean_html_old'
  51. options[:client_path] = client_path = '11-18'
  52. options[:server_path] = server_path = 'server_12-8'
  53. options[:skip_patterns] = [
  54. /\A[^\/]+\/\z/,
  55. /\A[^\/]+\/index\.html\z/,
  56. /\A[^\/]+\/release_notes\.html\z/,
  57. /\Aserver[^\/]+\/chef_overview\.html\z/,
  58. /\A[\d\-]+\/server_components\.html\z/
  59. ]
  60. self.root_path = "#{client_path}/chef_overview.html"
  61. self.initial_paths = ["#{server_path}/server_components.html"]
  62. options[:only_patterns] = [/\A#{client_path}\//, /\A#{server_path}\//]
  63. end
  64. def get_latest_version(opts)
  65. doc = fetch_doc('https://downloads.chef.io/products/infra', opts)
  66. doc.at_css('#versions > option').content.strip
  67. end
  68. end
  69. end