1
0

chef.rb 1.8 KB

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