openskies 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +87 -0
- data/README.rdoc +35 -0
- data/bin/openskies +9 -0
- data/guides/assets/images/belongs_to.png +0 -0
- data/guides/assets/images/book_icon.gif +0 -0
- data/guides/assets/images/bullet.gif +0 -0
- data/guides/assets/images/challenge.png +0 -0
- data/guides/assets/images/chapters_icon.gif +0 -0
- data/guides/assets/images/check_bullet.gif +0 -0
- data/guides/assets/images/credits_pic_blank.gif +0 -0
- data/guides/assets/images/csrf.png +0 -0
- data/guides/assets/images/customized_error_messages.png +0 -0
- data/guides/assets/images/edge_badge.png +0 -0
- data/guides/assets/images/error_messages.png +0 -0
- data/guides/assets/images/feature_tile.gif +0 -0
- data/guides/assets/images/footer_tile.gif +0 -0
- data/guides/assets/images/fxn.png +0 -0
- data/guides/assets/images/grey_bullet.gif +0 -0
- data/guides/assets/images/habtm.png +0 -0
- data/guides/assets/images/has_many.png +0 -0
- data/guides/assets/images/has_many_through.png +0 -0
- data/guides/assets/images/has_one.png +0 -0
- data/guides/assets/images/has_one_through.png +0 -0
- data/guides/assets/images/header_backdrop.png +0 -0
- data/guides/assets/images/header_tile.gif +0 -0
- data/guides/assets/images/i18n/demo_html_safe.png +0 -0
- data/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translated_en.png +0 -0
- data/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translation_missing.png +0 -0
- data/guides/assets/images/i18n/demo_untranslated.png +0 -0
- data/guides/assets/images/icons/README +5 -0
- data/guides/assets/images/icons/callouts/1.png +0 -0
- data/guides/assets/images/icons/callouts/10.png +0 -0
- data/guides/assets/images/icons/callouts/11.png +0 -0
- data/guides/assets/images/icons/callouts/12.png +0 -0
- data/guides/assets/images/icons/callouts/13.png +0 -0
- data/guides/assets/images/icons/callouts/14.png +0 -0
- data/guides/assets/images/icons/callouts/15.png +0 -0
- data/guides/assets/images/icons/callouts/2.png +0 -0
- data/guides/assets/images/icons/callouts/3.png +0 -0
- data/guides/assets/images/icons/callouts/4.png +0 -0
- data/guides/assets/images/icons/callouts/5.png +0 -0
- data/guides/assets/images/icons/callouts/6.png +0 -0
- data/guides/assets/images/icons/callouts/7.png +0 -0
- data/guides/assets/images/icons/callouts/8.png +0 -0
- data/guides/assets/images/icons/callouts/9.png +0 -0
- data/guides/assets/images/icons/caution.png +0 -0
- data/guides/assets/images/icons/example.png +0 -0
- data/guides/assets/images/icons/home.png +0 -0
- data/guides/assets/images/icons/important.png +0 -0
- data/guides/assets/images/icons/next.png +0 -0
- data/guides/assets/images/icons/note.png +0 -0
- data/guides/assets/images/icons/prev.png +0 -0
- data/guides/assets/images/icons/tip.png +0 -0
- data/guides/assets/images/icons/up.png +0 -0
- data/guides/assets/images/icons/warning.png +0 -0
- data/guides/assets/images/jaimeiniesta.jpg +0 -0
- data/guides/assets/images/nav_arrow.gif +0 -0
- data/guides/assets/images/polymorphic.png +0 -0
- data/guides/assets/images/posts_index.png +0 -0
- data/guides/assets/images/radar.png +0 -0
- data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/guides/assets/images/rails_guides_logo.gif +0 -0
- data/guides/assets/images/rails_logo_remix.gif +0 -0
- data/guides/assets/images/rails_welcome.png +0 -0
- data/guides/assets/images/session_fixation.png +0 -0
- data/guides/assets/images/tab_grey.gif +0 -0
- data/guides/assets/images/tab_info.gif +0 -0
- data/guides/assets/images/tab_note.gif +0 -0
- data/guides/assets/images/tab_red.gif +0 -0
- data/guides/assets/images/tab_yellow.gif +0 -0
- data/guides/assets/images/tab_yellow.png +0 -0
- data/guides/assets/images/validation_error_messages.png +0 -0
- data/guides/assets/images/vijaydev.jpg +0 -0
- data/guides/assets/javascripts/guides.js +7 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
- data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
- data/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
- data/guides/assets/stylesheets/fixes.css +16 -0
- data/guides/assets/stylesheets/kindle.css +11 -0
- data/guides/assets/stylesheets/main.css +453 -0
- data/guides/assets/stylesheets/print.css +52 -0
- data/guides/assets/stylesheets/reset.css +43 -0
- data/guides/assets/stylesheets/style.css +13 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
- data/guides/code/getting_started/Gemfile +38 -0
- data/guides/code/getting_started/README.rdoc +261 -0
- data/guides/code/getting_started/Rakefile +7 -0
- data/guides/code/getting_started/app/assets/images/rails.png +0 -0
- data/guides/code/getting_started/app/assets/javascripts/application.js +15 -0
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/home.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/application.css +13 -0
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/home.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +3 -0
- data/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss +56 -0
- data/guides/code/getting_started/app/controllers/application_controller.rb +3 -0
- data/guides/code/getting_started/app/controllers/comments_controller.rb +16 -0
- data/guides/code/getting_started/app/controllers/home_controller.rb +5 -0
- data/guides/code/getting_started/app/controllers/posts_controller.rb +84 -0
- data/guides/code/getting_started/app/helpers/application_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/comments_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/home_helper.rb +2 -0
- data/guides/code/getting_started/app/helpers/posts_helper.rb +5 -0
- data/guides/code/getting_started/app/models/comment.rb +3 -0
- data/guides/code/getting_started/app/models/post.rb +11 -0
- data/guides/code/getting_started/app/models/tag.rb +3 -0
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +15 -0
- data/guides/code/getting_started/app/views/comments/_form.html.erb +13 -0
- data/guides/code/getting_started/app/views/home/index.html.erb +2 -0
- data/guides/code/getting_started/app/views/layouts/application.html.erb +14 -0
- data/guides/code/getting_started/app/views/posts/_form.html.erb +32 -0
- data/guides/code/getting_started/app/views/posts/edit.html.erb +6 -0
- data/guides/code/getting_started/app/views/posts/index.html.erb +27 -0
- data/guides/code/getting_started/app/views/posts/new.html.erb +5 -0
- data/guides/code/getting_started/app/views/posts/show.html.erb +31 -0
- data/guides/code/getting_started/app/views/tags/_form.html.erb +12 -0
- data/guides/code/getting_started/config/application.rb +59 -0
- data/guides/code/getting_started/config/boot.rb +6 -0
- data/guides/code/getting_started/config/database.yml +25 -0
- data/guides/code/getting_started/config/environment.rb +5 -0
- data/guides/code/getting_started/config/environments/development.rb +37 -0
- data/guides/code/getting_started/config/environments/production.rb +67 -0
- data/guides/code/getting_started/config/environments/test.rb +37 -0
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +7 -0
- data/guides/code/getting_started/config/initializers/inflections.rb +15 -0
- data/guides/code/getting_started/config/initializers/mime_types.rb +5 -0
- data/guides/code/getting_started/config/initializers/secret_token.rb +7 -0
- data/guides/code/getting_started/config/initializers/session_store.rb +8 -0
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +14 -0
- data/guides/code/getting_started/config/locales/en.yml +5 -0
- data/guides/code/getting_started/config/routes.rb +64 -0
- data/guides/code/getting_started/config.ru +4 -0
- data/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb +11 -0
- data/guides/code/getting_started/db/migrate/20110901012815_create_comments.rb +12 -0
- data/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb +11 -0
- data/guides/code/getting_started/db/schema.rb +43 -0
- data/guides/code/getting_started/db/seeds.rb +7 -0
- data/guides/code/getting_started/doc/README_FOR_APP +2 -0
- data/guides/code/getting_started/public/404.html +26 -0
- data/guides/code/getting_started/public/422.html +26 -0
- data/guides/code/getting_started/public/500.html +25 -0
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +5 -0
- data/guides/code/getting_started/script/rails +6 -0
- data/guides/code/getting_started/test/fixtures/comments.yml +11 -0
- data/guides/code/getting_started/test/fixtures/posts.yml +11 -0
- data/guides/code/getting_started/test/fixtures/tags.yml +9 -0
- data/guides/code/getting_started/test/functional/comments_controller_test.rb +7 -0
- data/guides/code/getting_started/test/functional/home_controller_test.rb +9 -0
- data/guides/code/getting_started/test/functional/posts_controller_test.rb +49 -0
- data/guides/code/getting_started/test/performance/browsing_test.rb +12 -0
- data/guides/code/getting_started/test/test_helper.rb +13 -0
- data/guides/code/getting_started/test/unit/comment_test.rb +7 -0
- data/guides/code/getting_started/test/unit/helpers/comments_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/home_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/helpers/posts_helper_test.rb +4 -0
- data/guides/code/getting_started/test/unit/post_test.rb +7 -0
- data/guides/code/getting_started/test/unit/tag_test.rb +7 -0
- data/guides/rails_guides/generator.rb +310 -0
- data/guides/rails_guides/helpers.rb +45 -0
- data/guides/rails_guides/indexer.rb +69 -0
- data/guides/rails_guides/levenshtein.rb +31 -0
- data/guides/rails_guides/textile_extensions.rb +63 -0
- data/guides/rails_guides.rb +50 -0
- data/guides/source/2_2_release_notes.textile +422 -0
- data/guides/source/2_3_release_notes.textile +610 -0
- data/guides/source/3_0_release_notes.textile +595 -0
- data/guides/source/3_1_release_notes.textile +553 -0
- data/guides/source/3_2_release_notes.textile +540 -0
- data/guides/source/_license.html.erb +2 -0
- data/guides/source/_welcome.html.erb +19 -0
- data/guides/source/action_controller_overview.textile +820 -0
- data/guides/source/action_mailer_basics.textile +516 -0
- data/guides/source/action_view_overview.textile +1497 -0
- data/guides/source/active_model_basics.textile +205 -0
- data/guides/source/active_record_basics.textile +218 -0
- data/guides/source/active_record_querying.textile +1433 -0
- data/guides/source/active_record_validations_callbacks.textile +1283 -0
- data/guides/source/active_resource_basics.textile +120 -0
- data/guides/source/active_support_core_extensions.textile +3713 -0
- data/guides/source/ajax_on_rails.textile +267 -0
- data/guides/source/api_documentation_guidelines.textile +185 -0
- data/guides/source/asset_pipeline.textile +707 -0
- data/guides/source/association_basics.textile +1959 -0
- data/guides/source/caching_with_rails.textile +437 -0
- data/guides/source/command_line.textile +574 -0
- data/guides/source/configuring.textile +641 -0
- data/guides/source/contributing_to_ruby_on_rails.textile +448 -0
- data/guides/source/credits.html.erb +72 -0
- data/guides/source/debugging_rails_applications.textile +714 -0
- data/guides/source/documents.yaml +157 -0
- data/guides/source/engines.textile +618 -0
- data/guides/source/form_helpers.textile +798 -0
- data/guides/source/generators.textile +621 -0
- data/guides/source/getting_started.textile +1929 -0
- data/guides/source/i18n.textile +931 -0
- data/guides/source/index.html.erb +30 -0
- data/guides/source/initialization.textile +1116 -0
- data/guides/source/kindle/KINDLE.md +26 -0
- data/guides/source/kindle/copyright.html.erb +1 -0
- data/guides/source/kindle/layout.html.erb +27 -0
- data/guides/source/kindle/rails_guides.opf.erb +52 -0
- data/guides/source/kindle/toc.html.erb +24 -0
- data/guides/source/kindle/toc.ncx.erb +64 -0
- data/guides/source/kindle/welcome.html.erb +5 -0
- data/guides/source/layout.html.erb +124 -0
- data/guides/source/layouts_and_rendering.textile +1237 -0
- data/guides/source/migrations.textile +900 -0
- data/guides/source/nested_model_forms.textile +222 -0
- data/guides/source/performance_testing.textile +597 -0
- data/guides/source/plugins.textile +464 -0
- data/guides/source/rails_application_templates.textile +240 -0
- data/guides/source/rails_on_rack.textile +236 -0
- data/guides/source/routing.textile +885 -0
- data/guides/source/ruby_on_rails_guides_guidelines.textile +79 -0
- data/guides/source/security.textile +1004 -0
- data/guides/source/testing.textile +947 -0
- data/guides/w3c_validator.rb +91 -0
- data/lib/rails/all.rb +15 -0
- data/lib/rails/application/bootstrap.rb +73 -0
- data/lib/rails/application/configuration.rb +151 -0
- data/lib/rails/application/finisher.rb +98 -0
- data/lib/rails/application/railties.rb +13 -0
- data/lib/rails/application/route_inspector.rb +84 -0
- data/lib/rails/application/routes_reloader.rb +56 -0
- data/lib/rails/application.rb +320 -0
- data/lib/rails/backtrace_cleaner.rb +42 -0
- data/lib/rails/cli.rb +16 -0
- data/lib/rails/code_statistics.rb +118 -0
- data/lib/rails/commands/application.rb +38 -0
- data/lib/rails/commands/benchmarker.rb +34 -0
- data/lib/rails/commands/console.rb +55 -0
- data/lib/rails/commands/dbconsole.rb +123 -0
- data/lib/rails/commands/destroy.rb +10 -0
- data/lib/rails/commands/generate.rb +12 -0
- data/lib/rails/commands/plugin.rb +544 -0
- data/lib/rails/commands/plugin_new.rb +11 -0
- data/lib/rails/commands/profiler.rb +32 -0
- data/lib/rails/commands/runner.rb +54 -0
- data/lib/rails/commands/server.rb +100 -0
- data/lib/rails/commands/update.rb +9 -0
- data/lib/rails/commands.rb +104 -0
- data/lib/rails/configuration.rb +89 -0
- data/lib/rails/console/app.rb +36 -0
- data/lib/rails/console/helpers.rb +11 -0
- data/lib/rails/engine/commands.rb +43 -0
- data/lib/rails/engine/configuration.rb +84 -0
- data/lib/rails/engine/railties.rb +33 -0
- data/lib/rails/engine.rb +657 -0
- data/lib/rails/generators/actions.rb +325 -0
- data/lib/rails/generators/active_model.rb +78 -0
- data/lib/rails/generators/app_base.rb +281 -0
- data/lib/rails/generators/base.rb +390 -0
- data/lib/rails/generators/css/assets/assets_generator.rb +13 -0
- data/lib/rails/generators/css/assets/templates/stylesheet.css +4 -0
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +16 -0
- data/lib/rails/generators/erb/controller/controller_generator.rb +20 -0
- data/lib/rails/generators/erb/controller/templates/view.html.erb +2 -0
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +13 -0
- data/lib/rails/generators/erb/mailer/templates/view.text.erb +3 -0
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +29 -0
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +23 -0
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +6 -0
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +27 -0
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb +5 -0
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb +12 -0
- data/lib/rails/generators/erb.rb +21 -0
- data/lib/rails/generators/generated_attribute.rb +107 -0
- data/lib/rails/generators/js/assets/assets_generator.rb +13 -0
- data/lib/rails/generators/js/assets/templates/javascript.js +2 -0
- data/lib/rails/generators/migration.rb +68 -0
- data/lib/rails/generators/named_base.rb +202 -0
- data/lib/rails/generators/rails/app/USAGE +15 -0
- data/lib/rails/generators/rails/app/app_generator.rb +303 -0
- data/lib/rails/generators/rails/app/templates/Gemfile +26 -0
- data/lib/rails/generators/rails/app/templates/README +261 -0
- data/lib/rails/generators/rails/app/templates/Rakefile +7 -0
- data/lib/rails/generators/rails/app/templates/app/assets/images/rails.png +0 -0
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +17 -0
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +13 -0
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +3 -0
- data/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
- data/lib/rails/generators/rails/app/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +14 -0
- data/lib/rails/generators/rails/app/templates/config/application.rb +74 -0
- data/lib/rails/generators/rails/app/templates/config/boot.rb +6 -0
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +31 -0
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +86 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +62 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +33 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +43 -0
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +20 -0
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +54 -0
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +39 -0
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +55 -0
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +25 -0
- data/lib/rails/generators/rails/app/templates/config/environment.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +41 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +73 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +39 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +15 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +5 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +7 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +8 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +16 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +5 -0
- data/lib/rails/generators/rails/app/templates/config/routes.rb +58 -0
- data/lib/rails/generators/rails/app/templates/config.ru +4 -0
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -0
- data/lib/rails/generators/rails/app/templates/doc/README_FOR_APP +2 -0
- data/lib/rails/generators/rails/app/templates/gitignore +15 -0
- data/lib/rails/generators/rails/app/templates/public/404.html +26 -0
- data/lib/rails/generators/rails/app/templates/public/422.html +26 -0
- data/lib/rails/generators/rails/app/templates/public/500.html +25 -0
- data/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/lib/rails/generators/rails/app/templates/public/index.html +241 -0
- data/lib/rails/generators/rails/app/templates/public/robots.txt +5 -0
- data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/script/rails +5 -0
- data/lib/rails/generators/rails/app/templates/test/fixtures/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/functional/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/integration/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb +12 -0
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb +15 -0
- data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/rails/generators/rails/assets/USAGE +20 -0
- data/lib/rails/generators/rails/assets/assets_generator.rb +25 -0
- data/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
- data/lib/rails/generators/rails/controller/USAGE +18 -0
- data/lib/rails/generators/rails/controller/controller_generator.rb +20 -0
- data/lib/rails/generators/rails/controller/templates/controller.rb +13 -0
- data/lib/rails/generators/rails/generator/USAGE +12 -0
- data/lib/rails/generators/rails/generator/generator_generator.rb +25 -0
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
- data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/rails/generators/rails/helper/USAGE +17 -0
- data/lib/rails/generators/rails/helper/helper_generator.rb +13 -0
- data/lib/rails/generators/rails/helper/templates/helper.rb +4 -0
- data/lib/rails/generators/rails/integration_test/USAGE +10 -0
- data/lib/rails/generators/rails/integration_test/integration_test_generator.rb +7 -0
- data/lib/rails/generators/rails/migration/USAGE +29 -0
- data/lib/rails/generators/rails/migration/migration_generator.rb +8 -0
- data/lib/rails/generators/rails/model/USAGE +45 -0
- data/lib/rails/generators/rails/model/model_generator.rb +8 -0
- data/lib/rails/generators/rails/observer/USAGE +12 -0
- data/lib/rails/generators/rails/observer/observer_generator.rb +7 -0
- data/lib/rails/generators/rails/performance_test/USAGE +10 -0
- data/lib/rails/generators/rails/performance_test/performance_test_generator.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/USAGE +10 -0
- data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +318 -0
- data/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec +29 -0
- data/lib/rails/generators/rails/plugin_new/templates/Gemfile +23 -0
- data/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE +20 -0
- data/lib/rails/generators/rails/plugin_new/templates/README.rdoc +3 -0
- data/lib/rails/generators/rails/plugin_new/templates/Rakefile +31 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/mailers/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/models/.empty_directory +0 -0
- data/lib/rails/generators/rails/plugin_new/templates/app/views/layouts/%name%/application.html.erb.tt +14 -0
- data/lib/rails/generators/rails/plugin_new/templates/config/routes.rb +6 -0
- data/lib/rails/generators/rails/plugin_new/templates/gitignore +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/version.rb +3 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb +6 -0
- data/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +18 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb +10 -0
- data/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb +4 -0
- data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb +7 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb +12 -0
- data/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb +15 -0
- data/lib/rails/generators/rails/resource/USAGE +23 -0
- data/lib/rails/generators/rails/resource/resource_generator.rb +20 -0
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +50 -0
- data/lib/rails/generators/rails/scaffold/USAGE +35 -0
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +23 -0
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +56 -0
- data/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +25 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +89 -0
- data/lib/rails/generators/rails/session_migration/USAGE +8 -0
- data/lib/rails/generators/rails/session_migration/session_migration_generator.rb +8 -0
- data/lib/rails/generators/rails/task/USAGE +9 -0
- data/lib/rails/generators/rails/task/task_generator.rb +12 -0
- data/lib/rails/generators/rails/task/templates/task.rb +8 -0
- data/lib/rails/generators/resource_helpers.rb +80 -0
- data/lib/rails/generators/test_case.rb +247 -0
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +15 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +19 -0
- data/lib/rails/generators/test_unit/helper/helper_generator.rb +13 -0
- data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +6 -0
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +13 -0
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +7 -0
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +14 -0
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +21 -0
- data/lib/rails/generators/test_unit/model/model_generator.rb +24 -0
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml +23 -0
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb +9 -0
- data/lib/rails/generators/test_unit/observer/observer_generator.rb +13 -0
- data/lib/rails/generators/test_unit/observer/templates/unit_test.rb +9 -0
- data/lib/rails/generators/test_unit/performance/performance_generator.rb +13 -0
- data/lib/rails/generators/test_unit/performance/templates/performance_test.rb +12 -0
- data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +13 -0
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +3 -0
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +38 -0
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +51 -0
- data/lib/rails/generators/test_unit.rb +8 -0
- data/lib/rails/generators.rb +339 -0
- data/lib/rails/info.rb +116 -0
- data/lib/rails/info_controller.rb +15 -0
- data/lib/rails/initializable.rb +89 -0
- data/lib/rails/paths.rb +211 -0
- data/lib/rails/performance_test_help.rb +3 -0
- data/lib/rails/plugin.rb +92 -0
- data/lib/rails/rack/debugger.rb +24 -0
- data/lib/rails/rack/log_tailer.rb +34 -0
- data/lib/rails/rack/logger.rb +60 -0
- data/lib/rails/rack.rb +7 -0
- data/lib/rails/railtie/configurable.rb +35 -0
- data/lib/rails/railtie/configuration.rb +90 -0
- data/lib/rails/railtie.rb +202 -0
- data/lib/rails/ruby_version_check.rb +23 -0
- data/lib/rails/rubyprof_ext.rb +35 -0
- data/lib/rails/script_rails_loader.rb +29 -0
- data/lib/rails/source_annotation_extractor.rb +104 -0
- data/lib/rails/tasks/annotations.rake +20 -0
- data/lib/rails/tasks/documentation.rake +155 -0
- data/lib/rails/tasks/engine.rake +72 -0
- data/lib/rails/tasks/framework.rake +76 -0
- data/lib/rails/tasks/log.rake +9 -0
- data/lib/rails/tasks/middleware.rake +7 -0
- data/lib/rails/tasks/misc.rake +67 -0
- data/lib/rails/tasks/routes.rake +9 -0
- data/lib/rails/tasks/statistics.rake +16 -0
- data/lib/rails/tasks/tmp.rake +37 -0
- data/lib/rails/tasks.rb +16 -0
- data/lib/rails/test_help.rb +56 -0
- data/lib/rails/test_unit/railtie.rb +15 -0
- data/lib/rails/test_unit/sub_test_task.rb +8 -0
- data/lib/rails/test_unit/testing.rake +146 -0
- data/lib/rails/version.rb +10 -0
- data/lib/rails.rb +126 -0
- metadata +609 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
namespace :rails do
|
2
|
+
desc "Update configs and some other initially generated files (or use just update:configs, update:scripts, or update:application_controller)"
|
3
|
+
task :update => [ "update:configs", "update:scripts", "update:application_controller" ]
|
4
|
+
|
5
|
+
desc "Applies the template supplied by LOCATION=(/path/to/template) or URL"
|
6
|
+
task :template do
|
7
|
+
template = ENV["LOCATION"]
|
8
|
+
raise "No LOCATION value given. Please set LOCATION either as path to a file or a URL" if template.blank?
|
9
|
+
template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://}
|
10
|
+
require 'rails/generators'
|
11
|
+
require 'rails/generators/rails/app/app_generator'
|
12
|
+
generator = Rails::Generators::AppGenerator.new [Rails.root], {}, :destination_root => Rails.root
|
13
|
+
generator.apply template, :verbose => false
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace :templates do
|
17
|
+
# desc "Copy all the templates from rails to the application directory for customization. Already existing local copies will be overwritten"
|
18
|
+
task :copy do
|
19
|
+
generators_lib = File.expand_path("../../generators", __FILE__)
|
20
|
+
project_templates = "#{Rails.root}/lib/templates"
|
21
|
+
|
22
|
+
default_templates = { "erb" => %w{controller mailer scaffold},
|
23
|
+
"rails" => %w{controller helper scaffold_controller assets} }
|
24
|
+
|
25
|
+
default_templates.each do |type, names|
|
26
|
+
local_template_type_dir = File.join(project_templates, type)
|
27
|
+
FileUtils.mkdir_p local_template_type_dir
|
28
|
+
|
29
|
+
names.each do |name|
|
30
|
+
dst_name = File.join(local_template_type_dir, name)
|
31
|
+
src_name = File.join(generators_lib, type, name, "templates")
|
32
|
+
FileUtils.cp_r src_name, dst_name
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
namespace :update do
|
39
|
+
def invoke_from_app_generator(method)
|
40
|
+
app_generator.send(method)
|
41
|
+
end
|
42
|
+
|
43
|
+
def app_generator
|
44
|
+
@app_generator ||= begin
|
45
|
+
require 'rails/generators'
|
46
|
+
require 'rails/generators/rails/app/app_generator'
|
47
|
+
gen = Rails::Generators::AppGenerator.new ["rails"], { :with_dispatchers => true },
|
48
|
+
:destination_root => Rails.root
|
49
|
+
File.exists?(Rails.root.join("config", "application.rb")) ?
|
50
|
+
gen.send(:app_const) : gen.send(:valid_app_const?)
|
51
|
+
gen
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# desc "Update config/boot.rb from your current rails install"
|
56
|
+
task :configs do
|
57
|
+
invoke_from_app_generator :create_boot_file
|
58
|
+
invoke_from_app_generator :create_config_files
|
59
|
+
end
|
60
|
+
|
61
|
+
# desc "Adds new scripts to the application script/ directory"
|
62
|
+
task :scripts do
|
63
|
+
invoke_from_app_generator :create_script_files
|
64
|
+
end
|
65
|
+
|
66
|
+
# desc "Rename application.rb to application_controller.rb"
|
67
|
+
task :application_controller do
|
68
|
+
old_style = Rails.root + '/app/controllers/application.rb'
|
69
|
+
new_style = Rails.root + '/app/controllers/application_controller.rb'
|
70
|
+
if File.exists?(old_style) && !File.exists?(new_style)
|
71
|
+
FileUtils.mv(old_style, new_style)
|
72
|
+
puts "#{old_style} has been renamed to #{new_style}, update your SCM as necessary"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
task :rails_env do
|
2
|
+
# TODO Do we really need this?
|
3
|
+
unless defined? RAILS_ENV
|
4
|
+
RAILS_ENV = ENV['RAILS_ENV'] ||= 'development'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions).'
|
9
|
+
task :secret do
|
10
|
+
require 'securerandom'
|
11
|
+
puts SecureRandom.hex(64)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc 'List versions of all Rails frameworks and the environment'
|
15
|
+
task :about => :environment do
|
16
|
+
puts Rails::Info
|
17
|
+
end
|
18
|
+
|
19
|
+
namespace :time do
|
20
|
+
namespace :zones do
|
21
|
+
desc 'Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6'
|
22
|
+
task :all do
|
23
|
+
build_time_zone_list(:all)
|
24
|
+
end
|
25
|
+
|
26
|
+
# desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
|
27
|
+
task :us do
|
28
|
+
build_time_zone_list(:us_zones)
|
29
|
+
end
|
30
|
+
|
31
|
+
# desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time'
|
32
|
+
task :local do
|
33
|
+
require 'active_support'
|
34
|
+
require 'active_support/time'
|
35
|
+
jan_offset = Time.now.beginning_of_year.utc_offset
|
36
|
+
jul_offset = Time.now.beginning_of_year.change(:month => 7).utc_offset
|
37
|
+
offset = jan_offset < jul_offset ? jan_offset : jul_offset
|
38
|
+
build_time_zone_list(:all, offset)
|
39
|
+
end
|
40
|
+
|
41
|
+
# to find UTC -06:00 zones, OFFSET can be set to either -6, -6:00 or 21600
|
42
|
+
def build_time_zone_list(method, offset = ENV['OFFSET'])
|
43
|
+
require 'active_support'
|
44
|
+
require 'active_support/time'
|
45
|
+
if offset
|
46
|
+
offset = if offset.to_s.match(/(\+|-)?(\d+):(\d+)/)
|
47
|
+
sign = $1 == '-' ? -1 : 1
|
48
|
+
hours, minutes = $2.to_f, $3.to_f
|
49
|
+
((hours * 3600) + (minutes.to_f * 60)) * sign
|
50
|
+
elsif offset.to_f.abs <= 13
|
51
|
+
offset.to_f * 3600
|
52
|
+
else
|
53
|
+
offset.to_f
|
54
|
+
end
|
55
|
+
end
|
56
|
+
previous_offset = nil
|
57
|
+
ActiveSupport::TimeZone.__send__(method).each do |zone|
|
58
|
+
if offset.nil? || offset == zone.utc_offset
|
59
|
+
puts "\n* UTC #{zone.formatted_offset} *" unless zone.utc_offset == previous_offset
|
60
|
+
puts zone.name
|
61
|
+
previous_offset = zone.utc_offset
|
62
|
+
end
|
63
|
+
end
|
64
|
+
puts "\n"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
|
2
|
+
task :routes => :environment do
|
3
|
+
Rails.application.reload_routes!
|
4
|
+
all_routes = Rails.application.routes.routes
|
5
|
+
|
6
|
+
require 'rails/application/route_inspector'
|
7
|
+
inspector = Rails::Application::RouteInspector.new
|
8
|
+
puts inspector.format(all_routes, ENV['CONTROLLER']).join "\n"
|
9
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
STATS_DIRECTORIES = [
|
2
|
+
%w(Controllers app/controllers),
|
3
|
+
%w(Helpers app/helpers),
|
4
|
+
%w(Models app/models),
|
5
|
+
%w(Libraries lib/),
|
6
|
+
%w(APIs app/apis),
|
7
|
+
%w(Integration\ tests test/integration),
|
8
|
+
%w(Functional\ tests test/functional),
|
9
|
+
%w(Unit\ tests test/unit)
|
10
|
+
].collect { |name, dir| [ name, "#{Rails.root}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
|
11
|
+
|
12
|
+
desc "Report code statistics (KLOCs, etc) from the application"
|
13
|
+
task :stats do
|
14
|
+
require 'rails/code_statistics'
|
15
|
+
CodeStatistics.new(*STATS_DIRECTORIES).to_s
|
16
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
namespace :tmp do
|
2
|
+
desc "Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)"
|
3
|
+
task :clear => [ "tmp:sessions:clear", "tmp:cache:clear", "tmp:sockets:clear"]
|
4
|
+
|
5
|
+
desc "Creates tmp directories for sessions, cache, sockets, and pids"
|
6
|
+
task :create do
|
7
|
+
FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets tmp/pids tmp/cache/assets ))
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :sessions do
|
11
|
+
# desc "Clears all files in tmp/sessions"
|
12
|
+
task :clear do
|
13
|
+
FileUtils.rm(Dir['tmp/sessions/[^.]*'])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :cache do
|
18
|
+
# desc "Clears all files and directories in tmp/cache"
|
19
|
+
task :clear do
|
20
|
+
FileUtils.rm_rf(Dir['tmp/cache/[^.]*'])
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
namespace :sockets do
|
25
|
+
# desc "Clears all files in tmp/sockets"
|
26
|
+
task :clear do
|
27
|
+
FileUtils.rm(Dir['tmp/sockets/[^.]*'])
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
namespace :pids do
|
32
|
+
# desc "Clears all files in tmp/pids"
|
33
|
+
task :clear do
|
34
|
+
FileUtils.rm(Dir['tmp/pids/[^.]*'])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/rails/tasks.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Make double-sure the RAILS_ENV is not set to production,
|
2
|
+
# so fixtures aren't loaded into that environment
|
3
|
+
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'active_support/test_case'
|
7
|
+
require 'action_controller/test_case'
|
8
|
+
require 'action_dispatch/testing/integration'
|
9
|
+
|
10
|
+
if defined?(Test::Unit::Util::BacktraceFilter) && ENV['BACKTRACE'].nil?
|
11
|
+
require 'rails/backtrace_cleaner'
|
12
|
+
Test::Unit::Util::BacktraceFilter.module_eval { include Rails::BacktraceFilterForTestUnit }
|
13
|
+
end
|
14
|
+
|
15
|
+
if defined?(MiniTest)
|
16
|
+
# Enable turn if it is available
|
17
|
+
begin
|
18
|
+
require 'turn'
|
19
|
+
|
20
|
+
Turn.config do |c|
|
21
|
+
c.natural = true
|
22
|
+
end
|
23
|
+
rescue LoadError
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if defined?(ActiveRecord::Base)
|
28
|
+
require 'active_record/test_case'
|
29
|
+
|
30
|
+
class ActiveSupport::TestCase
|
31
|
+
include ActiveRecord::TestFixtures
|
32
|
+
self.fixture_path = "#{Rails.root}/test/fixtures/"
|
33
|
+
|
34
|
+
setup do
|
35
|
+
ActiveRecord::IdentityMap.clear
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
ActionDispatch::IntegrationTest.fixture_path = ActiveSupport::TestCase.fixture_path
|
40
|
+
|
41
|
+
def create_fixtures(*table_names, &block)
|
42
|
+
Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names, {}, &block)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class ActionController::TestCase
|
47
|
+
setup do
|
48
|
+
@routes = Rails.application.routes
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
class ActionDispatch::IntegrationTest
|
53
|
+
setup do
|
54
|
+
@routes = Rails.application.routes
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Rails
|
2
|
+
class TestUnitRailtie < Rails::Railtie
|
3
|
+
config.app_generators do |c|
|
4
|
+
c.test_framework :test_unit, :fixture => true,
|
5
|
+
:fixture_replacement => nil
|
6
|
+
|
7
|
+
c.integration_tool :test_unit
|
8
|
+
c.performance_tool :test_unit
|
9
|
+
end
|
10
|
+
|
11
|
+
rake_tasks do
|
12
|
+
load "rails/test_unit/testing.rake"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rails/test_unit/sub_test_task'
|
4
|
+
|
5
|
+
TEST_CHANGES_SINCE = Time.now - 600
|
6
|
+
|
7
|
+
# Look up tests for recently modified sources.
|
8
|
+
def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
|
9
|
+
FileList[source_pattern].map do |path|
|
10
|
+
if File.mtime(path) > touched_since
|
11
|
+
tests = []
|
12
|
+
source_dir = File.dirname(path).split("/")
|
13
|
+
source_file = File.basename(path, '.rb')
|
14
|
+
|
15
|
+
# Support subdirs in app/models and app/controllers
|
16
|
+
modified_test_path = source_dir.length > 2 ? "#{test_path}/" << source_dir[1..source_dir.length].join('/') : test_path
|
17
|
+
|
18
|
+
# For modified files in app/ run the tests for it. ex. /test/functional/account_controller.rb
|
19
|
+
test = "#{modified_test_path}/#{source_file}_test.rb"
|
20
|
+
tests.push test if File.exist?(test)
|
21
|
+
|
22
|
+
# For modified files in app, run tests in subdirs too. ex. /test/functional/account/*_test.rb
|
23
|
+
test = "#{modified_test_path}/#{File.basename(path, '.rb').sub("_controller","")}"
|
24
|
+
FileList["#{test}/*_test.rb"].each { |f| tests.push f } if File.exist?(test)
|
25
|
+
|
26
|
+
return tests
|
27
|
+
|
28
|
+
end
|
29
|
+
end.flatten.compact
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
# Recreated here from Active Support because :uncommitted needs it before Rails is available
|
34
|
+
module Kernel
|
35
|
+
remove_method :silence_stderr # Removing old method to prevent method redefined warning
|
36
|
+
def silence_stderr
|
37
|
+
old_stderr = STDERR.dup
|
38
|
+
STDERR.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
|
39
|
+
STDERR.sync = true
|
40
|
+
yield
|
41
|
+
ensure
|
42
|
+
STDERR.reopen(old_stderr)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
task :default => :test
|
47
|
+
|
48
|
+
desc 'Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)'
|
49
|
+
task :test do
|
50
|
+
Rake::Task[ENV['TEST'] ? 'test:single' : 'test:run'].invoke
|
51
|
+
end
|
52
|
+
|
53
|
+
namespace :test do
|
54
|
+
task :prepare do
|
55
|
+
# Placeholder task for other Railtie and plugins to enhance. See Active Record for an example.
|
56
|
+
end
|
57
|
+
|
58
|
+
task :run do
|
59
|
+
errors = %w(test:units test:functionals test:integration).collect do |task|
|
60
|
+
begin
|
61
|
+
Rake::Task[task].invoke
|
62
|
+
nil
|
63
|
+
rescue => e
|
64
|
+
{ :task => task, :exception => e }
|
65
|
+
end
|
66
|
+
end.compact
|
67
|
+
|
68
|
+
if errors.any?
|
69
|
+
puts errors.map { |e| "Errors running #{e[:task]}! #{e[:exception].inspect}" }.join("\n")
|
70
|
+
abort
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
Rake::TestTask.new(:recent => "test:prepare") do |t|
|
75
|
+
since = TEST_CHANGES_SINCE
|
76
|
+
touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
|
77
|
+
recent_tests('app/models/**/*.rb', 'test/unit', since) +
|
78
|
+
recent_tests('app/controllers/**/*.rb', 'test/functional', since)
|
79
|
+
|
80
|
+
t.libs << 'test'
|
81
|
+
t.test_files = touched.uniq
|
82
|
+
end
|
83
|
+
Rake::Task['test:recent'].comment = "Test recent changes"
|
84
|
+
|
85
|
+
Rake::TestTask.new(:uncommitted => "test:prepare") do |t|
|
86
|
+
def t.file_list
|
87
|
+
if File.directory?(".svn")
|
88
|
+
changed_since_checkin = silence_stderr { `svn status` }.split.map { |path| path.chomp[7 .. -1] }
|
89
|
+
elsif File.directory?(".git")
|
90
|
+
changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.split.map { |path| path.chomp }
|
91
|
+
else
|
92
|
+
abort "Not a Subversion or Git checkout."
|
93
|
+
end
|
94
|
+
|
95
|
+
models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb$/ }
|
96
|
+
controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb$/ }
|
97
|
+
|
98
|
+
unit_tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" }
|
99
|
+
functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.rb" }
|
100
|
+
(unit_tests + functional_tests).uniq.select { |file| File.exist?(file) }
|
101
|
+
end
|
102
|
+
|
103
|
+
t.libs << 'test'
|
104
|
+
end
|
105
|
+
Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion and Git)"
|
106
|
+
|
107
|
+
Rake::TestTask.new(:single => "test:prepare") do |t|
|
108
|
+
t.libs << "test"
|
109
|
+
end
|
110
|
+
|
111
|
+
Rails::SubTestTask.new(:units => "test:prepare") do |t|
|
112
|
+
t.libs << "test"
|
113
|
+
t.pattern = 'test/unit/**/*_test.rb'
|
114
|
+
end
|
115
|
+
|
116
|
+
Rails::SubTestTask.new(:functionals => "test:prepare") do |t|
|
117
|
+
t.libs << "test"
|
118
|
+
t.pattern = 'test/functional/**/*_test.rb'
|
119
|
+
end
|
120
|
+
|
121
|
+
Rails::SubTestTask.new(:integration => "test:prepare") do |t|
|
122
|
+
t.libs << "test"
|
123
|
+
t.pattern = 'test/integration/**/*_test.rb'
|
124
|
+
end
|
125
|
+
|
126
|
+
Rails::SubTestTask.new(:benchmark => 'test:prepare') do |t|
|
127
|
+
t.libs << 'test'
|
128
|
+
t.pattern = 'test/performance/**/*_test.rb'
|
129
|
+
t.options = '-- --benchmark'
|
130
|
+
end
|
131
|
+
|
132
|
+
Rails::SubTestTask.new(:profile => 'test:prepare') do |t|
|
133
|
+
t.libs << 'test'
|
134
|
+
t.pattern = 'test/performance/**/*_test.rb'
|
135
|
+
end
|
136
|
+
|
137
|
+
Rails::SubTestTask.new(:plugins => :environment) do |t|
|
138
|
+
t.libs << "test"
|
139
|
+
|
140
|
+
if ENV['PLUGIN']
|
141
|
+
t.pattern = "vendor/plugins/#{ENV['PLUGIN']}/test/**/*_test.rb"
|
142
|
+
else
|
143
|
+
t.pattern = 'vendor/plugins/*/**/test/**/*_test.rb'
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
data/lib/rails.rb
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'rails/ruby_version_check'
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
require 'active_support'
|
6
|
+
require 'active_support/core_ext/kernel/reporting'
|
7
|
+
require 'active_support/core_ext/array/extract_options'
|
8
|
+
require 'active_support/core_ext/logger'
|
9
|
+
|
10
|
+
require 'rails/application'
|
11
|
+
require 'rails/version'
|
12
|
+
|
13
|
+
require 'active_support/railtie'
|
14
|
+
require 'action_dispatch/railtie'
|
15
|
+
|
16
|
+
# For Ruby 1.8, this initialization sets $KCODE to 'u' to enable the
|
17
|
+
# multibyte safe operations. Plugin authors supporting other encodings
|
18
|
+
# should override this behavior and set the relevant +default_charset+
|
19
|
+
# on ActionController::Base.
|
20
|
+
#
|
21
|
+
# For Ruby 1.9, UTF-8 is the default internal and external encoding.
|
22
|
+
if RUBY_VERSION < '1.9'
|
23
|
+
$KCODE='u'
|
24
|
+
else
|
25
|
+
silence_warnings do
|
26
|
+
Encoding.default_external = Encoding::UTF_8
|
27
|
+
Encoding.default_internal = Encoding::UTF_8
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module Rails
|
32
|
+
autoload :Info, 'rails/info'
|
33
|
+
autoload :InfoController, 'rails/info_controller'
|
34
|
+
|
35
|
+
class << self
|
36
|
+
def application
|
37
|
+
@@application ||= nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def application=(application)
|
41
|
+
@@application = application
|
42
|
+
end
|
43
|
+
|
44
|
+
# The Configuration instance used to configure the Rails environment
|
45
|
+
def configuration
|
46
|
+
application.config
|
47
|
+
end
|
48
|
+
|
49
|
+
def initialize!
|
50
|
+
application.initialize!
|
51
|
+
end
|
52
|
+
|
53
|
+
def initialized?
|
54
|
+
@@initialized || false
|
55
|
+
end
|
56
|
+
|
57
|
+
def initialized=(initialized)
|
58
|
+
@@initialized ||= initialized
|
59
|
+
end
|
60
|
+
|
61
|
+
def logger
|
62
|
+
@@logger ||= nil
|
63
|
+
end
|
64
|
+
|
65
|
+
def logger=(logger)
|
66
|
+
@@logger = logger
|
67
|
+
end
|
68
|
+
|
69
|
+
def backtrace_cleaner
|
70
|
+
@@backtrace_cleaner ||= begin
|
71
|
+
# Relies on Active Support, so we have to lazy load to postpone definition until AS has been loaded
|
72
|
+
require 'rails/backtrace_cleaner'
|
73
|
+
Rails::BacktraceCleaner.new
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def root
|
78
|
+
application && application.config.root
|
79
|
+
end
|
80
|
+
|
81
|
+
def env
|
82
|
+
@_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development")
|
83
|
+
end
|
84
|
+
|
85
|
+
def env=(environment)
|
86
|
+
@_env = ActiveSupport::StringInquirer.new(environment)
|
87
|
+
end
|
88
|
+
|
89
|
+
def cache
|
90
|
+
RAILS_CACHE
|
91
|
+
end
|
92
|
+
|
93
|
+
# Returns all rails groups for loading based on:
|
94
|
+
#
|
95
|
+
# * The Rails environment;
|
96
|
+
# * The environment variable RAILS_GROUPS;
|
97
|
+
# * The optional envs given as argument and the hash with group dependencies;
|
98
|
+
#
|
99
|
+
# == Examples
|
100
|
+
#
|
101
|
+
# groups :assets => [:development, :test]
|
102
|
+
#
|
103
|
+
# # Returns
|
104
|
+
# # => [:default, :development, :assets] for Rails.env == "development"
|
105
|
+
# # => [:default, :production] for Rails.env == "production"
|
106
|
+
#
|
107
|
+
def groups(*groups)
|
108
|
+
hash = groups.extract_options!
|
109
|
+
env = Rails.env
|
110
|
+
groups.unshift(:default, env)
|
111
|
+
groups.concat ENV["RAILS_GROUPS"].to_s.split(",")
|
112
|
+
groups.concat hash.map { |k,v| k if v.map(&:to_s).include?(env) }
|
113
|
+
groups.compact!
|
114
|
+
groups.uniq!
|
115
|
+
groups
|
116
|
+
end
|
117
|
+
|
118
|
+
def version
|
119
|
+
VERSION::STRING
|
120
|
+
end
|
121
|
+
|
122
|
+
def public_path
|
123
|
+
application && application.paths["public"].first
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|