rails 2.2.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rails might be problematic. Click here for more details.
- data/bin/rails +8 -18
- metadata +118 -452
- data/CHANGELOG +0 -2071
- data/MIT-LICENSE +0 -20
- data/README +0 -256
- data/Rakefile +0 -411
- data/bin/about +0 -4
- data/bin/console +0 -3
- data/bin/dbconsole +0 -3
- data/bin/destroy +0 -3
- data/bin/generate +0 -3
- data/bin/performance/benchmarker +0 -3
- data/bin/performance/profiler +0 -3
- data/bin/performance/request +0 -3
- data/bin/plugin +0 -3
- data/bin/process/inspector +0 -3
- data/bin/process/reaper +0 -3
- data/bin/process/spawner +0 -3
- data/bin/runner +0 -3
- data/bin/server +0 -3
- data/builtin/rails_info/rails/info.rb +0 -125
- data/builtin/rails_info/rails/info_controller.rb +0 -9
- data/builtin/rails_info/rails/info_helper.rb +0 -2
- data/builtin/rails_info/rails_info_controller.rb +0 -2
- data/config.ru +0 -17
- data/configs/apache.conf +0 -40
- data/configs/databases/frontbase.yml +0 -28
- data/configs/databases/ibm_db.yml +0 -62
- data/configs/databases/mysql.yml +0 -57
- data/configs/databases/oracle.yml +0 -39
- data/configs/databases/postgresql.yml +0 -51
- data/configs/databases/sqlite2.yml +0 -19
- data/configs/databases/sqlite3.yml +0 -22
- data/configs/empty.log +0 -0
- data/configs/initializers/inflections.rb +0 -10
- data/configs/initializers/mime_types.rb +0 -5
- data/configs/initializers/new_rails_defaults.rb +0 -17
- data/configs/lighttpd.conf +0 -54
- data/configs/locales/en.yml +0 -5
- data/configs/routes.rb +0 -43
- data/dispatches/dispatch.fcgi +0 -24
- data/dispatches/dispatch.rb +0 -10
- data/dispatches/gateway.cgi +0 -97
- data/doc/README_FOR_APP +0 -5
- data/doc/guides/html/2_2_release_notes.html +0 -1185
- data/doc/guides/html/actioncontroller_basics.html +0 -1270
- data/doc/guides/html/activerecord_validations_callbacks.html +0 -749
- data/doc/guides/html/association_basics.html +0 -2585
- data/doc/guides/html/authors.html +0 -240
- data/doc/guides/html/benchmarking_and_profiling.html +0 -1018
- data/doc/guides/html/caching_with_rails.html +0 -583
- data/doc/guides/html/command_line.html +0 -434
- data/doc/guides/html/configuring.html +0 -438
- data/doc/guides/html/creating_plugins.html +0 -1594
- data/doc/guides/html/debugging_rails_applications.html +0 -1175
- data/doc/guides/html/finders.html +0 -1090
- data/doc/guides/html/form_helpers.html +0 -638
- data/doc/guides/html/getting_started_with_rails.html +0 -2066
- data/doc/guides/html/index.html +0 -349
- data/doc/guides/html/layouts_and_rendering.html +0 -1406
- data/doc/guides/html/migrations.html +0 -921
- data/doc/guides/html/routing_outside_in.html +0 -2213
- data/doc/guides/html/security.html +0 -1346
- data/doc/guides/html/testing_rails_applications.html +0 -1859
- data/doc/guides/source/2_2_release_notes.txt +0 -435
- data/doc/guides/source/actioncontroller_basics/changelog.txt +0 -5
- data/doc/guides/source/actioncontroller_basics/cookies.txt +0 -34
- data/doc/guides/source/actioncontroller_basics/csrf.txt +0 -32
- data/doc/guides/source/actioncontroller_basics/filters.txt +0 -119
- data/doc/guides/source/actioncontroller_basics/http_auth.txt +0 -24
- data/doc/guides/source/actioncontroller_basics/index.txt +0 -40
- data/doc/guides/source/actioncontroller_basics/introduction.txt +0 -9
- data/doc/guides/source/actioncontroller_basics/methods.txt +0 -39
- data/doc/guides/source/actioncontroller_basics/parameter_filtering.txt +0 -14
- data/doc/guides/source/actioncontroller_basics/params.txt +0 -93
- data/doc/guides/source/actioncontroller_basics/request_response_objects.txt +0 -43
- data/doc/guides/source/actioncontroller_basics/rescue.txt +0 -67
- data/doc/guides/source/actioncontroller_basics/session.txt +0 -187
- data/doc/guides/source/actioncontroller_basics/streaming.txt +0 -91
- data/doc/guides/source/actioncontroller_basics/verification.txt +0 -40
- data/doc/guides/source/active_record_basics.txt +0 -181
- data/doc/guides/source/activerecord_validations_callbacks.txt +0 -404
- data/doc/guides/source/association_basics.txt +0 -1840
- data/doc/guides/source/authors.txt +0 -39
- data/doc/guides/source/benchmarking_and_profiling/appendix.txt +0 -95
- data/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt +0 -105
- data/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt +0 -185
- data/doc/guides/source/benchmarking_and_profiling/gameplan.txt +0 -27
- data/doc/guides/source/benchmarking_and_profiling/index.txt +0 -242
- data/doc/guides/source/benchmarking_and_profiling/rubyprof.txt +0 -179
- data/doc/guides/source/benchmarking_and_profiling/statistics.txt +0 -57
- data/doc/guides/source/caching_with_rails.txt +0 -367
- data/doc/guides/source/command_line.txt +0 -147
- data/doc/guides/source/configuring.txt +0 -225
- data/doc/guides/source/creating_plugins/acts_as_yaffle.txt +0 -191
- data/doc/guides/source/creating_plugins/appendix.txt +0 -46
- data/doc/guides/source/creating_plugins/controllers.txt +0 -59
- data/doc/guides/source/creating_plugins/core_ext.txt +0 -123
- data/doc/guides/source/creating_plugins/custom_route.txt +0 -69
- data/doc/guides/source/creating_plugins/gem.txt +0 -1
- data/doc/guides/source/creating_plugins/generator_method.txt +0 -89
- data/doc/guides/source/creating_plugins/helpers.txt +0 -51
- data/doc/guides/source/creating_plugins/index.txt +0 -52
- data/doc/guides/source/creating_plugins/migration_generator.txt +0 -156
- data/doc/guides/source/creating_plugins/models.txt +0 -76
- data/doc/guides/source/creating_plugins/odds_and_ends.txt +0 -69
- data/doc/guides/source/creating_plugins/test_setup.txt +0 -230
- data/doc/guides/source/debugging_rails_applications.txt +0 -733
- data/doc/guides/source/finders.txt +0 -668
- data/doc/guides/source/form_helpers.txt +0 -345
- data/doc/guides/source/getting_started_with_rails.txt +0 -1256
- data/doc/guides/source/images/belongs_to.png +0 -0
- data/doc/guides/source/images/bullet.gif +0 -0
- data/doc/guides/source/images/csrf.png +0 -0
- data/doc/guides/source/images/habtm.png +0 -0
- data/doc/guides/source/images/has_many.png +0 -0
- data/doc/guides/source/images/has_many_through.png +0 -0
- data/doc/guides/source/images/has_one.png +0 -0
- data/doc/guides/source/images/has_one_through.png +0 -0
- data/doc/guides/source/images/header_backdrop.png +0 -0
- data/doc/guides/source/images/icons/README +0 -5
- data/doc/guides/source/images/icons/callouts/1.png +0 -0
- data/doc/guides/source/images/icons/callouts/10.png +0 -0
- data/doc/guides/source/images/icons/callouts/11.png +0 -0
- data/doc/guides/source/images/icons/callouts/12.png +0 -0
- data/doc/guides/source/images/icons/callouts/13.png +0 -0
- data/doc/guides/source/images/icons/callouts/14.png +0 -0
- data/doc/guides/source/images/icons/callouts/15.png +0 -0
- data/doc/guides/source/images/icons/callouts/2.png +0 -0
- data/doc/guides/source/images/icons/callouts/3.png +0 -0
- data/doc/guides/source/images/icons/callouts/4.png +0 -0
- data/doc/guides/source/images/icons/callouts/5.png +0 -0
- data/doc/guides/source/images/icons/callouts/6.png +0 -0
- data/doc/guides/source/images/icons/callouts/7.png +0 -0
- data/doc/guides/source/images/icons/callouts/8.png +0 -0
- data/doc/guides/source/images/icons/callouts/9.png +0 -0
- data/doc/guides/source/images/icons/caution.png +0 -0
- data/doc/guides/source/images/icons/example.png +0 -0
- data/doc/guides/source/images/icons/home.png +0 -0
- data/doc/guides/source/images/icons/important.png +0 -0
- data/doc/guides/source/images/icons/next.png +0 -0
- data/doc/guides/source/images/icons/note.png +0 -0
- data/doc/guides/source/images/icons/prev.png +0 -0
- data/doc/guides/source/images/icons/tip.png +0 -0
- data/doc/guides/source/images/icons/up.png +0 -0
- data/doc/guides/source/images/icons/warning.png +0 -0
- data/doc/guides/source/images/polymorphic.png +0 -0
- data/doc/guides/source/images/rails_logo_remix.gif +0 -0
- data/doc/guides/source/images/ruby_on_rails_by_mike_rundle2.gif +0 -0
- data/doc/guides/source/images/session_fixation.png +0 -0
- data/doc/guides/source/index.txt +0 -118
- data/doc/guides/source/layouts_and_rendering.txt +0 -982
- data/doc/guides/source/migrations/anatomy_of_a_migration.txt +0 -85
- data/doc/guides/source/migrations/changelog.txt +0 -5
- data/doc/guides/source/migrations/creating_a_migration.txt +0 -109
- data/doc/guides/source/migrations/foreign_keys.txt +0 -8
- data/doc/guides/source/migrations/index.txt +0 -22
- data/doc/guides/source/migrations/rakeing_around.txt +0 -111
- data/doc/guides/source/migrations/scheming.txt +0 -47
- data/doc/guides/source/migrations/using_models_in_migrations.txt +0 -46
- data/doc/guides/source/migrations/writing_a_migration.txt +0 -159
- data/doc/guides/source/routing_outside_in.txt +0 -986
- data/doc/guides/source/security.txt +0 -984
- data/doc/guides/source/stylesheets/base.css +0 -358
- data/doc/guides/source/stylesheets/forms.css +0 -35
- data/doc/guides/source/stylesheets/more.css +0 -82
- data/doc/guides/source/templates/guides.html.erb +0 -97
- data/doc/guides/source/templates/inline.css +0 -165
- data/doc/guides/source/testing_rails_applications.txt +0 -995
- data/environments/boot.rb +0 -109
- data/environments/development.rb +0 -17
- data/environments/environment.rb +0 -75
- data/environments/production.rb +0 -24
- data/environments/test.rb +0 -22
- data/fresh_rakefile +0 -10
- data/helpers/application.rb +0 -15
- data/helpers/application_helper.rb +0 -3
- data/helpers/performance_test.rb +0 -9
- data/helpers/test_helper.rb +0 -38
- data/html/404.html +0 -30
- data/html/422.html +0 -30
- data/html/500.html +0 -33
- data/html/favicon.ico +0 -0
- data/html/images/rails.png +0 -0
- data/html/index.html +0 -274
- data/html/javascripts/application.js +0 -2
- data/html/javascripts/controls.js +0 -963
- data/html/javascripts/dragdrop.js +0 -973
- data/html/javascripts/effects.js +0 -1128
- data/html/javascripts/prototype.js +0 -4320
- data/html/robots.txt +0 -5
- data/lib/code_statistics.rb +0 -107
- data/lib/commands.rb +0 -17
- data/lib/commands/about.rb +0 -3
- data/lib/commands/console.rb +0 -45
- data/lib/commands/dbconsole.rb +0 -67
- data/lib/commands/destroy.rb +0 -6
- data/lib/commands/generate.rb +0 -6
- data/lib/commands/ncgi/listener +0 -86
- data/lib/commands/ncgi/tracker +0 -69
- data/lib/commands/performance/benchmarker.rb +0 -24
- data/lib/commands/performance/profiler.rb +0 -50
- data/lib/commands/performance/request.rb +0 -6
- data/lib/commands/plugin.rb +0 -967
- data/lib/commands/process/inspector.rb +0 -68
- data/lib/commands/process/reaper.rb +0 -149
- data/lib/commands/process/spawner.rb +0 -219
- data/lib/commands/process/spinner.rb +0 -57
- data/lib/commands/runner.rb +0 -48
- data/lib/commands/server.rb +0 -49
- data/lib/commands/servers/base.rb +0 -31
- data/lib/commands/servers/lighttpd.rb +0 -94
- data/lib/commands/servers/mongrel.rb +0 -69
- data/lib/commands/servers/new_mongrel.rb +0 -16
- data/lib/commands/servers/thin.rb +0 -25
- data/lib/commands/servers/webrick.rb +0 -66
- data/lib/commands/update.rb +0 -4
- data/lib/console_app.rb +0 -30
- data/lib/console_sandbox.rb +0 -6
- data/lib/console_with_helpers.rb +0 -26
- data/lib/dispatcher.rb +0 -24
- data/lib/fcgi_handler.rb +0 -237
- data/lib/initializer.rb +0 -1038
- data/lib/performance_test_help.rb +0 -5
- data/lib/rails/gem_builder.rb +0 -21
- data/lib/rails/gem_dependency.rb +0 -251
- data/lib/rails/mongrel_server/commands.rb +0 -342
- data/lib/rails/mongrel_server/handler.rb +0 -55
- data/lib/rails/plugin.rb +0 -124
- data/lib/rails/plugin/loader.rb +0 -152
- data/lib/rails/plugin/locator.rb +0 -100
- data/lib/rails/rack.rb +0 -6
- data/lib/rails/rack/logger.rb +0 -28
- data/lib/rails/rack/static.rb +0 -35
- data/lib/rails/vendor_gem_source_index.rb +0 -140
- data/lib/rails/version.rb +0 -9
- data/lib/rails_generator.rb +0 -43
- data/lib/rails_generator/base.rb +0 -263
- data/lib/rails_generator/commands.rb +0 -616
- data/lib/rails_generator/generated_attribute.rb +0 -46
- data/lib/rails_generator/generators/applications/app/USAGE +0 -9
- data/lib/rails_generator/generators/applications/app/app_generator.rb +0 -184
- data/lib/rails_generator/generators/components/controller/USAGE +0 -29
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +0 -37
- data/lib/rails_generator/generators/components/controller/templates/controller.rb +0 -7
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +0 -8
- data/lib/rails_generator/generators/components/controller/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/controller/templates/view.html.erb +0 -2
- data/lib/rails_generator/generators/components/integration_test/USAGE +0 -8
- data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +0 -16
- data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +0 -10
- data/lib/rails_generator/generators/components/mailer/USAGE +0 -16
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +0 -30
- data/lib/rails_generator/generators/components/mailer/templates/fixture.erb +0 -3
- data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -0
- data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +0 -15
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +0 -20
- data/lib/rails_generator/generators/components/mailer/templates/view.erb +0 -3
- data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -0
- data/lib/rails_generator/generators/components/migration/USAGE +0 -29
- data/lib/rails_generator/generators/components/migration/migration_generator.rb +0 -20
- data/lib/rails_generator/generators/components/migration/templates/migration.rb +0 -11
- data/lib/rails_generator/generators/components/model/USAGE +0 -27
- data/lib/rails_generator/generators/components/model/model_generator.rb +0 -45
- data/lib/rails_generator/generators/components/model/templates/fixtures.yml +0 -19
- data/lib/rails_generator/generators/components/model/templates/migration.rb +0 -16
- data/lib/rails_generator/generators/components/model/templates/model.rb +0 -5
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/observer/USAGE +0 -13
- data/lib/rails_generator/generators/components/observer/observer_generator.rb +0 -16
- data/lib/rails_generator/generators/components/observer/templates/observer.rb +0 -2
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/performance_test/USAGE +0 -8
- data/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb +0 -16
- data/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb +0 -9
- data/lib/rails_generator/generators/components/plugin/USAGE +0 -25
- data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +0 -39
- data/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +0 -20
- data/lib/rails_generator/generators/components/plugin/templates/README +0 -13
- data/lib/rails_generator/generators/components/plugin/templates/Rakefile +0 -23
- data/lib/rails_generator/generators/components/plugin/templates/USAGE +0 -8
- data/lib/rails_generator/generators/components/plugin/templates/generator.rb +0 -8
- data/lib/rails_generator/generators/components/plugin/templates/init.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/install.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +0 -4
- data/lib/rails_generator/generators/components/plugin/templates/test_helper.rb +0 -3
- data/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +0 -1
- data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +0 -8
- data/lib/rails_generator/generators/components/resource/USAGE +0 -23
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +0 -74
- data/lib/rails_generator/generators/components/resource/templates/controller.rb +0 -2
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +0 -8
- data/lib/rails_generator/generators/components/resource/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold/USAGE +0 -29
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +0 -100
- data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +0 -85
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +0 -45
- data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +0 -2
- data/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb +0 -17
- data/lib/rails_generator/generators/components/scaffold/templates/style.css +0 -54
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +0 -18
- data/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +0 -24
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +0 -17
- data/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +0 -10
- data/lib/rails_generator/generators/components/session_migration/USAGE +0 -10
- data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +0 -18
- data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +0 -16
- data/lib/rails_generator/lookup.rb +0 -249
- data/lib/rails_generator/manifest.rb +0 -53
- data/lib/rails_generator/options.rb +0 -150
- data/lib/rails_generator/scripts.rb +0 -89
- data/lib/rails_generator/scripts/destroy.rb +0 -29
- data/lib/rails_generator/scripts/generate.rb +0 -7
- data/lib/rails_generator/scripts/update.rb +0 -12
- data/lib/rails_generator/secret_key_generator.rb +0 -22
- data/lib/rails_generator/simple_logger.rb +0 -46
- data/lib/rails_generator/spec.rb +0 -44
- data/lib/railties_path.rb +0 -1
- data/lib/ruby_version_check.rb +0 -17
- data/lib/rubyprof_ext.rb +0 -35
- data/lib/source_annotation_extractor.rb +0 -102
- data/lib/tasks/annotations.rake +0 -20
- data/lib/tasks/databases.rake +0 -416
- data/lib/tasks/documentation.rake +0 -95
- data/lib/tasks/framework.rake +0 -118
- data/lib/tasks/gems.rake +0 -80
- data/lib/tasks/log.rake +0 -9
- data/lib/tasks/misc.rake +0 -56
- data/lib/tasks/rails.rb +0 -8
- data/lib/tasks/routes.rake +0 -17
- data/lib/tasks/statistics.rake +0 -18
- data/lib/tasks/testing.rake +0 -139
- data/lib/tasks/tmp.rake +0 -37
- data/lib/test_help.rb +0 -27
- data/lib/webrick_server.rb +0 -156
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2004-2008 David Heinemeier Hansson
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
DELETED
@@ -1,256 +0,0 @@
|
|
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-Control pattern.
|
5
|
-
|
6
|
-
This pattern splits the view (also called the presentation) into "dumb" templates
|
7
|
-
that are primarily responsible for inserting pre-built data in between HTML tags.
|
8
|
-
The model contains the "smart" domain objects (such as Account, Product, Person,
|
9
|
-
Post) that holds all the business logic and knows how to persist themselves to
|
10
|
-
a database. The controller handles the incoming requests (such as Save New Account,
|
11
|
-
Update Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
-
|
13
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
-
layer entitled Active Record. This layer allows you to present the data from
|
15
|
-
database rows as objects and embellish these data objects with business logic
|
16
|
-
methods. You can read more about Active Record in
|
17
|
-
link:files/vendor/rails/activerecord/README.html.
|
18
|
-
|
19
|
-
The controller and view are handled by the Action Pack, which handles both
|
20
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
-
are bundled in a single package due to their heavy interdependence. This is
|
22
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
-
more separate. Each of these packages can be used independently outside of
|
24
|
-
Rails. You can read more about Action Pack in
|
25
|
-
link:files/vendor/rails/actionpack/README.html.
|
26
|
-
|
27
|
-
|
28
|
-
== Getting Started
|
29
|
-
|
30
|
-
1. At the command prompt, start a new Rails application using the <tt>rails</tt> command
|
31
|
-
and your application name. Ex: rails myapp
|
32
|
-
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
33
|
-
3. Go to http://localhost:3000/ and get "Welcome aboard: You're riding the Rails!"
|
34
|
-
4. Follow the guidelines to start developing your application
|
35
|
-
|
36
|
-
|
37
|
-
== Web Servers
|
38
|
-
|
39
|
-
By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
|
40
|
-
Rails will use WEBrick, the webserver that ships with Ruby. When you run script/server,
|
41
|
-
Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
|
42
|
-
that you can always get up and running quickly.
|
43
|
-
|
44
|
-
Mongrel is a Ruby-based webserver with a C component (which requires compilation) that is
|
45
|
-
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
46
|
-
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
47
|
-
More info at: http://mongrel.rubyforge.org
|
48
|
-
|
49
|
-
If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
|
50
|
-
Mongrel and WEBrick and also suited for production use, but requires additional
|
51
|
-
installation and currently only works well on OS X/Unix (Windows users are encouraged
|
52
|
-
to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
|
53
|
-
http://www.lighttpd.net.
|
54
|
-
|
55
|
-
And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
|
56
|
-
web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
|
57
|
-
for production.
|
58
|
-
|
59
|
-
But of course its also possible to run Rails on any platform that supports FCGI.
|
60
|
-
Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
|
61
|
-
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
|
62
|
-
|
63
|
-
|
64
|
-
== Apache .htaccess example
|
65
|
-
|
66
|
-
# General Apache options
|
67
|
-
AddHandler fastcgi-script .fcgi
|
68
|
-
AddHandler cgi-script .cgi
|
69
|
-
Options +FollowSymLinks +ExecCGI
|
70
|
-
|
71
|
-
# If you don't want Rails to look in certain directories,
|
72
|
-
# use the following rewrite rules so that Apache won't rewrite certain requests
|
73
|
-
#
|
74
|
-
# Example:
|
75
|
-
# RewriteCond %{REQUEST_URI} ^/notrails.*
|
76
|
-
# RewriteRule .* - [L]
|
77
|
-
|
78
|
-
# Redirect all requests not available on the filesystem to Rails
|
79
|
-
# By default the cgi dispatcher is used which is very slow
|
80
|
-
#
|
81
|
-
# For better performance replace the dispatcher with the fastcgi one
|
82
|
-
#
|
83
|
-
# Example:
|
84
|
-
# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
|
85
|
-
RewriteEngine On
|
86
|
-
|
87
|
-
# If your Rails application is accessed via an Alias directive,
|
88
|
-
# then you MUST also set the RewriteBase in this htaccess file.
|
89
|
-
#
|
90
|
-
# Example:
|
91
|
-
# Alias /myrailsapp /path/to/myrailsapp/public
|
92
|
-
# RewriteBase /myrailsapp
|
93
|
-
|
94
|
-
RewriteRule ^$ index.html [QSA]
|
95
|
-
RewriteRule ^([^.]+)$ $1.html [QSA]
|
96
|
-
RewriteCond %{REQUEST_FILENAME} !-f
|
97
|
-
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
98
|
-
|
99
|
-
# In case Rails experiences terminal errors
|
100
|
-
# Instead of displaying this message you can supply a file here which will be rendered instead
|
101
|
-
#
|
102
|
-
# Example:
|
103
|
-
# ErrorDocument 500 /500.html
|
104
|
-
|
105
|
-
ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
|
106
|
-
|
107
|
-
|
108
|
-
== Debugging Rails
|
109
|
-
|
110
|
-
Sometimes your application goes wrong. Fortunately there are a lot of tools that
|
111
|
-
will help you debug it and get it back on the rails.
|
112
|
-
|
113
|
-
First area to check is the application log files. Have "tail -f" commands running
|
114
|
-
on the server.log and development.log. Rails will automatically display debugging
|
115
|
-
and runtime information to these files. Debugging info will also be shown in the
|
116
|
-
browser on requests from 127.0.0.1.
|
117
|
-
|
118
|
-
You can also log your own messages directly into the log file from your code using
|
119
|
-
the Ruby logger class from inside your controllers. Example:
|
120
|
-
|
121
|
-
class WeblogController < ActionController::Base
|
122
|
-
def destroy
|
123
|
-
@weblog = Weblog.find(params[:id])
|
124
|
-
@weblog.destroy
|
125
|
-
logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
The result will be a message in your log file along the lines of:
|
130
|
-
|
131
|
-
Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1
|
132
|
-
|
133
|
-
More information on how to use the logger is at http://www.ruby-doc.org/core/
|
134
|
-
|
135
|
-
Also, Ruby documentation can be found at http://www.ruby-lang.org/ including:
|
136
|
-
|
137
|
-
* The Learning Ruby (Pickaxe) Book: http://www.ruby-doc.org/docs/ProgrammingRuby/
|
138
|
-
* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
|
139
|
-
|
140
|
-
These two online (and free) books will bring you up to speed on the Ruby language
|
141
|
-
and also on programming in general.
|
142
|
-
|
143
|
-
|
144
|
-
== Debugger
|
145
|
-
|
146
|
-
Debugger support is available through the debugger command when you start your Mongrel or
|
147
|
-
Webrick server with --debugger. This means that you can break out of execution at any point
|
148
|
-
in the code, investigate and change the model, AND then resume execution!
|
149
|
-
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
|
150
|
-
Example:
|
151
|
-
|
152
|
-
class WeblogController < ActionController::Base
|
153
|
-
def index
|
154
|
-
@posts = Post.find(:all)
|
155
|
-
debugger
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
So the controller will accept the action, run the first line, then present you
|
160
|
-
with a IRB prompt in the server window. Here you can do things like:
|
161
|
-
|
162
|
-
>> @posts.inspect
|
163
|
-
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
164
|
-
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
165
|
-
>> @posts.first.title = "hello from a debugger"
|
166
|
-
=> "hello from a debugger"
|
167
|
-
|
168
|
-
...and even better is that you can examine how your runtime objects actually work:
|
169
|
-
|
170
|
-
>> f = @posts.first
|
171
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
172
|
-
>> f.
|
173
|
-
Display all 152 possibilities? (y or n)
|
174
|
-
|
175
|
-
Finally, when you're ready to resume execution, you enter "cont"
|
176
|
-
|
177
|
-
|
178
|
-
== Console
|
179
|
-
|
180
|
-
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
181
|
-
Here you'll have all parts of the application configured, just like it is when the
|
182
|
-
application is running. You can inspect domain models, change values, and save to the
|
183
|
-
database. Starting the script without arguments will launch it in the development environment.
|
184
|
-
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
185
|
-
|
186
|
-
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
187
|
-
|
188
|
-
== dbconsole
|
189
|
-
|
190
|
-
You can go to the command line of your database directly through <tt>script/dbconsole</tt>.
|
191
|
-
You would be connected to the database with the credentials defined in database.yml.
|
192
|
-
Starting the script without arguments will connect you to the development database. Passing an
|
193
|
-
argument will connect you to a different database, like <tt>script/dbconsole production</tt>.
|
194
|
-
Currently works for mysql, postgresql and sqlite.
|
195
|
-
|
196
|
-
== Description of Contents
|
197
|
-
|
198
|
-
app
|
199
|
-
Holds all the code that's specific to this particular application.
|
200
|
-
|
201
|
-
app/controllers
|
202
|
-
Holds controllers that should be named like weblogs_controller.rb for
|
203
|
-
automated URL mapping. All controllers should descend from ApplicationController
|
204
|
-
which itself descends from ActionController::Base.
|
205
|
-
|
206
|
-
app/models
|
207
|
-
Holds models that should be named like post.rb.
|
208
|
-
Most models will descend from ActiveRecord::Base.
|
209
|
-
|
210
|
-
app/views
|
211
|
-
Holds the template files for the view that should be named like
|
212
|
-
weblogs/index.html.erb for the WeblogsController#index action. All views use eRuby
|
213
|
-
syntax.
|
214
|
-
|
215
|
-
app/views/layouts
|
216
|
-
Holds the template files for layouts to be used with views. This models the common
|
217
|
-
header/footer method of wrapping views. In your views, define a layout using the
|
218
|
-
<tt>layout :default</tt> and create a file named default.html.erb. Inside default.html.erb,
|
219
|
-
call <% yield %> to render the view using this layout.
|
220
|
-
|
221
|
-
app/helpers
|
222
|
-
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
223
|
-
for you automatically when using script/generate for controllers. Helpers can be used to
|
224
|
-
wrap functionality for your views into methods.
|
225
|
-
|
226
|
-
config
|
227
|
-
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
228
|
-
|
229
|
-
db
|
230
|
-
Contains the database schema in schema.rb. db/migrate contains all
|
231
|
-
the sequence of Migrations for your schema.
|
232
|
-
|
233
|
-
doc
|
234
|
-
This directory is where your application documentation will be stored when generated
|
235
|
-
using <tt>rake doc:app</tt>
|
236
|
-
|
237
|
-
lib
|
238
|
-
Application specific libraries. Basically, any kind of custom code that doesn't
|
239
|
-
belong under controllers, models, or helpers. This directory is in the load path.
|
240
|
-
|
241
|
-
public
|
242
|
-
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
243
|
-
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
244
|
-
set as the DOCUMENT_ROOT of your web server.
|
245
|
-
|
246
|
-
script
|
247
|
-
Helper scripts for automation and generation.
|
248
|
-
|
249
|
-
test
|
250
|
-
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
251
|
-
test files will be generated for you and placed in this directory.
|
252
|
-
|
253
|
-
vendor
|
254
|
-
External libraries that the application depends on. Also includes the plugins subdirectory.
|
255
|
-
If the app has frozen rails, those gems also go here, under vendor/rails/.
|
256
|
-
This directory is in the load path.
|
data/Rakefile
DELETED
@@ -1,411 +0,0 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rake/rdoctask'
|
4
|
-
require 'rake/gempackagetask'
|
5
|
-
require 'rake/contrib/rubyforgepublisher'
|
6
|
-
|
7
|
-
require 'date'
|
8
|
-
require 'rbconfig'
|
9
|
-
|
10
|
-
require File.join(File.dirname(__FILE__), 'lib/rails', 'version')
|
11
|
-
|
12
|
-
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
13
|
-
PKG_NAME = 'rails'
|
14
|
-
PKG_VERSION = Rails::VERSION::STRING + PKG_BUILD
|
15
|
-
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
16
|
-
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
|
17
|
-
|
18
|
-
RELEASE_NAME = "REL #{PKG_VERSION}"
|
19
|
-
|
20
|
-
RUBY_FORGE_PROJECT = "rails"
|
21
|
-
RUBY_FORGE_USER = "webster132"
|
22
|
-
|
23
|
-
|
24
|
-
task :default => :test
|
25
|
-
|
26
|
-
## This is required until the regular test task
|
27
|
-
## below passes. It's not ideal, but at least
|
28
|
-
## we can see the failures
|
29
|
-
task :test do
|
30
|
-
Dir['test/**/*_test.rb'].all? do |file|
|
31
|
-
system("ruby -Itest #{file}")
|
32
|
-
end or raise "Failures"
|
33
|
-
end
|
34
|
-
|
35
|
-
Rake::TestTask.new("regular_test") do |t|
|
36
|
-
t.libs << 'test'
|
37
|
-
t.pattern = 'test/**/*_test.rb'
|
38
|
-
t.warning = true
|
39
|
-
t.verbose = true
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
|
-
BASE_DIRS = %w(
|
44
|
-
app
|
45
|
-
config/environments
|
46
|
-
config/initializers
|
47
|
-
config/locales
|
48
|
-
components
|
49
|
-
db
|
50
|
-
doc
|
51
|
-
log
|
52
|
-
lib
|
53
|
-
lib/tasks
|
54
|
-
public
|
55
|
-
script
|
56
|
-
script/performance
|
57
|
-
script/process
|
58
|
-
test
|
59
|
-
vendor
|
60
|
-
vendor/plugins
|
61
|
-
tmp/sessions
|
62
|
-
tmp/cache
|
63
|
-
tmp/sockets
|
64
|
-
tmp/pids
|
65
|
-
)
|
66
|
-
|
67
|
-
APP_DIRS = %w( models controllers helpers views views/layouts )
|
68
|
-
PUBLIC_DIRS = %w( images javascripts stylesheets )
|
69
|
-
TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/test )
|
70
|
-
|
71
|
-
LOG_FILES = %w( server.log development.log test.log production.log )
|
72
|
-
HTML_FILES = %w( 422.html 404.html 500.html index.html robots.txt favicon.ico images/rails.png
|
73
|
-
javascripts/prototype.js javascripts/application.js
|
74
|
-
javascripts/effects.js javascripts/dragdrop.js javascripts/controls.js )
|
75
|
-
BIN_FILES = %w( about console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/inspector runner server plugin )
|
76
|
-
|
77
|
-
VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport activeresource railties )
|
78
|
-
|
79
|
-
|
80
|
-
desc "Generates a fresh Rails package with documentation"
|
81
|
-
task :fresh_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content, :generate_documentation ]
|
82
|
-
|
83
|
-
desc "Generates a fresh Rails package using GEMs with documentation"
|
84
|
-
task :fresh_gem_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_ties_content, :copy_gem_environment ]
|
85
|
-
|
86
|
-
desc "Generates a fresh Rails package without documentation (faster)"
|
87
|
-
task :fresh_rails_without_docs => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content ]
|
88
|
-
|
89
|
-
desc "Generates a fresh Rails package without documentation (faster)"
|
90
|
-
task :fresh_rails_without_docs_using_links => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
|
91
|
-
|
92
|
-
desc "Generates minimal Rails package using symlinks"
|
93
|
-
task :dev => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
|
94
|
-
|
95
|
-
desc "Packages the fresh Rails package with documentation"
|
96
|
-
task :package => [ :clean, :fresh_rails ] do
|
97
|
-
system %{cd ..; tar -czvf #{PKG_NAME}-#{PKG_VERSION}.tgz #{PKG_NAME}}
|
98
|
-
system %{cd ..; zip -r #{PKG_NAME}-#{PKG_VERSION}.zip #{PKG_NAME}}
|
99
|
-
end
|
100
|
-
|
101
|
-
task :clean do
|
102
|
-
rm_rf PKG_DESTINATION
|
103
|
-
end
|
104
|
-
|
105
|
-
# Get external spinoffs -------------------------------------------------------------------
|
106
|
-
|
107
|
-
desc "Updates railties to the latest version of the javascript spinoffs"
|
108
|
-
task :update_js do
|
109
|
-
for js in %w( prototype controls dragdrop effects )
|
110
|
-
rm "html/javascripts/#{js}.js"
|
111
|
-
cp "./../actionpack/lib/action_view/helpers/javascripts/#{js}.js", "html/javascripts"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# Make directory structure ----------------------------------------------------------------
|
116
|
-
|
117
|
-
def make_dest_dirs(dirs, path = '.')
|
118
|
-
mkdir_p dirs.map { |dir| File.join(PKG_DESTINATION, path.to_s, dir) }
|
119
|
-
end
|
120
|
-
|
121
|
-
desc "Make the directory structure for the new Rails application"
|
122
|
-
task :make_dir_structure => [ :make_base_dirs, :make_app_dirs, :make_public_dirs, :make_test_dirs ]
|
123
|
-
|
124
|
-
task(:make_base_dirs) { make_dest_dirs BASE_DIRS }
|
125
|
-
task(:make_app_dirs) { make_dest_dirs APP_DIRS, 'app' }
|
126
|
-
task(:make_public_dirs) { make_dest_dirs PUBLIC_DIRS, 'public' }
|
127
|
-
task(:make_test_dirs) { make_dest_dirs TEST_DIRS, 'test' }
|
128
|
-
|
129
|
-
|
130
|
-
# Initialize file stubs -------------------------------------------------------------------
|
131
|
-
|
132
|
-
desc "Initialize empty file stubs (such as for logging)"
|
133
|
-
task :initialize_file_stubs => [ :initialize_log_files ]
|
134
|
-
|
135
|
-
task :initialize_log_files do
|
136
|
-
log_dir = File.join(PKG_DESTINATION, 'log')
|
137
|
-
chmod 0777, log_dir
|
138
|
-
LOG_FILES.each do |log_file|
|
139
|
-
log_path = File.join(log_dir, log_file)
|
140
|
-
touch log_path
|
141
|
-
chmod 0666, log_path
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
|
146
|
-
# Copy Vendors ----------------------------------------------------------------------------
|
147
|
-
|
148
|
-
desc "Copy in all the Rails packages to vendor"
|
149
|
-
task :copy_vendor_libraries do
|
150
|
-
mkdir File.join(PKG_DESTINATION, 'vendor', 'rails')
|
151
|
-
VENDOR_LIBS.each { |dir| cp_r File.join('..', dir), File.join(PKG_DESTINATION, 'vendor', 'rails', dir) }
|
152
|
-
FileUtils.rm_r(Dir.glob(File.join(PKG_DESTINATION, 'vendor', 'rails', "**", ".svn")))
|
153
|
-
end
|
154
|
-
|
155
|
-
desc "Link in all the Rails packages to vendor"
|
156
|
-
task :link_vendor_libraries do
|
157
|
-
mkdir File.join(PKG_DESTINATION, 'vendor', 'rails')
|
158
|
-
VENDOR_LIBS.each { |dir| ln_s File.join('..', '..', '..', dir), File.join(PKG_DESTINATION, 'vendor', 'rails', dir) }
|
159
|
-
end
|
160
|
-
|
161
|
-
|
162
|
-
# Copy Ties Content -----------------------------------------------------------------------
|
163
|
-
|
164
|
-
desc "Make copies of all the default content of ties"
|
165
|
-
task :copy_ties_content => [
|
166
|
-
:copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_application,
|
167
|
-
:copy_configs, :copy_binfiles, :copy_test_helpers, :copy_app_doc_readme ]
|
168
|
-
|
169
|
-
task :copy_dispatches do
|
170
|
-
copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb")
|
171
|
-
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.rb"
|
172
|
-
|
173
|
-
copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi")
|
174
|
-
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.cgi"
|
175
|
-
|
176
|
-
copy_with_rewritten_ruby_path("dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi")
|
177
|
-
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi"
|
178
|
-
|
179
|
-
# copy_with_rewritten_ruby_path("dispatches/gateway.cgi", "#{PKG_DESTINATION}/public/gateway.cgi")
|
180
|
-
# chmod 0755, "#{PKG_DESTINATION}/public/gateway.cgi"
|
181
|
-
end
|
182
|
-
|
183
|
-
task :copy_html_files do
|
184
|
-
HTML_FILES.each { |file| cp File.join('html', file), File.join(PKG_DESTINATION, 'public', file) }
|
185
|
-
end
|
186
|
-
|
187
|
-
task :copy_application do
|
188
|
-
cp "helpers/application.rb", "#{PKG_DESTINATION}/app/controllers/application.rb"
|
189
|
-
cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
|
190
|
-
end
|
191
|
-
|
192
|
-
task :copy_configs do
|
193
|
-
app_name = "rails"
|
194
|
-
socket = nil
|
195
|
-
require 'erb'
|
196
|
-
File.open("#{PKG_DESTINATION}/config/database.yml", 'w') {|f| f.write ERB.new(IO.read("configs/databases/sqlite3.yml"), nil, '-').result(binding)}
|
197
|
-
|
198
|
-
cp "configs/routes.rb", "#{PKG_DESTINATION}/config/routes.rb"
|
199
|
-
|
200
|
-
cp "configs/initializers/inflections.rb", "#{PKG_DESTINATION}/config/initializers/inflections.rb"
|
201
|
-
cp "configs/initializers/mime_types.rb", "#{PKG_DESTINATION}/config/initializers/mime_types.rb"
|
202
|
-
|
203
|
-
cp "configs/locales/en.yml", "#{PKG_DESTINATION}/config/locales/en.yml"
|
204
|
-
|
205
|
-
cp "environments/boot.rb", "#{PKG_DESTINATION}/config/boot.rb"
|
206
|
-
cp "environments/environment.rb", "#{PKG_DESTINATION}/config/environment.rb"
|
207
|
-
cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
|
208
|
-
cp "environments/development.rb", "#{PKG_DESTINATION}/config/environments/development.rb"
|
209
|
-
cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
|
210
|
-
end
|
211
|
-
|
212
|
-
task :copy_binfiles do
|
213
|
-
BIN_FILES.each do |file|
|
214
|
-
dest_file = File.join(PKG_DESTINATION, 'script', file)
|
215
|
-
copy_with_rewritten_ruby_path(File.join('bin', file), dest_file)
|
216
|
-
chmod 0755, dest_file
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
task :copy_rootfiles do
|
221
|
-
cp "fresh_rakefile", "#{PKG_DESTINATION}/Rakefile"
|
222
|
-
cp "README", "#{PKG_DESTINATION}/README"
|
223
|
-
cp "CHANGELOG", "#{PKG_DESTINATION}/CHANGELOG"
|
224
|
-
end
|
225
|
-
|
226
|
-
task :copy_test_helpers do
|
227
|
-
cp "helpers/test_helper.rb", "#{PKG_DESTINATION}/test/test_helper.rb"
|
228
|
-
end
|
229
|
-
|
230
|
-
task :copy_app_doc_readme do
|
231
|
-
cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
|
232
|
-
end
|
233
|
-
|
234
|
-
def copy_with_rewritten_ruby_path(src_file, dest_file)
|
235
|
-
ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
236
|
-
|
237
|
-
File.open(dest_file, 'w') do |df|
|
238
|
-
File.open(src_file) do |sf|
|
239
|
-
line = sf.gets
|
240
|
-
if (line =~ /#!.+ruby\s*/) != nil
|
241
|
-
df.puts("#!#{ruby}")
|
242
|
-
else
|
243
|
-
df.puts(line)
|
244
|
-
end
|
245
|
-
df.write(sf.read)
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
|
251
|
-
# Generate documentation ------------------------------------------------------------------
|
252
|
-
|
253
|
-
desc "Generate documentation for the framework and for the empty application"
|
254
|
-
task :generate_documentation => [ :generate_app_doc, :generate_rails_framework_doc ]
|
255
|
-
|
256
|
-
task :generate_rails_framework_doc do
|
257
|
-
system %{cd #{PKG_DESTINATION}; rake doc:rails}
|
258
|
-
end
|
259
|
-
|
260
|
-
task :generate_app_doc do
|
261
|
-
cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
|
262
|
-
system %{cd #{PKG_DESTINATION}; rake doc:app}
|
263
|
-
end
|
264
|
-
|
265
|
-
Rake::RDocTask.new { |rdoc|
|
266
|
-
rdoc.rdoc_dir = 'doc'
|
267
|
-
rdoc.title = "Railties -- Gluing the Engine to the Rails"
|
268
|
-
rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=object'
|
269
|
-
rdoc.options << '--charset' << 'utf-8'
|
270
|
-
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
|
271
|
-
rdoc.rdoc_files.include('README', 'CHANGELOG')
|
272
|
-
rdoc.rdoc_files.include('lib/*.rb')
|
273
|
-
rdoc.rdoc_files.include('lib/rails/*.rb')
|
274
|
-
rdoc.rdoc_files.include('lib/rails_generator/*.rb')
|
275
|
-
rdoc.rdoc_files.include('lib/commands/**/*.rb')
|
276
|
-
}
|
277
|
-
|
278
|
-
desc "Generate guides for the framework"
|
279
|
-
task :guides do
|
280
|
-
require 'mizuho/generator'
|
281
|
-
|
282
|
-
source = "doc/guides/source/"
|
283
|
-
html = "doc/guides/html/"
|
284
|
-
FileUtils.rm_r(html) if File.directory?(html)
|
285
|
-
FileUtils.mkdir(html)
|
286
|
-
|
287
|
-
template = File.expand_path("doc/guides/source/templates/guides.html.erb")
|
288
|
-
|
289
|
-
ignore = ['..', 'icons', 'images', 'templates', 'stylesheets']
|
290
|
-
ignore << 'active_record_basics.txt'
|
291
|
-
|
292
|
-
indexless = ['index.txt', 'authors.txt']
|
293
|
-
|
294
|
-
# Traverse all entries in doc/guides/source/
|
295
|
-
Dir.entries(source).each do |entry|
|
296
|
-
next if ignore.include?(entry)
|
297
|
-
|
298
|
-
if File.directory?(File.join(source, entry))
|
299
|
-
# If the current entry is a directory, then we will want to compile
|
300
|
-
# the 'index.txt' file inside this directory.
|
301
|
-
if entry == '.'
|
302
|
-
input = File.join(source, 'index.txt')
|
303
|
-
output = File.join(html, "index.html")
|
304
|
-
else
|
305
|
-
input = File.join(source, entry, 'index.txt')
|
306
|
-
output = File.join(html, "#{entry}.html")
|
307
|
-
end
|
308
|
-
else
|
309
|
-
# If the current entry is a file, then we will want to compile this file.
|
310
|
-
input = File.join(source, entry)
|
311
|
-
output = File.join(html, entry).sub(/\.txt$/, '.html')
|
312
|
-
end
|
313
|
-
|
314
|
-
begin
|
315
|
-
puts "GENERATING => #{output}"
|
316
|
-
ENV['MANUALSONRAILS_TOC'] = 'no' if indexless.include?(entry)
|
317
|
-
Mizuho::Generator.new(input, :output => output, :template => template).start
|
318
|
-
rescue Mizuho::GenerationError
|
319
|
-
STDERR.puts "*** ERROR"
|
320
|
-
exit 2
|
321
|
-
ensure
|
322
|
-
ENV.delete('MANUALSONRAILS_TOC')
|
323
|
-
end
|
324
|
-
end
|
325
|
-
|
326
|
-
# Copy images and css files to html directory. These dirs are in .gitigore and shouldn't be source controlled.
|
327
|
-
FileUtils.cp_r File.join(source, 'images'), File.join(html, 'images')
|
328
|
-
FileUtils.cp_r File.join(source, 'stylesheets'), File.join(html, 'stylesheets')
|
329
|
-
end
|
330
|
-
|
331
|
-
# Generate GEM ----------------------------------------------------------------------------
|
332
|
-
|
333
|
-
task :copy_gem_environment do
|
334
|
-
cp "environments/environment.rb", "#{PKG_DESTINATION}/config/environment.rb"
|
335
|
-
chmod 0755, dest_file
|
336
|
-
end
|
337
|
-
|
338
|
-
|
339
|
-
PKG_FILES = FileList[
|
340
|
-
'[a-zA-Z]*',
|
341
|
-
'bin/**/*',
|
342
|
-
'builtin/**/*',
|
343
|
-
'configs/**/*',
|
344
|
-
'doc/**/*',
|
345
|
-
'dispatches/**/*',
|
346
|
-
'environments/**/*',
|
347
|
-
'helpers/**/*',
|
348
|
-
'generators/**/*',
|
349
|
-
'html/**/*',
|
350
|
-
'lib/**/*'
|
351
|
-
] - [ 'test' ]
|
352
|
-
|
353
|
-
spec = Gem::Specification.new do |s|
|
354
|
-
s.platform = Gem::Platform::RUBY
|
355
|
-
s.name = 'rails'
|
356
|
-
s.version = PKG_VERSION
|
357
|
-
s.summary = "Web-application framework with template engine, control-flow layer, and ORM."
|
358
|
-
s.description = <<-EOF
|
359
|
-
Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick
|
360
|
-
on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.
|
361
|
-
EOF
|
362
|
-
|
363
|
-
s.add_dependency('rake', '>= 0.8.3')
|
364
|
-
s.add_dependency('activesupport', '= 2.2.2' + PKG_BUILD)
|
365
|
-
s.add_dependency('activerecord', '= 2.2.2' + PKG_BUILD)
|
366
|
-
s.add_dependency('actionpack', '= 2.2.2' + PKG_BUILD)
|
367
|
-
s.add_dependency('actionmailer', '= 2.2.2' + PKG_BUILD)
|
368
|
-
s.add_dependency('activeresource', '= 2.2.2' + PKG_BUILD)
|
369
|
-
|
370
|
-
s.rdoc_options << '--exclude' << '.'
|
371
|
-
s.has_rdoc = false
|
372
|
-
|
373
|
-
s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
|
374
|
-
s.require_path = 'lib'
|
375
|
-
s.bindir = "bin" # Use these for applications.
|
376
|
-
s.executables = ["rails"]
|
377
|
-
s.default_executable = "rails"
|
378
|
-
|
379
|
-
s.author = "David Heinemeier Hansson"
|
380
|
-
s.email = "david@loudthinking.com"
|
381
|
-
s.homepage = "http://www.rubyonrails.org"
|
382
|
-
s.rubyforge_project = "rails"
|
383
|
-
end
|
384
|
-
|
385
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
386
|
-
pkg.gem_spec = spec
|
387
|
-
end
|
388
|
-
|
389
|
-
|
390
|
-
# Publishing -------------------------------------------------------
|
391
|
-
desc "Publish the rails gem"
|
392
|
-
task :pgem => [:gem] do
|
393
|
-
Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
394
|
-
`ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
|
395
|
-
end
|
396
|
-
|
397
|
-
desc "Publish the API documentation"
|
398
|
-
task :pdoc => :rdoc do
|
399
|
-
# railties API isn't separately published
|
400
|
-
end
|
401
|
-
|
402
|
-
desc "Publish the release files to RubyForge."
|
403
|
-
task :release => [ :package ] do
|
404
|
-
require 'rubyforge'
|
405
|
-
|
406
|
-
packages = %w( gem ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
|
407
|
-
|
408
|
-
rubyforge = RubyForge.new
|
409
|
-
rubyforge.login
|
410
|
-
rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
|
411
|
-
end
|