openskies 0.0.5.2 → 0.0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +0 -87
- data/bin/openskies +31 -5
- metadata +4 -593
- 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 +0 -5
- 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 +0 -7
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
- data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
- data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +0 -97
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
- data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
- data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
- data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
- data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
- data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
- data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
- data/guides/assets/javascripts/syntaxhighlighter/shCore.js +0 -17
- data/guides/assets/stylesheets/fixes.css +0 -16
- data/guides/assets/stylesheets/kindle.css +0 -11
- data/guides/assets/stylesheets/main.css +0 -453
- data/guides/assets/stylesheets/print.css +0 -52
- data/guides/assets/stylesheets/reset.css +0 -43
- data/guides/assets/stylesheets/style.css +0 -13
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +0 -226
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +0 -116
- data/guides/code/getting_started/Gemfile +0 -38
- data/guides/code/getting_started/README.rdoc +0 -261
- data/guides/code/getting_started/Rakefile +0 -7
- data/guides/code/getting_started/app/assets/images/rails.png +0 -0
- data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/home.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/home.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/scaffolds.css.scss +0 -56
- data/guides/code/getting_started/app/controllers/application_controller.rb +0 -3
- data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -16
- data/guides/code/getting_started/app/controllers/home_controller.rb +0 -5
- data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -84
- data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/home_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -5
- data/guides/code/getting_started/app/models/comment.rb +0 -3
- data/guides/code/getting_started/app/models/post.rb +0 -11
- data/guides/code/getting_started/app/models/tag.rb +0 -3
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
- data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
- data/guides/code/getting_started/app/views/home/index.html.erb +0 -2
- data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
- data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -32
- data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -6
- data/guides/code/getting_started/app/views/posts/index.html.erb +0 -27
- data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
- data/guides/code/getting_started/app/views/posts/show.html.erb +0 -31
- data/guides/code/getting_started/app/views/tags/_form.html.erb +0 -12
- data/guides/code/getting_started/config/application.rb +0 -59
- data/guides/code/getting_started/config/boot.rb +0 -6
- data/guides/code/getting_started/config/database.yml +0 -25
- data/guides/code/getting_started/config/environment.rb +0 -5
- data/guides/code/getting_started/config/environments/development.rb +0 -37
- data/guides/code/getting_started/config/environments/production.rb +0 -67
- data/guides/code/getting_started/config/environments/test.rb +0 -37
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
- data/guides/code/getting_started/config/initializers/inflections.rb +0 -15
- data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
- data/guides/code/getting_started/config/initializers/secret_token.rb +0 -7
- data/guides/code/getting_started/config/initializers/session_store.rb +0 -8
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
- data/guides/code/getting_started/config/locales/en.yml +0 -5
- data/guides/code/getting_started/config/routes.rb +0 -64
- data/guides/code/getting_started/config.ru +0 -4
- data/guides/code/getting_started/db/migrate/20110901012504_create_posts.rb +0 -11
- data/guides/code/getting_started/db/migrate/20110901012815_create_comments.rb +0 -12
- data/guides/code/getting_started/db/migrate/20110901013701_create_tags.rb +0 -11
- data/guides/code/getting_started/db/schema.rb +0 -43
- data/guides/code/getting_started/db/seeds.rb +0 -7
- data/guides/code/getting_started/doc/README_FOR_APP +0 -2
- data/guides/code/getting_started/public/404.html +0 -26
- data/guides/code/getting_started/public/422.html +0 -26
- data/guides/code/getting_started/public/500.html +0 -25
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +0 -5
- data/guides/code/getting_started/script/rails +0 -6
- data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
- data/guides/code/getting_started/test/fixtures/posts.yml +0 -11
- data/guides/code/getting_started/test/fixtures/tags.yml +0 -9
- data/guides/code/getting_started/test/functional/comments_controller_test.rb +0 -7
- data/guides/code/getting_started/test/functional/home_controller_test.rb +0 -9
- data/guides/code/getting_started/test/functional/posts_controller_test.rb +0 -49
- data/guides/code/getting_started/test/performance/browsing_test.rb +0 -12
- data/guides/code/getting_started/test/test_helper.rb +0 -13
- data/guides/code/getting_started/test/unit/comment_test.rb +0 -7
- data/guides/code/getting_started/test/unit/helpers/comments_helper_test.rb +0 -4
- data/guides/code/getting_started/test/unit/helpers/home_helper_test.rb +0 -4
- data/guides/code/getting_started/test/unit/helpers/posts_helper_test.rb +0 -4
- data/guides/code/getting_started/test/unit/post_test.rb +0 -7
- data/guides/code/getting_started/test/unit/tag_test.rb +0 -7
- data/guides/rails_guides/generator.rb +0 -310
- data/guides/rails_guides/helpers.rb +0 -45
- data/guides/rails_guides/indexer.rb +0 -69
- data/guides/rails_guides/levenshtein.rb +0 -31
- data/guides/rails_guides/textile_extensions.rb +0 -63
- data/guides/rails_guides.rb +0 -50
- data/guides/source/2_2_release_notes.textile +0 -422
- data/guides/source/2_3_release_notes.textile +0 -610
- data/guides/source/3_0_release_notes.textile +0 -595
- data/guides/source/3_1_release_notes.textile +0 -553
- data/guides/source/3_2_release_notes.textile +0 -540
- data/guides/source/_license.html.erb +0 -2
- data/guides/source/_welcome.html.erb +0 -19
- data/guides/source/action_controller_overview.textile +0 -820
- data/guides/source/action_mailer_basics.textile +0 -516
- data/guides/source/action_view_overview.textile +0 -1497
- data/guides/source/active_model_basics.textile +0 -205
- data/guides/source/active_record_basics.textile +0 -218
- data/guides/source/active_record_querying.textile +0 -1433
- data/guides/source/active_record_validations_callbacks.textile +0 -1283
- data/guides/source/active_resource_basics.textile +0 -120
- data/guides/source/active_support_core_extensions.textile +0 -3713
- data/guides/source/ajax_on_rails.textile +0 -267
- data/guides/source/api_documentation_guidelines.textile +0 -185
- data/guides/source/asset_pipeline.textile +0 -707
- data/guides/source/association_basics.textile +0 -1959
- data/guides/source/caching_with_rails.textile +0 -437
- data/guides/source/command_line.textile +0 -574
- data/guides/source/configuring.textile +0 -641
- data/guides/source/contributing_to_ruby_on_rails.textile +0 -448
- data/guides/source/credits.html.erb +0 -72
- data/guides/source/debugging_rails_applications.textile +0 -714
- data/guides/source/documents.yaml +0 -157
- data/guides/source/engines.textile +0 -618
- data/guides/source/form_helpers.textile +0 -798
- data/guides/source/generators.textile +0 -621
- data/guides/source/getting_started.textile +0 -1929
- data/guides/source/i18n.textile +0 -931
- data/guides/source/index.html.erb +0 -30
- data/guides/source/initialization.textile +0 -1116
- data/guides/source/kindle/KINDLE.md +0 -26
- data/guides/source/kindle/copyright.html.erb +0 -1
- data/guides/source/kindle/layout.html.erb +0 -27
- data/guides/source/kindle/rails_guides.opf.erb +0 -52
- data/guides/source/kindle/toc.html.erb +0 -24
- data/guides/source/kindle/toc.ncx.erb +0 -64
- data/guides/source/kindle/welcome.html.erb +0 -5
- data/guides/source/layout.html.erb +0 -124
- data/guides/source/layouts_and_rendering.textile +0 -1237
- data/guides/source/migrations.textile +0 -900
- data/guides/source/nested_model_forms.textile +0 -222
- data/guides/source/performance_testing.textile +0 -597
- data/guides/source/plugins.textile +0 -464
- data/guides/source/rails_application_templates.textile +0 -240
- data/guides/source/rails_on_rack.textile +0 -236
- data/guides/source/routing.textile +0 -885
- data/guides/source/ruby_on_rails_guides_guidelines.textile +0 -79
- data/guides/source/security.textile +0 -1004
- data/guides/source/testing.textile +0 -947
- data/guides/w3c_validator.rb +0 -91
- data/lib/rails/all.rb +0 -15
- data/lib/rails/application/bootstrap.rb +0 -73
- data/lib/rails/application/configuration.rb +0 -151
- data/lib/rails/application/finisher.rb +0 -98
- data/lib/rails/application/railties.rb +0 -13
- data/lib/rails/application/route_inspector.rb +0 -84
- data/lib/rails/application/routes_reloader.rb +0 -56
- data/lib/rails/application.rb +0 -320
- data/lib/rails/backtrace_cleaner.rb +0 -42
- data/lib/rails/cli.rb +0 -16
- data/lib/rails/code_statistics.rb +0 -118
- data/lib/rails/commands/application.rb +0 -36
- data/lib/rails/commands/benchmarker.rb +0 -34
- data/lib/rails/commands/console.rb +0 -55
- data/lib/rails/commands/dbconsole.rb +0 -123
- data/lib/rails/commands/destroy.rb +0 -10
- data/lib/rails/commands/generate.rb +0 -12
- data/lib/rails/commands/plugin.rb +0 -544
- data/lib/rails/commands/plugin_new.rb +0 -11
- data/lib/rails/commands/profiler.rb +0 -32
- data/lib/rails/commands/runner.rb +0 -54
- data/lib/rails/commands/server.rb +0 -100
- data/lib/rails/commands/update.rb +0 -9
- data/lib/rails/commands.rb +0 -104
- data/lib/rails/configuration.rb +0 -89
- data/lib/rails/console/app.rb +0 -36
- data/lib/rails/console/helpers.rb +0 -11
- data/lib/rails/engine/commands.rb +0 -43
- data/lib/rails/engine/configuration.rb +0 -84
- data/lib/rails/engine/railties.rb +0 -33
- data/lib/rails/engine.rb +0 -657
- data/lib/rails/generators/actions.rb +0 -325
- data/lib/rails/generators/active_model.rb +0 -78
- data/lib/rails/generators/app_base.rb +0 -266
- data/lib/rails/generators/base.rb +0 -390
- data/lib/rails/generators/css/assets/assets_generator.rb +0 -13
- data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -16
- data/lib/rails/generators/erb/controller/controller_generator.rb +0 -20
- data/lib/rails/generators/erb/controller/templates/view.html.erb +0 -2
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +0 -13
- data/lib/rails/generators/erb/mailer/templates/view.text.erb +0 -3
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +0 -29
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb +0 -23
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb +0 -6
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb +0 -27
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb +0 -5
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb +0 -12
- data/lib/rails/generators/erb.rb +0 -21
- data/lib/rails/generators/generated_attribute.rb +0 -107
- data/lib/rails/generators/js/assets/assets_generator.rb +0 -13
- data/lib/rails/generators/js/assets/templates/javascript.js +0 -2
- data/lib/rails/generators/migration.rb +0 -68
- data/lib/rails/generators/named_base.rb +0 -202
- data/lib/rails/generators/rails/app/USAGE +0 -15
- data/lib/rails/generators/rails/app/app_generator.rb +0 -312
- data/lib/rails/generators/rails/app/templates/Gemfile +0 -21
- data/lib/rails/generators/rails/app/templates/README +0 -261
- data/lib/rails/generators/rails/app/templates/Rakefile +0 -7
- 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 +0 -17
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +0 -13
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb +0 -3
- data/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +0 -2
- 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 +0 -14
- data/lib/rails/generators/rails/app/templates/config/application.rb +0 -68
- data/lib/rails/generators/rails/app/templates/config/boot.rb +0 -6
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +0 -31
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +0 -86
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +0 -62
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +0 -33
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +0 -43
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +0 -20
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +0 -54
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +0 -39
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +0 -55
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +0 -25
- data/lib/rails/generators/rails/app/templates/config/environment.rb +0 -5
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +0 -41
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +0 -73
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +0 -39
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +0 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +0 -15
- data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +0 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/secret_token.rb.tt +0 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +0 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +0 -5
- data/lib/rails/generators/rails/app/templates/config/routes.rb +0 -58
- data/lib/rails/generators/rails/app/templates/config.ru +0 -4
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +0 -7
- data/lib/rails/generators/rails/app/templates/doc/README_FOR_APP +0 -2
- data/lib/rails/generators/rails/app/templates/gitignore +0 -15
- data/lib/rails/generators/rails/app/templates/public/404.html +0 -26
- data/lib/rails/generators/rails/app/templates/public/422.html +0 -26
- data/lib/rails/generators/rails/app/templates/public/500.html +0 -25
- data/lib/rails/generators/rails/app/templates/public/robots.txt +0 -5
- data/lib/rails/generators/rails/app/templates/public/stylesheets/.empty_directory +0 -0
- data/lib/rails/generators/rails/app/templates/script/openskies +0 -5
- 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 +0 -12
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb +0 -15
- data/lib/rails/generators/rails/app/templates/test/unit/.empty_directory +0 -0
- data/lib/rails/generators/rails/assets/USAGE +0 -20
- data/lib/rails/generators/rails/assets/assets_generator.rb +0 -25
- data/lib/rails/generators/rails/assets/templates/javascript.js +0 -2
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/rails/controller/USAGE +0 -18
- data/lib/rails/generators/rails/controller/controller_generator.rb +0 -20
- data/lib/rails/generators/rails/controller/templates/controller.rb +0 -13
- data/lib/rails/generators/rails/generator/USAGE +0 -12
- data/lib/rails/generators/rails/generator/generator_generator.rb +0 -25
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +0 -3
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +0 -8
- data/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/lib/rails/generators/rails/helper/USAGE +0 -17
- data/lib/rails/generators/rails/helper/helper_generator.rb +0 -13
- data/lib/rails/generators/rails/helper/templates/helper.rb +0 -4
- data/lib/rails/generators/rails/integration_test/USAGE +0 -10
- data/lib/rails/generators/rails/integration_test/integration_test_generator.rb +0 -7
- data/lib/rails/generators/rails/migration/USAGE +0 -29
- data/lib/rails/generators/rails/migration/migration_generator.rb +0 -8
- data/lib/rails/generators/rails/model/USAGE +0 -45
- data/lib/rails/generators/rails/model/model_generator.rb +0 -8
- data/lib/rails/generators/rails/observer/USAGE +0 -12
- data/lib/rails/generators/rails/observer/observer_generator.rb +0 -7
- data/lib/rails/generators/rails/performance_test/USAGE +0 -10
- data/lib/rails/generators/rails/performance_test/performance_test_generator.rb +0 -7
- data/lib/rails/generators/rails/plugin_new/USAGE +0 -10
- data/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb +0 -318
- data/lib/rails/generators/rails/plugin_new/templates/%name%.gemspec +0 -29
- data/lib/rails/generators/rails/plugin_new/templates/Gemfile +0 -23
- data/lib/rails/generators/rails/plugin_new/templates/MIT-LICENSE +0 -20
- data/lib/rails/generators/rails/plugin_new/templates/README.rdoc +0 -3
- data/lib/rails/generators/rails/plugin_new/templates/Rakefile +0 -31
- data/lib/rails/generators/rails/plugin_new/templates/app/controllers/%name%/application_controller.rb.tt +0 -4
- data/lib/rails/generators/rails/plugin_new/templates/app/helpers/%name%/application_helper.rb.tt +0 -4
- 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 +0 -14
- data/lib/rails/generators/rails/plugin_new/templates/config/routes.rb +0 -6
- data/lib/rails/generators/rails/plugin_new/templates/gitignore +0 -7
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb +0 -7
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%/version.rb +0 -3
- data/lib/rails/generators/rails/plugin_new/templates/lib/%name%.rb +0 -6
- data/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake +0 -4
- data/lib/rails/generators/rails/plugin_new/templates/rails/application.rb +0 -18
- data/lib/rails/generators/rails/plugin_new/templates/rails/boot.rb +0 -10
- data/lib/rails/generators/rails/plugin_new/templates/rails/routes.rb +0 -4
- data/lib/rails/generators/rails/plugin_new/templates/script/rails.tt +0 -7
- data/lib/rails/generators/rails/plugin_new/templates/test/%name%_test.rb +0 -7
- data/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb +0 -12
- data/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb +0 -15
- data/lib/rails/generators/rails/resource/USAGE +0 -23
- data/lib/rails/generators/rails/resource/resource_generator.rb +0 -20
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +0 -50
- data/lib/rails/generators/rails/scaffold/USAGE +0 -35
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +0 -23
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -56
- data/lib/rails/generators/rails/scaffold_controller/USAGE +0 -19
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +0 -25
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +0 -89
- data/lib/rails/generators/rails/session_migration/USAGE +0 -8
- data/lib/rails/generators/rails/session_migration/session_migration_generator.rb +0 -8
- data/lib/rails/generators/rails/task/USAGE +0 -9
- data/lib/rails/generators/rails/task/task_generator.rb +0 -12
- data/lib/rails/generators/rails/task/templates/task.rb +0 -8
- data/lib/rails/generators/resource_helpers.rb +0 -80
- data/lib/rails/generators/test_case.rb +0 -247
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +0 -15
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb +0 -19
- data/lib/rails/generators/test_unit/helper/helper_generator.rb +0 -13
- data/lib/rails/generators/test_unit/helper/templates/helper_test.rb +0 -6
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +0 -13
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb +0 -7
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +0 -14
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +0 -21
- data/lib/rails/generators/test_unit/model/model_generator.rb +0 -24
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml +0 -23
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb +0 -9
- data/lib/rails/generators/test_unit/observer/observer_generator.rb +0 -13
- data/lib/rails/generators/test_unit/observer/templates/unit_test.rb +0 -9
- data/lib/rails/generators/test_unit/performance/performance_generator.rb +0 -13
- data/lib/rails/generators/test_unit/performance/templates/performance_test.rb +0 -12
- data/lib/rails/generators/test_unit/plugin/plugin_generator.rb +0 -13
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +0 -7
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +0 -3
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +0 -38
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +0 -51
- data/lib/rails/generators/test_unit.rb +0 -8
- data/lib/rails/generators.rb +0 -339
- data/lib/rails/info.rb +0 -116
- data/lib/rails/info_controller.rb +0 -15
- data/lib/rails/initializable.rb +0 -89
- data/lib/rails/paths.rb +0 -211
- data/lib/rails/performance_test_help.rb +0 -3
- data/lib/rails/plugin.rb +0 -92
- data/lib/rails/rack/debugger.rb +0 -24
- data/lib/rails/rack/log_tailer.rb +0 -34
- data/lib/rails/rack/logger.rb +0 -60
- data/lib/rails/rack.rb +0 -7
- data/lib/rails/railtie/configurable.rb +0 -35
- data/lib/rails/railtie/configuration.rb +0 -90
- data/lib/rails/railtie.rb +0 -202
- data/lib/rails/ruby_version_check.rb +0 -23
- data/lib/rails/rubyprof_ext.rb +0 -35
- data/lib/rails/script_rails_loader.rb +0 -29
- data/lib/rails/source_annotation_extractor.rb +0 -104
- data/lib/rails/tasks/annotations.rake +0 -20
- data/lib/rails/tasks/documentation.rake +0 -155
- data/lib/rails/tasks/engine.rake +0 -72
- data/lib/rails/tasks/framework.rake +0 -76
- data/lib/rails/tasks/log.rake +0 -9
- data/lib/rails/tasks/middleware.rake +0 -7
- data/lib/rails/tasks/misc.rake +0 -67
- data/lib/rails/tasks/routes.rake +0 -9
- data/lib/rails/tasks/statistics.rake +0 -16
- data/lib/rails/tasks/tmp.rake +0 -37
- data/lib/rails/tasks.rb +0 -16
- data/lib/rails/test_help.rb +0 -56
- data/lib/rails/test_unit/railtie.rb +0 -15
- data/lib/rails/test_unit/sub_test_task.rb +0 -8
- data/lib/rails/test_unit/testing.rake +0 -146
- data/lib/rails.rb +0 -121
- data/lib/version.rb +0 -16
data/lib/rails/engine.rb
DELETED
@@ -1,657 +0,0 @@
|
|
1
|
-
require 'rails/railtie'
|
2
|
-
require 'active_support/core_ext/module/delegation'
|
3
|
-
require 'pathname'
|
4
|
-
require 'rbconfig'
|
5
|
-
require 'rails/engine/railties'
|
6
|
-
|
7
|
-
module Rails
|
8
|
-
# <tt>Rails::Engine</tt> allows you to wrap a specific Rails application or subset of
|
9
|
-
# functionality and share it with other applications. Since Rails 3.0, every
|
10
|
-
# <tt>Rails::Application</tt> is just an engine, which allows for simple
|
11
|
-
# feature and application sharing.
|
12
|
-
#
|
13
|
-
# Any <tt>Rails::Engine</tt> is also a <tt>Rails::Railtie</tt>, so the same
|
14
|
-
# methods (like <tt>rake_tasks</tt> and +generators+) and configuration
|
15
|
-
# options that are available in railties can also be used in engines.
|
16
|
-
#
|
17
|
-
# == Creating an Engine
|
18
|
-
#
|
19
|
-
# In Rails versions prior to 3.0, your gems automatically behaved as engines, however,
|
20
|
-
# this coupled Rails to Rubygems. Since Rails 3.0, if you want a gem to automatically
|
21
|
-
# behave as an engine, you have to specify an +Engine+ for it somewhere inside
|
22
|
-
# your plugin's +lib+ folder (similar to how we specify a +Railtie+):
|
23
|
-
#
|
24
|
-
# # lib/my_engine.rb
|
25
|
-
# module MyEngine
|
26
|
-
# class Engine < Rails::Engine
|
27
|
-
# end
|
28
|
-
# end
|
29
|
-
#
|
30
|
-
# Then ensure that this file is loaded at the top of your <tt>config/application.rb</tt>
|
31
|
-
# (or in your +Gemfile+) and it will automatically load models, controllers and helpers
|
32
|
-
# inside +app+, load routes at <tt>config/routes.rb</tt>, load locales at
|
33
|
-
# <tt>config/locales/*</tt>, and load tasks at <tt>lib/tasks/*</tt>.
|
34
|
-
#
|
35
|
-
# == Configuration
|
36
|
-
#
|
37
|
-
# Besides the +Railtie+ configuration which is shared across the application, in a
|
38
|
-
# <tt>Rails::Engine</tt> you can access <tt>autoload_paths</tt>, <tt>eager_load_paths</tt>
|
39
|
-
# and <tt>autoload_once_paths</tt>, which, differently from a <tt>Railtie</tt>, are scoped to
|
40
|
-
# the current engine.
|
41
|
-
#
|
42
|
-
# Example:
|
43
|
-
#
|
44
|
-
# class MyEngine < Rails::Engine
|
45
|
-
# # Add a load path for this specific Engine
|
46
|
-
# config.autoload_paths << File.expand_path("../lib/some/path", __FILE__)
|
47
|
-
#
|
48
|
-
# initializer "my_engine.add_middleware" do |app|
|
49
|
-
# app.middleware.use MyEngine::Middleware
|
50
|
-
# end
|
51
|
-
# end
|
52
|
-
#
|
53
|
-
# == Generators
|
54
|
-
#
|
55
|
-
# You can set up generators for engines with <tt>config.generators</tt> method:
|
56
|
-
#
|
57
|
-
# class MyEngine < Rails::Engine
|
58
|
-
# config.generators do |g|
|
59
|
-
# g.orm :active_record
|
60
|
-
# g.template_engine :erb
|
61
|
-
# g.test_framework :test_unit
|
62
|
-
# end
|
63
|
-
# end
|
64
|
-
#
|
65
|
-
# You can also set generators for an application by using <tt>config.app_generators</tt>:
|
66
|
-
#
|
67
|
-
# class MyEngine < Rails::Engine
|
68
|
-
# # note that you can also pass block to app_generators in the same way you
|
69
|
-
# # can pass it to generators method
|
70
|
-
# config.app_generators.orm :datamapper
|
71
|
-
# end
|
72
|
-
#
|
73
|
-
# == Paths
|
74
|
-
#
|
75
|
-
# Since Rails 3.0, applications and engines have more flexible path configuration (as
|
76
|
-
# opposed to the previous hardcoded path configuration). This means that you are not
|
77
|
-
# required to place your controllers at <tt>app/controllers</tt>, but in any place
|
78
|
-
# which you find convenient.
|
79
|
-
#
|
80
|
-
# For example, let's suppose you want to place your controllers in <tt>lib/controllers</tt>.
|
81
|
-
# You can set that as an option:
|
82
|
-
#
|
83
|
-
# class MyEngine < Rails::Engine
|
84
|
-
# paths["app/controllers"] = "lib/controllers"
|
85
|
-
# end
|
86
|
-
#
|
87
|
-
# You can also have your controllers loaded from both <tt>app/controllers</tt> and
|
88
|
-
# <tt>lib/controllers</tt>:
|
89
|
-
#
|
90
|
-
# class MyEngine < Rails::Engine
|
91
|
-
# paths["app/controllers"] << "lib/controllers"
|
92
|
-
# end
|
93
|
-
#
|
94
|
-
# The available paths in an engine are:
|
95
|
-
#
|
96
|
-
# class MyEngine < Rails::Engine
|
97
|
-
# paths["app"] # => ["app"]
|
98
|
-
# paths["app/controllers"] # => ["app/controllers"]
|
99
|
-
# paths["app/helpers"] # => ["app/helpers"]
|
100
|
-
# paths["app/models"] # => ["app/models"]
|
101
|
-
# paths["app/views"] # => ["app/views"]
|
102
|
-
# paths["lib"] # => ["lib"]
|
103
|
-
# paths["lib/tasks"] # => ["lib/tasks"]
|
104
|
-
# paths["config"] # => ["config"]
|
105
|
-
# paths["config/initializers"] # => ["config/initializers"]
|
106
|
-
# paths["config/locales"] # => ["config/locales"]
|
107
|
-
# paths["config/routes"] # => ["config/routes.rb"]
|
108
|
-
# end
|
109
|
-
#
|
110
|
-
# The <tt>Application</tt> class adds a couple more paths to this set. And as in your
|
111
|
-
# <tt>Application</tt>, all folders under +app+ are automatically added to the load path.
|
112
|
-
# If you have an <tt>app/observers</tt> folder for example, it will be added by default.
|
113
|
-
#
|
114
|
-
# == Endpoint
|
115
|
-
#
|
116
|
-
# An engine can be also a rack application. It can be useful if you have a rack application that
|
117
|
-
# you would like to wrap with +Engine+ and provide some of the +Engine+'s features.
|
118
|
-
#
|
119
|
-
# To do that, use the +endpoint+ method:
|
120
|
-
#
|
121
|
-
# module MyEngine
|
122
|
-
# class Engine < Rails::Engine
|
123
|
-
# endpoint MyRackApplication
|
124
|
-
# end
|
125
|
-
# end
|
126
|
-
#
|
127
|
-
# Now you can mount your engine in application's routes just like that:
|
128
|
-
#
|
129
|
-
# MyRailsApp::Application.routes.draw do
|
130
|
-
# mount MyEngine::Engine => "/engine"
|
131
|
-
# end
|
132
|
-
#
|
133
|
-
# == Middleware stack
|
134
|
-
#
|
135
|
-
# As an engine can now be a rack endpoint, it can also have a middleware
|
136
|
-
# stack. The usage is exactly the same as in <tt>Application</tt>:
|
137
|
-
#
|
138
|
-
# module MyEngine
|
139
|
-
# class Engine < Rails::Engine
|
140
|
-
# middleware.use SomeMiddleware
|
141
|
-
# end
|
142
|
-
# end
|
143
|
-
#
|
144
|
-
# == Routes
|
145
|
-
#
|
146
|
-
# If you don't specify an endpoint, routes will be used as the default
|
147
|
-
# endpoint. You can use them just like you use an application's routes:
|
148
|
-
#
|
149
|
-
# # ENGINE/config/routes.rb
|
150
|
-
# MyEngine::Engine.routes.draw do
|
151
|
-
# match "/" => "posts#index"
|
152
|
-
# end
|
153
|
-
#
|
154
|
-
# == Mount priority
|
155
|
-
#
|
156
|
-
# Note that now there can be more than one router in your application, and it's better to avoid
|
157
|
-
# passing requests through many routers. Consider this situation:
|
158
|
-
#
|
159
|
-
# MyRailsApp::Application.routes.draw do
|
160
|
-
# mount MyEngine::Engine => "/blog"
|
161
|
-
# match "/blog/omg" => "main#omg"
|
162
|
-
# end
|
163
|
-
#
|
164
|
-
# +MyEngine+ is mounted at <tt>/blog</tt>, and <tt>/blog/omg</tt> points to application's
|
165
|
-
# controller. In such a situation, requests to <tt>/blog/omg</tt> will go through +MyEngine+,
|
166
|
-
# and if there is no such route in +Engine+'s routes, it will be dispatched to <tt>main#omg</tt>.
|
167
|
-
# It's much better to swap that:
|
168
|
-
#
|
169
|
-
# MyRailsApp::Application.routes.draw do
|
170
|
-
# match "/blog/omg" => "main#omg"
|
171
|
-
# mount MyEngine::Engine => "/blog"
|
172
|
-
# end
|
173
|
-
#
|
174
|
-
# Now, +Engine+ will get only requests that were not handled by +Application+.
|
175
|
-
#
|
176
|
-
# == Engine name
|
177
|
-
#
|
178
|
-
# There are some places where an Engine's name is used:
|
179
|
-
#
|
180
|
-
# * routes: when you mount an Engine with <tt>mount(MyEngine::Engine => '/my_engine')</tt>,
|
181
|
-
# it's used as default :as option
|
182
|
-
# * some of the rake tasks are based on engine name, e.g. <tt>my_engine:install:migrations</tt>,
|
183
|
-
# <tt>my_engine:install:assets</tt>
|
184
|
-
#
|
185
|
-
# Engine name is set by default based on class name. For <tt>MyEngine::Engine</tt> it will be
|
186
|
-
# <tt>my_engine_engine</tt>. You can change it manually using the <tt>engine_name</tt> method:
|
187
|
-
#
|
188
|
-
# module MyEngine
|
189
|
-
# class Engine < Rails::Engine
|
190
|
-
# engine_name "my_engine"
|
191
|
-
# end
|
192
|
-
# end
|
193
|
-
#
|
194
|
-
# == Isolated Engine
|
195
|
-
#
|
196
|
-
# Normally when you create controllers, helpers and models inside an engine, they are treated
|
197
|
-
# as if they were created inside the application itself. This means that all helpers and
|
198
|
-
# named routes from the application will be available to your engine's controllers as well.
|
199
|
-
#
|
200
|
-
# However, sometimes you want to isolate your engine from the application, especially if your engine
|
201
|
-
# has its own router. To do that, you simply need to call +isolate_namespace+. This method requires
|
202
|
-
# you to pass a module where all your controllers, helpers and models should be nested to:
|
203
|
-
#
|
204
|
-
# module MyEngine
|
205
|
-
# class Engine < Rails::Engine
|
206
|
-
# isolate_namespace MyEngine
|
207
|
-
# end
|
208
|
-
# end
|
209
|
-
#
|
210
|
-
# With such an engine, everything that is inside the +MyEngine+ module will be isolated from
|
211
|
-
# the application.
|
212
|
-
#
|
213
|
-
# Consider such controller:
|
214
|
-
#
|
215
|
-
# module MyEngine
|
216
|
-
# class FooController < ActionController::Base
|
217
|
-
# end
|
218
|
-
# end
|
219
|
-
#
|
220
|
-
# If an engine is marked as isolated, +FooController+ has access only to helpers from +Engine+ and
|
221
|
-
# <tt>url_helpers</tt> from <tt>MyEngine::Engine.routes</tt>.
|
222
|
-
#
|
223
|
-
# The next thing that changes in isolated engines is the behavior of routes. Normally, when you namespace
|
224
|
-
# your controllers, you also need to do namespace all your routes. With an isolated engine,
|
225
|
-
# the namespace is applied by default, so you can ignore it in routes:
|
226
|
-
#
|
227
|
-
# MyEngine::Engine.routes.draw do
|
228
|
-
# resources :articles
|
229
|
-
# end
|
230
|
-
#
|
231
|
-
# The routes above will automatically point to <tt>MyEngine::ApplicationController</tt>. Furthermore, you don't
|
232
|
-
# need to use longer url helpers like <tt>my_engine_articles_path</tt>. Instead, you should simply use
|
233
|
-
# <tt>articles_path</tt> as you would do with your application.
|
234
|
-
#
|
235
|
-
# To make that behavior consistent with other parts of the framework, an isolated engine also has influence on
|
236
|
-
# <tt>ActiveModel::Naming</tt>. When you use a namespaced model, like <tt>MyEngine::Article</tt>, it will normally
|
237
|
-
# use the prefix "my_engine". In an isolated engine, the prefix will be omitted in url helpers and
|
238
|
-
# form fields for convenience.
|
239
|
-
#
|
240
|
-
# polymorphic_url(MyEngine::Article.new) # => "articles_path"
|
241
|
-
#
|
242
|
-
# form_for(MyEngine::Article.new) do
|
243
|
-
# text_field :title # => <input type="text" name="article[title]" id="article_title" />
|
244
|
-
# end
|
245
|
-
#
|
246
|
-
# Additionally, an isolated engine will set its name according to namespace, so
|
247
|
-
# MyEngine::Engine.engine_name will be "my_engine". It will also set MyEngine.table_name_prefix
|
248
|
-
# to "my_engine_", changing the MyEngine::Article model to use the my_engine_articles table.
|
249
|
-
#
|
250
|
-
# == Using Engine's routes outside Engine
|
251
|
-
#
|
252
|
-
# Since you can now mount an engine inside application's routes, you do not have direct access to +Engine+'s
|
253
|
-
# <tt>url_helpers</tt> inside +Application+. When you mount an engine in an application's routes, a special helper is
|
254
|
-
# created to allow you to do that. Consider such a scenario:
|
255
|
-
#
|
256
|
-
# # config/routes.rb
|
257
|
-
# MyApplication::Application.routes.draw do
|
258
|
-
# mount MyEngine::Engine => "/my_engine", :as => "my_engine"
|
259
|
-
# match "/foo" => "foo#index"
|
260
|
-
# end
|
261
|
-
#
|
262
|
-
# Now, you can use the <tt>my_engine</tt> helper inside your application:
|
263
|
-
#
|
264
|
-
# class FooController < ApplicationController
|
265
|
-
# def index
|
266
|
-
# my_engine.root_url #=> /my_engine/
|
267
|
-
# end
|
268
|
-
# end
|
269
|
-
#
|
270
|
-
# There is also a <tt>main_app</tt> helper that gives you access to application's routes inside Engine:
|
271
|
-
#
|
272
|
-
# module MyEngine
|
273
|
-
# class BarController
|
274
|
-
# def index
|
275
|
-
# main_app.foo_path #=> /foo
|
276
|
-
# end
|
277
|
-
# end
|
278
|
-
# end
|
279
|
-
#
|
280
|
-
# Note that the <tt>:as</tt> option given to mount takes the <tt>engine_name</tt> as default, so most of the time
|
281
|
-
# you can simply omit it.
|
282
|
-
#
|
283
|
-
# Finally, if you want to generate a url to an engine's route using
|
284
|
-
# <tt>polymorphic_url</tt>, you also need to pass the engine helper. Let's
|
285
|
-
# say that you want to create a form pointing to one of the engine's routes.
|
286
|
-
# All you need to do is pass the helper as the first element in array with
|
287
|
-
# attributes for url:
|
288
|
-
#
|
289
|
-
# form_for([my_engine, @user])
|
290
|
-
#
|
291
|
-
# This code will use <tt>my_engine.user_path(@user)</tt> to generate the proper route.
|
292
|
-
#
|
293
|
-
# == Isolated engine's helpers
|
294
|
-
#
|
295
|
-
# Sometimes you may want to isolate engine, but use helpers that are defined for it.
|
296
|
-
# If you want to share just a few specific helpers you can add them to application's
|
297
|
-
# helpers in ApplicationController:
|
298
|
-
#
|
299
|
-
# class ApplicationController < ActionController::Base
|
300
|
-
# helper MyEngine::SharedEngineHelper
|
301
|
-
# end
|
302
|
-
#
|
303
|
-
# If you want to include all of the engine's helpers, you can use #helpers method on an engine's
|
304
|
-
# instance:
|
305
|
-
#
|
306
|
-
# class ApplicationController < ActionController::Base
|
307
|
-
# helper MyEngine::Engine.helpers
|
308
|
-
# end
|
309
|
-
#
|
310
|
-
# It will include all of the helpers from engine's directory. Take into account that this does
|
311
|
-
# not include helpers defined in controllers with helper_method or other similar solutions,
|
312
|
-
# only helpers defined in the helpers directory will be included.
|
313
|
-
#
|
314
|
-
# == Migrations & seed data
|
315
|
-
#
|
316
|
-
# Engines can have their own migrations. The default path for migrations is exactly the same
|
317
|
-
# as in application: <tt>db/migrate</tt>
|
318
|
-
#
|
319
|
-
# To use engine's migrations in application you can use rake task, which copies them to
|
320
|
-
# application's dir:
|
321
|
-
#
|
322
|
-
# rake ENGINE_NAME:install:migrations
|
323
|
-
#
|
324
|
-
# Note that some of the migrations may be skipped if a migration with the same name already exists
|
325
|
-
# in application. In such a situation you must decide whether to leave that migration or rename the
|
326
|
-
# migration in the application and rerun copying migrations.
|
327
|
-
#
|
328
|
-
# If your engine has migrations, you may also want to prepare data for the database in
|
329
|
-
# the <tt>seeds.rb</tt> file. You can load that data using the <tt>load_seed</tt> method, e.g.
|
330
|
-
#
|
331
|
-
# MyEngine::Engine.load_seed
|
332
|
-
#
|
333
|
-
# == Loading priority
|
334
|
-
#
|
335
|
-
# In order to change engine's priority you can use config.railties_order in main application.
|
336
|
-
# It will affect the priority of loading views, helpers, assets and all the other files
|
337
|
-
# related to engine or application.
|
338
|
-
#
|
339
|
-
# Example:
|
340
|
-
#
|
341
|
-
# # load Blog::Engine with highest priority, followed by application and other railties
|
342
|
-
# config.railties_order = [Blog::Engine, :main_app, :all]
|
343
|
-
#
|
344
|
-
class Engine < Railtie
|
345
|
-
autoload :Configuration, "rails/engine/configuration"
|
346
|
-
autoload :Railties, "rails/engine/railties"
|
347
|
-
|
348
|
-
def load_generators(app=self)
|
349
|
-
initialize_generators
|
350
|
-
railties.all { |r| r.load_generators(app) }
|
351
|
-
Rails::Generators.configure!(app.config.generators)
|
352
|
-
super
|
353
|
-
self
|
354
|
-
end
|
355
|
-
|
356
|
-
class << self
|
357
|
-
attr_accessor :called_from, :isolated
|
358
|
-
alias :isolated? :isolated
|
359
|
-
alias :engine_name :railtie_name
|
360
|
-
|
361
|
-
def inherited(base)
|
362
|
-
unless base.abstract_railtie?
|
363
|
-
base.called_from = begin
|
364
|
-
# Remove the line number from backtraces making sure we don't leave anything behind
|
365
|
-
call_stack = caller.map { |p| p.sub(/:\d+.*/, '') }
|
366
|
-
File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] })
|
367
|
-
end
|
368
|
-
end
|
369
|
-
|
370
|
-
super
|
371
|
-
end
|
372
|
-
|
373
|
-
def endpoint(endpoint = nil)
|
374
|
-
@endpoint ||= nil
|
375
|
-
@endpoint = endpoint if endpoint
|
376
|
-
@endpoint
|
377
|
-
end
|
378
|
-
|
379
|
-
def isolate_namespace(mod)
|
380
|
-
engine_name(generate_railtie_name(mod))
|
381
|
-
|
382
|
-
self.routes.default_scope = { :module => ActiveSupport::Inflector.underscore(mod.name) }
|
383
|
-
self.isolated = true
|
384
|
-
|
385
|
-
unless mod.respond_to?(:railtie_namespace)
|
386
|
-
name, railtie = engine_name, self
|
387
|
-
|
388
|
-
mod.singleton_class.instance_eval do
|
389
|
-
define_method(:railtie_namespace) { railtie }
|
390
|
-
|
391
|
-
unless mod.respond_to?(:table_name_prefix)
|
392
|
-
define_method(:table_name_prefix) { "#{name}_" }
|
393
|
-
end
|
394
|
-
|
395
|
-
unless mod.respond_to?(:use_relative_model_naming?)
|
396
|
-
class_eval "def use_relative_model_naming?; true; end", __FILE__, __LINE__
|
397
|
-
end
|
398
|
-
|
399
|
-
unless mod.respond_to?(:railtie_helpers_paths)
|
400
|
-
define_method(:railtie_helpers_paths) { railtie.helpers_paths }
|
401
|
-
end
|
402
|
-
|
403
|
-
unless mod.respond_to?(:railtie_routes_url_helpers)
|
404
|
-
define_method(:railtie_routes_url_helpers) { railtie.routes_url_helpers }
|
405
|
-
end
|
406
|
-
end
|
407
|
-
end
|
408
|
-
end
|
409
|
-
|
410
|
-
# Finds engine with given path
|
411
|
-
def find(path)
|
412
|
-
expanded_path = File.expand_path path.to_s
|
413
|
-
Rails::Engine::Railties.engines.find { |engine|
|
414
|
-
File.expand_path(engine.root.to_s) == expanded_path
|
415
|
-
}
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
delegate :middleware, :root, :paths, :to => :config
|
420
|
-
delegate :engine_name, :isolated?, :to => "self.class"
|
421
|
-
|
422
|
-
def load_tasks(app=self)
|
423
|
-
railties.all { |r| r.load_tasks(app) }
|
424
|
-
super
|
425
|
-
paths["lib/tasks"].existent.sort.each { |ext| load(ext) }
|
426
|
-
end
|
427
|
-
|
428
|
-
def load_console(app=self)
|
429
|
-
railties.all { |r| r.load_console(app) }
|
430
|
-
super
|
431
|
-
end
|
432
|
-
|
433
|
-
def eager_load!
|
434
|
-
railties.all(&:eager_load!)
|
435
|
-
|
436
|
-
config.eager_load_paths.each do |load_path|
|
437
|
-
matcher = /\A#{Regexp.escape(load_path)}\/(.*)\.rb\Z/
|
438
|
-
Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
|
439
|
-
require_dependency file.sub(matcher, '\1')
|
440
|
-
end
|
441
|
-
end
|
442
|
-
end
|
443
|
-
|
444
|
-
def railties
|
445
|
-
@railties ||= self.class::Railties.new(config)
|
446
|
-
end
|
447
|
-
|
448
|
-
def helpers
|
449
|
-
@helpers ||= begin
|
450
|
-
helpers = Module.new
|
451
|
-
all = ActionController::Base.all_helpers_from_path(helpers_paths)
|
452
|
-
ActionController::Base.modules_for_helpers(all).each do |mod|
|
453
|
-
helpers.send(:include, mod)
|
454
|
-
end
|
455
|
-
helpers
|
456
|
-
end
|
457
|
-
end
|
458
|
-
|
459
|
-
def helpers_paths
|
460
|
-
paths["app/helpers"].existent
|
461
|
-
end
|
462
|
-
|
463
|
-
def routes_url_helpers
|
464
|
-
routes.url_helpers
|
465
|
-
end
|
466
|
-
|
467
|
-
def app
|
468
|
-
@app ||= begin
|
469
|
-
config.middleware = config.middleware.merge_into(default_middleware_stack)
|
470
|
-
config.middleware.build(endpoint)
|
471
|
-
end
|
472
|
-
end
|
473
|
-
|
474
|
-
def endpoint
|
475
|
-
self.class.endpoint || routes
|
476
|
-
end
|
477
|
-
|
478
|
-
def call(env)
|
479
|
-
app.call(env.merge!(env_config))
|
480
|
-
end
|
481
|
-
|
482
|
-
def env_config
|
483
|
-
@env_config ||= {
|
484
|
-
'action_dispatch.routes' => routes
|
485
|
-
}
|
486
|
-
end
|
487
|
-
|
488
|
-
def routes
|
489
|
-
@routes ||= ActionDispatch::Routing::RouteSet.new
|
490
|
-
@routes.append(&Proc.new) if block_given?
|
491
|
-
@routes
|
492
|
-
end
|
493
|
-
|
494
|
-
def ordered_railties
|
495
|
-
railties.all + [self]
|
496
|
-
end
|
497
|
-
|
498
|
-
def initializers
|
499
|
-
initializers = []
|
500
|
-
ordered_railties.each do |r|
|
501
|
-
if r == self
|
502
|
-
initializers += super
|
503
|
-
else
|
504
|
-
initializers += r.initializers
|
505
|
-
end
|
506
|
-
end
|
507
|
-
initializers
|
508
|
-
end
|
509
|
-
|
510
|
-
def config
|
511
|
-
@config ||= Engine::Configuration.new(find_root_with_flag("lib"))
|
512
|
-
end
|
513
|
-
|
514
|
-
# Load data from db/seeds.rb file. It can be used in to load engines'
|
515
|
-
# seeds, e.g.:
|
516
|
-
#
|
517
|
-
# Blog::Engine.load_seed
|
518
|
-
def load_seed
|
519
|
-
seed_file = paths["db/seeds"].existent.first
|
520
|
-
load(seed_file) if seed_file
|
521
|
-
end
|
522
|
-
|
523
|
-
# Add configured load paths to ruby load paths and remove duplicates.
|
524
|
-
initializer :set_load_path, :before => :bootstrap_hook do
|
525
|
-
_all_load_paths.reverse_each do |path|
|
526
|
-
$LOAD_PATH.unshift(path) if File.directory?(path)
|
527
|
-
end
|
528
|
-
$LOAD_PATH.uniq!
|
529
|
-
end
|
530
|
-
|
531
|
-
# Set the paths from which Rails will automatically load source files,
|
532
|
-
# and the load_once paths.
|
533
|
-
#
|
534
|
-
# This needs to be an initializer, since it needs to run once
|
535
|
-
# per engine and get the engine as a block parameter
|
536
|
-
initializer :set_autoload_paths, :before => :bootstrap_hook do |app|
|
537
|
-
ActiveSupport::Dependencies.autoload_paths.unshift(*_all_autoload_paths)
|
538
|
-
ActiveSupport::Dependencies.autoload_once_paths.unshift(*_all_autoload_once_paths)
|
539
|
-
|
540
|
-
# Freeze so future modifications will fail rather than do nothing mysteriously
|
541
|
-
config.autoload_paths.freeze
|
542
|
-
config.eager_load_paths.freeze
|
543
|
-
config.autoload_once_paths.freeze
|
544
|
-
end
|
545
|
-
|
546
|
-
initializer :add_routing_paths do |app|
|
547
|
-
paths = self.paths["config/routes"].existent
|
548
|
-
|
549
|
-
if routes? || paths.any?
|
550
|
-
app.routes_reloader.paths.unshift(*paths)
|
551
|
-
app.routes_reloader.route_sets << routes
|
552
|
-
end
|
553
|
-
end
|
554
|
-
|
555
|
-
# I18n load paths are a special case since the ones added
|
556
|
-
# later have higher priority.
|
557
|
-
initializer :add_locales do
|
558
|
-
config.i18n.railties_load_path.concat(paths["config/locales"].existent)
|
559
|
-
end
|
560
|
-
|
561
|
-
initializer :add_view_paths do
|
562
|
-
views = paths["app/views"].existent
|
563
|
-
unless views.empty?
|
564
|
-
ActiveSupport.on_load(:action_controller){ prepend_view_path(views) }
|
565
|
-
ActiveSupport.on_load(:action_mailer){ prepend_view_path(views) }
|
566
|
-
end
|
567
|
-
end
|
568
|
-
|
569
|
-
initializer :load_environment_config, :before => :load_environment_hook, :group => :all do
|
570
|
-
environment = paths["config/environments"].existent.first
|
571
|
-
require environment if environment
|
572
|
-
end
|
573
|
-
|
574
|
-
initializer :append_assets_path, :group => :all do |app|
|
575
|
-
app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories)
|
576
|
-
app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories)
|
577
|
-
app.config.assets.paths.unshift(*paths["app/assets"].existent_directories)
|
578
|
-
end
|
579
|
-
|
580
|
-
initializer :prepend_helpers_path do |app|
|
581
|
-
if !isolated? || (app == self)
|
582
|
-
app.config.helpers_paths.unshift(*paths["app/helpers"].existent)
|
583
|
-
end
|
584
|
-
end
|
585
|
-
|
586
|
-
initializer :load_config_initializers do
|
587
|
-
config.paths["config/initializers"].existent.sort.each do |initializer|
|
588
|
-
load(initializer)
|
589
|
-
end
|
590
|
-
end
|
591
|
-
|
592
|
-
initializer :engines_blank_point do
|
593
|
-
# We need this initializer so all extra initializers added in engines are
|
594
|
-
# consistently executed after all the initializers above across all engines.
|
595
|
-
end
|
596
|
-
|
597
|
-
rake_tasks do
|
598
|
-
next if self.is_a?(Rails::Application)
|
599
|
-
next unless has_migrations?
|
600
|
-
|
601
|
-
namespace railtie_name do
|
602
|
-
namespace :install do
|
603
|
-
desc "Copy migrations from #{railtie_name} to application"
|
604
|
-
task :migrations do
|
605
|
-
ENV["FROM"] = railtie_name
|
606
|
-
Rake::Task["railties:install:migrations"].invoke
|
607
|
-
end
|
608
|
-
end
|
609
|
-
end
|
610
|
-
end
|
611
|
-
|
612
|
-
protected
|
613
|
-
|
614
|
-
def initialize_generators
|
615
|
-
require "rails/generators"
|
616
|
-
end
|
617
|
-
|
618
|
-
def routes?
|
619
|
-
defined?(@routes)
|
620
|
-
end
|
621
|
-
|
622
|
-
def has_migrations?
|
623
|
-
paths["db/migrate"].existent.any?
|
624
|
-
end
|
625
|
-
|
626
|
-
def find_root_with_flag(flag, default=nil)
|
627
|
-
root_path = self.class.called_from
|
628
|
-
|
629
|
-
while root_path && File.directory?(root_path) && !File.exist?("#{root_path}/#{flag}")
|
630
|
-
parent = File.dirname(root_path)
|
631
|
-
root_path = parent != root_path && parent
|
632
|
-
end
|
633
|
-
|
634
|
-
root = File.exist?("#{root_path}/#{flag}") ? root_path : default
|
635
|
-
raise "Could not find root path for #{self}" unless root
|
636
|
-
|
637
|
-
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ?
|
638
|
-
Pathname.new(root).expand_path : Pathname.new(root).realpath
|
639
|
-
end
|
640
|
-
|
641
|
-
def default_middleware_stack
|
642
|
-
ActionDispatch::MiddlewareStack.new
|
643
|
-
end
|
644
|
-
|
645
|
-
def _all_autoload_once_paths
|
646
|
-
config.autoload_once_paths
|
647
|
-
end
|
648
|
-
|
649
|
-
def _all_autoload_paths
|
650
|
-
@_all_autoload_paths ||= (config.autoload_paths + config.eager_load_paths + config.autoload_once_paths).uniq
|
651
|
-
end
|
652
|
-
|
653
|
-
def _all_load_paths
|
654
|
-
@_all_load_paths ||= (config.paths.load_paths + _all_autoload_paths).uniq
|
655
|
-
end
|
656
|
-
end
|
657
|
-
end
|