diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/engine.rb | 88 | ||||
-rw-r--r-- | railties/lib/rails/source_annotation_extractor.rb | 14 |
2 files changed, 51 insertions, 51 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 792b1fc699..be8af5c46c 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -5,13 +5,13 @@ require 'pathname' require 'rbconfig' module Rails - # `Rails::Engine` allows you to wrap a specific Rails application or subset of + # <tt>Rails::Engine</tt> allows you to wrap a specific Rails application or subset of # functionality and share it with other applications or within a larger packaged application. - # Since Rails 3.0, every `Rails::Application` is just an engine, which allows for simple + # Since Rails 3.0, every <tt>Rails::Application</tt> is just an engine, which allows for simple # feature and application sharing. # - # Any `Rails::Engine` is also a `Rails::Railtie`, so the same - # methods (like `rake_tasks` and +generators+) and configuration + # Any <tt>Rails::Engine</tt> is also a <tt>Rails::Railtie</tt>, so the same + # methods (like <tt>rake_tasks</tt> and +generators+) and configuration # options that are available in railties can also be used in engines. # # == Creating an Engine @@ -27,16 +27,16 @@ module Rails # end # end # - # Then ensure that this file is loaded at the top of your `config/application.rb` + # Then ensure that this file is loaded at the top of your <tt>config/application.rb</tt> # (or in your +Gemfile+) and it will automatically load models, controllers and helpers - # inside +app+, load routes at `config/routes.rb`, load locales at - # `config/locales/*`, and load tasks at `lib/tasks/*`. + # inside +app+, load routes at <tt>config/routes.rb</tt>, load locales at + # <tt>config/locales/*</tt>, and load tasks at <tt>lib/tasks/*</tt>. # # == Configuration # # Besides the +Railtie+ configuration which is shared across the application, in a - # `Rails::Engine` you can access `autoload_paths`, `eager_load_paths` - # and `autoload_once_paths`, which, differently from a `Railtie`, are scoped to + # <tt>Rails::Engine</tt> you can access <tt>autoload_paths</tt>, <tt>eager_load_paths</tt> + # and <tt>autoload_once_paths</tt>, which, differently from a <tt>Railtie</tt>, are scoped to # the current engine. # # class MyEngine < Rails::Engine @@ -50,7 +50,7 @@ module Rails # # == Generators # - # You can set up generators for engines with `config.generators` method: + # You can set up generators for engines with <tt>config.generators</tt> method: # # class MyEngine < Rails::Engine # config.generators do |g| @@ -60,7 +60,7 @@ module Rails # end # end # - # You can also set generators for an application by using `config.app_generators`: + # You can also set generators for an application by using <tt>config.app_generators</tt>: # # class MyEngine < Rails::Engine # # note that you can also pass block to app_generators in the same way you @@ -72,18 +72,18 @@ module Rails # # Since Rails 3.0, applications and engines have more flexible path configuration (as # opposed to the previous hardcoded path configuration). This means that you are not - # required to place your controllers at `app/controllers`, but in any place + # required to place your controllers at <tt>app/controllers</tt>, but in any place # which you find convenient. # - # For example, let's suppose you want to place your controllers in `lib/controllers`. + # For example, let's suppose you want to place your controllers in <tt>lib/controllers</tt>. # You can set that as an option: # # class MyEngine < Rails::Engine # paths["app/controllers"] = "lib/controllers" # end # - # You can also have your controllers loaded from both `app/controllers` and - # `lib/controllers`: + # You can also have your controllers loaded from both <tt>app/controllers</tt> and + # <tt>lib/controllers</tt>: # # class MyEngine < Rails::Engine # paths["app/controllers"] << "lib/controllers" @@ -105,9 +105,9 @@ module Rails # paths["config/routes"] # => ["config/routes.rb"] # end # - # The `Application` class adds a couple more paths to this set. And as in your - # `Application`, all folders under +app+ are automatically added to the load path. - # If you have an `app/services` folder for example, it will be added by default. + # The <tt>Application</tt> class adds a couple more paths to this set. And as in your + # <tt>Application</tt>, all folders under +app+ are automatically added to the load path. + # If you have an <tt>app/services</tt> folder for example, it will be added by default. # # == Endpoint # @@ -131,7 +131,7 @@ module Rails # == Middleware stack # # As an engine can now be a rack endpoint, it can also have a middleware - # stack. The usage is exactly the same as in `Application`: + # stack. The usage is exactly the same as in <tt>Application</tt>: # # module MyEngine # class Engine < Rails::Engine @@ -159,9 +159,9 @@ module Rails # get "/blog/omg" => "main#omg" # end # - # +MyEngine+ is mounted at `/blog`, and `/blog/omg` points to application's - # controller. In such a situation, requests to `/blog/omg` will go through +MyEngine+, - # and if there is no such route in +Engine+'s routes, it will be dispatched to `main#omg`. + # +MyEngine+ is mounted at <tt>/blog</tt>, and <tt>/blog/omg</tt> points to application's + # controller. In such a situation, requests to <tt>/blog/omg</tt> will go through +MyEngine+, + # and if there is no such route in +Engine+'s routes, it will be dispatched to <tt>main#omg</tt>. # It's much better to swap that: # # Rails.application.routes.draw do @@ -175,12 +175,12 @@ module Rails # # There are some places where an Engine's name is used: # - # * routes: when you mount an Engine with `mount(MyEngine::Engine => '/my_engine')`, - # it's used as default `:as` option - # * rake task for installing migrations `my_engine:install:migrations` + # * routes: when you mount an Engine with <tt>mount(MyEngine::Engine => '/my_engine')</tt>, + # it's used as default <tt>:as</tt> option + # * rake task for installing migrations <tt>my_engine:install:migrations</tt> # - # Engine name is set by default based on class name. For `MyEngine::Engine` it will be - # `my_engine_engine`. You can change it manually using the `engine_name` method: + # Engine name is set by default based on class name. For <tt>MyEngine::Engine</tt> it will be + # <tt>my_engine_engine</tt>. You can change it manually using the <tt>engine_name</tt> method: # # module MyEngine # class Engine < Rails::Engine @@ -215,7 +215,7 @@ module Rails # end # # If an engine is marked as isolated, +FooController+ has access only to helpers from +Engine+ and - # `url_helpers` from `MyEngine::Engine.routes`. + # <tt>url_helpers</tt> from <tt>MyEngine::Engine.routes</tt>. # # The next thing that changes in isolated engines is the behavior of routes. Normally, when you namespace # your controllers, you also need to do namespace all your routes. With an isolated engine, @@ -225,12 +225,12 @@ module Rails # resources :articles # end # - # The routes above will automatically point to `MyEngine::ArticlesController`. Furthermore, you don't - # need to use longer url helpers like `my_engine_articles_path`. Instead, you should simply use - # `articles_path` as you would do with your application. + # The routes above will automatically point to <tt>MyEngine::ArticlesController</tt>. Furthermore, you don't + # need to use longer url helpers like <tt>my_engine_articles_path</tt>. Instead, you should simply use + # <tt>articles_path</tt> as you would do with your application. # # To make that behavior consistent with other parts of the framework, an isolated engine also has influence on - # `ActiveModel::Naming`. When you use a namespaced model, like `MyEngine::Article`, it will normally + # <tt>ActiveModel::Naming</tt>. When you use a namespaced model, like <tt>MyEngine::Article</tt>, it will normally # use the prefix "my_engine". In an isolated engine, the prefix will be omitted in url helpers and # form fields for convenience. # @@ -247,7 +247,7 @@ module Rails # == Using Engine's routes outside Engine # # Since you can now mount an engine inside application's routes, you do not have direct access to +Engine+'s - # `url_helpers` inside +Application+. When you mount an engine in an application's routes, a special helper is + # <tt>url_helpers</tt> inside +Application+. When you mount an engine in an application's routes, a special helper is # created to allow you to do that. Consider such a scenario: # # # config/routes.rb @@ -256,7 +256,7 @@ module Rails # get "/foo" => "foo#index" # end # - # Now, you can use the `my_engine` helper inside your application: + # Now, you can use the <tt>my_engine</tt> helper inside your application: # # class FooController < ApplicationController # def index @@ -264,7 +264,7 @@ module Rails # end # end # - # There is also a `main_app` helper that gives you access to application's routes inside Engine: + # There is also a <tt>main_app</tt> helper that gives you access to application's routes inside Engine: # # module MyEngine # class BarController @@ -274,18 +274,18 @@ module Rails # end # end # - # Note that the `:as` option given to mount takes the `engine_name` as default, so most of the time + # Note that the <tt>:as</tt> option given to mount takes the <tt>engine_name</tt> as default, so most of the time # you can simply omit it. # # Finally, if you want to generate a url to an engine's route using - # `polymorphic_url`, you also need to pass the engine helper. Let's + # <tt>polymorphic_url</tt>, you also need to pass the engine helper. Let's # say that you want to create a form pointing to one of the engine's routes. # All you need to do is pass the helper as the first element in array with # attributes for url: # # form_for([my_engine, @user]) # - # This code will use `my_engine.user_path(@user)` to generate the proper route. + # This code will use <tt>my_engine.user_path(@user)</tt> to generate the proper route. # # == Isolated engine's helpers # @@ -311,7 +311,7 @@ module Rails # == Migrations & seed data # # Engines can have their own migrations. The default path for migrations is exactly the same - # as in application: `db/migrate` + # as in application: <tt>db/migrate</tt> # # To use engine's migrations in application you can use rake task, which copies them to # application's dir: @@ -323,7 +323,7 @@ module Rails # migration in the application and rerun copying migrations. # # If your engine has migrations, you may also want to prepare data for the database in - # the `db/seeds.rb` file. You can load that data using the `load_seed` method, e.g. + # the <tt>db/seeds.rb</tt> file. You can load that data using the <tt>load_seed</tt> method, e.g. # # MyEngine::Engine.load_seed # @@ -428,7 +428,7 @@ module Rails end # Load console and invoke the registered hooks. - # Check `Rails::Railtie.console` for more info. + # Check <tt>Rails::Railtie.console</tt> for more info. def load_console(app=self) require "pp" require "rails/console/app" @@ -438,14 +438,14 @@ module Rails end # Load Rails runner and invoke the registered hooks. - # Check `Rails::Railtie.runner` for more info. + # Check <tt>Rails::Railtie.runner</tt> for more info. def load_runner(app=self) run_runner_blocks(app) self end # Load Rake, railties tasks and invoke the registered hooks. - # Check `Rails::Railtie.rake_tasks` for more info. + # Check <tt>Rails::Railtie.rake_tasks</tt> for more info. def load_tasks(app=self) require "rake" run_tasks_blocks(app) @@ -453,7 +453,7 @@ module Rails end # Load Rails generators and invoke the registered hooks. - # Check `Rails::Railtie.generators` for more info. + # Check <tt>Rails::Railtie.generators</tt> for more info. def load_generators(app=self) require "rails/generators" run_generators_blocks(app) diff --git a/railties/lib/rails/source_annotation_extractor.rb b/railties/lib/rails/source_annotation_extractor.rb index 528f1125f4..290634290f 100644 --- a/railties/lib/rails/source_annotation_extractor.rb +++ b/railties/lib/rails/source_annotation_extractor.rb @@ -3,9 +3,9 @@ # rake notes # rake notes:optimize # -# and friends. See `rake -T notes` and `railties/lib/tasks/annotations.rake`. +# and friends. See <tt>rake -T notes</tt> and <tt>railties/lib/tasks/annotations.rake</tt>. # -# Annotation objects are triplets `:line`, `:tag`, `:text` that +# Annotation objects are triplets <tt>:line</tt>, <tt>:tag</tt>, <tt>:text</tt> that # represent the line where the annotation lives, its tag, and its text. Note # the filename is not stored. # @@ -22,7 +22,7 @@ class SourceAnnotationExtractor # # [126] [TODO] This algorithm is simple and clearly correct, make it faster. # - # If +options+ has a flag `:tag` the tag is shown as in the example above. + # If +options+ has a flag <tt>:tag</tt> the tag is shown as in the example above. # Otherwise the string contains just line and text. def to_s(options={}) s = "[#{line.to_s.rjust(options[:indent])}] " @@ -35,15 +35,15 @@ class SourceAnnotationExtractor # +config+, +db+, +lib+, and +test+ (recursively). # # Additional directories may be added using a comma-delimited list set using - # `ENV['SOURCE_ANNOTATION_DIRECTORIES']`. + # <tt>ENV['SOURCE_ANNOTATION_DIRECTORIES']</tt>. # - # Directories may also be explicitly set using the `:dirs` key in +options+. + # Directories may also be explicitly set using the <tt>:dirs</tt> key in +options+. # # SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true # - # If +options+ has a `:tag` flag, it will be passed to each annotation's +to_s+. + # If +options+ has a <tt>:tag</tt> flag, it will be passed to each annotation's +to_s+. # - # See `#find_in` for a list of file extensions that will be taken into account. + # See <tt>#find_in</tt> for a list of file extensions that will be taken into account. # # This class method is the single entry point for the rake tasks. def self.enumerate(tag, options={}) |