koa.rb 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # frozen_string_literal: true
  2. module Docs
  3. class Koa < Github
  4. self.initial_paths = %w[
  5. error-handling
  6. faq
  7. guide
  8. koa-vs-express
  9. migration
  10. troubleshooting
  11. api/index
  12. api/context
  13. api/request
  14. api/response
  15. ].map { |name| name + '.md' }
  16. self.links = {
  17. home: 'https://koajs.com/',
  18. code: 'https://github.com/koajs/koa'
  19. }
  20. html_filters.push 'koa/clean_html', 'koa/entries'
  21. options[:skip_patterns] = [/\.gif/]
  22. options[:trailing_slash] = false
  23. options[:container] = '.markdown-body'
  24. options[:attribution] = <<-HTML
  25. &copy; 2020 Koa contributors<br>
  26. Licensed under the MIT License.
  27. HTML
  28. version do
  29. self.base_url = 'https://github.com/koajs/koa/blob/v3.0.0/docs'
  30. self.root_path = 'api/index.md'
  31. self.release = '3.0.0'
  32. options[:fix_urls] = ->(url) do
  33. url.sub! 'https://koajs.com/#error-handling', self.base_url + '/error-handling.md'
  34. url
  35. end
  36. end
  37. version '2' do
  38. self.base_url = 'https://github.com/koajs/koa/blob/v2.16.1/docs'
  39. self.root_path = 'api/index.md'
  40. self.release = '2.16.1'
  41. options[:fix_urls] = ->(url) do
  42. url.sub! 'https://koajs.com/#error-handling', self.base_url + '/error-handling.md'
  43. url
  44. end
  45. end
  46. version '1' do
  47. self.base_url = 'https://github.com/koajs/koa/blob/1.7.1/docs'
  48. self.root_path = 'api/index.md'
  49. self.release = '1.7.1'
  50. options[:fix_urls] = ->(url) do
  51. url.sub! 'https://koajs.com/#error-handling', self.base_url + '/error-handling.md'
  52. url
  53. end
  54. end
  55. def get_latest_version(opts)
  56. get_npm_version('koa', opts)
  57. end
  58. end
  59. end