1
0

rails.rb 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. module Docs
  2. class Rails < Rdoc
  3. include FixInternalUrlsBehavior
  4. self.name = 'Ruby on Rails'
  5. self.slug = 'rails'
  6. self.initial_paths = %w(guides/index.html)
  7. self.links = {
  8. home: 'https://rubyonrails.org/',
  9. code: 'https://github.com/rails/rails'
  10. }
  11. html_filters.replace 'rdoc/entries', 'rails/entries'
  12. html_filters.push 'rails/clean_html_guides'
  13. options[:skip_rdoc_filters?] = ->(filter) { filter.slug.start_with?('guides/') }
  14. options[:root_title] = 'Ruby on Rails'
  15. options[:skip] += %w(
  16. guides/credits.html
  17. guides/ruby_on_rails_guides_guidelines.html
  18. guides/contributing_to_ruby_on_rails.html
  19. guides/development_dependencies_install.html
  20. guides/api_documentation_guidelines.html
  21. ActionController/Instrumentation.html
  22. ActionController/Rendering.html
  23. ActionDispatch/DebugExceptions.html
  24. ActionDispatch/Journey/Parser.html
  25. ActionDispatch/Reloader.html
  26. ActionDispatch/Routing/HtmlTableFormatter.html
  27. ActionDispatch/ShowExceptions.html
  28. ActionView/FixtureResolver.html
  29. ActionView/LogSubscriber.html
  30. ActionView/TestCase/Behavior/RenderedViewsCollection.html
  31. ActiveRecord/Tasks/DatabaseTasks.html
  32. ActiveSupport/Dependencies/WatchStack.html
  33. ActiveSupport/Notifications/Fanout.html)
  34. # False positives found by docs:generate
  35. options[:skip].concat %w(
  36. ActionDispatch/www.example.com
  37. ActionDispatch/Http/www.rubyonrails.org
  38. ActionDispatch/Http/www.rubyonrails.co.uk
  39. 'TZ'
  40. active_record_migrations.html
  41. association_basics.html)
  42. options[:skip_patterns] += [
  43. /release_notes/,
  44. /\AActionController\/Testing/,
  45. /\AActionView\/LookupContext/,
  46. /\AActionView\/Resolver/,
  47. /\AActiveSupport\/Multibyte\/Unicode\//,
  48. /\AActiveSupport\/XML/i,
  49. /\ASourceAnnotationExtractor/,
  50. /\AI18n\/Railtie/,
  51. /\AMinitest/,
  52. /\ARails\/API/,
  53. /\ARails\/AppBuilder/,
  54. /\ARails\/PluginBuilder/,
  55. /\ARails\/Generators\/Testing/]
  56. options[:attribution] = ->(filter) do
  57. if filter.slug.start_with?('guides')
  58. <<-HTML
  59. &copy; 2004&ndash;2021 David Heinemeier Hansson<br>
  60. Licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
  61. HTML
  62. else
  63. <<-HTML
  64. &copy; 2004&ndash;2021 David Heinemeier Hansson<br>
  65. Licensed under the MIT License.
  66. HTML
  67. end
  68. end
  69. version '7.1' do
  70. self.release = '7.1.2'
  71. end
  72. version '7.0' do
  73. self.release = '7.0.8'
  74. end
  75. version '6.1' do
  76. self.release = '6.1.7'
  77. end
  78. version '6.0' do
  79. self.release = '6.0.6'
  80. end
  81. version '5.2' do
  82. self.release = '5.2.6'
  83. end
  84. version '5.1' do
  85. self.release = '5.1.7'
  86. end
  87. version '5.0' do
  88. self.release = '5.0.7'
  89. end
  90. version '4.2' do
  91. self.release = '4.2.11'
  92. end
  93. version '4.1' do
  94. self.release = '4.1.16'
  95. end
  96. def get_latest_version(opts)
  97. doc = fetch_doc('https://rubyonrails.org/', opts)
  98. doc.at_css('.heading__button span').content.scan(/\d\.\d*\.*\d*\.*\d*/)[0]
  99. end
  100. end
  101. end