Skip to content

HTTPS clone URL

Subversion checkout URL

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