Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 180 lines (150 sloc) 6.079 kB
82eff0f @spastorino Bump up rdoc to 2.5.10
spastorino authored
1 gem 'rdoc', '>= 2.5.10'
07c6b7a @fxn migrates the Jamis template to RDoc 2.x, the root Rakefile requires R…
fxn authored
2 require 'rdoc'
3
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
4 require 'rake'
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
5 require 'rdoc/task'
8ff310a Break up rails and railties:
Carlhuda authored
6 require 'rake/gempackagetask'
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
7
5aec933 @fxn quick hack: hijacks the predicate RDoc::Parser.binary? so that it doe…
fxn authored
8 # RDoc skips some files in the Rails tree due to its binary? predicate. This is a quick
9 # hack for edge docs, until we decide which is the correct way to address this issue.
10 # If not fixed in RDoc itself, via an option or something, we should probably move this
11 # to railties and use it also in doc:rails.
12 def hijack_rdoc!
13 require "rdoc/parser"
14 class << RDoc::Parser
15 def binary?(file)
16 s = File.read(file, 1024) or return false
17
18 if s[0, 2] == Marshal.dump('')[0, 2] then
19 true
78c7705 @fxn undoes one of the modifications to RDoc::Parser.binary?
fxn authored
20 elsif file =~ /erb\.rb$/ then
5aec933 @fxn quick hack: hijacks the predicate RDoc::Parser.binary? so that it doe…
fxn authored
21 false
22 elsif s.index("\x00") then # ORIGINAL is s.scan(/<%|%>/).length >= 4 || s.index("\x00")
23 true
24 elsif 0.respond_to? :fdiv then
25 s.count("^ -~\t\r\n").fdiv(s.size) > 0.3
26 else # HACK 1.8.6
27 (s.count("^ -~\t\r\n").to_f / s.size) > 0.3
28 end
29 end
30 end
31 end
32
8ff310a Break up rails and railties:
Carlhuda authored
33 PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
34
35 desc 'Run all tests by default'
bbb3e5a @jeremy Unify test:isolated across components and run by default at toplevel
jeremy authored
36 task :default => %w(test test:isolated)
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
37
728ba20 @fxn include the root README.rdoc as main page
fxn authored
38 %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
39 desc "Run #{task_name} task for all projects"
40 task task_name do
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
41 errors = []
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
42 PROJECTS.each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
43 system(%(cd #{project} && #{$0} #{task_name})) || errors << project
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
44 end
49afe81 @kerryb Report errors in 'all project' rake tasks [#2224 state:resolved]
kerryb authored
45 fail("Errors in #{errors.join(', ')}") unless errors.empty?
8922c5d @jeremy Add toplevel Rakefile to run tests, generate docs, etc en masse
jeremy authored
46 end
47 end
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
48
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
49 desc "Smoke-test all projects"
50 task :smoke do
51 (PROJECTS - %w(activerecord)).each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
52 system %(cd #{project} && #{$0} test:isolated)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
53 end
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
54 system %(cd activerecord && #{$0} sqlite3:isolated_test)
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
55 end
8ff310a Break up rails and railties:
Carlhuda authored
56
a76af23 @jeremy rake smoke: toplevel task to quickly smoke-test all projects
jeremy authored
57 spec = eval(File.read('rails.gemspec'))
8ff310a Break up rails and railties:
Carlhuda authored
58 Rake::GemPackageTask.new(spec) do |pkg|
59 pkg.gem_spec = spec
60 end
61
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
62 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
63 task :release => :release_projects do
64 require 'rake/gemcutter'
65 Rake::Gemcutter::Tasks.new(spec).define
66 Rake::Task['gem:push'].invoke
67 end
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
68
69 desc "Release all components to gemcutter."
459ecaf @jeremy Submarine the rake-gemcutter dep in Rakefiles
jeremy authored
70 task :release_projects => :package do
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
71 errors = []
72 PROJECTS.each do |project|
11db694 @brynary Remove cruft in the gem packaging and release code
brynary authored
73 system(%(cd #{project} && #{$0} release)) || errors << project
c1785f3 @jeremy Release using gemcutter gem:push tasks
jeremy authored
74 end
75 fail("Errors in #{errors.join(', ')}") unless errors.empty?
76 end
77
87a011d @josevalim Make install appear on rake -T.
josevalim authored
78 desc "Install gems for all projects."
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
79 task :install => :gem do
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 st…
wycats authored
80 version = File.read("RAILS_VERSION").strip
f3ed0de @wycats Create an install task that successfully installs all Rails gems
wycats authored
81 (PROJECTS - ["railties"]).each do |project|
8ff310a Break up rails and railties:
Carlhuda authored
82 puts "INSTALLING #{project}"
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 st…
wycats authored
83 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
84 end
c428fbd @wycats Use the new RAILS_VERSION in rake install (ht: ZhangJinzhu) [#4116 st…
wycats authored
85 system("gem install railties/pkg/railties-#{version}.gem --no-ri --no-rdoc")
86 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
87 end
88
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
89 desc "Generate documentation for the Rails framework"
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
90 RDoc::Task.new do |rdoc|
5aec933 @fxn quick hack: hijacks the predicate RDoc::Parser.binary? so that it doe…
fxn authored
91 hijack_rdoc!
92
a02d672 @jeremy Horo rdoc template
jeremy authored
93 rdoc.rdoc_dir = 'doc/rdoc'
94 rdoc.title = "Ruby on Rails Documentation"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
95
b50635a @tenderlove update Rakefiles for RDoc 2.5
tenderlove authored
96 rdoc.options << '-f' << 'horo'
728ba20 @fxn include the root README.rdoc as main page
fxn authored
97 rdoc.options << '-c' << 'utf-8'
98 rdoc.options << '-m' << 'README.rdoc'
99
100 rdoc.rdoc_files.include('README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
101
102 rdoc.rdoc_files.include('railties/CHANGELOG')
103 rdoc.rdoc_files.include('railties/MIT-LICENSE')
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
104 rdoc.rdoc_files.include('railties/README.rdoc')
d39ec81 @pixeltrix Make Railties RDoc task work again [#4291 state:resolved]
pixeltrix authored
105 rdoc.rdoc_files.include('railties/lib/**/*.rb')
106 rdoc.rdoc_files.exclude('railties/lib/rails/generators/**/templates/*')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
107
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
108 rdoc.rdoc_files.include('activerecord/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
109 rdoc.rdoc_files.include('activerecord/CHANGELOG')
110 rdoc.rdoc_files.include('activerecord/lib/active_record/**/*.rb')
111 rdoc.rdoc_files.exclude('activerecord/lib/active_record/vendor/*')
112
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
113 rdoc.rdoc_files.include('activeresource/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
114 rdoc.rdoc_files.include('activeresource/CHANGELOG')
115 rdoc.rdoc_files.include('activeresource/lib/active_resource.rb')
116 rdoc.rdoc_files.include('activeresource/lib/active_resource/*')
117
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
118 rdoc.rdoc_files.include('actionpack/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
119 rdoc.rdoc_files.include('actionpack/CHANGELOG')
413c9c8 @fxn adds Abstract Controller to the API
fxn authored
120 rdoc.rdoc_files.include('actionpack/lib/abstract_controller/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
121 rdoc.rdoc_files.include('actionpack/lib/action_controller/**/*.rb')
26bc5c5 @pixeltrix Add ActionDispatch to RDoc task [#4287 state:resolved]
pixeltrix authored
122 rdoc.rdoc_files.include('actionpack/lib/action_dispatch/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
123 rdoc.rdoc_files.include('actionpack/lib/action_view/**/*.rb')
124 rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')
125
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
126 rdoc.rdoc_files.include('actionmailer/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
127 rdoc.rdoc_files.include('actionmailer/CHANGELOG')
128 rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
129 rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')
130
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
131 rdoc.rdoc_files.include('activesupport/README.rdoc')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
132 rdoc.rdoc_files.include('activesupport/CHANGELOG')
133 rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
134 rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
9fd9e5d @fxn fixes doc generation
fxn authored
135
508fba9 @josevalim Add .rdoc extension to README files.
josevalim authored
136 rdoc.rdoc_files.include('activemodel/README.rdoc')
9fd9e5d @fxn fixes doc generation
fxn authored
137 rdoc.rdoc_files.include('activemodel/CHANGELOG')
138 rdoc.rdoc_files.include('activemodel/lib/active_model/**/*.rb')
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
139 end
140
141 # Enhance rdoc task to copy referenced images also
142 task :rdoc do
a02d672 @jeremy Horo rdoc template
jeremy authored
143 FileUtils.mkdir_p "doc/rdoc/files/examples/"
144 FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
145 end
146
147 desc "Publish API docs for Rails as a whole and for each component"
148 task :pdoc => :rdoc do
4c96397 @jeremy Defer rake/contrib requires so we can use the stdlib rake instead of …
jeremy authored
149 require 'rake/contrib/sshpublisher'
2aa4e5f @fxn pdoc tasks publishe APIs in api.rubyonrails.org
fxn authored
150 Rake::SshDirPublisher.new("rails@api.rubyonrails.org", "public_html/api", "doc/rdoc").upload
4c720b7 @jeremy Add toplevel rdoc and pdoc tasks
jeremy authored
151 end
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all comp…
brynary authored
152
153 task :update_versions do
deb00bc @brynary Read Rails version from a file instead of modifying the load path and…
brynary authored
154 require File.dirname(__FILE__) + "/version"
155
156 File.open("RAILS_VERSION", "w") do |f|
157 f.write Rails::VERSION::STRING + "\n"
158 end
159
b1769fe @brynary Add `rake update_versions` task at root for quickly updating all comp…
brynary authored
160 constants = {
161 "activesupport" => "ActiveSupport",
162 "activemodel" => "ActiveModel",
163 "actionpack" => "ActionPack",
164 "actionmailer" => "ActionMailer",
165 "activeresource" => "ActiveResource",
166 "activerecord" => "ActiveRecord",
167 "railties" => "Rails"
168 }
169
170 version_file = File.read("version.rb")
171
172 PROJECTS.each do |project|
173 Dir["#{project}/lib/*/version.rb"].each do |file|
174 File.open(file, "w") do |f|
175 f.write version_file.gsub(/Rails/, constants[project])
176 end
177 end
178 end
179 end
Something went wrong with that request. Please try again.