Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 150 lines (124 sloc) 5.193 kb
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
1 require 'rake'
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
2 require 'rake/rdoctask'
8ff310a Break up rails and railties:
Carlhuda authored
3 require 'rake/gempackagetask'
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
4
8ff310a Break up rails and railties:
Carlhuda authored
5 PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
6
7 desc 'Run all tests by default'
bbb3e5a @jeremy Unify test:isolated across components and run by default at toplevel
jeremy authored
8 task :default => %w(test test:isolated)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
9
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
10 %w(test test:isolated rdoc package gem).each do |task_name|
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
11 desc "Run #{task_name} task for all projects"
12 task task_name do
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
13 errors = []
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
14 PROJECTS.each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
15 system(%(cd #{project} && #{$0} #{task_name})) || errors << project
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
16 end
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
17 fail("Errors in #{errors.join(', ')}") unless errors.empty?
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
18 end
19 end
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
20
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
21 desc "Smoke-test all projects"
22 task :smoke do
23 (PROJECTS - %w(activerecord)).each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
24 system %(cd #{project} && #{$0} test:isolated)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
25 end
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
26 system %(cd activerecord && #{$0} sqlite3:isolated_test)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
27 end
8ff310a Break up rails and railties:
Carlhuda authored
28
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
29 spec = eval(File.read('rails.gemspec'))
8ff310a Break up rails and railties:
Carlhuda authored
30 Rake::GemPackageTask.new(spec) do |pkg|
31 pkg.gem_spec = spec
32 end
33
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
34 desc "Release all gems to gemcutter. Package rails, package & push components, then push rails"
459ecaf @jeremy Submarine the rake-gemcutter dep in Rakefiles
jeremy authored
35 task :release => :release_projects do
36 require 'rake/gemcutter'
37 Rake::Gemcutter::Tasks.new(spec).define
38 Rake::Task['gem:push'].invoke
39 end
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
40
41 desc "Release all components to gemcutter."
459ecaf @jeremy Submarine the rake-gemcutter dep in Rakefiles
jeremy authored
42 task :release_projects => :package do
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
43 errors = []
44 PROJECTS.each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
45 system(%(cd #{project} && #{$0} release)) || errors << project
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
46 end
47 fail("Errors in #{errors.join(', ')}") unless errors.empty?
48 end
49
87a011d @josevalim Make install appear on rake -T.
authored
50 desc "Install gems for all projects."
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
51 task :install => :gem do
52 (PROJECTS - ["railties"]).each do |project|
8ff310a Break up rails and railties:
Carlhuda authored
53 puts "INSTALLING #{project}"
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
54 system("gem install #{project}/pkg/#{project}-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
55 end
8ff310a Break up rails and railties:
Carlhuda authored
56 system("gem install railties/pkg/railties-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
57 system("gem install pkg/rails-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
58 end
59
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
60 desc "Generate documentation for the Rails framework"
61 Rake::RDocTask.new do |rdoc|
a02d672 @jeremy Horo rdoc template
jeremy authored
62 rdoc.rdoc_dir = 'doc/rdoc'
63 rdoc.title = "Ruby on Rails Documentation"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
64
65 rdoc.options << '--line-numbers' << '--inline-source'
66 rdoc.options << '-A cattr_accessor=object'
67 rdoc.options << '--charset' << 'utf-8'
68
a02d672 @jeremy Horo rdoc template
jeremy authored
69 rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : './doc/template/horo'
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')
73 rdoc.rdoc_files.include('railties/README')
5021dc6 @josevalim Vendorized Thor.
authored
74 rdoc.rdoc_files.include('railties/lib/{*.rb,commands/*.rb,rails/*.rb,generators/*.rb}')
75 rdoc.rdoc_files.exclude('railties/lib/vendor/*')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
76
77 rdoc.rdoc_files.include('activerecord/README')
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
82 rdoc.rdoc_files.include('activeresource/README')
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
87 rdoc.rdoc_files.include('actionpack/README')
88 rdoc.rdoc_files.include('actionpack/CHANGELOG')
89 rdoc.rdoc_files.include('actionpack/lib/action_controller/**/*.rb')
90 rdoc.rdoc_files.include('actionpack/lib/action_view/**/*.rb')
91 rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')
92
93 rdoc.rdoc_files.include('actionmailer/README')
94 rdoc.rdoc_files.include('actionmailer/CHANGELOG')
95 rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
96 rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
97
98 rdoc.rdoc_files.include('activesupport/README')
99 rdoc.rdoc_files.include('activesupport/CHANGELOG')
100 rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
101 rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
9fd9e5d @fxn fixes doc generation
fxn authored
102
103 rdoc.rdoc_files.include('activemodel/README')
104 rdoc.rdoc_files.include('activemodel/CHANGELOG')
105 rdoc.rdoc_files.include('activemodel/lib/active_model/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
106 end
107
108 # Enhance rdoc task to copy referenced images also
109 task :rdoc do
a02d672 @jeremy Horo rdoc template
jeremy authored
110 FileUtils.mkdir_p "doc/rdoc/files/examples/"
111 FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
112 end
113
114 desc "Publish API docs for Rails as a whole and for each component"
115 task :pdoc => :rdoc do
4c96397 @jeremy Defer rake/contrib requires so we can use the stdlib rake instead of the...
jeremy authored
116 require 'rake/contrib/sshpublisher'
a02d672 @jeremy Horo rdoc template
jeremy authored
117 Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/api", "doc/rdoc").upload
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
118 PROJECTS.each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
119 system %(cd #{project} && #{$0} pdoc)
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
120 end
121 end
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
122
123 task :update_versions do
deb00bc @brynary Read Rails version from a file instead of modifying the load path and do...
brynary authored
124 require File.dirname(__FILE__) + "/version"
125
126 File.open("RAILS_VERSION", "w") do |f|
127 f.write Rails::VERSION::STRING + "\n"
128 end
129
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all compone...
brynary authored
130 constants = {
131 "activesupport" => "ActiveSupport",
132 "activemodel" => "ActiveModel",
133 "actionpack" => "ActionPack",
134 "actionmailer" => "ActionMailer",
135 "activeresource" => "ActiveResource",
136 "activerecord" => "ActiveRecord",
137 "railties" => "Rails"
138 }
139
140 version_file = File.read("version.rb")
141
142 PROJECTS.each do |project|
143 Dir["#{project}/lib/*/version.rb"].each do |file|
144 File.open(file, "w") do |f|
145 f.write version_file.gsub(/Rails/, constants[project])
146 end
147 end
148 end
149 end
Something went wrong with that request. Please try again.