Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 191 lines (160 sloc) 6.799 kb
cb15709 @raggi Rakefiles are executables, and rake loads rake, not rakefile code
raggi authored
1 #!/usr/bin/env rake
07c6b7a @fxn migrates the Jamis template to RDoc 2.x, the root Rakefile requires RDoc...
fxn authored
2
05adf52 @amatsuda Ensure RDoc::Task exists even if 'rdoc/task' was not required
amatsuda authored
3 require 'rdoc/task'
dff0dfb @fxn adds a publish_docs task to force stable docs generation and publishing ...
fxn authored
4 require 'net/http'
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
5
4ff8c59 @carllerche Update the main Rakefile to use the new release tasks
carllerche authored
6 $:.unshift File.expand_path('..', __FILE__)
7 require "tasks/release"
8
9 desc "Build gem files for all projects"
10 task :build => "all:build"
11
12 desc "Release all gems to gemcutter and create a tag"
c3dd123 @carllerche Small cleanup of the release task
carllerche authored
13 task :release => "all:release"
4ff8c59 @carllerche Update the main Rakefile to use the new release tasks
carllerche authored
14
8ff310a Break up rails and railties:
Carlhuda authored
15 PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
16
17 desc 'Run all tests by default'
bbb3e5a @jeremy Unify test:isolated across components and run by default at toplevel
jeremy authored
18 task :default => %w(test test:isolated)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
19
728ba20 @fxn include the root README.rdoc as main page
fxn authored
20 %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
21 desc "Run #{task_name} task for all projects"
22 task task_name do
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
23 errors = []
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
24 PROJECTS.each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
25 system(%(cd #{project} && #{$0} #{task_name})) || errors << project
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
26 end
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
27 fail("Errors in #{errors.join(', ')}") unless errors.empty?
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
28 end
29 end
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
30
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
31 desc "Smoke-test all projects"
32 task :smoke do
33 (PROJECTS - %w(activerecord)).each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
34 system %(cd #{project} && #{$0} test:isolated)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
35 end
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
36 system %(cd activerecord && #{$0} sqlite3:isolated_test)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
37 end
8ff310a Break up rails and railties:
Carlhuda authored
38
87a011d @josevalim Make install appear on rake -T.
josevalim authored
39 desc "Install gems for all projects."
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
40 task :install => :gem do
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 state...
wycats authored
41 version = File.read("RAILS_VERSION").strip
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
42 (PROJECTS - ["railties"]).each do |project|
8ff310a Break up rails and railties:
Carlhuda authored
43 puts "INSTALLING #{project}"
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 state...
wycats authored
44 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
45 end
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 state...
wycats authored
46 system("gem install railties/pkg/railties-#{version}.gem --no-ri --no-rdoc")
47 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
48 end
49
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
50 desc "Generate documentation for the Rails framework"
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
51 RDoc::Task.new do |rdoc|
e68b7a0 @fxn (temporary hack) generate a main file for RDoc escaping "Rails"
fxn authored
52 RDOC_MAIN = 'RDOC_MAIN.rdoc'
53
caadef9 @fxn backslash insertion for RDoc main page ignores code blocks, also adds co...
fxn authored
54 # This is a hack.
55 #
56 # Backslashes are needed to prevent RDoc from autolinking "Rails" to the
57 # documentation of the Rails module. On the other hand, as of this
58 # writing README.rdoc is displayed in the front page of the project in
59 # GitHub, where backslashes are shown and look weird.
60 #
61 # The temporary solution is to have a README.rdoc without backslashes for
62 # GitHub, and gsub it to generate the main page of the API.
63 #
ed4be0a @fxn explains why links are gsub'ed, and changes the regexp delimiters
fxn authored
64 # Also, relative links in GitHub have to point to blobs, whereas in the API
65 # they need to point to files.
66 #
caadef9 @fxn backslash insertion for RDoc main page ignores code blocks, also adds co...
fxn authored
67 # The idea for the future is to have totally different files, since the
68 # API is no longer a generic entry point to Rails and deserves a
69 # dedicated main page specifically thought as an API entry point.
e68b7a0 @fxn (temporary hack) generate a main file for RDoc escaping "Rails"
fxn authored
70 rdoc.before_running_rdoc do
71 rdoc_main = File.read('README.rdoc')
caadef9 @fxn backslash insertion for RDoc main page ignores code blocks, also adds co...
fxn authored
72
73 # The ^(?=\S) assertion prevents code blocks from being processed,
74 # since no autolinking happens there and RDoc displays the backslash
75 # otherwise.
76 rdoc_main.gsub!(/^(?=\S).*?\b(?=Rails)\b/) { "#$&\\" }
ed4be0a @fxn explains why links are gsub'ed, and changes the regexp delimiters
fxn authored
77 rdoc_main.gsub!(%r{link:blob/master/(\w+)/README\.rdoc}, "link:files/\\1/README_rdoc.html")
caadef9 @fxn backslash insertion for RDoc main page ignores code blocks, also adds co...
fxn authored
78
e68b7a0 @fxn (temporary hack) generate a main file for RDoc escaping "Rails"
fxn authored
79 File.open(RDOC_MAIN, 'w') do |f|
80 f.write(rdoc_main)
81 end
82
83 rdoc.rdoc_files.include(RDOC_MAIN)
84 end
85
a02d672 @jeremy Horo rdoc template
jeremy authored
86 rdoc.rdoc_dir = 'doc/rdoc'
87 rdoc.title = "Ruby on Rails Documentation"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
88
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
89 rdoc.options << '-f' << 'horo'
728ba20 @fxn include the root README.rdoc as main page
fxn authored
90 rdoc.options << '-c' << 'utf-8'
e68b7a0 @fxn (temporary hack) generate a main file for RDoc escaping "Rails"
fxn authored
91 rdoc.options << '-m' << RDOC_MAIN
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
92
93 rdoc.rdoc_files.include('railties/CHANGELOG')
94 rdoc.rdoc_files.include('railties/MIT-LICENSE')
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
95 rdoc.rdoc_files.include('railties/README.rdoc')
d39ec81 @pixeltrix Make Railties RDoc task work again [#4291 state:resolved]
pixeltrix authored
96 rdoc.rdoc_files.include('railties/lib/**/*.rb')
de757af @fxn revises the pattern that excludes generator templates in API generation
fxn authored
97 rdoc.rdoc_files.exclude('railties/lib/rails/generators/**/templates/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
98
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
99 rdoc.rdoc_files.include('activerecord/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
100 rdoc.rdoc_files.include('activerecord/CHANGELOG')
101 rdoc.rdoc_files.include('activerecord/lib/active_record/**/*.rb')
102 rdoc.rdoc_files.exclude('activerecord/lib/active_record/vendor/*')
103
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
104 rdoc.rdoc_files.include('activeresource/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
105 rdoc.rdoc_files.include('activeresource/CHANGELOG')
106 rdoc.rdoc_files.include('activeresource/lib/active_resource.rb')
107 rdoc.rdoc_files.include('activeresource/lib/active_resource/*')
108
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
109 rdoc.rdoc_files.include('actionpack/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
110 rdoc.rdoc_files.include('actionpack/CHANGELOG')
aed698a @fxn adds Abstract Controller to the API
fxn authored
111 rdoc.rdoc_files.include('actionpack/lib/abstract_controller/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
112 rdoc.rdoc_files.include('actionpack/lib/action_controller/**/*.rb')
26bc5c5 @pixeltrix Add ActionDispatch to RDoc task [#4287 state:resolved]
pixeltrix authored
113 rdoc.rdoc_files.include('actionpack/lib/action_dispatch/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
114 rdoc.rdoc_files.include('actionpack/lib/action_view/**/*.rb')
115 rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')
116
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
117 rdoc.rdoc_files.include('actionmailer/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
118 rdoc.rdoc_files.include('actionmailer/CHANGELOG')
119 rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
f65023c @dcrec1 expose ActionMailer::MailHelper in the RDoc
dcrec1 authored
120 rdoc.rdoc_files.include('actionmailer/lib/action_mailer/mail_helper.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
121 rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
122
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
123 rdoc.rdoc_files.include('activesupport/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
124 rdoc.rdoc_files.include('activesupport/CHANGELOG')
125 rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
126 rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
9fd9e5d @fxn fixes doc generation
fxn authored
127
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
128 rdoc.rdoc_files.include('activemodel/README.rdoc')
9fd9e5d @fxn fixes doc generation
fxn authored
129 rdoc.rdoc_files.include('activemodel/CHANGELOG')
130 rdoc.rdoc_files.include('activemodel/lib/active_model/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
131 end
132
133 # Enhance rdoc task to copy referenced images also
134 task :rdoc do
a02d672 @jeremy Horo rdoc template
jeremy authored
135 FileUtils.mkdir_p "doc/rdoc/files/examples/"
136 FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
137 end
138
b861942 @jeremy Update CHANGELOGs for 3.0 release and upcoming 3.1
jeremy authored
139 desc 'Bump all versions to match version.rb'
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
140 task :update_versions do
deb00bc @brynary Read Rails version from a file instead of modifying the load path and do...
brynary authored
141 require File.dirname(__FILE__) + "/version"
142
143 File.open("RAILS_VERSION", "w") do |f|
144 f.write Rails::VERSION::STRING + "\n"
145 end
146
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
147 constants = {
148 "activesupport" => "ActiveSupport",
149 "activemodel" => "ActiveModel",
150 "actionpack" => "ActionPack",
151 "actionmailer" => "ActionMailer",
152 "activeresource" => "ActiveResource",
153 "activerecord" => "ActiveRecord",
154 "railties" => "Rails"
155 }
156
157 version_file = File.read("version.rb")
158
159 PROJECTS.each do |project|
160 Dir["#{project}/lib/*/version.rb"].each do |file|
161 File.open(file, "w") do |f|
162 f.write version_file.gsub(/Rails/, constants[project])
163 end
164 end
165 end
166 end
dff0dfb @fxn adds a publish_docs task to force stable docs generation and publishing ...
fxn authored
167
168 #
169 # We have a webhook configured in Github that gets invoked after pushes.
170 # This hook triggers the following tasks:
171 #
172 # * updates the local checkout
173 # * updates Rails Contributors
174 # * generates and publishes edge docs
175 # * if there's a new stable tag, generates and publishes stable docs
176 #
177 # Everything is automated and you do NOT need to run this task normally.
178 #
646e520 @spastorino Typo fixed
spastorino authored
179 # We publish a new version by tagging, and pushing a tag does not trigger
dff0dfb @fxn adds a publish_docs task to force stable docs generation and publishing ...
fxn authored
180 # that webhook. Stable docs would be updated by any subsequent regular
181 # push, but if you want that to happen right away just run this.
182 #
183 desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
184 task :publish_docs do
185 Net::HTTP.new('rails-hooks.hashref.com').start do |http|
186 request = Net::HTTP::Post.new('/rails-master-hook')
187 response = http.request(request)
188 puts response.body
189 end
190 end
Something went wrong with that request. Please try again.