diff options
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/3_2_release_notes.textile | 9 | ||||
-rw-r--r-- | railties/guides/source/api_documentation_guidelines.textile | 7 | ||||
-rw-r--r-- | railties/guides/source/command_line.textile | 16 | ||||
-rw-r--r-- | railties/guides/source/configuring.textile | 10 | ||||
-rw-r--r-- | railties/guides/source/documents.yaml | 2 | ||||
-rw-r--r-- | railties/guides/source/generators.textile | 16 | ||||
-rw-r--r-- | railties/guides/source/getting_started.textile | 2 | ||||
-rw-r--r-- | railties/guides/source/layout.html.erb | 55 | ||||
-rw-r--r-- | railties/guides/source/plugins.textile | 35 | ||||
-rw-r--r-- | railties/guides/source/rails_application_templates.textile | 27 | ||||
-rw-r--r-- | railties/guides/source/testing.textile | 1 |
11 files changed, 25 insertions, 155 deletions
diff --git a/railties/guides/source/3_2_release_notes.textile b/railties/guides/source/3_2_release_notes.textile index c1afee004e..927abc7944 100644 --- a/railties/guides/source/3_2_release_notes.textile +++ b/railties/guides/source/3_2_release_notes.textile @@ -67,6 +67,7 @@ When running a multi-user, multi-account application, it's a great help to be ab h3. Railties + * Speed up development by only reloading classes if dependencies files changed. This can be turned off by setting <tt>config.reload_classes_only_on_change</tt> to false. * New applications get a flag <tt>config.active_record.auto_explain_threshold_in_seconds</tt> in the environments configuration files. With a value of <tt>0.5</tt> in <tt>development.rb</tt> and commented out in <tt>production.rb</tt>. No mention in <tt>test.rb</tt>. @@ -105,6 +106,10 @@ will create indexes for +title+ and +author+ with the latter being an unique ind * Remove old <tt>config.paths.app.controller</tt> API in favor of <tt>config.paths["app/controller"]</tt>. +h4. Deprecations + +* +Rails::Plugin+ is deprecated and will be removed in Rails 4.0. Instead of adding plugins to +vendor/plugins+ use gems or bundler with path or git dependencies. + h3. Action Pack h4. Action Controller @@ -225,6 +230,8 @@ content_tag_for(:li, @items) do |item| end </ruby> +* Added +font_path+ helper method that computes the path to a font asset in <tt>public/fonts</tt>. + h5. Deprecations * Passing formats or handlers to render :template and friends like <tt>render :template => "foo.html.erb"</tt> is deprecated. Instead, you can provide :handlers and :formats directly as an options: <tt> render :template => "foo", :formats => [:html, :js], :handlers => :erb</tt>. @@ -414,6 +421,8 @@ Event.where(:created_at => Time.now.all_day) h4. Deprecations +* +ActiveSupport::Base64+ is deprecated in favor of <tt>::Base64</tt>. + * Deprecated <tt>ActiveSupport::Memoizable</tt> in favor of Ruby memoization pattern. * <tt>Module#synchronize</tt> is deprecated with no replacement. Please use monitor from ruby's standard library. diff --git a/railties/guides/source/api_documentation_guidelines.textile b/railties/guides/source/api_documentation_guidelines.textile index 99eb668513..93120c15a7 100644 --- a/railties/guides/source/api_documentation_guidelines.textile +++ b/railties/guides/source/api_documentation_guidelines.textile @@ -134,13 +134,6 @@ h4. Regular Font When "true" and "false" are English words rather than Ruby keywords use a regular font: -<ruby> -# If <tt>reload_plugins?</tt> is false, add this to your plugin's <tt>init.rb</tt> -# to make it reloadable: -# -# Dependencies.load_once_paths.delete lib_path -</ruby> - h3. Description Lists In lists of options, parameters, etc. use a hyphen between the item and its description (reads better than a colon because normally options are symbols): diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index fa783edc58..fe4a84dae9 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -45,8 +45,6 @@ $ rails new commandsapp ... create tmp/cache create tmp/pids - create vendor/plugins - create vendor/plugins/.gitkeep </shell> Rails will set you up with what seems like a huge amount of stuff for such a tiny command! You've got the entire Rails directory structure now with all the code you need to run our simple application right out of the box. @@ -295,18 +293,6 @@ h4. +rails dbconsole+ You can also use the alias "db" to invoke the dbconsole: <tt>rails db</tt>. -h4. +rails plugin+ - -The +rails plugin+ command simplifies plugin management. Plugins can be installed by name or their repository URLs. You need to have Git installed if you want to install a plugin from a Git repo. The same holds for Subversion too. - -<shell> -$ rails plugin install https://github.com/technoweenie/acts_as_paranoid.git -+ ./CHANGELOG -+ ./MIT-LICENSE -... -... -</shell> - h4. +rails runner+ <tt>runner</tt> runs Ruby code in the context of Rails non-interactively. For instance: @@ -415,8 +401,6 @@ The +doc:+ namespace has the tools to generate documentation for your app, API d * +rake doc:app+ generates documentation for your application in +doc/app+. * +rake doc:guides+ generates Rails guides in +doc/guides+. * +rake doc:rails+ generates API documentation for Rails in +doc/api+. -* +rake doc:plugins+ generates API documentation for all the plugins installed in the application in +doc/plugins+. -* +rake doc:clobber_plugins+ removes the generated documentation for all plugins. h4. +notes+ diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 09ef308665..3153cac2f9 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -42,7 +42,7 @@ h4. Rails General Configuration These configuration methods are to be called on a +Rails::Railtie+ object, such as a subclass of +Rails::Engine+ or +Rails::Application+. -* +config.after_initialize+ takes a block which will be run _after_ Rails has finished initializing the application. That includes the initialization of the framework itself, plugins, engines, and all the application's initializers in +config/initializers+. Note that this block _will_ be run for rake tasks. Useful for configuring values set up by other initializers: +* +config.after_initialize+ takes a block which will be run _after_ Rails has finished initializing the application. That includes the initialization of the framework itself, engines, and all the application's initializers in +config/initializers+. Note that this block _will_ be run for rake tasks. Useful for configuring values set up by other initializers: <ruby> config.after_initialize do @@ -98,14 +98,10 @@ NOTE. The +config.asset_path+ configuration is ignored if the asset pipeline is * +config.middleware+ allows you to configure the application's middleware. This is covered in depth in the "Configuring Middleware":#configuring-middleware section below. -* +config.plugins+ accepts the list of plugins to load. The default is +nil+ in which case all plugins will be loaded. If this is set to +[]+, no plugins will be loaded. Otherwise, plugins will be loaded in the order specified. This option lets you enforce some particular loading order, useful when dependencies between plugins require it. For that use case, put first the plugins you want to be loaded in a certain order, and then the special symbol +:all+ to have the rest loaded without the need to specify them. - * +config.preload_frameworks+ enables or disables preloading all frameworks at startup. Enabled by +config.threadsafe!+. Defaults to +nil+, so is disabled. * +config.reload_classes_only_on_change+ enables or disables reloading of classes only when tracked files change. By default tracks everything on autoload paths and is set to true. If +config.cache_classes+ is true, this option is ignored. -* +config.reload_plugins+ enables or disables plugin reloading. Defaults to false. - * +config.secret_token+ used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get +config.secret_token+ initialized to a random key in +config/initializers/secret_token.rb+. * +config.serve_static_assets+ configures Rails itself to serve static assets. Defaults to true, but in the production environment is turned off as the server software (e.g. Nginx or Apache) used to run the application should serve static assets instead. Unlike the default setting set this to true when running (absolutely not recommended!) or testing your app in production mode using WEBrick. Otherwise you won´t be able use page caching and requests for files that exist regularly under the public directory will anyway hit your Rails app. @@ -462,7 +458,7 @@ Some parts of Rails can also be configured externally by supplying environment v h3. Using Initializer Files -After loading the framework and any gems and plugins in your application, Rails turns to loading initializers. An initializer is any Ruby file stored under +config/initializers+ in your application. You can use initializers to hold configuration settings that should be made after all of the frameworks, plugins and gems are loaded, such as options to configure settings for these parts. +After loading the framework and any gems in your application, Rails turns to loading initializers. An initializer is any Ruby file stored under +config/initializers+ in your application. You can use initializers to hold configuration settings that should be made after all of the frameworks and gems are loaded, such as options to configure settings for these parts. NOTE: You can use subfolders to organize your initializers if you like, because Rails will look into the whole file hierarchy from the initializers folder on down. @@ -617,7 +613,7 @@ The error occurred while evaluating nil.each *+prepend_helpers_path+* Adds the directory +app/helpers+ from the application, railties and engines to the lookup path for helpers for the application. -*+load_config_initializers+* Loads all Ruby files from +config/initializers+ in the application, railties and engines. The files in this directory can be used to hold configuration settings that should be made after all of the frameworks and plugins are loaded. +*+load_config_initializers+* Loads all Ruby files from +config/initializers+ in the application, railties and engines. The files in this directory can be used to hold configuration settings that should be made after all of the frameworks are loaded. *+engines_blank_point+* Provides a point-in-initialization to hook into if you wish to do anything before engines are loaded. After this point, all railtie and engine initializers are ran. diff --git a/railties/guides/source/documents.yaml b/railties/guides/source/documents.yaml index dccfefb4fb..58713a08a8 100644 --- a/railties/guides/source/documents.yaml +++ b/railties/guides/source/documents.yaml @@ -84,7 +84,7 @@ url: configuring.html description: This guide covers the basic configuration settings for a Rails application. - - name: Rails Command Line Tools and Rake tasks + name: Rails Command Line Tools and Rake Tasks url: command_line.html description: This guide covers the command line tools and rake tasks provided by Rails. - diff --git a/railties/guides/source/generators.textile b/railties/guides/source/generators.textile index d93dcf40bf..920ff997ae 100644 --- a/railties/guides/source/generators.textile +++ b/railties/guides/source/generators.textile @@ -406,22 +406,6 @@ The following are methods available for both generators and templates for Rails. NOTE: Methods provided by Thor are not covered this guide and can be found in "Thor's documentation":http://rdoc.info/github/wycats/thor/master/Thor/Actions.html -h4. +plugin+ - -+plugin+ will install a plugin into the current application. - -<ruby> -plugin("dynamic-form", :git => "git://github.com/rails/dynamic-form.git") -</ruby> - -Available options are: - -* +:git+ - Takes the path to the git repository where this plugin can be found. -* +:branch+ - The name of the branch of the git repository where the plugin is found. -* +:submodule+ - Set to +true+ for the plugin to be installed as a submodule. Defaults to +false+. -* +:svn+ - Takes the path to the svn repository where this plugin can be found. -* +:revision+ - The revision of the plugin in an SVN repository. - h4. +gem+ Specifies a gem dependency of the application. diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index 9150c4b8d6..a36f84e9fd 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -290,7 +290,7 @@ rundown on the function of each of the files and folders that Rails created by d |script/|Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application.| |test/|Unit tests, fixtures, and other test apparatus. These are covered in "Testing Rails Applications":testing.html| |tmp/|Temporary files| -|vendor/|A place for all third-party code. In a typical Rails application, this includes Ruby Gems, the Rails source code (if you optionally install it into your project) and plugins containing additional prepackaged functionality.| +|vendor/|A place for all third-party code. In a typical Rails application, this includes Ruby Gems and the Rails source code (if you optionally install it into your project).| h4. Configuring a Database diff --git a/railties/guides/source/layout.html.erb b/railties/guides/source/layout.html.erb index e69936b43a..84427b380c 100644 --- a/railties/guides/source/layout.html.erb +++ b/railties/guides/source/layout.html.erb @@ -44,51 +44,16 @@ <li class="index"><a href="index.html" onclick="guideMenu(); return false;" id="guidesMenu">Guides Index</a> <div id="guides" class="clearfix" style="display: none;"> <hr /> - <dl class="L"> - <dt>Start Here</dt> - <dd><a href="getting_started.html">Getting Started with Rails</a></dd> - <dt>Models</dt> - <dd><a href="migrations.html">Rails Database Migrations</a></dd> - <dd><a href="active_record_validations_callbacks.html">Active Record Validations and Callbacks</a></dd> - <dd><a href="association_basics.html">Active Record Associations</a></dd> - <dd><a href="active_record_querying.html">Active Record Query Interface</a></dd> - <dt>Views</dt> - <dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd> - <dd><a href="form_helpers.html">Action View Form Helpers</a></dd> - <dt>Controllers</dt> - <dd><a href="action_controller_overview.html">Action Controller Overview</a></dd> - <dd><a href="routing.html">Rails Routing from the Outside In</a></dd> - </dl> - <dl class="R"> - <dt>Digging Deeper</dt> - <dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd> - <dd><a href="i18n.html">Rails Internationalization API</a></dd> - <dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd> - <dd><a href="testing.html">Testing Rails Applications</a></dd> - <dd><a href="security.html">Securing Rails Applications</a></dd> - <dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd> - <dd><a href="performance_testing.html">Performance Testing Rails Applications</a></dd> - <dd><a href="configuring.html">Configuring Rails Applications</a></dd> - <dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd> - <dd><a href="caching_with_rails.html">Caching with Rails</a></dd> - <dd><a href="asset_pipeline.html">Asset Pipeline</a></dd> - - <dt>Extending Rails</dt> - <dd><a href="plugins.html">The Basics of Creating Rails Plugins</a></dd> - <dd><a href="rails_on_rack.html">Rails on Rack</a></dd> - <dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd> - - <dt>Contributing to Ruby on Rails</dt> - <dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd> - <dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd> - <dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd> - - <dt>Release Notes</dt> - <dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</a></dd> - <dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd> - <dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd> - <dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd> - </dl> + <% ['L', 'R'].each do |position| %> + <dl class="<%= position %>"> + <% docs_for_menu(position).each do |section| %> + <dt><%= section['name'] %></dt> + <% finished_documents(section['documents']).each do |document| %> + <dd><a href="<%= document['url'] %>"><%= document['name'] %></a></dd> + <% end %> + <% end %> + </dl> + <% end %> </div> </li> <li><a href="contributing_to_ruby_on_rails.html">Contribute</a></li> diff --git a/railties/guides/source/plugins.textile b/railties/guides/source/plugins.textile index 5cfd336d1e..ccff2a1eed 100644 --- a/railties/guides/source/plugins.textile +++ b/railties/guides/source/plugins.textile @@ -30,16 +30,6 @@ Before you continue, take a moment to decide if your new plugin will be potentia * If your plugin is specific to your application, your new plugin will be a _vendored plugin_. * If you think your plugin may be used across applications, build it as a _gemified plugin_. -h4. Either generate a vendored plugin... - -Use the +rails generate plugin+ command in your Rails root directory - to create a new plugin that will live in the +vendor/plugins+ - directory. See usage and options by asking for help: - -<shell> -$ rails generate plugin --help -</shell> - h4. Or generate a gemified plugin. Writing your Rails plugin as a gem, rather than as a vendored plugin, @@ -412,30 +402,6 @@ After running +bundle install+, your gem functionality will be available to the When the gem is ready to be shared as a formal release, it can be published to "RubyGems":http://www.rubygems.org. For more information about publishing gems to RubyGems, see: "http://blog.thepete.net/2010/11/creating-and-publishing-your-first-ruby.html":http://blog.thepete.net/2010/11/creating-and-publishing-your-first-ruby.html -h3. Non-Gem Plugins - -Non-gem plugins are useful for functionality that won't be shared with another project. Keeping your custom functionality in the -vendor/plugins directory un-clutters the rest of the application. - -Move the directory that you created for the gem based plugin into the vendor/plugins directory of a generated Rails application, create a vendor/plugins/yaffle/init.rb file that contains "require 'yaffle'" and everything will still work. - -<ruby> -# yaffle/init.rb - -require 'yaffle' -</ruby> - -You can test this by changing to the Rails application that you added the plugin to and starting a rails console. Once in the -console we can check to see if the String has an instance method to_squawk: - -<shell> -$ cd my_app -$ rails console -$ "Rails plugins are easy!".to_squawk -</shell> - -You can also remove the .gemspec, Gemfile and Gemfile.lock files as they will no longer be needed. - h3. RDoc Documentation Once your plugin is stable and you are ready to deploy do everyone else a favor and document it! Luckily, writing documentation for your plugin is easy. @@ -461,4 +427,3 @@ h4. References * "Using Gemspecs As Intended":http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended/ * "Gemspec Reference":http://docs.rubygems.org/read/chapter/20 * "GemPlugins":http://www.mbleigh.com/2008/06/11/gemplugins-a-brief-introduction-to-the-future-of-rails-plugins -* "Keeping init.rb thin":http://daddy.platte.name/2007/05/rails-plugins-keep-initrb-thin.html diff --git a/railties/guides/source/rails_application_templates.textile b/railties/guides/source/rails_application_templates.textile index 3b51a52733..f50ced3307 100644 --- a/railties/guides/source/rails_application_templates.textile +++ b/railties/guides/source/rails_application_templates.textile @@ -1,6 +1,6 @@ h2. Rails Application Templates -Application templates are simple Ruby files containing DSL for adding plugins/gems/initializers etc. to your freshly created Rails project or an existing Rails project. +Application templates are simple Ruby files containing DSL for adding gems/initializers etc. to your freshly created Rails project or an existing Rails project. By referring to this guide, you will be able to: @@ -82,31 +82,6 @@ For example, if you need to source a gem from "http://code.whytheluckystiff.net" add_source "http://code.whytheluckystiff.net" </ruby> -h4. plugin(name, options = {}) - -Installs a plugin to the generated application. - -Plugin can be installed from Git: - -<ruby> -plugin 'authentication', :git => 'git://github.com/foor/bar.git' -</ruby> - -You can even install plugins as git submodules: - -<ruby> -plugin 'authentication', :git => 'git://github.com/foor/bar.git', - :submodule => true -</ruby> - -Please note that you need to +git :init+ before you can install a plugin as a submodule. - -Or use plain old SVN: - -<ruby> -plugin 'usingsvn', :svn => 'svn://example.com/usingsvn/trunk' -</ruby> - h4. vendor/lib/file/initializer(filename, data = nil, &block) Adds an initializer to the generated application’s +config/initializers+ directory. diff --git a/railties/guides/source/testing.textile b/railties/guides/source/testing.textile index 5dbbe2c0f0..e0386b95b4 100644 --- a/railties/guides/source/testing.textile +++ b/railties/guides/source/testing.textile @@ -738,7 +738,6 @@ You don't need to set up and run your tests by hand on a test-by-test basis. Rai |+rake test:benchmark+ |Benchmark the performance tests| |+rake test:functionals+ |Runs all the functional tests from +test/functional+| |+rake test:integration+ |Runs all the integration tests from +test/integration+| -|+rake test:plugins+ |Run all the plugin tests from +vendor/plugins/*/**/test+ (or specify with +PLUGIN=_name_+)| |+rake test:profile+ |Profile the performance tests| |+rake test:recent+ |Tests recent changes| |+rake test:uncommitted+ |Runs all the tests which are uncommitted. Supports Subversion and Git| |