chef.rb 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 '17' do
  21. self.release = '17.9.18'
  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 '16' do
  31. self.release = '16.8.14'
  32. options[:container] = '.off-canvas-wrapper'
  33. options[:skip] = [
  34. '/automate/api/',
  35. '/habitat/supervisor_api/',
  36. '/habitat/builder_api/'
  37. ]
  38. html_filters.push 'chef/entries', 'chef/clean_html'
  39. end
  40. version '12' do
  41. self.release = '12.13'
  42. self.base_url = 'https://docs-archive.chef.io/release/'
  43. html_filters.push 'chef/entries_old', 'chef/clean_html_old'
  44. options[:client_path] = client_path = '12-13'
  45. options[:server_path] = server_path = 'server_12-8'
  46. options[:skip_patterns] = [
  47. /\A[^\/]+\/\z/,
  48. /\A[^\/]+\/index\.html\z/,
  49. /\A[^\/]+\/release_notes\.html\z/,
  50. /\Aserver[^\/]+\/chef_overview\.html\z/,
  51. /\A[\d\-]+\/server_components\.html\z/
  52. ]
  53. self.root_path = "#{client_path}/chef_overview.html"
  54. self.initial_paths = ["#{server_path}/server_components.html"]
  55. options[:only_patterns] = [/\A#{client_path}\//, /\A#{server_path}\//]
  56. end
  57. version '11' do
  58. self.release = '11.18'
  59. self.base_url = 'https://docs-archive.chef.io/release/'
  60. html_filters.push 'chef/entries_old', 'chef/clean_html_old'
  61. options[:client_path] = client_path = '11-18'
  62. options[:server_path] = server_path = 'server_12-8'
  63. options[:skip_patterns] = [
  64. /\A[^\/]+\/\z/,
  65. /\A[^\/]+\/index\.html\z/,
  66. /\A[^\/]+\/release_notes\.html\z/,
  67. /\Aserver[^\/]+\/chef_overview\.html\z/,
  68. /\A[\d\-]+\/server_components\.html\z/
  69. ]
  70. self.root_path = "#{client_path}/chef_overview.html"
  71. self.initial_paths = ["#{server_path}/server_components.html"]
  72. options[:only_patterns] = [/\A#{client_path}\//, /\A#{server_path}\//]
  73. end
  74. def get_latest_version(opts)
  75. tags = get_github_tags('chef', 'chef', opts)
  76. tags[0]['name'][1..-1]
  77. end
  78. end
  79. end