Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 187 lines (157 sloc) 6.372 kb
cad8bef @spastorino Bump up rdoc to 2.5.10
spastorino authored
1 gem 'rdoc', '>= 2.5.10'
07c6b7a @fxn migrates the Jamis template to RDoc 2.x, the root Rakefile requires RDoc...
fxn authored
2 require 'rdoc'
3
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
4 require 'rake'
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
5 require 'rdoc/task'
dff0dfb @fxn adds a publish_docs task to force stable docs generation and publishing ...
fxn authored
6 require 'net/http'
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
7
4ff8c59 @carllerche Update the main Rakefile to use the new release tasks
carllerche authored
8 $:.unshift File.expand_path('..', __FILE__)
9 require "tasks/release"
10
11 desc "Build gem files for all projects"
12 task :build => "all:build"
13
14 desc "Release all gems to gemcutter and create a tag"
15 task :release => ["all:release", "git:tag"]
16
0953c04 @fxn quick hack: hijacks the predicate RDoc::Parser.binary? so that it does n...
fxn authored
17 # RDoc skips some files in the Rails tree due to its binary? predicate. This is a quick
18 # hack for edge docs, until we decide which is the correct way to address this issue.
19 # If not fixed in RDoc itself, via an option or something, we should probably move this
20 # to railties and use it also in doc:rails.
21 def hijack_rdoc!
22 require "rdoc/parser"
23 class << RDoc::Parser
24 def binary?(file)
25 s = File.read(file, 1024) or return false
26
27 if s[0, 2] == Marshal.dump('')[0, 2] then
28 true
997021e @fxn undoes one of the modifications to RDoc::Parser.binary?
fxn authored
29 elsif file =~ /erb\.rb$/ then
0953c04 @fxn quick hack: hijacks the predicate RDoc::Parser.binary? so that it does n...
fxn authored
30 false
31 elsif s.index("\x00") then # ORIGINAL is s.scan(/<%|%>/).length >= 4 || s.index("\x00")
32 true
33 elsif 0.respond_to? :fdiv then
34 s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
35 else # HACK 1.8.6
36 (s.count("^ -~\t\r\n").to_f / s.size) > 0.3
37 end
38 end
39 end
40 end
41
8ff310a Break up rails and railties:
Carlhuda authored
42 PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
43
44 desc 'Run all tests by default'
bbb3e5a @jeremy Unify test:isolated across components and run by default at toplevel
jeremy authored
45 task :default => %w(test test:isolated)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
46
728ba20 @fxn include the root README.rdoc as main page
fxn authored
47 %w(test test:isolated package gem).each do |task_name|
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
48 desc "Run #{task_name} task for all projects"
49 task task_name do
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
50 errors = []
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
51 PROJECTS.each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
52 system(%(cd #{project} && #{$0} #{task_name})) || errors << project
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
53 end
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
54 fail("Errors in #{errors.join(', ')}") unless errors.empty?
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
55 end
56 end
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
57
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
58 desc "Smoke-test all projects"
59 task :smoke do
60 (PROJECTS - %w(activerecord)).each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
61 system %(cd #{project} && #{$0} test:isolated)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
62 end
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
63 system %(cd activerecord && #{$0} sqlite3:isolated_test)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
64 end
8ff310a Break up rails and railties:
Carlhuda authored
65
87a011d @josevalim Make install appear on rake -T.
authored
66 desc "Install gems for all projects."
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
67 task :install => :gem do
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 state...
wycats authored
68 version = File.read("RAILS_VERSION").strip
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
69 (PROJECTS - ["railties"]).each do |project|
8ff310a Break up rails and railties:
Carlhuda authored
70 puts "INSTALLING #{project}"
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 state...
wycats authored
71 system("gem install #{project}/pkg/#{project}-#{version}.gem --no-ri --no-rdoc")
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
72 end
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 state...
wycats authored
73 system("gem install railties/pkg/railties-#{version}.gem --no-ri --no-rdoc")
74 system("gem install pkg/rails-#{version}.gem --no-ri --no-rdoc")
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
75 end
76
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
77 desc "Generate documentation for the Rails framework"
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
78 RDoc::Task.new do |rdoc|
0953c04 @fxn quick hack: hijacks the predicate RDoc::Parser.binary? so that it does n...
fxn authored
79 hijack_rdoc!
80
a02d672 @jeremy Horo rdoc template
jeremy authored
81 rdoc.rdoc_dir = 'doc/rdoc'
82 rdoc.title = "Ruby on Rails Documentation"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
83
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
84 rdoc.options << '-f' << 'horo'
728ba20 @fxn include the root README.rdoc as main page
fxn authored
85 rdoc.options << '-c' << 'utf-8'
86 rdoc.options << '-m' << 'README.rdoc'
87
88 rdoc.rdoc_files.include('README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
89
90 rdoc.rdoc_files.include('railties/CHANGELOG')
91 rdoc.rdoc_files.include('railties/MIT-LICENSE')
508fba9 @josevalim Add .rdoc extension to README files.
authored
92 rdoc.rdoc_files.include('railties/README.rdoc')
d39ec81 @pixeltrix Make Railties RDoc task work again [#4291 state:resolved]
pixeltrix authored
93 rdoc.rdoc_files.include('railties/lib/**/*.rb')
94 rdoc.rdoc_files.exclude('railties/lib/rails/generators/**/templates/*')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
95
508fba9 @josevalim Add .rdoc extension to README files.
authored
96 rdoc.rdoc_files.include('activerecord/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
97 rdoc.rdoc_files.include('activerecord/CHANGELOG')
98 rdoc.rdoc_files.include('activerecord/lib/active_record/**/*.rb')
99 rdoc.rdoc_files.exclude('activerecord/lib/active_record/vendor/*')
100
508fba9 @josevalim Add .rdoc extension to README files.
authored
101 rdoc.rdoc_files.include('activeresource/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
102 rdoc.rdoc_files.include('activeresource/CHANGELOG')
103 rdoc.rdoc_files.include('activeresource/lib/active_resource.rb')
104 rdoc.rdoc_files.include('activeresource/lib/active_resource/*')
105
508fba9 @josevalim Add .rdoc extension to README files.
authored
106 rdoc.rdoc_files.include('actionpack/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
107 rdoc.rdoc_files.include('actionpack/CHANGELOG')
aed698a @fxn adds Abstract Controller to the API
fxn authored
108 rdoc.rdoc_files.include('actionpack/lib/abstract_controller/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
109 rdoc.rdoc_files.include('actionpack/lib/action_controller/**/*.rb')
26bc5c5 @pixeltrix Add ActionDispatch to RDoc task [#4287 state:resolved]
pixeltrix authored
110 rdoc.rdoc_files.include('actionpack/lib/action_dispatch/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
111 rdoc.rdoc_files.include('actionpack/lib/action_view/**/*.rb')
112 rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')
113
508fba9 @josevalim Add .rdoc extension to README files.
authored
114 rdoc.rdoc_files.include('actionmailer/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
115 rdoc.rdoc_files.include('actionmailer/CHANGELOG')
116 rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
117 rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
118
508fba9 @josevalim Add .rdoc extension to README files.
authored
119 rdoc.rdoc_files.include('activesupport/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
120 rdoc.rdoc_files.include('activesupport/CHANGELOG')
121 rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
122 rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
9fd9e5d @fxn fixes doc generation
fxn authored
123
508fba9 @josevalim Add .rdoc extension to README files.
authored
124 rdoc.rdoc_files.include('activemodel/README.rdoc')
9fd9e5d @fxn fixes doc generation
fxn authored
125 rdoc.rdoc_files.include('activemodel/CHANGELOG')
126 rdoc.rdoc_files.include('activemodel/lib/active_model/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
127 end
128
129 # Enhance rdoc task to copy referenced images also
130 task :rdoc do
a02d672 @jeremy Horo rdoc template
jeremy authored
131 FileUtils.mkdir_p "doc/rdoc/files/examples/"
132 FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
133 end
134
b861942 @jeremy Update CHANGELOGs for 3.0 release and upcoming 3.1
jeremy authored
135 desc 'Bump all versions to match version.rb'
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
136 task :update_versions do
deb00bc @brynary Read Rails version from a file instead of modifying the load path and do...
brynary authored
137 require File.dirname(__FILE__) + "/version"
138
139 File.open("RAILS_VERSION", "w") do |f|
140 f.write Rails::VERSION::STRING + "\n"
141 end
142
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
143 constants = {
144 "activesupport" => "ActiveSupport",
145 "activemodel" => "ActiveModel",
146 "actionpack" => "ActionPack",
147 "actionmailer" => "ActionMailer",
148 "activeresource" => "ActiveResource",
149 "activerecord" => "ActiveRecord",
150 "railties" => "Rails"
151 }
152
153 version_file = File.read("version.rb")
154
155 PROJECTS.each do |project|
156 Dir["#{project}/lib/*/version.rb"].each do |file|
157 File.open(file, "w") do |f|
158 f.write version_file.gsub(/Rails/, constants[project])
159 end
160 end
161 end
162 end
dff0dfb @fxn adds a publish_docs task to force stable docs generation and publishing ...
fxn authored
163
164 #
165 # We have a webhook configured in Github that gets invoked after pushes.
166 # This hook triggers the following tasks:
167 #
168 # * updates the local checkout
169 # * updates Rails Contributors
170 # * generates and publishes edge docs
171 # * if there's a new stable tag, generates and publishes stable docs
172 #
173 # Everything is automated and you do NOT need to run this task normally.
174 #
175 # We publish a new verion by tagging, and pushing a tag does not trigger
176 # that webhook. Stable docs would be updated by any subsequent regular
177 # push, but if you want that to happen right away just run this.
178 #
179 desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
180 task :publish_docs do
181 Net::HTTP.new('rails-hooks.hashref.com').start do |http|
182 request = Net::HTTP::Post.new('/rails-master-hook')
183 response = http.request(request)
184 puts response.body
185 end
186 end
Something went wrong with that request. Please try again.