History

Add Ruby on Rails documentation

Thibaut committed 12 years ago

Commit dc0e1741 parent 07d8d1a10 files · +176 −-3Browse files

Unified · Split

10 files
  1. assets/images/icons.png +0 −0
  2. assets/images/icons@2x.png +0 −0
  3. assets/javascripts/templates/pages/about_tmpl.coffee +5 −0
  4. assets/javascripts/templates/pages/news_tmpl.coffee +4 −1
  5. assets/stylesheets/global/_icons.scss +1 −0
  6. lib/docs/filters/rails/entries.rb +73 −0
  7. lib/docs/scrapers/rdoc/rails.rb +96 −0
  8. public/icons/docs/rails/16.png +0 −0
  9. public/icons/docs/rails/16@2x.png +0 −0
  10. public/icons/docs/rails/SOURCE +1 −0
assets/images/icons.png+0−0

Binary file not shown.

assets/images/icons@2x.png+0−0

Binary file not shown.

assets/javascripts/templates/pages/about_tmpl.coffee+5−0
@@ -143,6 +143,11 @@ credits = [ · 142 unmodified lines
143 '1993-2013 Yukihiro Matsumoto',143 '1993-2013 Yukihiro Matsumoto',
144 'Ruby',144 'Ruby',
145 'https://www.ruby-lang.org/en/about/license.txt'145 'https://www.ruby-lang.org/en/about/license.txt'
146 ], [
147 'Ruby on Rails',
148 '2004-2013 David Heinemeier Hansson',
149 'MIT',
150 'https://raw.github.com/rails/rails/master/activerecord/MIT-LICENSE'
146 ], [151 ], [
147 'Sass',152 'Sass',
148 '2006-2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',153 '2006-2013 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',
assets/javascripts/templates/pages/news_tmpl.coffee+4−1
@@ -24,7 +24,10 @@ newsItem = (date, news) -> · 23 unmodified lines
24 result24 result
25 25
26app.news = [26app.news = [
27 [ 1384560000000, # November 16, 201327 [ 1384819200000, # November 19, 2013
28 """ New <a href="/rails/">Ruby on Rails</a> documentation """
29 ], [
30 1384560000000, # November 16, 2013
28 """ New <a href="/ruby/">Ruby</a> documentation """31 """ New <a href="/ruby/">Ruby</a> documentation """
29 ], [32 ], [
30 1382572800000, # October 24, 201333 1382572800000, # October 24, 2013
assets/stylesheets/global/_icons.scss+1−0
@@ -40,3 +40,4 @@ · 39 unmodified lines
40._icon-lodash:before { background-position: -1rem -5rem; }40._icon-lodash:before { background-position: -1rem -5rem; }
41._icon-php:before { background-position: -2rem -5rem; }41._icon-php:before { background-position: -2rem -5rem; }
42._icon-ruby:before { background-position: -3rem -5rem; }42._icon-ruby:before { background-position: -3rem -5rem; }
43._icon-rails:before { background-position: -4rem -5rem; }
lib/docs/filters/rails/entries.rb+73−0
@@ -0,0 +1,73 @@
1module 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
73end
lib/docs/scrapers/rdoc/rails.rb+96−0
@@ -0,0 +1,96 @@
1module 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 &copy; 2004&ndash;2013 David Heinemeier Hansson<br>
93 Licensed under the MIT License.
94 HTML
95 end
96end
public/icons/docs/rails/16.png+0−0

Binary file not shown.

public/icons/docs/rails/16@2x.png+0−0

Binary file not shown.

public/icons/docs/rails/SOURCE+1−0
@@ -0,0 +1 @@
1http://commons.wikimedia.org/wiki/File:Ruby_logo.svg