Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 169 lines (140 sloc) 5.754 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.
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
54 rdoc.before_running_rdoc do
55 rdoc_main = File.read('README.rdoc')
56 rdoc_main.gsub!(/\b(?=Rails)\b/) { '\\' }
57 File.open(RDOC_MAIN, 'w') do |f|
58 f.write(rdoc_main)
59 end
60
61 rdoc.rdoc_files.include(RDOC_MAIN)
62 end
63
a02d672 @jeremy Horo rdoc template
jeremy authored
64 rdoc.rdoc_dir = 'doc/rdoc'
65 rdoc.title = "Ruby on Rails Documentation"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
66
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
67 rdoc.options << '-f' << 'horo'
728ba20 @fxn include the root README.rdoc as main page
fxn authored
68 rdoc.options << '-c' << 'utf-8'
e68b7a0 @fxn (temporary hack) generate a main file for RDoc escaping "Rails"
fxn authored
69 rdoc.options << '-m' << RDOC_MAIN
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
70
71 rdoc.rdoc_files.include('railties/CHANGELOG')
72 rdoc.rdoc_files.include('railties/MIT-LICENSE')
508fba9 @josevalim Add .rdoc extension to README files.
authored
73 rdoc.rdoc_files.include('railties/README.rdoc')
d39ec81 @pixeltrix Make Railties RDoc task work again [#4291 state:resolved]
pixeltrix authored
74 rdoc.rdoc_files.include('railties/lib/**/*.rb')
75 rdoc.rdoc_files.exclude('railties/lib/rails/generators/**/templates/*')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
76
508fba9 @josevalim Add .rdoc extension to README files.
authored
77 rdoc.rdoc_files.include('activerecord/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
78 rdoc.rdoc_files.include('activerecord/CHANGELOG')
79 rdoc.rdoc_files.include('activerecord/lib/active_record/**/*.rb')
80 rdoc.rdoc_files.exclude('activerecord/lib/active_record/vendor/*')
81
508fba9 @josevalim Add .rdoc extension to README files.
authored
82 rdoc.rdoc_files.include('activeresource/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
83 rdoc.rdoc_files.include('activeresource/CHANGELOG')
84 rdoc.rdoc_files.include('activeresource/lib/active_resource.rb')
85 rdoc.rdoc_files.include('activeresource/lib/active_resource/*')
86
508fba9 @josevalim Add .rdoc extension to README files.
authored
87 rdoc.rdoc_files.include('actionpack/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
88 rdoc.rdoc_files.include('actionpack/CHANGELOG')
aed698a @fxn adds Abstract Controller to the API
fxn authored
89 rdoc.rdoc_files.include('actionpack/lib/abstract_controller/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
90 rdoc.rdoc_files.include('actionpack/lib/action_controller/**/*.rb')
26bc5c5 @pixeltrix Add ActionDispatch to RDoc task [#4287 state:resolved]
pixeltrix authored
91 rdoc.rdoc_files.include('actionpack/lib/action_dispatch/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
92 rdoc.rdoc_files.include('actionpack/lib/action_view/**/*.rb')
93 rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')
94
508fba9 @josevalim Add .rdoc extension to README files.
authored
95 rdoc.rdoc_files.include('actionmailer/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
96 rdoc.rdoc_files.include('actionmailer/CHANGELOG')
97 rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
f65023c @dcrec1 expose ActionMailer::MailHelper in the RDoc
dcrec1 authored
98 rdoc.rdoc_files.include('actionmailer/lib/action_mailer/mail_helper.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
99 rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
100
508fba9 @josevalim Add .rdoc extension to README files.
authored
101 rdoc.rdoc_files.include('activesupport/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
102 rdoc.rdoc_files.include('activesupport/CHANGELOG')
103 rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
104 rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
9fd9e5d @fxn fixes doc generation
fxn authored
105
508fba9 @josevalim Add .rdoc extension to README files.
authored
106 rdoc.rdoc_files.include('activemodel/README.rdoc')
9fd9e5d @fxn fixes doc generation
fxn authored
107 rdoc.rdoc_files.include('activemodel/CHANGELOG')
108 rdoc.rdoc_files.include('activemodel/lib/active_model/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
109 end
110
111 # Enhance rdoc task to copy referenced images also
112 task :rdoc do
a02d672 @jeremy Horo rdoc template
jeremy authored
113 FileUtils.mkdir_p "doc/rdoc/files/examples/"
114 FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
115 end
116
b861942 @jeremy Update CHANGELOGs for 3.0 release and upcoming 3.1
jeremy authored
117 desc 'Bump all versions to match version.rb'
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
118 task :update_versions do
deb00bc @brynary Read Rails version from a file instead of modifying the load path and do...
brynary authored
119 require File.dirname(__FILE__) + "/version"
120
121 File.open("RAILS_VERSION", "w") do |f|
122 f.write Rails::VERSION::STRING + "\n"
123 end
124
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
125 constants = {
126 "activesupport" => "ActiveSupport",
127 "activemodel" => "ActiveModel",
128 "actionpack" => "ActionPack",
129 "actionmailer" => "ActionMailer",
130 "activeresource" => "ActiveResource",
131 "activerecord" => "ActiveRecord",
132 "railties" => "Rails"
133 }
134
135 version_file = File.read("version.rb")
136
137 PROJECTS.each do |project|
138 Dir["#{project}/lib/*/version.rb"].each do |file|
139 File.open(file, "w") do |f|
140 f.write version_file.gsub(/Rails/, constants[project])
141 end
142 end
143 end
144 end
dff0dfb @fxn adds a publish_docs task to force stable docs generation and publishing ...
fxn authored
145
146 #
147 # We have a webhook configured in Github that gets invoked after pushes.
148 # This hook triggers the following tasks:
149 #
150 # * updates the local checkout
151 # * updates Rails Contributors
152 # * generates and publishes edge docs
153 # * if there's a new stable tag, generates and publishes stable docs
154 #
155 # Everything is automated and you do NOT need to run this task normally.
156 #
646e520 @spastorino Typo fixed
spastorino authored
157 # 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
158 # that webhook. Stable docs would be updated by any subsequent regular
159 # push, but if you want that to happen right away just run this.
160 #
161 desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
162 task :publish_docs do
163 Net::HTTP.new('rails-hooks.hashref.com').start do |http|
164 request = Net::HTTP::Post.new('/rails-master-hook')
165 response = http.request(request)
166 puts response.body
167 end
168 end
Something went wrong with that request. Please try again.