Showing the changes to lib/docs (2 of 10 files). Show all
Unified · Split
| @@ -0,0 +1,73 @@ | ||
| 1 | +module Docs | |
| 2 | + class Rails | |
| 3 | + class EntriesFilter < Docs::Rdoc::EntriesFilter | |
| 4 | + TYPE_BY_NAME_MATCHES = { | |
| 5 | + /Assertions|::Test|Fixture/ => 'Testing', | |
| 6 | + /\AActiveRecord.+Assoc/ => 'ActiveRecord/Associations', | |
| 7 | + /\AActiveRecord.+Attribute/ => 'ActiveRecord/Attributes', | |
| 8 | + /\AActiveRecord.+(Migration|Schema|Adapters::Table)/ => 'ActiveRecord/Migrations', | |
| 9 | + /\AActiveSupport.+(Subscriber|Notifications)/ => 'ActiveSupport/Instrumentation', | |
| 10 | + /\A(False|Nil|True)Class/ => 'Boolean' } | |
| 11 | + | |
| 12 | + TYPE_BY_NAME_STARTS_WITH = { | |
| 13 | + 'ActionDispatch::Integration' => 'Testing', | |
| 14 | + 'ActionDispatch::Routing' => 'ActionDispatch/Routing', | |
| 15 | + 'ActionView::Helpers' => 'ActionView/Helpers', | |
| 16 | + 'ActiveModel::Errors' => 'ActiveModel/Validation', | |
| 17 | + 'ActiveModel::Valid' => 'ActiveModel/Validation', | |
| 18 | + 'ActiveRecord::Batches' => 'ActiveModel/Query', | |
| 19 | + 'ActiveRecord::Calculations' => 'ActiveModel/Query', | |
| 20 | + 'ActiveRecord::Connection' => 'ActiveModel/Connection', | |
| 21 | + 'ActiveRecord::FinderMethods' => 'ActiveModel/Query', | |
| 22 | + 'ActiveRecord::Query' => 'ActiveModel/Query', | |
| 23 | + 'ActiveRecord::Relation' => 'ActiveModel/Relation', | |
| 24 | + 'ActiveRecord::Result' => 'ActiveModel/Connection', | |
| 25 | + 'ActiveRecord::Scoping' => 'ActiveModel/Query', | |
| 26 | + 'ActiveRecord::SpawnMethods' => 'ActiveModel/Query', | |
| 27 | + 'ActiveSupport::Cach' => 'ActiveSupport/Caching', | |
| 28 | + 'ActiveSupport::Hash' => 'ActiveSupport/Hash', | |
| 29 | + 'ActiveSupport::Inflector' => 'ActiveSupport/Inflector', | |
| 30 | + 'ActiveSupport::Ordered' => 'ActiveSupport/Hash', | |
| 31 | + 'ActiveSupport::Time' => 'ActiveSupport/TimeZones', | |
| 32 | + 'Rails::Application' => 'Rails/Application', | |
| 33 | + 'Rails::Engine' => 'Rails/Engine', | |
| 34 | + 'Rails::Railtie' => 'Rails/Railtie' } | |
| 35 | + | |
| 36 | + def get_name | |
| 37 | + name = super | |
| 38 | + name.sub! 'HashWithIndifferentAccess::HashWithIndifferentAccess', 'HashWithIndifferentAccess' | |
| 39 | + name | |
| 40 | + end | |
| 41 | + | |
| 42 | + def get_type | |
| 43 | + parent = at_css('.meta-parent').try(:content).to_s | |
| 44 | + | |
| 45 | + if [name, parent].any? { |str| str.end_with?('Error') || str.end_with?('Exception') } | |
| 46 | + return 'Errors' | |
| 47 | + end | |
| 48 | + | |
| 49 | + TYPE_BY_NAME_MATCHES.each_pair do |key, value| | |
| 50 | + return value if name =~ key | |
| 51 | + end | |
| 52 | + | |
| 53 | + TYPE_BY_NAME_STARTS_WITH.each_pair do |key, value| | |
| 54 | + return value if name.start_with?(key) | |
| 55 | + end | |
| 56 | + | |
| 57 | + super | |
| 58 | + end | |
| 59 | + | |
| 60 | + def include_default_entry? | |
| 61 | + super && !skip? | |
| 62 | + end | |
| 63 | + | |
| 64 | + def additional_entries | |
| 65 | + skip? ? [] : super | |
| 66 | + end | |
| 67 | + | |
| 68 | + def skip? | |
| 69 | + @skip ||= !css('p').any? { |node| node.content.present? } | |
| 70 | + end | |
| 71 | + end | |
| 72 | + end | |
| 73 | +end | |
| @@ -0,0 +1,96 @@ | ||
| 1 | +module Docs | |
| 2 | + class Rails < Rdoc | |
| 3 | + # Generated with: | |
| 4 | + # find \ | |
| 5 | + # actionmailer \ | |
| 6 | + # actionpack \ | |
| 7 | + # activemodel \ | |
| 8 | + # activerecord \ | |
| 9 | + # activesupport \ | |
| 10 | + # railties \ | |
| 11 | + # -name '*.rb' \ | |
| 12 | + # -not -name 'version.rb' \ | |
| 13 | + # -not -wholename '*generators/*' \ | |
| 14 | + # -not -wholename '*test/*' \ | |
| 15 | + # -not -wholename '*examples/*' \ | |
| 16 | + # | xargs \ | |
| 17 | + # rdoc --format=darkfish --no-line-numbers --op=rdoc --visibility=public | |
| 18 | + | |
| 19 | + self.name = 'Ruby on Rails' | |
| 20 | + self.slug = 'rails' | |
| 21 | + self.version = '4.0.1' | |
| 22 | + self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Rails' | |
| 23 | + | |
| 24 | + html_filters.replace 'rdoc/entries', 'rails/entries' | |
| 25 | + | |
| 26 | + options[:root_title] = 'Ruby on Rails' | |
| 27 | + | |
| 28 | + options[:skip] += %w( | |
| 29 | + AbstractController/Callbacks.html | |
| 30 | + AbstractController/UrlFor.html | |
| 31 | + ActionController.html | |
| 32 | + ActionController/Instrumentation.html | |
| 33 | + ActionController/ModelNaming.html | |
| 34 | + ActionController/Rendering.html | |
| 35 | + ActionController/Rescue.html | |
| 36 | + ActionController/UrlFor.html | |
| 37 | + ActionDispatch/DebugExceptions.htnl | |
| 38 | + ActionDispatch/Http/FilterParameters.html | |
| 39 | + ActionDispatch/Http/URL.html | |
| 40 | + ActionDispatch/Integration/Runner.html | |
| 41 | + ActionDispatch/Integration/Session.html | |
| 42 | + ActionDispatch/Reloader.html | |
| 43 | + ActionDispatch/RequestId.html | |
| 44 | + ActionDispatch/Routing/HtmlTableFormatter.html | |
| 45 | + ActionDispatch/Routing/Mapper.html | |
| 46 | + ActionDispatch/ShowExceptions.html | |
| 47 | + ActionView.html | |
| 48 | + ActionView/Context.html | |
| 49 | + ActionView/DependencyTracker/ERBTracker.html | |
| 50 | + ActionView/FileSystemResolver.html | |
| 51 | + ActionView/FixtureResolver.html | |
| 52 | + ActionView/LogSubscriber.html | |
| 53 | + ActionView/ModelNaming.html | |
| 54 | + ActionView/Template/Handlers/Erubis.html | |
| 55 | + ActiveModel.html | |
| 56 | + ActiveModel/Lint/Tests.html | |
| 57 | + ActiveRecord.html | |
| 58 | + ActiveRecord/DynamicMatchers/Finder.html | |
| 59 | + ActiveRecord/Sanitization.html | |
| 60 | + ActiveRecord/Tasks/DatabaseTasks.html | |
| 61 | + ActiveSupport.html | |
| 62 | + ActiveSupport/Configurable/Configuration.html | |
| 63 | + ActiveSupport/Dependencies/WatchStack.html | |
| 64 | + ActiveSupport/DescendantsTracker.html | |
| 65 | + ActiveSupport/FileUpdateChecker.html | |
| 66 | + ActiveSupport/Notifications/Fanout.html | |
| 67 | + ActiveSupport/Testing/ConstantLookup.html | |
| 68 | + ActiveSupport/Testing/Declarative.html | |
| 69 | + ActiveSupport/Testing/Isolation/Subprocess.html | |
| 70 | + Rails/API/Task.html | |
| 71 | + Rails/ConsoleMethods.html) | |
| 72 | + | |
| 73 | + options[:skip_patterns] = [ | |
| 74 | + /\AAbstractController\/ViewPaths/, | |
| 75 | + /\AActionController\/Caching(?!\/Fragments|\.)/, | |
| 76 | + /\AActionController\/HideActions/, | |
| 77 | + /\AActionController\/RequestForgeryProtection\/ProtectionMethods/, | |
| 78 | + /\AActionController\/Test/, | |
| 79 | + /\AActionDispatch\/RemoteIp/, | |
| 80 | + /\AActionDispatch\/Test/, | |
| 81 | + /\AActionMailer\/DeliveryMethods/, | |
| 82 | + /\AActionView\/LookupContext/, | |
| 83 | + /\AActionView\/Resolver/, | |
| 84 | + /\AActiveRecord\/ConnectionAdapters\/(?!DatabaseStatements|SchemaStatements|Table)/, | |
| 85 | + /\AActiveSupport\/JSON\//, | |
| 86 | + /\AActiveSupport\/Multibyte\/Unicode\//, | |
| 87 | + /\AActiveSupport\/XML/i, | |
| 88 | + /\ALogger/, | |
| 89 | + /\ASourceAnnotationExtractor/] | |
| 90 | + | |
| 91 | + options[:attribution] = <<-HTML | |
| 92 | + © 2004–2013 David Heinemeier Hansson<br> | |
| 93 | + Licensed under the MIT License. | |
| 94 | + HTML | |
| 95 | + end | |
| 96 | +end | |