Skip to content

HTTPS clone URL

Subversion checkout URL

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