authorails 1.0.0
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.
- data/AUTHORAILS_README +20 -0
- data/CHANGELOG +1366 -0
- data/MIT-LICENSE +20 -0
- data/README +182 -0
- data/Rakefile +334 -0
- data/bin/about +3 -0
- data/bin/authorails +19 -0
- data/bin/breakpointer +3 -0
- data/bin/console +3 -0
- data/bin/destroy +3 -0
- data/bin/generate +3 -0
- data/bin/performance/benchmarker +3 -0
- data/bin/performance/profiler +3 -0
- data/bin/plugin +3 -0
- data/bin/process/inspector +3 -0
- data/bin/process/reaper +3 -0
- data/bin/process/spawner +3 -0
- data/bin/runner +3 -0
- data/bin/server +3 -0
- data/builtin/rails_info/rails/info.rb +123 -0
- data/builtin/rails_info/rails/info_controller.rb +9 -0
- data/builtin/rails_info/rails/info_helper.rb +2 -0
- data/builtin/rails_info/rails_info_controller.rb +2 -0
- data/configs/apache.conf +40 -0
- data/configs/databases/frontbase.yml +28 -0
- data/configs/databases/mysql.yml +48 -0
- data/configs/databases/oracle.yml +39 -0
- data/configs/databases/postgresql.yml +44 -0
- data/configs/databases/sqlite2.yml +16 -0
- data/configs/databases/sqlite3.yml +19 -0
- data/configs/empty.log +0 -0
- data/configs/lighttpd.conf +54 -0
- data/configs/routes.rb +23 -0
- data/controllers/accounts_controller.rb +11 -0
- data/controllers/admin_controller.rb +76 -0
- data/controllers/begin_controller.rb +5 -0
- data/controllers/login_controller.rb +101 -0
- data/controllers/permission_controller.rb +91 -0
- data/controllers/roles_controller.rb +58 -0
- data/controllers/tables_controller.rb +714 -0
- data/dispatches/dispatch.fcgi +24 -0
- data/dispatches/dispatch.rb +10 -0
- data/dispatches/gateway.cgi +97 -0
- data/doc/README_FOR_APP +2 -0
- data/environments/boot.rb +45 -0
- data/environments/development.rb +21 -0
- data/environments/environment.rb +63 -0
- data/environments/production.rb +18 -0
- data/environments/test.rb +19 -0
- data/fresh_rakefile +10 -0
- data/helpers/application.rb +607 -0
- data/helpers/application_helper.rb +315 -0
- data/helpers/permission_helper.rb +27 -0
- data/helpers/test_helper.rb +28 -0
- data/html/404.html +30 -0
- data/html/500.html +30 -0
- data/html/favicon.ico +0 -0
- data/html/images/ArrowDn.png +0 -0
- data/html/images/ArrowUp.png +0 -0
- data/html/images/arrow.gif +0 -0
- data/html/images/authorails_logo.gif +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/edit.png +0 -0
- data/html/images/minus.gif +0 -0
- data/html/images/plus.gif +0 -0
- data/html/images/rails.png +0 -0
- data/html/images/show.png +0 -0
- data/html/images/spinner.gif +0 -0
- data/html/index.html +273 -0
- data/html/javascripts/application.js +2 -0
- data/html/javascripts/controls.js +833 -0
- data/html/javascripts/dragdrop.js +942 -0
- data/html/javascripts/effects.js +1088 -0
- data/html/javascripts/live_validation.js +4 -0
- data/html/javascripts/prototype.js +2515 -0
- data/html/robots.txt +1 -0
- data/lib/authorails/version.rb +9 -0
- data/lib/binding_of_caller.rb +85 -0
- data/lib/breakpoint.rb +553 -0
- data/lib/breakpoint_client.rb +196 -0
- data/lib/code_statistics.rb +107 -0
- data/lib/commands.rb +17 -0
- data/lib/commands/about.rb +2 -0
- data/lib/commands/breakpointer.rb +1 -0
- data/lib/commands/console.rb +25 -0
- data/lib/commands/destroy.rb +6 -0
- data/lib/commands/generate.rb +6 -0
- data/lib/commands/ncgi/listener +86 -0
- data/lib/commands/ncgi/tracker +69 -0
- data/lib/commands/performance/benchmarker.rb +24 -0
- data/lib/commands/performance/profiler.rb +50 -0
- data/lib/commands/plugin.rb +918 -0
- data/lib/commands/process/inspector.rb +68 -0
- data/lib/commands/process/reaper.rb +149 -0
- data/lib/commands/process/spawner.rb +209 -0
- data/lib/commands/process/spinner.rb +57 -0
- data/lib/commands/runner.rb +48 -0
- data/lib/commands/server.rb +39 -0
- data/lib/commands/servers/base.rb +19 -0
- data/lib/commands/servers/lighttpd.rb +94 -0
- data/lib/commands/servers/mongrel.rb +65 -0
- data/lib/commands/servers/webrick.rb +59 -0
- data/lib/commands/update.rb +4 -0
- data/lib/console_app.rb +27 -0
- data/lib/console_sandbox.rb +6 -0
- data/lib/console_with_helpers.rb +23 -0
- data/lib/dispatcher.rb +173 -0
- data/lib/fcgi_handler.rb +225 -0
- data/lib/initializer.rb +702 -0
- data/lib/rails_generator.rb +43 -0
- data/lib/rails_generator/base.rb +261 -0
- data/lib/rails_generator/commands.rb +581 -0
- data/lib/rails_generator/generated_attribute.rb +42 -0
- data/lib/rails_generator/generators/applications/app/USAGE +16 -0
- data/lib/rails_generator/generators/applications/app/app_generator.rb +341 -0
- data/lib/rails_generator/generators/components/controller/USAGE +30 -0
- data/lib/rails_generator/generators/components/controller/controller_generator.rb +37 -0
- data/lib/rails_generator/generators/components/controller/templates/controller.rb +10 -0
- data/lib/rails_generator/generators/components/controller/templates/functional_test.rb +18 -0
- data/lib/rails_generator/generators/components/controller/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/controller/templates/view.rhtml +2 -0
- data/lib/rails_generator/generators/components/integration_test/USAGE +14 -0
- data/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb +16 -0
- data/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb +10 -0
- data/lib/rails_generator/generators/components/mailer/USAGE +18 -0
- data/lib/rails_generator/generators/components/mailer/mailer_generator.rb +34 -0
- data/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +3 -0
- data/lib/rails_generator/generators/components/mailer/templates/mailer.rb +13 -0
- data/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +37 -0
- data/lib/rails_generator/generators/components/mailer/templates/view.rhtml +3 -0
- data/lib/rails_generator/generators/components/migration/USAGE +14 -0
- data/lib/rails_generator/generators/components/migration/migration_generator.rb +7 -0
- data/lib/rails_generator/generators/components/migration/templates/migration.rb +7 -0
- data/lib/rails_generator/generators/components/model/USAGE +26 -0
- data/lib/rails_generator/generators/components/model/model_generator.rb +38 -0
- data/lib/rails_generator/generators/components/model/templates/fixtures.yml +11 -0
- data/lib/rails_generator/generators/components/model/templates/migration.rb +13 -0
- data/lib/rails_generator/generators/components/model/templates/model.rb +2 -0
- data/lib/rails_generator/generators/components/model/templates/unit_test.rb +10 -0
- data/lib/rails_generator/generators/components/observer/USAGE +15 -0
- data/lib/rails_generator/generators/components/observer/observer_generator.rb +16 -0
- data/lib/rails_generator/generators/components/observer/templates/observer.rb +2 -0
- data/lib/rails_generator/generators/components/observer/templates/unit_test.rb +10 -0
- data/lib/rails_generator/generators/components/plugin/USAGE +35 -0
- data/lib/rails_generator/generators/components/plugin/plugin_generator.rb +38 -0
- data/lib/rails_generator/generators/components/plugin/templates/README +4 -0
- data/lib/rails_generator/generators/components/plugin/templates/Rakefile +22 -0
- data/lib/rails_generator/generators/components/plugin/templates/USAGE +8 -0
- data/lib/rails_generator/generators/components/plugin/templates/generator.rb +8 -0
- data/lib/rails_generator/generators/components/plugin/templates/init.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/install.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/plugin.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/tasks.rake +4 -0
- data/lib/rails_generator/generators/components/plugin/templates/uninstall.rb +1 -0
- data/lib/rails_generator/generators/components/plugin/templates/unit_test.rb +8 -0
- data/lib/rails_generator/generators/components/resource/resource_generator.rb +76 -0
- data/lib/rails_generator/generators/components/resource/templates/USAGE +18 -0
- data/lib/rails_generator/generators/components/resource/templates/controller.rb +2 -0
- data/lib/rails_generator/generators/components/resource/templates/fixtures.yml +11 -0
- data/lib/rails_generator/generators/components/resource/templates/functional_test.rb +20 -0
- data/lib/rails_generator/generators/components/resource/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/resource/templates/migration.rb +13 -0
- data/lib/rails_generator/generators/components/resource/templates/model.rb +2 -0
- data/lib/rails_generator/generators/components/resource/templates/unit_test.rb +10 -0
- data/lib/rails_generator/generators/components/scaffold/USAGE +32 -0
- data/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +208 -0
- data/lib/rails_generator/generators/components/scaffold/templates/controller.rb +134 -0
- data/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +3 -0
- data/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml +35 -0
- data/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +102 -0
- data/lib/rails_generator/generators/components/scaffold/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/scaffold/templates/layout.rhtml +17 -0
- data/lib/rails_generator/generators/components/scaffold/templates/partial_list_elements.rhtml +127 -0
- data/lib/rails_generator/generators/components/scaffold/templates/style.css +74 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +75 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +30 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +8 -0
- data/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml +37 -0
- data/lib/rails_generator/generators/components/scaffold_resource/USAGE +29 -0
- data/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb +92 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb +79 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/fixtures.yml +11 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/functional_test.rb +57 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/helper.rb +2 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml +17 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/migration.rb +13 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/model.rb +2 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/style.css +74 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/unit_test.rb +10 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml +19 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.rhtml +24 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml +18 -0
- data/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.rhtml +10 -0
- data/lib/rails_generator/generators/components/session_migration/USAGE +15 -0
- data/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb +18 -0
- data/lib/rails_generator/generators/components/session_migration/templates/migration.rb +16 -0
- data/lib/rails_generator/generators/components/web_service/USAGE +28 -0
- data/lib/rails_generator/generators/components/web_service/templates/api_definition.rb +5 -0
- data/lib/rails_generator/generators/components/web_service/templates/controller.rb +8 -0
- data/lib/rails_generator/generators/components/web_service/templates/functional_test.rb +19 -0
- data/lib/rails_generator/generators/components/web_service/web_service_generator.rb +29 -0
- data/lib/rails_generator/lookup.rb +209 -0
- data/lib/rails_generator/manifest.rb +53 -0
- data/lib/rails_generator/options.rb +143 -0
- data/lib/rails_generator/scripts.rb +83 -0
- data/lib/rails_generator/scripts/destroy.rb +7 -0
- data/lib/rails_generator/scripts/generate.rb +7 -0
- data/lib/rails_generator/scripts/update.rb +12 -0
- data/lib/rails_generator/simple_logger.rb +46 -0
- data/lib/rails_generator/spec.rb +44 -0
- data/lib/railties_path.rb +1 -0
- data/lib/ruby_version_check.rb +17 -0
- data/lib/rubyprof_ext.rb +35 -0
- data/lib/tasks/databases.rake +187 -0
- data/lib/tasks/documentation.rake +82 -0
- data/lib/tasks/framework.rake +112 -0
- data/lib/tasks/log.rake +9 -0
- data/lib/tasks/misc.rake +4 -0
- data/lib/tasks/pre_namespace_aliases.rake +53 -0
- data/lib/tasks/rails.rb +8 -0
- data/lib/tasks/statistics.rake +18 -0
- data/lib/tasks/testing.rake +120 -0
- data/lib/tasks/tmp.rake +37 -0
- data/lib/test_help.rb +19 -0
- data/lib/webrick_server.rb +166 -0
- data/libs/migration_helper.rb +11 -0
- data/migrations/001_create_logins.rb +22 -0
- data/migrations/002_create_admins.rb +16 -0
- data/migrations/003_create_roles.rb +13 -0
- data/migrations/004_create_tables.rb +11 -0
- data/migrations/005_create_attr_types.rb +13 -0
- data/migrations/006_create_table_fields.rb +22 -0
- data/migrations/007_create_tab_operations.rb +13 -0
- data/migrations/008_create_attr_operations.rb +13 -0
- data/migrations/009_create_tab_permissions.rb +21 -0
- data/migrations/010_create_attr_permissions.rb +21 -0
- data/migrations/011_create_relations.rb +23 -0
- data/migrations/012_create_scaffolds.rb +11 -0
- data/migrations/013_create_relation_permissions.rb +20 -0
- data/models/admin.rb +38 -0
- data/models/attr_operation.rb +3 -0
- data/models/attr_permission.rb +5 -0
- data/models/attr_type.rb +3 -0
- data/models/login.rb +51 -0
- data/models/relation.rb +5 -0
- data/models/relation_permission.rb +4 -0
- data/models/role.rb +13 -0
- data/models/scaffold.rb +2 -0
- data/models/tab_operation.rb +3 -0
- data/models/tab_permission.rb +5 -0
- data/models/table.rb +18 -0
- data/models/table_field.rb +6 -0
- data/plugins/redhillonrails_core/CHANGELOG +186 -0
- data/plugins/redhillonrails_core/MIT-LICENSE +20 -0
- data/plugins/redhillonrails_core/README +152 -0
- data/plugins/redhillonrails_core/init.rb +1 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/base.rb +54 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/abstract_adapter.rb +46 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/column.rb +21 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/foreign_key_definition.rb +26 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/index_definition.rb +11 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_adapter.rb +94 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/mysql_column.rb +8 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/postgresql_adapter.rb +131 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/schema_statements.rb +23 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/sqlite3_adapter.rb +9 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/connection_adapters/table_definition.rb +27 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema.rb +25 -0
- data/plugins/redhillonrails_core/lib/red_hill_consulting/core/active_record/schema_dumper.rb +58 -0
- data/plugins/redhillonrails_core/lib/redhillonrails_core.rb +19 -0
- data/plugins/redhillonrails_core/tasks/db/comments.rake +9 -0
- data/plugins/schema_validations/CHANGELOG +149 -0
- data/plugins/schema_validations/MIT-LICENSE +20 -0
- data/plugins/schema_validations/README +54 -0
- data/plugins/schema_validations/about.yml +5 -0
- data/plugins/schema_validations/init.rb +1 -0
- data/plugins/schema_validations/install.rb +1 -0
- data/plugins/schema_validations/lib/red_hill_consulting/schema_validations/active_record/base.rb +108 -0
- data/plugins/schema_validations/lib/schema_validations.rb +1 -0
- data/plugins/svn/README +69 -0
- data/plugins/svn/Rakefile +22 -0
- data/plugins/svn/assets/javascripts/live_validation.js +4 -0
- data/plugins/svn/assets/stylesheets/live_validation.css +28 -0
- data/plugins/svn/init.rb +2 -0
- data/plugins/svn/install.rb +1 -0
- data/plugins/svn/lib/form_helpers.rb +49 -0
- data/plugins/svn/lib/live_validations.rb +73 -0
- data/plugins/svn/tasks/live_validation_tasks.rake +17 -0
- data/plugins/svn/test/form_helpers_test.rb +214 -0
- data/plugins/svn/test/live_validations_test.rb +124 -0
- data/plugins/svn/test/resource.rb +17 -0
- data/plugins/svn/uninstall.rb +1 -0
- data/stylesheets/live_validation.css +28 -0
- data/stylesheets/print.css +72 -0
- data/stylesheets/scaffold.css +175 -0
- data/views/accounts/index.rhtml +12 -0
- data/views/accounts/show.rhtml +5 -0
- data/views/admin/_form.rhtml +15 -0
- data/views/admin/add_user.rhtml +21 -0
- data/views/admin/change_pwd.rhtml +23 -0
- data/views/admin/edit_user.rhtml +12 -0
- data/views/admin/index.rhtml +19 -0
- data/views/begin/index.rhtml +0 -0
- data/views/layouts/general.rhtml +59 -0
- data/views/layouts/login.rhtml +18 -0
- data/views/login/change_pwd.rhtml +21 -0
- data/views/login/expired_pwd.rhtml +19 -0
- data/views/login/index.rhtml +15 -0
- data/views/permission/index.rhtml +17 -0
- data/views/permission/relations.rhtml +28 -0
- data/views/permission/roles.rhtml +45 -0
- data/views/permission/tables.rhtml +53 -0
- data/views/roles/_form.rhtml +8 -0
- data/views/roles/edit.rhtml +11 -0
- data/views/roles/list.rhtml +28 -0
- data/views/roles/new.rhtml +8 -0
- data/views/roles/show.rhtml +14 -0
- data/views/shared_views/_advanced_search.rhtml +35 -0
- data/views/shared_views/_child_elements.rhtml +30 -0
- data/views/shared_views/_childs.rhtml +20 -0
- data/views/shared_views/_father_elements.rhtml +27 -0
- data/views/shared_views/_fathers.rhtml +21 -0
- data/views/shared_views/_fathers_header.rhtml +58 -0
- data/views/shared_views/_many_to_many_elements.rhtml +50 -0
- data/views/shared_views/_many_to_manys.rhtml +18 -0
- data/views/shared_views/_one_to_one_elements.rhtml +24 -0
- data/views/shared_views/_one_to_one_father_elements.rhtml +26 -0
- data/views/shared_views/_one_to_ones.rhtml +42 -0
- data/views/shared_views/_one_to_ones_header.rhtml +117 -0
- data/views/shared_views/edit_child.rhtml +89 -0
- data/views/shared_views/edit_many.rhtml +75 -0
- data/views/tables/_cascade.rhtml +10 -0
- data/views/tables/_field.rhtml +10 -0
- data/views/tables/_fk.rhtml +9 -0
- data/views/tables/_form.rhtml +9 -0
- data/views/tables/_join_table_name.rhtml +16 -0
- data/views/tables/_relation_types.rhtml +5 -0
- data/views/tables/_tables.rhtml +15 -0
- data/views/tables/attributes.rhtml +15 -0
- data/views/tables/edit.rhtml +11 -0
- data/views/tables/edit_field.rhtml +18 -0
- data/views/tables/list.rhtml +39 -0
- data/views/tables/new.rhtml +8 -0
- data/views/tables/new_field.rhtml +25 -0
- data/views/tables/relations.rhtml +24 -0
- data/views/tables/show.rhtml +24 -0
- metadata +518 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2004-2006 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
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
== Welcome to Rails
|
|
2
|
+
|
|
3
|
+
Rails is a web-application and persistence framework that includes everything
|
|
4
|
+
needed to create database-backed web-applications according to the
|
|
5
|
+
Model-View-Control pattern of separation. This pattern splits the view (also
|
|
6
|
+
called the presentation) into "dumb" templates that are primarily responsible
|
|
7
|
+
for inserting pre-built data in between HTML tags. The model contains the
|
|
8
|
+
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
|
9
|
+
the business logic and knows how to persist themselves to a database. The
|
|
10
|
+
controller handles the incoming requests (such as Save New Account, Update
|
|
11
|
+
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 rails command
|
|
31
|
+
and your application name. Ex: rails myapp
|
|
32
|
+
(If you've downloaded rails in a complete tgz or zip, this step is already done)
|
|
33
|
+
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
|
34
|
+
3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
|
|
35
|
+
4. Follow the guidelines to start developing your application
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
== Web Servers
|
|
39
|
+
|
|
40
|
+
By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
|
|
41
|
+
Rails will use the WEBrick, the webserver that ships with Ruby. When you run script/server,
|
|
42
|
+
Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
|
|
43
|
+
that you can always get up and running quickly.
|
|
44
|
+
|
|
45
|
+
Mongrel is a Ruby-based webserver with a C-component (which requires compilation) that is
|
|
46
|
+
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
|
47
|
+
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
|
48
|
+
More info at: http://mongrel.rubyforge.org
|
|
49
|
+
|
|
50
|
+
If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
|
|
51
|
+
Mongrel and WEBrick and also suited for production use, but requires additional
|
|
52
|
+
installation and currently only works well on OS X/Unix (Windows users are encouraged
|
|
53
|
+
to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
|
|
54
|
+
http://www.lighttpd.net.
|
|
55
|
+
|
|
56
|
+
And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
|
|
57
|
+
web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
|
|
58
|
+
for production.
|
|
59
|
+
|
|
60
|
+
But of course its also possible to run Rails on any platform that supports FCGI.
|
|
61
|
+
Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
|
|
62
|
+
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
== Debugging Rails
|
|
66
|
+
|
|
67
|
+
Have "tail -f" commands running on the server.log and development.log. Rails will
|
|
68
|
+
automatically display debugging and runtime information to these files. Debugging
|
|
69
|
+
info will also be shown in the browser on requests from 127.0.0.1.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
== Breakpoints
|
|
73
|
+
|
|
74
|
+
Breakpoint support is available through the script/breakpointer client. This
|
|
75
|
+
means that you can break out of execution at any point in the code, investigate
|
|
76
|
+
and change the model, AND then resume execution! Example:
|
|
77
|
+
|
|
78
|
+
class WeblogController < ActionController::Base
|
|
79
|
+
def index
|
|
80
|
+
@posts = Post.find(:all)
|
|
81
|
+
breakpoint "Breaking out from the list"
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
So the controller will accept the action, run the first line, then present you
|
|
86
|
+
with a IRB prompt in the breakpointer window. Here you can do things like:
|
|
87
|
+
|
|
88
|
+
Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
|
|
89
|
+
|
|
90
|
+
>> @posts.inspect
|
|
91
|
+
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
|
92
|
+
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
|
93
|
+
>> @posts.first.title = "hello from a breakpoint"
|
|
94
|
+
=> "hello from a breakpoint"
|
|
95
|
+
|
|
96
|
+
...and even better is that you can examine how your runtime objects actually work:
|
|
97
|
+
|
|
98
|
+
>> f = @posts.first
|
|
99
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
|
100
|
+
>> f.
|
|
101
|
+
Display all 152 possibilities? (y or n)
|
|
102
|
+
|
|
103
|
+
Finally, when you're ready to resume execution, you press CTRL-D
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
== Console
|
|
107
|
+
|
|
108
|
+
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
|
109
|
+
Here you'll have all parts of the application configured, just like it is when the
|
|
110
|
+
application is running. You can inspect domain models, change values, and save to the
|
|
111
|
+
database. Starting the script without arguments will launch it in the development environment.
|
|
112
|
+
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
|
113
|
+
|
|
114
|
+
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
|
115
|
+
|
|
116
|
+
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
== Description of contents
|
|
121
|
+
|
|
122
|
+
app
|
|
123
|
+
Holds all the code that's specific to this particular application.
|
|
124
|
+
|
|
125
|
+
app/controllers
|
|
126
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
|
127
|
+
automated URL mapping. All controllers should descend from ApplicationController
|
|
128
|
+
which itself descends from ActionController::Base.
|
|
129
|
+
|
|
130
|
+
app/models
|
|
131
|
+
Holds models that should be named like post.rb.
|
|
132
|
+
Most models will descend from ActiveRecord::Base.
|
|
133
|
+
|
|
134
|
+
app/views
|
|
135
|
+
Holds the template files for the view that should be named like
|
|
136
|
+
weblogs/index.rhtml for the WeblogsController#index action. All views use eRuby
|
|
137
|
+
syntax.
|
|
138
|
+
|
|
139
|
+
app/views/layouts
|
|
140
|
+
Holds the template files for layouts to be used with views. This models the common
|
|
141
|
+
header/footer method of wrapping views. In your views, define a layout using the
|
|
142
|
+
<tt>layout :default</tt> and create a file named default.rhtml. Inside default.rhtml,
|
|
143
|
+
call <% yield %> to render the view using this layout.
|
|
144
|
+
|
|
145
|
+
app/helpers
|
|
146
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
|
147
|
+
for you automatically when using script/generate for controllers. Helpers can be used to
|
|
148
|
+
wrap functionality for your views into methods.
|
|
149
|
+
|
|
150
|
+
config
|
|
151
|
+
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
|
152
|
+
|
|
153
|
+
components
|
|
154
|
+
Self-contained mini-applications that can bundle together controllers, models, and views.
|
|
155
|
+
|
|
156
|
+
db
|
|
157
|
+
Contains the database schema in schema.rb. db/migrate contains all
|
|
158
|
+
the sequence of Migrations for your schema.
|
|
159
|
+
|
|
160
|
+
doc
|
|
161
|
+
This directory is where your application documentation will be stored when generated
|
|
162
|
+
using <tt>rake doc:app</tt>
|
|
163
|
+
|
|
164
|
+
lib
|
|
165
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
|
166
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
|
167
|
+
|
|
168
|
+
public
|
|
169
|
+
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
|
170
|
+
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
|
171
|
+
set as the DOCUMENT_ROOT of your web server.
|
|
172
|
+
|
|
173
|
+
script
|
|
174
|
+
Helper scripts for automation and generation.
|
|
175
|
+
|
|
176
|
+
test
|
|
177
|
+
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
|
178
|
+
test files will be generated for you and placed in this directory.
|
|
179
|
+
|
|
180
|
+
vendor
|
|
181
|
+
External libraries that the application depends on. Also includes the plugins subdirectory.
|
|
182
|
+
This directory is in the load path.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
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
|
+
## This is required until the regular test task
|
|
25
|
+
## below passes. It's not ideal, but at least
|
|
26
|
+
## we can see the failures
|
|
27
|
+
task :test do
|
|
28
|
+
Dir['test/**/*_test.rb'].all? do |file|
|
|
29
|
+
system("ruby #{file}")
|
|
30
|
+
end or raise "Failures"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Rake::TestTask.new("regular_test") do |t|
|
|
34
|
+
t.libs << 'test'
|
|
35
|
+
t.pattern = 'test/**/*_test.rb'
|
|
36
|
+
t.warning = true
|
|
37
|
+
t.verbose = true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
BASE_DIRS = %w(
|
|
42
|
+
app config/environments components db doc log lib lib/tasks public script script/performance script/process test vendor vendor/plugins
|
|
43
|
+
tmp/sessions tmp/cache tmp/sockets tmp/pids
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
APP_DIRS = %w( models controllers helpers views views/layouts )
|
|
47
|
+
PUBLIC_DIRS = %w( images javascripts stylesheets )
|
|
48
|
+
TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/test )
|
|
49
|
+
|
|
50
|
+
LOG_FILES = %w( server.log development.log test.log production.log )
|
|
51
|
+
HTML_FILES = %w( 404.html 500.html index.html robots.txt favicon.ico images/rails.png
|
|
52
|
+
javascripts/prototype.js javascripts/application.js
|
|
53
|
+
javascripts/effects.js javascripts/dragdrop.js javascripts/controls.js )
|
|
54
|
+
BIN_FILES = %w( about breakpointer console destroy generate performance/benchmarker performance/profiler process/reaper process/spawner process/inspector runner server plugin )
|
|
55
|
+
|
|
56
|
+
VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport actionwebservice railties )
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
desc "Generates a fresh Rails package with documentation"
|
|
60
|
+
task :fresh_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content, :generate_documentation ]
|
|
61
|
+
|
|
62
|
+
desc "Generates a fresh Rails package using GEMs with documentation"
|
|
63
|
+
task :fresh_gem_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_ties_content, :copy_gem_environment ]
|
|
64
|
+
|
|
65
|
+
desc "Generates a fresh Rails package without documentation (faster)"
|
|
66
|
+
task :fresh_rails_without_docs => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content ]
|
|
67
|
+
|
|
68
|
+
desc "Generates a fresh Rails package without documentation (faster)"
|
|
69
|
+
task :fresh_rails_without_docs_using_links => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
|
|
70
|
+
|
|
71
|
+
desc "Generates minimal Rails package using symlinks"
|
|
72
|
+
task :dev => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
|
|
73
|
+
|
|
74
|
+
desc "Packages the fresh Rails package with documentation"
|
|
75
|
+
task :package => [ :clean, :fresh_rails ] do
|
|
76
|
+
system %{cd ..; tar -czvf #{PKG_NAME}-#{PKG_VERSION}.tgz #{PKG_NAME}}
|
|
77
|
+
system %{cd ..; zip -r #{PKG_NAME}-#{PKG_VERSION}.zip #{PKG_NAME}}
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
task :clean do
|
|
81
|
+
rm_rf PKG_DESTINATION
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Get external spinoffs -------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
desc "Updates railties to the latest version of the javascript spinoffs"
|
|
87
|
+
task :update_js do
|
|
88
|
+
for js in %w( prototype controls dragdrop effects )
|
|
89
|
+
rm "html/javascripts/#{js}.js"
|
|
90
|
+
cp "./../actionpack/lib/action_view/helpers/javascripts/#{js}.js", "html/javascripts"
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Make directory structure ----------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
def make_dest_dirs(dirs, path = '.')
|
|
97
|
+
mkdir_p dirs.map { |dir| File.join(PKG_DESTINATION, path.to_s, dir) }
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
desc "Make the directory structure for the new Rails application"
|
|
101
|
+
task :make_dir_structure => [ :make_base_dirs, :make_app_dirs, :make_public_dirs, :make_test_dirs ]
|
|
102
|
+
|
|
103
|
+
task(:make_base_dirs) { make_dest_dirs BASE_DIRS }
|
|
104
|
+
task(:make_app_dirs) { make_dest_dirs APP_DIRS, 'app' }
|
|
105
|
+
task(:make_public_dirs) { make_dest_dirs PUBLIC_DIRS, 'public' }
|
|
106
|
+
task(:make_test_dirs) { make_dest_dirs TEST_DIRS, 'test' }
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# Initialize file stubs -------------------------------------------------------------------
|
|
110
|
+
|
|
111
|
+
desc "Initialize empty file stubs (such as for logging)"
|
|
112
|
+
task :initialize_file_stubs => [ :initialize_log_files ]
|
|
113
|
+
|
|
114
|
+
task :initialize_log_files do
|
|
115
|
+
log_dir = File.join(PKG_DESTINATION, 'log')
|
|
116
|
+
chmod 0777, log_dir
|
|
117
|
+
LOG_FILES.each do |log_file|
|
|
118
|
+
log_path = File.join(log_dir, log_file)
|
|
119
|
+
touch log_path
|
|
120
|
+
chmod 0666, log_path
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# Copy Vendors ----------------------------------------------------------------------------
|
|
126
|
+
|
|
127
|
+
desc "Copy in all the Rails packages to vendor"
|
|
128
|
+
task :copy_vendor_libraries do
|
|
129
|
+
mkdir File.join(PKG_DESTINATION, 'vendor', 'rails')
|
|
130
|
+
VENDOR_LIBS.each { |dir| cp_r File.join('..', dir), File.join(PKG_DESTINATION, 'vendor', 'rails', dir) }
|
|
131
|
+
FileUtils.rm_r(Dir.glob(File.join(PKG_DESTINATION, 'vendor', 'rails', "**", ".svn")))
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
desc "Link in all the Rails packages to vendor"
|
|
135
|
+
task :link_vendor_libraries do
|
|
136
|
+
mkdir File.join(PKG_DESTINATION, 'vendor', 'rails')
|
|
137
|
+
VENDOR_LIBS.each { |dir| ln_s File.join('..', '..', '..', dir), File.join(PKG_DESTINATION, 'vendor', 'rails', dir) }
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# Copy Ties Content -----------------------------------------------------------------------
|
|
142
|
+
|
|
143
|
+
# :link_apache_config
|
|
144
|
+
desc "Make copies of all the default content of ties"
|
|
145
|
+
task :copy_ties_content => [
|
|
146
|
+
:copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_application,
|
|
147
|
+
:copy_configs, :copy_binfiles, :copy_test_helpers, :copy_app_doc_readme ]
|
|
148
|
+
|
|
149
|
+
task :copy_dispatches do
|
|
150
|
+
copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb")
|
|
151
|
+
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.rb"
|
|
152
|
+
|
|
153
|
+
copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi")
|
|
154
|
+
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.cgi"
|
|
155
|
+
|
|
156
|
+
copy_with_rewritten_ruby_path("dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi")
|
|
157
|
+
chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi"
|
|
158
|
+
|
|
159
|
+
# copy_with_rewritten_ruby_path("dispatches/gateway.cgi", "#{PKG_DESTINATION}/public/gateway.cgi")
|
|
160
|
+
# chmod 0755, "#{PKG_DESTINATION}/public/gateway.cgi"
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
task :copy_html_files do
|
|
164
|
+
HTML_FILES.each { |file| cp File.join('html', file), File.join(PKG_DESTINATION, 'public', file) }
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
task :copy_application do
|
|
168
|
+
cp "helpers/application.rb", "#{PKG_DESTINATION}/app/controllers/application.rb"
|
|
169
|
+
cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
task :copy_configs do
|
|
173
|
+
app_name = "rails"
|
|
174
|
+
socket = nil
|
|
175
|
+
require 'erb'
|
|
176
|
+
File.open("#{PKG_DESTINATION}/config/database.yml", 'w') {|f| f.write ERB.new(IO.read("configs/databases/mysql.yml"), nil, '-').result(binding)}
|
|
177
|
+
|
|
178
|
+
cp "configs/routes.rb", "#{PKG_DESTINATION}/config/routes.rb"
|
|
179
|
+
|
|
180
|
+
cp "configs/apache.conf", "#{PKG_DESTINATION}/public/.htaccess"
|
|
181
|
+
|
|
182
|
+
cp "environments/boot.rb", "#{PKG_DESTINATION}/config/boot.rb"
|
|
183
|
+
cp "environments/environment.rb", "#{PKG_DESTINATION}/config/environment.rb"
|
|
184
|
+
cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
|
|
185
|
+
cp "environments/development.rb", "#{PKG_DESTINATION}/config/environments/development.rb"
|
|
186
|
+
cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
task :copy_binfiles do
|
|
190
|
+
BIN_FILES.each do |file|
|
|
191
|
+
dest_file = File.join(PKG_DESTINATION, 'script', file)
|
|
192
|
+
copy_with_rewritten_ruby_path(File.join('bin', file), dest_file)
|
|
193
|
+
chmod 0755, dest_file
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
task :copy_rootfiles do
|
|
198
|
+
cp "fresh_rakefile", "#{PKG_DESTINATION}/Rakefile"
|
|
199
|
+
cp "README", "#{PKG_DESTINATION}/README"
|
|
200
|
+
cp "CHANGELOG", "#{PKG_DESTINATION}/CHANGELOG"
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
task :copy_test_helpers do
|
|
204
|
+
cp "helpers/test_helper.rb", "#{PKG_DESTINATION}/test/test_helper.rb"
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
task :copy_app_doc_readme do
|
|
208
|
+
cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
task :link_apache_config do
|
|
212
|
+
chdir(File.join(PKG_DESTINATION, 'config')) {
|
|
213
|
+
ln_s "../public/.htaccess", "apache.conf"
|
|
214
|
+
}
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def copy_with_rewritten_ruby_path(src_file, dest_file)
|
|
218
|
+
ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
|
|
219
|
+
|
|
220
|
+
File.open(dest_file, 'w') do |df|
|
|
221
|
+
File.open(src_file) do |sf|
|
|
222
|
+
line = sf.gets
|
|
223
|
+
if (line =~ /#!.+ruby\s*/) != nil
|
|
224
|
+
df.puts("#!#{ruby}")
|
|
225
|
+
else
|
|
226
|
+
df.puts(line)
|
|
227
|
+
end
|
|
228
|
+
df.write(sf.read)
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
# Generate documentation ------------------------------------------------------------------
|
|
235
|
+
|
|
236
|
+
desc "Generate documentation for the framework and for the empty application"
|
|
237
|
+
task :generate_documentation => [ :generate_app_doc, :generate_rails_framework_doc ]
|
|
238
|
+
|
|
239
|
+
task :generate_rails_framework_doc do
|
|
240
|
+
system %{cd #{PKG_DESTINATION}; rake apidoc}
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
task :generate_app_doc do
|
|
244
|
+
File.cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
|
|
245
|
+
system %{cd #{PKG_DESTINATION}; rake appdoc}
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
Rake::RDocTask.new { |rdoc|
|
|
249
|
+
rdoc.rdoc_dir = 'doc'
|
|
250
|
+
rdoc.title = "Railties -- Gluing the Engine to the Rails"
|
|
251
|
+
rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=object'
|
|
252
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
|
253
|
+
rdoc.rdoc_files.include('README', 'CHANGELOG')
|
|
254
|
+
rdoc.rdoc_files.include('lib/*.rb')
|
|
255
|
+
rdoc.rdoc_files.include('lib/rails_generator/*.rb')
|
|
256
|
+
rdoc.rdoc_files.include('lib/commands/**/*.rb')
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
# Generate GEM ----------------------------------------------------------------------------
|
|
260
|
+
|
|
261
|
+
task :copy_gem_environment do
|
|
262
|
+
cp "environments/environment.rb", "#{PKG_DESTINATION}/config/environment.rb"
|
|
263
|
+
chmod 0755, dest_file
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
PKG_FILES = FileList[
|
|
268
|
+
'[a-zA-Z]*',
|
|
269
|
+
'bin/**/*',
|
|
270
|
+
'builtin/**/*',
|
|
271
|
+
'configs/**/*',
|
|
272
|
+
'doc/**/*',
|
|
273
|
+
'dispatches/**/*',
|
|
274
|
+
'environments/**/*',
|
|
275
|
+
'helpers/**/*',
|
|
276
|
+
'generators/**/*',
|
|
277
|
+
'html/**/*',
|
|
278
|
+
'lib/**/*'
|
|
279
|
+
] - [ 'test' ]
|
|
280
|
+
|
|
281
|
+
spec = Gem::Specification.new do |s|
|
|
282
|
+
s.name = 'rails'
|
|
283
|
+
s.version = PKG_VERSION
|
|
284
|
+
s.summary = "Web-application framework with template engine, control-flow layer, and ORM."
|
|
285
|
+
s.description = <<-EOF
|
|
286
|
+
Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick
|
|
287
|
+
on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.
|
|
288
|
+
EOF
|
|
289
|
+
|
|
290
|
+
s.add_dependency('rake', '>= 0.7.2')
|
|
291
|
+
s.add_dependency('activesupport', '= 1.4.2' + PKG_BUILD)
|
|
292
|
+
s.add_dependency('activerecord', '= 1.15.3' + PKG_BUILD)
|
|
293
|
+
s.add_dependency('actionpack', '= 1.13.3' + PKG_BUILD)
|
|
294
|
+
s.add_dependency('actionmailer', '= 1.3.3' + PKG_BUILD)
|
|
295
|
+
s.add_dependency('actionwebservice', '= 1.2.3' + PKG_BUILD)
|
|
296
|
+
|
|
297
|
+
s.rdoc_options << '--exclude' << '.'
|
|
298
|
+
s.has_rdoc = false
|
|
299
|
+
|
|
300
|
+
s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
|
|
301
|
+
s.require_path = 'lib'
|
|
302
|
+
|
|
303
|
+
s.bindir = "bin" # Use these for applications.
|
|
304
|
+
s.executables = ["rails"]
|
|
305
|
+
s.default_executable = "rails"
|
|
306
|
+
|
|
307
|
+
s.author = "David Heinemeier Hansson"
|
|
308
|
+
s.email = "david@loudthinking.com"
|
|
309
|
+
s.homepage = "http://www.rubyonrails.org"
|
|
310
|
+
s.rubyforge_project = "rails"
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
|
314
|
+
pkg.gem_spec = spec
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
# Publishing -------------------------------------------------------
|
|
319
|
+
desc "Publish the API documentation"
|
|
320
|
+
task :pgem => [:gem] do
|
|
321
|
+
Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
|
322
|
+
`ssh davidhh@wrath.rubyonrails.org './gemupdate.sh'`
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
desc "Publish the release files to RubyForge."
|
|
326
|
+
task :release => [ :package ] do
|
|
327
|
+
require 'rubyforge'
|
|
328
|
+
|
|
329
|
+
packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
|
|
330
|
+
|
|
331
|
+
rubyforge = RubyForge.new
|
|
332
|
+
rubyforge.login
|
|
333
|
+
rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
|
|
334
|
+
end
|