phoenix.rb 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. module Docs
  2. class Phoenix < UrlScraper
  3. self.type = 'elixir'
  4. self.release = '1.3.4'
  5. self.base_url = 'https://hexdocs.pm/'
  6. self.root_path = 'phoenix/Phoenix.html'
  7. self.initial_paths = %w(
  8. phoenix/api-reference.html
  9. ecto/api-reference.html
  10. phoenix_html/api-reference.html
  11. phoenix_pubsub/api-reference.html
  12. plug/api-reference.html)
  13. self.links = {
  14. home: 'http://www.phoenixframework.org',
  15. code: 'https://github.com/phoenixframework/phoenix'
  16. }
  17. html_filters.push 'elixir/clean_html', 'elixir/entries'
  18. options[:container] = '#content'
  19. options[:skip_patterns] = [/extra-api-reference/]
  20. options[:only_patterns] = [
  21. /\Aphoenix\//,
  22. /\Aecto\//,
  23. /\Aphoenix_pubsub\//,
  24. /\Aphoenix_html\//,
  25. /\Aplug\//
  26. ]
  27. options[:attribution] = -> (filter) {
  28. if filter.slug.start_with?('ecto')
  29. <<-HTML
  30. &copy; 2012 Plataformatec<br>
  31. Licensed under the Apache License, Version 2.0.
  32. HTML
  33. elsif filter.slug.start_with?('plug')
  34. <<-HTML
  35. &copy; 2013 Plataformatec<br>
  36. Licensed under the Apache License, Version 2.0.
  37. HTML
  38. else
  39. <<-HTML
  40. &copy; 2014 Chris McCord<br>
  41. Licensed under the MIT License.
  42. HTML
  43. end
  44. }
  45. def get_latest_version(opts)
  46. doc = fetch_doc('https://hexdocs.pm/phoenix/Phoenix.html', opts)
  47. doc.at_css('.sidebar-projectVersion').content.strip[1..-1]
  48. end
  49. end
  50. end