railties 4.0.0.beta1 → 4.0.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +120 -27
- data/RDOC_MAIN.rdoc +73 -0
- data/bin/rails +3 -1
- data/lib/rails/api/task.rb +158 -0
- data/lib/rails/app_rails_loader.rb +44 -20
- data/lib/rails/application.rb +55 -32
- data/lib/rails/application/configuration.rb +9 -7
- data/lib/rails/commands.rb +2 -0
- data/lib/rails/commands/console.rb +3 -1
- data/lib/rails/commands/server.rb +6 -2
- data/lib/rails/engine.rb +4 -3
- data/lib/rails/generators/actions.rb +1 -1
- data/lib/rails/generators/app_base.rb +52 -30
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +10 -1
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +9 -9
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb +1 -2
- data/lib/rails/generators/generated_attribute.rb +4 -0
- data/lib/rails/generators/named_base.rb +2 -1
- data/lib/rails/generators/rails/app/templates/Gemfile +9 -4
- data/lib/rails/generators/rails/app/templates/config.ru +1 -1
- data/lib/rails/generators/rails/app/templates/config/application.rb +3 -2
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/routes.rb +1 -1
- data/lib/rails/generators/rails/app/templates/public/404.html +41 -10
- data/lib/rails/generators/rails/app/templates/public/422.html +42 -10
- data/lib/rails/generators/rails/app/templates/public/500.html +41 -10
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb +1 -1
- data/lib/rails/generators/rails/model/USAGE +16 -10
- data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +9 -5
- data/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec +0 -3
- data/lib/rails/generators/rails/plugin_new/templates/Gemfile +0 -8
- data/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb +4 -8
- data/lib/rails/generators/rails/plugin_new/templates/rails/javascripts.js +13 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/stylesheets.css +13 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +1 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +1 -1
- data/lib/rails/generators/test_case.rb +6 -211
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml +7 -9
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +5 -1
- data/lib/rails/generators/testing/assertions.rb +121 -0
- data/lib/rails/generators/testing/behaviour.rb +106 -0
- data/lib/rails/generators/testing/setup_and_teardown.rb +18 -0
- data/lib/rails/info.rb +2 -2
- data/lib/rails/tasks/documentation.rake +2 -46
- data/lib/rails/templates/rails/welcome/index.html.erb +1 -1
- data/lib/rails/test_unit/railtie.rb +4 -0
- data/lib/rails/test_unit/sub_test_task.rb +78 -1
- data/lib/rails/test_unit/testing.rake +32 -42
- data/lib/rails/version.rb +3 -3
- metadata +15 -23
- data/lib/rails/generators/rails/app/templates/app/assets/images/rails.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37e89dda5a168600b16ced676d5df9369fe7c3a4
|
4
|
+
data.tar.gz: 53de3cda6db70ee7ad7e39198d8bf0ee2fb9b348
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c1dc30721c0547579a5c877fb2deec2d76895c6e541cc9becaa026b37ab3a8f53112cfc3e1a45ae4acdd46ef8b48a77a0c3693c3fb6bef2b6a4eef950e593a5
|
7
|
+
data.tar.gz: d049ff1041a82b40557189150497da39423b9016d041d9b8c03575c6d8474929bcb804f26920a927ef07ebaa8171555944b5dee253d98531aac5e9947363b670
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,66 @@
|
|
1
|
+
## Rails 4.0.0 (unreleased) ##
|
2
|
+
|
3
|
+
* Move rails.png into a data-uri. One less file to get generated into a new
|
4
|
+
application. This is also consistent with the removal of index.html.
|
5
|
+
|
6
|
+
*Steve Klabnik*
|
7
|
+
|
8
|
+
* The application rake task `doc:rails` generates now an API like the
|
9
|
+
official one (except for the links to GitHub).
|
10
|
+
|
11
|
+
*Xavier Noria*
|
12
|
+
|
13
|
+
* Allow vanilla apps to render CoffeeScript templates in production
|
14
|
+
|
15
|
+
Vanilla apps already render CoffeeScript templates in development and test
|
16
|
+
environments. With this change, the production behavior matches that of
|
17
|
+
the other environments.
|
18
|
+
|
19
|
+
Effectively, this meant moving coffee-rails (and the JavaScript runtime on
|
20
|
+
which it is dependent) from the :assets group to the top-level of the
|
21
|
+
generated Gemfile.
|
22
|
+
|
23
|
+
*Gabe Kopley*
|
24
|
+
|
25
|
+
* Don't generate a scaffold.css when --no-assets is specified
|
26
|
+
|
27
|
+
*Kevin Glowacz*
|
28
|
+
|
29
|
+
* Add support for generate scaffold password:digest
|
30
|
+
|
31
|
+
* adds password_digest attribute to the migration
|
32
|
+
* adds has_secure_password to the model
|
33
|
+
* adds password and password_confirmation password_fields to _form.html
|
34
|
+
* omits password from index.html and show.html
|
35
|
+
* adds password and password_confirmation to the controller
|
36
|
+
* adds unencrypted password and password_confirmation to the controller test
|
37
|
+
* adds encrypted password_digest to the fixture
|
38
|
+
|
39
|
+
*Sam Ruby*
|
40
|
+
|
41
|
+
* Improved `rake test` command for running tests
|
42
|
+
|
43
|
+
To run all tests:
|
44
|
+
|
45
|
+
$ rake test
|
46
|
+
|
47
|
+
To run a test suite
|
48
|
+
|
49
|
+
$ rake test:[models,helpers,units,controllers,mailers,...]
|
50
|
+
|
51
|
+
To run a selected test file(s):
|
52
|
+
|
53
|
+
$ rake test test/unit/foo_test.rb [test/unit/bar_test.rb ...]
|
54
|
+
|
55
|
+
To run a single test from a test file
|
56
|
+
|
57
|
+
$ rake test test/unit/foo_test.rb TESTOPTS='-n test_the_truth'
|
58
|
+
|
59
|
+
* Improve service pages with new layout (404, etc).
|
60
|
+
|
61
|
+
*Stanislav Sobolev*
|
62
|
+
|
63
|
+
|
1
64
|
## Rails 4.0.0.beta1 (February 25, 2013) ##
|
2
65
|
|
3
66
|
* Improve `rake stats` for JavaScript and CoffeeScript: ignore block comments
|
@@ -5,13 +68,13 @@
|
|
5
68
|
|
6
69
|
*Hendy Tanata*
|
7
70
|
|
8
|
-
* Ability to use a custom builder by passing `--builder` (or `-b`) has been removed.
|
9
|
-
using application template instead. See this guide for more detail:
|
71
|
+
* Ability to use a custom builder by passing `--builder` (or `-b`) has been removed.
|
72
|
+
Consider using application template instead. See this guide for more detail:
|
10
73
|
http://guides.rubyonrails.org/rails_application_templates.html
|
11
74
|
|
12
75
|
*Prem Sichanugrist*
|
13
76
|
|
14
|
-
*
|
77
|
+
* Fix `rake db:*` tasks to work with `DATABASE_URL` and without `config/database.yml`.
|
15
78
|
|
16
79
|
*Terence Lee*
|
17
80
|
|
@@ -35,13 +98,13 @@
|
|
35
98
|
*Amparo Luna*
|
36
99
|
|
37
100
|
* Fixes database.yml when creating a new rails application with '.'
|
38
|
-
|
101
|
+
Fixes #8304.
|
39
102
|
|
40
103
|
*Jeremy W. Rowe*
|
41
104
|
|
42
105
|
* Restore Rails::Engine::Railties#engines with deprecation to ensure
|
43
106
|
compatibility with gems such as Thinking Sphinx
|
44
|
-
|
107
|
+
Fixes #8551.
|
45
108
|
|
46
109
|
*Tim Raymond*
|
47
110
|
|
@@ -115,7 +178,7 @@
|
|
115
178
|
|
116
179
|
* Environment name can be a start substring of the default environment names
|
117
180
|
(production, development, test). For example: tes, pro, prod, dev, devel.
|
118
|
-
|
181
|
+
Fixes #8628.
|
119
182
|
|
120
183
|
*Mykola Kyryk*
|
121
184
|
|
@@ -125,7 +188,7 @@
|
|
125
188
|
|
126
189
|
* Quote column names in generates fixture files. This prevents
|
127
190
|
conflicts with reserved YAML keywords such as 'yes' and 'no'
|
128
|
-
|
191
|
+
Fixes #8612.
|
129
192
|
|
130
193
|
*Yves Senn*
|
131
194
|
|
@@ -158,19 +221,19 @@
|
|
158
221
|
* Add `db` to list of folders included by `rake notes` and `rake notes:custom`. *Antonio Cangiano*
|
159
222
|
|
160
223
|
* Engines with a dummy app include the rake tasks of dependencies in the app namespace.
|
161
|
-
|
224
|
+
Fixes #8229.
|
162
225
|
|
163
226
|
*Yves Senn*
|
164
227
|
|
165
228
|
* Add `sqlserver.yml` template file to satisfy `-d sqlserver` being passed to `rails new`.
|
166
|
-
|
229
|
+
Fixes #6882.
|
167
230
|
|
168
231
|
*Robert Nesius*
|
169
232
|
|
170
233
|
* Rake test:uncommitted finds git directory in ancestors *Nicolas Despres*
|
171
234
|
|
172
235
|
* Add dummy app Rake tasks when `--skip-test-unit` and `--dummy-path` is passed to the plugin generator.
|
173
|
-
|
236
|
+
Fixes #8121.
|
174
237
|
|
175
238
|
*Yves Senn*
|
176
239
|
|
@@ -212,17 +275,25 @@
|
|
212
275
|
|
213
276
|
*Derek Prior & Francesco Rodriguez*
|
214
277
|
|
215
|
-
* Fixed support for DATABASE_URL environment variable for rake db tasks.
|
278
|
+
* Fixed support for `DATABASE_URL` environment variable for rake db tasks.
|
216
279
|
|
217
|
-
*
|
218
|
-
|
280
|
+
*Grace Liu*
|
281
|
+
|
282
|
+
* `rails dbconsole` now can use SSL for MySQL. The `database.yml` options sslca, sslcert, sslcapath, sslcipher
|
283
|
+
and sslkey now affect `rails dbconsole`.
|
284
|
+
|
285
|
+
*Jim Kingdon and Lars Petrus*
|
219
286
|
|
220
287
|
* Correctly handle SCRIPT_NAME when generating routes to engine in application
|
221
288
|
that's mounted at a sub-uri. With this behavior, you *should not* use
|
222
|
-
default_url_options[:script_name] to set proper application's mount point by
|
223
|
-
yourself.
|
289
|
+
`default_url_options[:script_name]` to set proper application's mount point by
|
290
|
+
yourself.
|
291
|
+
|
292
|
+
*Piotr Sarnacki*
|
224
293
|
|
225
|
-
* `config.threadsafe!` is deprecated in favor of `config.eager_load` which provides a more fine grained control on what is eager loaded
|
294
|
+
* `config.threadsafe!` is deprecated in favor of `config.eager_load` which provides a more fine grained control on what is eager loaded .
|
295
|
+
|
296
|
+
*José Valim*
|
226
297
|
|
227
298
|
* The migration generator will now produce AddXXXToYYY/RemoveXXXFromYYY migrations with references statements, for instance
|
228
299
|
|
@@ -245,21 +316,35 @@
|
|
245
316
|
|
246
317
|
*Aleksey Magusev*
|
247
318
|
|
248
|
-
* Set `config.active_record.migration_error` to `:page_load` for development
|
319
|
+
* Set `config.active_record.migration_error` to `:page_load` for development.
|
320
|
+
|
321
|
+
*Richard Schneeman*
|
249
322
|
|
250
|
-
* Add runner to Rails::Railtie as a hook called just after runner starts.
|
323
|
+
* Add runner to `Rails::Railtie` as a hook called just after runner starts.
|
251
324
|
|
252
|
-
*
|
325
|
+
*José Valim & kennyj*
|
253
326
|
|
254
|
-
*
|
327
|
+
* Add `/rails/info/routes` path, displays same information as `rake routes` .
|
255
328
|
|
256
|
-
*
|
329
|
+
*Richard Schneeman & Andrew White*
|
257
330
|
|
258
|
-
*
|
331
|
+
* Improved `rake routes` output for redirects.
|
259
332
|
|
260
|
-
|
333
|
+
*Łukasz Strzałkowski & Andrew White*
|
261
334
|
|
262
|
-
*
|
335
|
+
* Load all environments available in `config.paths["config/environments"]`.
|
336
|
+
|
337
|
+
*Piotr Sarnacki*
|
338
|
+
|
339
|
+
* Remove `Rack::SSL` in favour of `ActionDispatch::SSL`.
|
340
|
+
|
341
|
+
*Rafael Mendonça França*
|
342
|
+
|
343
|
+
* Remove Active Resource from Rails framework.
|
344
|
+
|
345
|
+
*Prem Sichangrist*
|
346
|
+
|
347
|
+
* Allow to set class that will be used to run as a console, other than IRB, with `Rails.application.config.console=`. It's best to add it to `console` block.
|
263
348
|
|
264
349
|
Example:
|
265
350
|
|
@@ -271,12 +356,20 @@
|
|
271
356
|
config.console = Pry
|
272
357
|
end
|
273
358
|
|
359
|
+
*Piotr Sarnacki*
|
360
|
+
|
274
361
|
* Add convenience `hide!` method to Rails generators to hide current generator
|
275
|
-
namespace from showing when running `rails generate`.
|
362
|
+
namespace from showing when running `rails generate`.
|
363
|
+
|
364
|
+
*Carlos Antonio da Silva*
|
276
365
|
|
277
|
-
* Rails::Plugin has gone. Instead of adding plugins to vendor/plugins use gems or bundler with path or git dependencies.
|
366
|
+
* Rails::Plugin has gone. Instead of adding plugins to vendor/plugins use gems or bundler with path or git dependencies.
|
367
|
+
|
368
|
+
*Santiago Pastorino*
|
278
369
|
|
279
370
|
* Set config.action_mailer.async = true to turn on asynchronous
|
280
|
-
message delivery
|
371
|
+
message delivery.
|
372
|
+
|
373
|
+
*Brian Cardarella*
|
281
374
|
|
282
375
|
Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/railties/CHANGELOG.md) for previous changes.
|
data/RDOC_MAIN.rdoc
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
== Welcome to \Rails
|
2
|
+
|
3
|
+
\Rails is a web-application framework that includes everything needed to create
|
4
|
+
database-backed web applications according to the {Model-View-Controller (MVC)}[http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller] pattern.
|
5
|
+
|
6
|
+
Understanding the MVC pattern is key to understanding \Rails. MVC divides your application
|
7
|
+
into three layers, each with a specific responsibility.
|
8
|
+
|
9
|
+
The View layer is composed of "templates" that are responsible for providing
|
10
|
+
appropriate representations of your application's resources. Templates
|
11
|
+
can come in a variety of formats, but most view templates are \HTML with embedded Ruby
|
12
|
+
code (.erb files).
|
13
|
+
|
14
|
+
The Model layer represents your domain model (such as Account, Product, Person, Post)
|
15
|
+
and encapsulates the business logic that is specific to your application. In \Rails,
|
16
|
+
database-backed model classes are derived from ActiveRecord::Base. Active Record allows
|
17
|
+
you to present the data from database rows as objects and embellish these data objects
|
18
|
+
with business logic methods. Although most \Rails models are backed by a database, models
|
19
|
+
can also be ordinary Ruby classes, or Ruby classes that implement a set of interfaces as
|
20
|
+
provided by the ActiveModel module. You can read more about Active Record in its
|
21
|
+
{README}[link:/activerecord/README.rdoc].
|
22
|
+
|
23
|
+
The Controller layer is responsible for handling incoming HTTP requests and providing a
|
24
|
+
suitable response. Usually this means returning \HTML, but \Rails controllers can also
|
25
|
+
generate XML, JSON, PDFs, mobile-specific views, and more. Controllers manipulate models
|
26
|
+
and render view templates in order to generate the appropriate HTTP response.
|
27
|
+
|
28
|
+
In \Rails, the Controller and View layers are handled together by Action Pack.
|
29
|
+
These two layers are bundled in a single package due to their heavy interdependence.
|
30
|
+
This is unlike the relationship between Active Record and Action Pack, which are
|
31
|
+
independent. Each of these packages can be used independently outside of \Rails. You
|
32
|
+
can read more about Action Pack in its {README}[link:/actionpack/README.rdoc].
|
33
|
+
|
34
|
+
== Getting Started
|
35
|
+
|
36
|
+
1. Install \Rails at the command prompt if you haven't yet:
|
37
|
+
|
38
|
+
gem install rails
|
39
|
+
|
40
|
+
2. At the command prompt, create a new \Rails application:
|
41
|
+
|
42
|
+
rails new myapp
|
43
|
+
|
44
|
+
where "myapp" is the application name.
|
45
|
+
|
46
|
+
3. Change directory to +myapp+ and start the web server:
|
47
|
+
|
48
|
+
cd myapp; rails server
|
49
|
+
|
50
|
+
Run with <tt>--help</tt> or <tt>-h</tt> for options.
|
51
|
+
|
52
|
+
4. Go to http://localhost:3000 and you'll see:
|
53
|
+
|
54
|
+
"Welcome aboard: You're riding Ruby on Rails!"
|
55
|
+
|
56
|
+
5. Follow the guidelines to start developing your application. You may find the following resources handy:
|
57
|
+
|
58
|
+
* The README file created within your application.
|
59
|
+
* {Getting Started with \Rails}[http://guides.rubyonrails.org/getting_started.html].
|
60
|
+
* {Ruby on \Rails Tutorial}[http://ruby.railstutorial.org/ruby-on-rails-tutorial-book].
|
61
|
+
* {Ruby on \Rails Guides}[http://guides.rubyonrails.org].
|
62
|
+
* {The API Documentation}[http://api.rubyonrails.org].
|
63
|
+
|
64
|
+
== Contributing
|
65
|
+
|
66
|
+
We encourage you to contribute to Ruby on \Rails! Please check out the {Contributing to Rails
|
67
|
+
guide}[http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html] for guidelines about how
|
68
|
+
to proceed. {Join us}[http://contributors.rubyonrails.org]!
|
69
|
+
|
70
|
+
|
71
|
+
== License
|
72
|
+
|
73
|
+
Ruby on \Rails is released under the {MIT License}[http://www.opensource.org/licenses/MIT].
|
data/bin/rails
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
git_path = File.join(File.expand_path('../../..', __FILE__), '.git')
|
4
|
+
|
5
|
+
if File.exists?(git_path)
|
4
6
|
railties_path = File.expand_path('../../lib', __FILE__)
|
5
7
|
$:.unshift(railties_path)
|
6
8
|
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
require 'rdoc/task'
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module API
|
5
|
+
class Task < RDoc::Task
|
6
|
+
RDOC_FILES = {
|
7
|
+
'activesupport' => {
|
8
|
+
:include => %w(
|
9
|
+
README.rdoc
|
10
|
+
CHANGELOG.md
|
11
|
+
lib/active_support/**/*.rb
|
12
|
+
),
|
13
|
+
:exclude => 'lib/active_support/vendor/*'
|
14
|
+
},
|
15
|
+
|
16
|
+
'activerecord' => {
|
17
|
+
:include => %w(
|
18
|
+
README.rdoc
|
19
|
+
CHANGELOG.md
|
20
|
+
lib/active_record/**/*.rb
|
21
|
+
),
|
22
|
+
:exclude => 'lib/active_record/vendor/*'
|
23
|
+
},
|
24
|
+
|
25
|
+
'activemodel' => {
|
26
|
+
:include => %w(
|
27
|
+
README.rdoc
|
28
|
+
CHANGELOG.md
|
29
|
+
lib/active_model/**/*.rb
|
30
|
+
)
|
31
|
+
},
|
32
|
+
|
33
|
+
'actionpack' => {
|
34
|
+
:include => %w(
|
35
|
+
README.rdoc
|
36
|
+
CHANGELOG.md
|
37
|
+
lib/abstract_controller/**/*.rb
|
38
|
+
lib/action_controller/**/*.rb
|
39
|
+
lib/action_dispatch/**/*.rb
|
40
|
+
lib/action_view/**/*.rb
|
41
|
+
),
|
42
|
+
:exclude => 'lib/action_controller/vendor/*'
|
43
|
+
},
|
44
|
+
|
45
|
+
'actionmailer' => {
|
46
|
+
:include => %w(
|
47
|
+
README.rdoc
|
48
|
+
CHANGELOG.md
|
49
|
+
lib/action_mailer/**/*.rb
|
50
|
+
),
|
51
|
+
:exclude => 'lib/action_mailer/vendor/*'
|
52
|
+
},
|
53
|
+
|
54
|
+
'railties' => {
|
55
|
+
:include => %w(
|
56
|
+
README.rdoc
|
57
|
+
CHANGELOG.md
|
58
|
+
MIT-LICENSE
|
59
|
+
lib/**/*.rb
|
60
|
+
),
|
61
|
+
:exclude => 'lib/rails/generators/rails/**/templates/**/*.rb'
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
def initialize(name)
|
66
|
+
super
|
67
|
+
|
68
|
+
# Every time rake runs this task is instantiated as all the rest.
|
69
|
+
# Be lazy computing stuff to have as light impact as possible to
|
70
|
+
# the rest of tasks.
|
71
|
+
before_running_rdoc do
|
72
|
+
load_and_configure_sdoc
|
73
|
+
configure_rdoc_files
|
74
|
+
setup_horo_variables
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Hack, ignore the desc calls performed by the original initializer.
|
79
|
+
def desc(description)
|
80
|
+
# no-op
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_and_configure_sdoc
|
84
|
+
require 'sdoc'
|
85
|
+
|
86
|
+
self.title = 'Ruby on Rails API'
|
87
|
+
self.rdoc_dir = api_dir
|
88
|
+
|
89
|
+
options << '-m' << api_main
|
90
|
+
options << '-e' << 'UTF-8'
|
91
|
+
|
92
|
+
options << '-f' << 'sdoc'
|
93
|
+
options << '-T' << 'rails'
|
94
|
+
rescue LoadError
|
95
|
+
$stderr.puts %(Unable to load SDoc, please add\n\n gem 'sdoc', require: false\n\nto the Gemfile.)
|
96
|
+
exit 1
|
97
|
+
end
|
98
|
+
|
99
|
+
def configure_rdoc_files
|
100
|
+
rdoc_files.include(api_main)
|
101
|
+
|
102
|
+
RDOC_FILES.each do |component, cfg|
|
103
|
+
cdr = component_root_dir(component)
|
104
|
+
|
105
|
+
Array(cfg[:include]).each do |pattern|
|
106
|
+
rdoc_files.include("#{cdr}/#{pattern}")
|
107
|
+
end
|
108
|
+
|
109
|
+
Array(cfg[:exclude]).each do |pattern|
|
110
|
+
rdoc_files.exclude("#{cdr}/#{pattern}")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def setup_horo_variables
|
116
|
+
ENV['HORO_PROJECT_NAME'] = 'Ruby on Rails'
|
117
|
+
ENV['HORO_PROJECT_VERSION'] = rails_version
|
118
|
+
end
|
119
|
+
|
120
|
+
def api_main
|
121
|
+
component_root_dir('railties') + '/RDOC_MAIN.rdoc'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
class RepoTask < Task
|
126
|
+
def load_and_configure_sdoc
|
127
|
+
super
|
128
|
+
options << '-g' # link to GitHub, SDoc flag
|
129
|
+
end
|
130
|
+
|
131
|
+
def component_root_dir(component)
|
132
|
+
component
|
133
|
+
end
|
134
|
+
|
135
|
+
def api_dir
|
136
|
+
'doc/rdoc'
|
137
|
+
end
|
138
|
+
|
139
|
+
def rails_version
|
140
|
+
"master@#{`git rev-parse HEAD`[0, 7]}"
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class AppTask < Task
|
145
|
+
def component_root_dir(gem_name)
|
146
|
+
$:.grep(%r{#{gem_name}[\w.-]*/lib\z}).first[0..-5]
|
147
|
+
end
|
148
|
+
|
149
|
+
def api_dir
|
150
|
+
'doc/api'
|
151
|
+
end
|
152
|
+
|
153
|
+
def rails_version
|
154
|
+
Rails::VERSION::STRING
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|