chef.rb 3.2 KB

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