aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile3
-rwxr-xr-xRakefile2
-rw-r--r--actionmailer/MIT-LICENSE2
-rw-r--r--actionmailer/lib/action_mailer.rb2
-rw-r--r--actionpack/CHANGELOG.md238
-rw-r--r--actionpack/MIT-LICENSE2
-rw-r--r--actionpack/lib/action_controller/metal/http_authentication.rb10
-rw-r--r--actionpack/lib/action_controller/test_case.rb61
-rw-r--r--actionpack/lib/action_dispatch.rb2
-rw-r--r--actionpack/lib/action_dispatch/routing.rb5
-rw-r--r--actionpack/lib/action_dispatch/routing/route_set.rb67
-rw-r--r--actionpack/lib/action_dispatch/routing/routes_proxy.rb4
-rw-r--r--actionpack/lib/action_dispatch/routing/url_for.rb23
-rw-r--r--actionpack/lib/action_pack.rb2
-rw-r--r--actionpack/lib/action_view.rb2
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb14
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb2
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb9
-rw-r--r--actionpack/test/controller/action_pack_assertions_test.rb14
-rw-r--r--actionpack/test/controller/http_basic_authentication_test.rb2
-rw-r--r--actionpack/test/controller/test_case_test.rb (renamed from actionpack/test/controller/test_test.rb)38
-rw-r--r--actionpack/test/dispatch/prefix_generation_test.rb7
-rw-r--r--actionpack/test/dispatch/request/xml_params_parsing_test.rb8
-rw-r--r--actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf0
-rw-r--r--actionpack/test/fixtures/sprockets/app/fonts/font.ttf0
-rw-r--r--actionpack/test/template/sprockets_helper_test.rb26
-rw-r--r--activemodel/MIT-LICENSE2
-rw-r--r--activemodel/lib/active_model.rb2
-rw-r--r--activemodel/lib/active_model/mass_assignment_security/permission_set.rb2
-rw-r--r--activerecord/MIT-LICENSE2
-rw-r--r--activerecord/lib/active_record.rb2
-rw-r--r--activerecord/lib/active_record/associations/builder/belongs_to.rb6
-rw-r--r--activerecord/lib/active_record/associations/builder/has_many.rb7
-rw-r--r--activerecord/lib/active_record/fixtures.rb12
-rw-r--r--activerecord/lib/active_record/migration/command_recorder.rb2
-rw-r--r--activerecord/lib/active_record/railties/databases.rake2
-rw-r--r--activerecord/lib/active_record/session_store.rb8
-rw-r--r--activerecord/test/cases/connection_pool_test.rb4
-rw-r--r--activerecord/test/cases/fixtures_test.rb14
-rw-r--r--activerecord/test/cases/locking_test.rb12
-rw-r--r--activerecord/test/cases/migration/command_recorder_test.rb6
-rw-r--r--activerecord/test/models/car.rb2
-rw-r--r--activerecord/test/schema/schema.rb1
-rw-r--r--activeresource/MIT-LICENSE2
-rw-r--r--activeresource/lib/active_resource.rb2
-rw-r--r--activeresource/test/cases/authorization_test.rb16
-rw-r--r--activesupport/MIT-LICENSE2
-rw-r--r--activesupport/lib/active_support.rb3
-rw-r--r--activesupport/lib/active_support/base64.rb18
-rw-r--r--activesupport/lib/active_support/core_ext/class/attribute.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/debugger.rb2
-rw-r--r--activesupport/lib/active_support/json/encoding.rb4
-rw-r--r--activesupport/lib/active_support/message_encryptor.rb6
-rw-r--r--activesupport/lib/active_support/message_verifier.rb6
-rw-r--r--activesupport/lib/active_support/test_case.rb12
-rw-r--r--activesupport/lib/active_support/xml_mini.rb9
-rw-r--r--activesupport/test/core_ext/base64_ext_test.rb10
-rw-r--r--activesupport/test/core_ext/range_ext_test.rb2
-rw-r--r--activesupport/test/json/encoding_test.rb4
-rw-r--r--activesupport/test/message_encryptor_test.rb6
-rw-r--r--railties/CHANGELOG.md6
-rw-r--r--railties/MIT-LICENSE2
-rw-r--r--railties/guides/code/getting_started/README.rdoc10
-rw-r--r--railties/guides/code/getting_started/config/application.rb4
-rw-r--r--railties/guides/rails_guides/helpers.rb12
-rw-r--r--railties/guides/source/3_2_release_notes.textile9
-rw-r--r--railties/guides/source/api_documentation_guidelines.textile7
-rw-r--r--railties/guides/source/command_line.textile16
-rw-r--r--railties/guides/source/configuring.textile10
-rw-r--r--railties/guides/source/documents.yaml2
-rw-r--r--railties/guides/source/generators.textile16
-rw-r--r--railties/guides/source/getting_started.textile2
-rw-r--r--railties/guides/source/layout.html.erb55
-rw-r--r--railties/guides/source/plugins.textile35
-rw-r--r--railties/guides/source/rails_application_templates.textile27
-rw-r--r--railties/guides/source/testing.textile1
-rw-r--r--railties/lib/rails/application.rb5
-rw-r--r--railties/lib/rails/application/bootstrap.rb2
-rw-r--r--railties/lib/rails/application/configuration.rb2
-rw-r--r--railties/lib/rails/application/railties.rb2
-rw-r--r--railties/lib/rails/commands.rb2
-rw-r--r--railties/lib/rails/commands/plugin.rb544
-rw-r--r--railties/lib/rails/engine/configuration.rb2
-rw-r--r--railties/lib/rails/engine/railties.rb9
-rw-r--r--railties/lib/rails/generators.rb11
-rw-r--r--railties/lib/rails/generators/actions.rb34
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb5
-rw-r--r--railties/lib/rails/generators/rails/app/templates/README10
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb4
-rw-r--r--railties/lib/rails/plugin.rb91
-rw-r--r--railties/lib/rails/rack/debugger.rb2
-rw-r--r--railties/lib/rails/railtie.rb8
-rw-r--r--railties/lib/rails/tasks/documentation.rake40
-rw-r--r--railties/lib/rails/test_unit/testing.rake12
-rw-r--r--railties/test/application/paths_test.rb1
-rw-r--r--railties/test/generators/actions_test.rb37
-rw-r--r--railties/test/generators/app_generator_test.rb1
-rw-r--r--railties/test/isolation/abstract_unit.rb14
-rw-r--r--railties/test/railties/engine_test.rb40
-rw-r--r--railties/test/railties/plugin_ordering_test.rb76
-rw-r--r--railties/test/railties/plugin_test.rb123
-rw-r--r--railties/test/railties/shared_tests.rb13
102 files changed, 486 insertions, 1555 deletions
diff --git a/Gemfile b/Gemfile
index 1284c60531..76be75e872 100644
--- a/Gemfile
+++ b/Gemfile
@@ -43,7 +43,8 @@ platforms :mri_18 do
end
# Add your own local bundler stuff
-instance_eval File.read '.Gemfile' if File.exists? '.Gemfile'
+local_gemfile = File.dirname(__FILE__) + "/.Gemfile"
+instance_eval File.read local_gemfile if File.exists? local_gemfile
platforms :mri do
group :test do
diff --git a/Rakefile b/Rakefile
index 831187d5f5..03b8a952c3 100755
--- a/Rakefile
+++ b/Rakefile
@@ -94,7 +94,7 @@ RDoc::Task.new do |rdoc|
rdoc.options << '-f' << 'sdoc'
rdoc.options << '-T' << 'rails'
- rdoc.options << '-c' << 'utf-8'
+ rdoc.options << '-e' << 'UTF-8'
rdoc.options << '-g' # SDoc flag, link methods to GitHub
rdoc.options << '-m' << RDOC_MAIN
diff --git a/actionmailer/MIT-LICENSE b/actionmailer/MIT-LICENSE
index 7ad1051066..810daf856c 100644
--- a/actionmailer/MIT-LICENSE
+++ b/actionmailer/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2011 David Heinemeier Hansson
+Copyright (c) 2004-2012 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index 2ac4f3f681..1045dd58ef 100644
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2011 David Heinemeier Hansson
+# Copyright (c) 2004-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index c992f1388a..f408c50390 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,5 +1,7 @@
## Rails 3.2.0 (unreleased) ##
+* Add font_path helper method *Santiago Pastorino*
+
* Depends on rack ~> 1.4.0 *Santiago Pastorino*
* Add :gzip option to `caches_page`. The default option can be configured globally using `page_cache_compression` *Andrey Sitnik*
@@ -155,7 +157,7 @@
## Rails 3.1.3 (unreleased) ##
-* Fix using `tranlate` helper with a html translation which uses the `:count` option for
+* Fix using `translate` helper with a html translation which uses the `:count` option for
pluralization.
*Jon Leighton*
@@ -204,23 +206,30 @@
## Rails 3.1.1 (unreleased) ##
* javascript_path and stylesheet_path now refer to /assets if asset pipelining
- is on. [Santiago Pastorino]
+ is on. *Santiago Pastorino*
+
* button_to support form option. Now you're able to pass for example
- 'data-type' => 'json'. [ihower]
+ 'data-type' => 'json'. *ihower*
+
* image_path and image_tag should use /assets if asset pipelining is turned
- on. Closes #3126 [Santiago Pastorino and christos]
+ on. Closes #3126 *Santiago Pastorino and christos*
+
* Avoid use of existing precompiled assets during rake assets:precompile run.
- Closes #3119 [Guillermo Iguaran]
+ Closes #3119 *Guillermo Iguaran*
+
* Copy assets to nondigested filenames too *Santiago Pastorino*
* Give precedence to `config.digest = false` over the existence of
- manifest.yml asset digests [christos]
+ manifest.yml asset digests *christos*
+
* escape options for the stylesheet_link_tag method *Alexey Vakhov*
* Re-launch assets:precompile task using (Rake.)ruby instead of Kernel.exec so
- it works on Windows [cablegram]
-* env var passed to process shouldn't be modified in process method. [Santiago
- Pastorino]
+ it works on Windows *cablegram*
+
+* env var passed to process shouldn't be modified in process method. *Santiago
+ Pastorino*
+
* `rake assets:precompile` loads the application but does not initialize
it.
To the app developer, this means configuration add in
@@ -235,7 +244,8 @@
* Fix Hash#to_query edge case with html_safe strings. *brainopia*
* Allow asset tag helper methods to accept :digest => false option in order to completely avoid the digest generation.
- Useful for linking assets from static html files or from emails when the user could probably look at an older html email with an older asset. [Santiago Pastorino]
+ Useful for linking assets from static html files or from emails when the user could probably look at an older html email with an older asset. *Santiago Pastorino*
+
* Don't mount Sprockets server at config.assets.prefix if config.assets.compile is false. *Mark J. Titorenko*
* Set relative url root in assets when controller isn't available for Sprockets (eg. Sass files using asset_path). Fixes #2435 *Guillermo Iguaran*
@@ -392,6 +402,7 @@
* ActionDispatch::MiddlewareStack now uses composition over inheritance. It is
no longer an array which means there may be methods missing that were not tested.
+
* Add an :authenticity_token option to form_tag for custom handling or to omit the token (pass :authenticity_token => false). *Jakub Kuźma, Igor Wiedler*
* HTML5 button_tag helper. *Rizwan Reza*
@@ -433,7 +444,7 @@
* No changes.
-* Rails 3.0.6 (April 5, 2011)
+## Rails 3.0.6 (April 5, 2011) ##
* Fixed XSS vulnerability in `auto_link`. `auto_link` no longer marks input as
html safe. Please make sure that calls to auto_link() are wrapped in a
@@ -622,7 +633,7 @@
* Added ActionDispatch::Request#authorization to access the http authentication header regardless of its proxy hiding *DHH*
-* Added :alert, :notice, and :flash as options to ActionController::Base#redirect_to that'll automatically set the proper flash before the redirection [DHH]. Examples:
+* Added :alert, :notice, and :flash as options to ActionController::Base#redirect_to that'll automatically set the proper flash before the redirection *DHH*. Examples:
flash[:notice] = 'Post was created'
redirect_to(@post)
@@ -633,7 +644,6 @@
* Added ActionController::Base#notice/= and ActionController::Base#alert/= as a convenience accessors in both the controller and the view for flash[:notice]/= and flash[:alert]/= *DHH*
-
* Introduce grouped_collection_select helper. #1249 *Dan Codeape, Erik Ostrom*
* Make sure javascript_include_tag/stylesheet_link_tag does not append ".js" or ".css" onto external urls. #1664 *Matthew Rudy Jacobs*
@@ -673,19 +683,19 @@
* Make the form_for and fields_for helpers support the new Active Record nested update options. #1202 *Eloy Duran*
- <% form_for @person do |person_form| %>
+ <% form_for @person do |person_form| %>
...
<% person_form.fields_for :projects do |project_fields| %>
<% if project_fields.object.active? %>
Name: <%= project_fields.text_field :name %>
<% end %>
<% end %>
- <% end %>
+ <% end %>
* Added grouped_options_for_select helper method for wrapping option tags in optgroups. #977 *Jon Crawford*
-* Implement HTTP Digest authentication. #1230 [Gregg Kellogg, Pratik Naik] Example :
+* Implement HTTP Digest authentication. #1230 *Gregg Kellogg, Pratik Naik* Example :
class DummyDigestController < ActionController::Base
USERS = { "lifo" => 'world' }
@@ -723,7 +733,7 @@
* Fixed the AssetTagHelper cache to use the computed asset host as part of the cache key instead of just assuming the its a string #1299 *DHH*
-* Make ActionController#render(string) work as a shortcut for render :file/:template/:action => string. [#1435] [Pratik Naik] Examples:
+* Make ActionController#render(string) work as a shortcut for render :file/:template/:action => string. #1435 *Pratik Naik* Examples:
\# Instead of render(:action => 'other_action')
render('other_action') # argument has no '/'
@@ -755,7 +765,7 @@
* Remove deprecated ActionController::Base#assign_default_content_type_and_charset
-* Changed the default of ActionView#render to assume partials instead of files when not given an options hash [David Heinemeier Hansson]. Examples:
+* Changed the default of ActionView#render to assume partials instead of files when not given an options hash *DHH*. Examples:
# Instead of <%= render :partial => "account" %>
<%= render "account" %>
@@ -813,7 +823,7 @@
* Fix incorrect closing CDATA delimiter and that HTML::Node.parse would blow up on unclosed CDATA sections *packagethief*
-* Added stale? and fresh_when methods to provide a layer of abstraction above request.fresh? and friends [David Heinemeier Hansson]. Example:
+* Added stale? and fresh_when methods to provide a layer of abstraction above request.fresh? and friends *DHH*. Example:
class ArticlesController < ApplicationController
def show_with_respond_to_block
@@ -847,7 +857,7 @@
end
-* Added inline builder yield to atom_feed_helper tags where appropriate [Sam Ruby]. Example:
+* Added inline builder yield to atom_feed_helper tags where appropriate *Sam Ruby*. Example:
entry.summary :type => 'xhtml' do |xhtml|
xhtml.p pluralize(order.line_items.count, "line item")
@@ -869,7 +879,7 @@
* Changed BenchmarkHelper#benchmark to report in milliseconds *David Heinemeier Hansson*
-* Changed logging format to be millisecond based and skip misleading stats [David Heinemeier Hansson]. Went from:
+* Changed logging format to be millisecond based and skip misleading stats *DHH*. Went from:
Completed in 0.10000 (4 reqs/sec) | Rendering: 0.04000 (40%) | DB: 0.00400 (4%) | 200 OK [http://example.com]
@@ -953,7 +963,7 @@
* Deprecated TemplateHandler line offset *Josh Peek*
-* Allow caches_action to accept cache store options. #416. [José Valim]. Example:
+* Allow caches_action to accept cache store options. #416. *José Valim*. Example:
caches_action :index, :redirected, :if => Proc.new { |c| !c.request.format.json? }, :expires_in => 1.hour
@@ -983,7 +993,7 @@
* Replaced TemplateFinder abstraction with ViewLoadPaths *Josh Peek*
-* Added block-call style to link_to [Sam Stephenson/David Heinemeier Hansson]. Example:
+* Added block-call style to link_to *Sam Stephenson/David Heinemeier Hansson*. Example:
<% link_to(@profile) do %>
<strong><%= @profile.name %></strong> -- <span>Check it out!!</span>
@@ -1206,7 +1216,7 @@
* Added OPTIONS to list of default accepted HTTP methods #10449 *holoway*
-* Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [Cheah Chu Yeow]. Example:
+* Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 *Cheah Chu Yeow*. Example:
ActionController::Base.asset_host = Proc.new { |source|
if source.starts_with?('/images')
@@ -1251,7 +1261,7 @@
* Update to Prototype -r8232. *sam*
-* Make sure the optimisation code for routes doesn't get used if :host, :anchor or :port are provided in the hash arguments. [pager, Michael Koziarski] #10292
+* Make sure the optimisation code for routes doesn't get used if :host, :anchor or :port are provided in the hash arguments. *pager, Michael Koziarski* #10292
* Added protection from trailing slashes on page caching #10229 *devrieda*
@@ -1423,9 +1433,9 @@
* Don't warn when a path segment precedes a required segment. Closes #9615. *Nicholas Seckar*
-* Fixed CaptureHelper#content_for to work with the optional content parameter instead of just the block #9434 [sandofsky/wildchild].
+* Fixed CaptureHelper#content_for to work with the optional content parameter instead of just the block #9434 *sandofsky/wildchild*.
-* Added Mime::Type.register_alias for dealing with different formats using the same mime type [David Heinemeier Hansson]. Example:
+* Added Mime::Type.register_alias for dealing with different formats using the same mime type *DHH*. Example:
class PostsController < ApplicationController
before_filter :adjust_format_for_iphone
@@ -1448,7 +1458,7 @@
end
end
-* Added that render :json will automatically call .to_json unless it's being passed a string [David Heinemeier Hansson].
+* Added that render :json will automatically call .to_json unless it's being passed a string *DHH*.
* Autolink behaves well with emails embedded in URLs. #7313 *Jeremy McAnally, Tarmo Tänav*
@@ -1472,7 +1482,7 @@
* Removed deprecated form of calling xml_http_request/xhr without the first argument being the http verb *David Heinemeier Hansson*
-* Removed deprecated methods [David Heinemeier Hansson]:
+* Removed deprecated methods *DHH*:
- ActionController::Base#keep_flash (use flash.keep instead)
- ActionController::Base#expire_matched_fragments (just call expire_fragment with a regular expression)
@@ -1588,7 +1598,7 @@
* Reduce file stat calls when checking for template changes. #7736 *alex*
-* Added custom path cache_page/expire_page parameters in addition to the options hashes [David Heinemeier Hansson]. Example:
+* Added custom path cache_page/expire_page parameters in addition to the options hashes *DHH*. Example:
def index
caches_page(response.body, "/index.html")
@@ -1626,7 +1636,7 @@
* Update to Prototype 1.5.1. *Sam Stephenson*
-* Allow routes to be decalred under namespaces [Tobias Lütke]:
+* Allow routes to be decalred under namespaces *Tobias Lütke*:
map.namespace :admin do |admin|
admin.root :controller => "products"
@@ -1641,7 +1651,7 @@
* select :include_blank option can be set to a string instead of true, which just uses an empty string. #7664 *Wizard*
-* Added url_for usage on render :location, which allows for record identification [David Heinemeier Hansson]. Example:
+* Added url_for usage on render :location, which allows for record identification *DHH*. Example:
render :xml => person, :status => :created, :location => person
@@ -1667,7 +1677,7 @@
end
end
-* Added record identifications to FormHelper#form_for and PrototypeHelper#remote_form_for [David Heinemeier Hansson]. Examples:
+* Added record identifications to FormHelper#form_for and PrototypeHelper#remote_form_for *DHH*. Examples:
<% form_for(@post) do |f| %>
...
@@ -1693,7 +1703,7 @@
* Rationalize route path escaping according to RFC 2396 section 3.3. #7544, #8307. *Jeremy Kemper, Chris Roos, begemot, jugend*
-* Added record identification with polymorphic routes for ActionController::Base#url_for and ActionView::Base#url_for [David Heinemeier Hansson]. Examples:
+* Added record identification with polymorphic routes for ActionController::Base#url_for and ActionView::Base#url_for *DHH*. Examples:
redirect_to(post) # => redirect_to(posts_url(post)) => Location: http://example.com/posts/1
link_to(post.title, post) # => link_to(post.title, posts_url(post)) => <a href="/posts/1">Hello world</a>
@@ -1724,13 +1734,13 @@
* Update UrlWriter to accept :anchor parameter. Closes #6771. *Chris McGrath*
-* Added RecordTagHelper for using RecordIdentifier conventions on divs and other container elements [David Heinemeier Hansson]. Example:
+* Added RecordTagHelper for using RecordIdentifier conventions on divs and other container elements *DHH*. Example:
<% div_for(post) do %> <div id="post_45" class="post">
<%= post.body %> What a wonderful world!
<% end %> </div>
-* Added page[record] accessor to JavaScriptGenerator that relies on RecordIdentifier to find the right dom id [David Heinemeier Hansson]. Example:
+* Added page[record] accessor to JavaScriptGenerator that relies on RecordIdentifier to find the right dom id *DHH*. Example:
format.js do
# Calls: new Effect.fade('post_45');
@@ -1757,7 +1767,7 @@
:has_many => [ :tags, :images, :variants ]
end
-* Added :name_prefix as standard for nested resources [David Heinemeier Hansson]. WARNING: May be backwards incompatible with your app
+* Added :name_prefix as standard for nested resources *DHH*. WARNING: May be backwards incompatible with your app
Before:
@@ -1789,7 +1799,7 @@
map.resources :notes, :has_many => [ :comments, :attachments ], :has_one => :author
-* Added that render :xml will try to call to_xml if it can [David Heinemeier Hansson]. Makes these work:
+* Added that render :xml will try to call to_xml if it can *DHH*. Makes these work:
render :xml => post
render :xml => comments
@@ -1866,7 +1876,7 @@
* Allow array and hash query parameters. Array route parameters are converted/to/a/path as before. #6765, #7047, #7462 *bgipsy, Jeremy McAnally, Dan Kubb, brendan*
- \# Add a #dbman attr_reader for CGI::Session and make CGI::Session::CookieStore#generate_digest public so it's easy to generate digests using the cookie store's secret. [Rick Olson]
+ \# Add a #dbman attr_reader for CGI::Session and make CGI::Session::CookieStore#generate_digest public so it's easy to generate digests using the cookie store's secret. *Rick Olson*
* Added Request#url that returns the complete URL used for the request *David Heinemeier Hansson*
* Extract dynamic scaffolding into a plugin. #7700 *Josh Peek*
@@ -1883,7 +1893,7 @@
* Allow send_file/send_data to use a registered mime type as the :type parameter #7620 *jonathan*
-* Allow routing requirements on map.resource(s) #7633 [quixoten]. Example:
+* Allow routing requirements on map.resource(s) #7633 *quixoten*. Example:
map.resources :network_interfaces, :requirements => { :id => /^\d+\.\d+\.\d+\.\d+$/ }
@@ -1907,9 +1917,9 @@
:secret => Proc.new { User.current.secret_key }
}
-* Added .erb and .builder as preferred aliases to the now deprecated .rhtml and .rxml extensions [Chad Fowler]. This is done to separate the renderer from the mime type. .erb templates are often used to render emails, atom, csv, whatever. So labeling them .rhtml doesn't make too much sense. The same goes for .rxml, which can be used to build everything from HTML to Atom to whatever. .rhtml and .rxml will continue to work until Rails 3.0, though. So this is a slow phasing out. All generators and examples will start using the new aliases, though.
+* Added .erb and .builder as preferred aliases to the now deprecated .rhtml and .rxml extensions *Chad Fowler*. This is done to separate the renderer from the mime type. .erb templates are often used to render emails, atom, csv, whatever. So labeling them .rhtml doesn't make too much sense. The same goes for .rxml, which can be used to build everything from HTML to Atom to whatever. .rhtml and .rxml will continue to work until Rails 3.0, though. So this is a slow phasing out. All generators and examples will start using the new aliases, though.
-* Added caching option to AssetTagHelper#stylesheet_link_tag and AssetTagHelper#javascript_include_tag [David Heinemeier Hansson]. Examples:
+* Added caching option to AssetTagHelper#stylesheet_link_tag and AssetTagHelper#javascript_include_tag *DHH*. Examples:
stylesheet_link_tag :all, :cache => true # when ActionController::Base.perform_caching is false =>
<link href="/stylesheets/style1.css" media="screen" rel="Stylesheet" type="text/css" />
@@ -1948,7 +1958,7 @@
* Fix #render_file so that TemplateError is called with the correct params and you don't get the WSOD. *Rick Olson*
* Fix issue with deprecation messing up #template_root= usage. Add #prepend_view_path and #append_view_path to allow modification of a copy of the
- superclass' view_paths. [Rick Olson]
+ superclass' view_paths. *Rick Olson*
* Allow Controllers to have multiple view_paths instead of a single template_root. Closes #2754 *John Long*
* Add much-needed html-scanner tests. Fixed CDATA parsing bug. *Rick Olson*
@@ -2100,13 +2110,13 @@
* Added map.root as an alias for map.connect '' *David Heinemeier Hansson*
-* Added Request#format to return the format used for the request as a mime type. If no format is specified, the first Request#accepts type is used. This means you can stop using respond_to for anything else than responses [David Heinemeier Hansson]. Examples:
+* Added Request#format to return the format used for the request as a mime type. If no format is specified, the first Request#accepts type is used. This means you can stop using respond_to for anything else than responses *DHH*. Examples:
GET /posts/5.xml | request.format => Mime::XML
GET /posts/5.xhtml | request.format => Mime::HTML
GET /posts/5 | request.format => request.accepts.first (usually Mime::HTML for browsers)
-* Added the option for extension aliases to mime type registration [David Heinemeier Hansson]. Example (already in the default routes):
+* Added the option for extension aliases to mime type registration *DHH*. Example (already in the default routes):
Mime::Type.register "text/html", :html, %w( application/xhtml+xml ), %w( xhtml )
@@ -2173,7 +2183,7 @@
* Add a 0 margin/padding div around the hidden _method input tag that form_tag outputs. *Rick Olson*
-* Added block-usage to TagHelper#content_tag [David Heinemeier Hansson]. Example:
+* Added block-usage to TagHelper#content_tag *DHH*. Example:
<% content_tag :div, :class => "strong" %>
Hello world!
@@ -2204,7 +2214,7 @@
* Fix deprecation warnings when rendering the template error template. *Nicholas Seckar*
-* Fix routing to correctly determine when generation fails. Closes #6300. [psross].
+* Fix routing to correctly determine when generation fails. Closes #6300. *psross*.
* Fix broken assert_generates when extra keys are being checked. *Jamis Buck*
@@ -2230,7 +2240,7 @@
* Fixed that FormHelper#radio_button didn't respect an :id being passed in #6266 *evansj*
-* Added an html_options hash parameter to javascript_tag() and update_page_tag() helpers #6311 [tzaharia]. Example:
+* Added an html_options hash parameter to javascript_tag() and update_page_tag() helpers #6311 *tzaharia*. Example:
update_page_tag :defer => 'true' { |page| ... }
@@ -2254,13 +2264,13 @@
* Deprecation: @cookies, @headers, @request, @response will be removed after 1.2. Use the corresponding method instead. *Jeremy Kemper*
-* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. [Jamis Buck]. Examples:
+* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. *Jamis Buck*. Examples:
head :status => 404 # expands to "404 Not Found"
head :status => :not_found # expands to "404 Not Found"
head :status => :created # expands to "201 Created"
-* Add head(options = {}) for responses that have no body. [Jamis Buck]. Examples:
+* Add head(options = {}) for responses that have no body. *Jamis Buck*. Examples:
head :status => 404 # return an empty response with a 404 status
head :location => person_path(@person), :status => 201
@@ -2281,7 +2291,7 @@
* Rescue Errno::ECONNRESET to handle an unexpectedly closed socket connection. Improves SCGI reliability. #3368, #6226 *sdsykes, fhanshaw@vesaria.com*
-* Added that respond_to blocks will automatically set the content type to be the same as is requested [David Heinemeier Hansson]. Examples:
+* Added that respond_to blocks will automatically set the content type to be the same as is requested *DHH*. Examples:
respond_to do |format|
format.html { render :text => "I'm being sent as text/html" }
@@ -2291,7 +2301,7 @@
* Added utf-8 as the default charset for all renders. You can change this default using ActionController::Base.default_charset=(encoding) *David Heinemeier Hansson*
-* Added proper getters and setters for content type and charset [David Heinemeier Hansson]. Example of what we used to do:
+* Added proper getters and setters for content type and charset *DHH*. Example of what we used to do:
response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
@@ -2336,7 +2346,7 @@
* Update UrlWriter to support :only_path. *Nicholas Seckar, Dave Thomas*
-* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [David Heinemeier Hansson]. So what used to require a nil, like this:
+* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional *DHH*. So what used to require a nil, like this:
link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
@@ -2348,7 +2358,7 @@
* Update to Prototype 1.5.0_rc1 *sam*
-* Added access to nested attributes in RJS #4548 [richcollins@gmail.com]. Examples:
+* Added access to nested attributes in RJS #4548 *richcollins@gmail.com*. Examples:
page['foo']['style'] # => $('foo').style;
page['foo']['style']['color'] # => $('blank_slate').style.color;
@@ -2460,7 +2470,7 @@
* Fixed the new_#{resource}_url route and added named route tests for Simply Restful. *Rick Olson*
-* Added map.resources from the Simply Restful plugin [David Heinemeier Hansson]. Examples (the API has changed to use plurals!):
+* Added map.resources from the Simply Restful plugin *DHH*. Examples (the API has changed to use plurals!):
map.resources :messages
map.resources :messages, :comments
@@ -2533,9 +2543,9 @@
* Added Mime::TEXT (text/plain) and Mime::ICS (text/calendar) as new default types *David Heinemeier Hansson*
-* Added Mime::Type.register(string, symbol, synonyms = []) for adding new custom mime types [David Heinemeier Hansson]. Example: Mime::Type.register("image/gif", :gif)
+* Added Mime::Type.register(string, symbol, synonyms = []) for adding new custom mime types *DHH*. Example: Mime::Type.register("image/gif", :gif)
-* Added support for Mime objects in render :content_type option [David Heinemeier Hansson]. Example: render :text => some_atom, :content_type => Mime::ATOM
+* Added support for Mime objects in render :content_type option *DHH*. Example: render :text => some_atom, :content_type => Mime::ATOM
* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 *Manfred Stienstra <m.stienstra@fngtps.com>*
@@ -2549,7 +2559,7 @@
* Accept multipart PUT parameters. #5235 *guy.naor@famundo.com*
-* Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output [David Heinemeier Hansson]. Example:
+* Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output *DHH*. Example:
class WeblogController < ActionController::Base
def index
@@ -2817,7 +2827,7 @@
* Add a 0 margin/padding div around the hidden _method input tag that form_tag outputs. *Rick Olson*
-* Added block-usage to TagHelper#content_tag [David Heinemeier Hansson]. Example:
+* Added block-usage to TagHelper#content_tag *DHH*. Example:
<% content_tag :div, :class => "strong" %>
Hello world!
@@ -2846,7 +2856,7 @@
* Fix double-escaped entities, such as &amp;amp;, &amp;#123;, etc. *Rick Olson*
-* Fix routing to correctly determine when generation fails. Closes #6300. [psross].
+* Fix routing to correctly determine when generation fails. Closes #6300. *psross*.
* Fix broken assert_generates when extra keys are being checked. *Jamis Buck*
@@ -2868,7 +2878,7 @@
* Fixed that FormHelper#radio_button didn't respect an :id being passed in #6266 *evansj*
-* Added an html_options hash parameter to javascript_tag() and update_page_tag() helpers #6311 [tzaharia]. Example:
+* Added an html_options hash parameter to javascript_tag() and update_page_tag() helpers #6311 *tzaharia*. Example:
update_page_tag :defer => 'true' { |page| ... }
@@ -2892,13 +2902,13 @@
* Deprecation: @cookies, @headers, @request, @response will be removed after 1.2. Use the corresponding method instead. *Jeremy Kemper*
-* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. [Jamis Buck]. Examples:
+* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. *Jamis Buck*. Examples:
head :status => 404 # expands to "404 Not Found"
head :status => :not_found # expands to "404 Not Found"
head :status => :created # expands to "201 Created"
-* Add head(options = {}) for responses that have no body. [Jamis Buck]. Examples:
+* Add head(options = {}) for responses that have no body. *Jamis Buck*. Examples:
head :status => 404 # return an empty response with a 404 status
head :location => person_path(@person), :status => 201
@@ -2917,7 +2927,7 @@
* Rescue Errno::ECONNRESET to handle an unexpectedly closed socket connection. Improves SCGI reliability. #3368, #6226 *sdsykes, fhanshaw@vesaria.com*
-* Added that respond_to blocks will automatically set the content type to be the same as is requested [David Heinemeier Hansson]. Examples:
+* Added that respond_to blocks will automatically set the content type to be the same as is requested *DHH*. Examples:
respond_to do |format|
format.html { render :text => "I'm being sent as text/html" }
@@ -2927,7 +2937,7 @@
* Added utf-8 as the default charset for all renders. You can change this default using ActionController::Base.default_charset=(encoding) *David Heinemeier Hansson*
-* Added proper getters and setters for content type and charset [David Heinemeier Hansson]. Example of what we used to do:
+* Added proper getters and setters for content type and charset *DHH*. Example of what we used to do:
response.headers["Content-Type"] = "application/atom+xml; charset=utf-8"
@@ -2964,7 +2974,7 @@
* Update UrlWriter to support :only_path. *Nicholas Seckar, Dave Thomas*
-* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional [David Heinemeier Hansson]. So what used to require a nil, like this:
+* Fixed JavaScriptHelper#link_to_function and JavaScriptHelper#button_to_function to have the script argument be optional *DHH*. So what used to require a nil, like this:
link_to("Hider", nil, :class => "hider_link") { |p| p[:something].hide }
@@ -2972,7 +2982,7 @@
link_to("Hider", :class => "hider_link") { |p| p[:something].hide }
-* Added access to nested attributes in RJS #4548 [richcollins@gmail.com]. Examples:
+* Added access to nested attributes in RJS #4548 *richcollins@gmail.com*. Examples:
page['foo']['style'] # => $('foo').style;
page['foo']['style']['color'] # => $('blank_slate').style.color;
@@ -3059,7 +3069,7 @@
* Fixed the new_#{resource}_url route and added named route tests for Simply Restful. *Rick Olson*
-* Added map.resources from the Simply Restful plugin [David Heinemeier Hansson]. Examples (the API has changed to use plurals!):
+* Added map.resources from the Simply Restful plugin *DHH*. Examples (the API has changed to use plurals!):
map.resources :messages
map.resources :messages, :comments
@@ -3126,9 +3136,9 @@
* Added Mime::TEXT (text/plain) and Mime::ICS (text/calendar) as new default types *David Heinemeier Hansson*
-* Added Mime::Type.register(string, symbol, synonyms = []) for adding new custom mime types [David Heinemeier Hansson]. Example: Mime::Type.register("image/gif", :gif)
+* Added Mime::Type.register(string, symbol, synonyms = []) for adding new custom mime types *DHH*. Example: Mime::Type.register("image/gif", :gif)
-* Added support for Mime objects in render :content_type option [David Heinemeier Hansson]. Example: render :text => some_atom, :content_type => Mime::ATOM
+* Added support for Mime objects in render :content_type option *DHH*. Example: render :text => some_atom, :content_type => Mime::ATOM
* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 *Manfred Stienstra <m.stienstra@fngtps.com>*
@@ -3142,7 +3152,7 @@
* Accept multipart PUT parameters. #5235 *guy.naor@famundo.com*
-* Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output [David Heinemeier Hansson]. Example:
+* Added interrogation of params[:format] to determine Accept type. If :format is specified and matches a declared extension, like "rss" or "xml", that mime type will be put in front of the accept handler. This means you can link to the same action from different extensions and use that fact to determine output *DHH*. Example:
class WeblogController < ActionController::Base
def index
@@ -3281,7 +3291,7 @@
* Applied Prototype $() performance patches (#4465, #4477) and updated script.aculo.us *Sam Stephenson, Thomas Fuchs*
-* Added automated timestamping to AssetTagHelper methods for stylesheets, javascripts, and images when Action Controller is run under Rails [David Heinemeier Hansson]. Example:
+* Added automated timestamping to AssetTagHelper methods for stylesheets, javascripts, and images when Action Controller is run under Rails *DHH*. Example:
image_tag("rails.png") # => '<img alt="Rails" src="/images/rails.png?1143664135" />'
@@ -3335,7 +3345,7 @@
* Change url_for to escape the resulting URLs when called from a view. *Nicholas Seckar, coffee2code*
-* Added easy support for testing file uploads with fixture_file_upload #4105 [turnip@turnipspatch.com]. Example:
+* Added easy support for testing file uploads with fixture_file_upload #4105 *turnip@turnipspatch.com*. Example:
# Looks in Test::Unit::TestCase.fixture_path + '/files/spongebob.png'
post :change_avatar, :avatar => fixture_file_upload('/files/spongebob.png', 'image/png')
@@ -3370,11 +3380,11 @@
* Added simple alert() notifications for RJS exceptions when config.action_view.debug_rjs = true. *Sam Stephenson*
-* Added :content_type option to render, so you can change the content type on the fly [David Heinemeier Hansson]. Example: render :action => "atom.rxml", :content_type => "application/atom+xml"
+* Added :content_type option to render, so you can change the content type on the fly *DHH*. Example: render :action => "atom.rxml", :content_type => "application/atom+xml"
* CHANGED DEFAULT: The default content type for .rxml is now application/xml instead of type/xml, see http://www.xml.com/pub/a/2004/07/21/dive.html for reason *David Heinemeier Hansson*
-* Added option to render action/template/file of a specific extension (and here by template type). This means you can have multiple templates with the same name but a different extension [David Heinemeier Hansson]. Example:
+* Added option to render action/template/file of a specific extension (and here by template type). This means you can have multiple templates with the same name but a different extension *DHH*. Example:
class WeblogController < ActionController::Base
def index
@@ -3388,7 +3398,7 @@
end
end
-* Added better support for using the same actions to output for different sources depending on the Accept header [David Heinemeier Hansson]. Example:
+* Added better support for using the same actions to output for different sources depending on the Accept header *DHH*. Example:
class WeblogController < ActionController::Base
def create
@@ -3409,7 +3419,7 @@
* Integration test's url_for now runs in the context of the last request (if any) so after post /products/show/1 url_for :action => 'new' will yield /product/new *Tobias Lütke*
-* Re-added mixed-in helper methods for the JavascriptGenerator. Moved JavascriptGenerators methods to a module that is mixed in after the helpers are added. Also fixed that variables set in the enumeration methods like #collect are set correctly. Documentation added for the enumeration methods [Rick Olson]. Examples:
+* Re-added mixed-in helper methods for the JavascriptGenerator. Moved JavascriptGenerators methods to a module that is mixed in after the helpers are added. Also fixed that variables set in the enumeration methods like #collect are set correctly. Documentation added for the enumeration methods *Rick Olson*. Examples:
page.select('#items li').collect('items') do |element|
element.hide
@@ -3427,7 +3437,7 @@
# Assign the default XmlSimple to a new content type
ActionController::Base.param_parsers['application/backpack+xml'] = :xml_simple
- Default YAML web services were retired, ActionController::Base.param_parsers carries an example which shows how to get this functionality back. As part of this new plugin support, request.[formatted_post?, xml_post?, yaml_post? and post_format] were all deprecated in favor of request.content_type [Tobias Lütke]
+ Default YAML web services were retired, ActionController::Base.param_parsers carries an example which shows how to get this functionality back. As part of this new plugin support, request.[formatted_post?, xml_post?, yaml_post? and post_format] were all deprecated in favor of request.content_type *Tobias Lütke*
* Fixed Effect.Appear in effects.js to work with floats in Safari #3524, #3813, #3044 *Thomas Fuchs*
* Fixed that default image extension was not appended when using a full URL with AssetTagHelper#image_tag #4032, #3728 *rubyonrails@beautifulpixel.com*
@@ -3442,7 +3452,7 @@
* Added .rxml (and any non-rhtml template, really) supportfor CaptureHelper#content_for and CaptureHelper#capture #3287 *Brian Takita*
-* Added script.aculo.us drag and drop helpers to RJS [Thomas Fuchs]. Examples:
+* Added script.aculo.us drag and drop helpers to RJS *Thomas Fuchs*. Examples:
page.draggable 'product-1'
page.drop_receiving 'wastebasket', :url => { :action => 'delete' }
@@ -3460,7 +3470,7 @@
* Update script.aculo.us to V1.5.2 *Thomas Fuchs*
-* Added element and collection proxies to RJS [David Heinemeier Hansson]. Examples:
+* Added element and collection proxies to RJS *DHH*. Examples:
page['blank_slate'] # => $('blank_slate');
page['blank_slate'].show # => $('blank_slate').show();
@@ -3510,7 +3520,7 @@
* Ensure that the instance variables are copied to the template when performing render :update. *Nicholas Seckar*
-* Add the ability to call JavaScriptGenerator methods from helpers called in update blocks. [Sam Stephenson] Example:
+* Add the ability to call JavaScriptGenerator methods from helpers called in update blocks. *Sam Stephenson* Example:
module ApplicationHelper
def update_time
page.replace_html 'time', Time.now.to_s(:db)
@@ -3544,7 +3554,7 @@
* Pass along blocks from render_to_string to render. *Sam Stephenson*
-* Add render :update for inline RJS. [Sam Stephenson] Example:
+* Add render :update for inline RJS. *Sam Stephenson* Example:
class UserController < ApplicationController
def refresh
render :update do |page|
@@ -3594,7 +3604,7 @@
* Added :select option for JavaScriptMacroHelper#auto_complete_field that makes it easier to only use part of the auto-complete suggestion as the value for insertion *Thomas Fuchs*
-* Added delayed execution of Javascript from within RJS #3264 [devslashnull@gmail.com]. Example:
+* Added delayed execution of Javascript from within RJS #3264 *devslashnull@gmail.com*. Example:
page.delay(20) do
page.visual_effect :fade, 'notice'
@@ -3678,7 +3688,7 @@
* Handle cookie parsing irregularity for certain Nokia phones. #2530 *zaitzow@gmail.com*
-* Added PrototypeHelper::JavaScriptGenerator and PrototypeHelper#update_page for easily modifying multiple elements in an Ajax response. [Sam Stephenson] Example:
+* Added PrototypeHelper::JavaScriptGenerator and PrototypeHelper#update_page for easily modifying multiple elements in an Ajax response. *Sam Stephenson* Example:
update_page do |page|
page.insert_html :bottom, 'list', '<li>Last item</li>'
@@ -3702,7 +3712,7 @@
* Only include builtin filters whose filenames match /^[a-z][a-z_]*_helper.rb$/ to avoid including operating system metadata such as ._foo_helper.rb. #2855 *court3nay*
-* Added FormHelper#form_for and FormHelper#fields_for that makes it easier to work with forms for single objects also if they don't reside in instance variables [David Heinemeier Hansson]. Examples:
+* Added FormHelper#form_for and FormHelper#fields_for that makes it easier to work with forms for single objects also if they don't reside in instance variables *DHH*. Examples:
<% form_for :person, @person, :url => { :action => "update" } do |f| %>
First name: <%= f.text_field :first_name %>
@@ -3745,7 +3755,7 @@
* Added short-hand to assert_tag so assert_tag :tag => "span" can be written as assert_tag "span" *David Heinemeier Hansson*
-* Added skip_before_filter/skip_after_filter for easier control of the filter chain in inheritance hierachies [David Heinemeier Hansson]. Example:
+* Added skip_before_filter/skip_after_filter for easier control of the filter chain in inheritance hierachies *DHH*. Example:
class ApplicationController < ActionController::Base
before_filter :authenticate
@@ -3928,7 +3938,7 @@
* Fixed that number_to_currency(1000, {:precision => 0})) should return "$1,000", instead of "$1,000." #2122 *sd@notso.net*
-* Allow link_to_remote to use any DOM-element as the parent of the form elements to be submitted #2137 [erik@ruby-lang.nl]. Example:
+* Allow link_to_remote to use any DOM-element as the parent of the form elements to be submitted #2137 *erik@ruby-lang.nl*. Example:
<tr id="row023">
<td><input name="foo"/></td>
@@ -3955,7 +3965,7 @@
* Updated vendor copy of html-scanner to support better xml parsing
-* Added :popup option to UrlHelper#link_to #1996 [gabriel.gironda@gmail.com]. Examples:
+* Added :popup option to UrlHelper#link_to #1996 *gabriel.gironda@gmail.com*. Examples:
link_to "Help", { :action => "help" }, :popup => true
link_to "Busy loop", { :action => "busy" }, :popup => ['new_window', 'height=300,width=600']
@@ -4012,7 +4022,7 @@
* Added support for per-action session management #1763
-* Improved rendering speed on complicated templates by up to 100% (the more complex the templates, the higher the speedup) #1234 [Stefan Kaes]. This did necessasitate a change to the internals of ActionView#render_template that now has four parameters. Developers of custom view handlers (like Amrita) need to update for that.
+* Improved rendering speed on complicated templates by up to 100% (the more complex the templates, the higher the speedup) #1234 *Stefan Kaes*. This did necessasitate a change to the internals of ActionView#render_template that now has four parameters. Developers of custom view handlers (like Amrita) need to update for that.
* Added options hash as third argument to FormHelper#input, so you can do input('person', 'zip', :size=>10) #1719 *jeremye@bsa.ca.gov*
@@ -4087,7 +4097,7 @@
* Added :prompt option to FormOptions#select (and the users of it, like FormOptions#select_country etc) to create "Please select" style descriptors #1181 *Michael Schuerig*
-* Added JavascriptHelper#update_element_function, which returns a Javascript function (or expression) that'll update a DOM element according to the options passed #933 [mortonda@dgrmm.net]. Examples:
+* Added JavascriptHelper#update_element_function, which returns a Javascript function (or expression) that'll update a DOM element according to the options passed #933 *mortonda@dgrmm.net*. Examples:
<%= update_element_function("products", :action => :insert, :position => :bottom, :content => "<p>New product!</p>") %>
@@ -4104,7 +4114,7 @@
* Removed the default option of wrap=virtual on FormHelper#text_area to ensure XHTML compatibility #1300 *thomas@columbus.rr.com*
-* Adds the ability to include XML CDATA tags using Builder #1563 [Josh Knowles]. Example:
+* Adds the ability to include XML CDATA tags using Builder #1563 *Josh Knowles*. Example:
xml.cdata! "some text" # => <![CDATA[some text]]>
@@ -4116,7 +4126,7 @@
* Routes fail with leading slash #1540 *Nicholas Seckar*
-* Added support for graceful error handling of Ajax calls #1217 [Jamis Buck/Thomas Fuchs]. Example:
+* Added support for graceful error handling of Ajax calls #1217 *Jamis Buck/Thomas Fuchs*. Example:
link_to_remote(
"test",
@@ -4146,7 +4156,7 @@
* Added TextHelper#word_wrap(text, line_length = 80) #1449 *tuxie@dekadance.se*
-* Added a fall-through action for form_remote_tag that'll be used in case Javascript is unavailable #1459 [Scott Barron]. Example:
+* Added a fall-through action for form_remote_tag that'll be used in case Javascript is unavailable #1459 *Scott Barron*. Example:
form_remote_tag :html => { :action => url_for(:controller => "some", :action => "place") }
@@ -4154,7 +4164,7 @@
* Added tag_options as a third parameter to AssetHelper#auto_discovery_link_tag to control options like the title of the link #1430 *Kevin Clark*
-* Added option to pass in parameters to CaptureHelper#capture, so you can create more advanced view helper methods #1466 [duane.johnson@gmail.com]. Example:
+* Added option to pass in parameters to CaptureHelper#capture, so you can create more advanced view helper methods #1466 *duane.johnson@gmail.com*. Example:
<% show_calendar(:year => 2005, :month => 6) do |day, options| %>
<% options[:bgcolor] = '#dfd' if 10..15.include? day %>
@@ -4167,7 +4177,7 @@
* Correct distance_of_time_in_words for integer arguments and make the second arg optional, treating the first arg as a duration in seconds. #1458 *madrobby <thomas@fesch.at>*
-* Fixed query parser to deal gracefully with equal signs inside keys and values #1345 [gorou].
+* Fixed query parser to deal gracefully with equal signs inside keys and values #1345 *gorou*.
Example: /?sig=abcdef=:foobar=&x=y will pass now.
* Added Cuba to country list #1351 *todd*
@@ -4180,7 +4190,7 @@
* Fixed image_tag so an exception is not thrown just because the image is missing and alt value can't be generated #1395 *Marcel Molina Jr.*
-* Added a third parameter to TextHelper#auto_link called href_options for specifying additional tag options on the links generated #1401 [tyler.kovacs@gmail.com]. Example: auto_link(text, :all, { :target => "_blank" }) to have all the generated links open in a new window.
+* Added a third parameter to TextHelper#auto_link called href_options for specifying additional tag options on the links generated #1401 *tyler.kovacs@gmail.com*. Example: auto_link(text, :all, { :target => "_blank" }) to have all the generated links open in a new window.
* Fixed TextHelper#highlight to return the text, not nil, if the phrase is blank #1409 *Patrick Lenz*
@@ -4366,7 +4376,7 @@
## 1.8.1 (20th April, 2005) ##
-* Added xml_http_request/xhr method for simulating XMLHttpRequest in functional tests #1151 [Sam Stephenson]. Example:
+* Added xml_http_request/xhr method for simulating XMLHttpRequest in functional tests #1151 *Sam Stephenson*. Example:
xhr :post, :index
@@ -4388,18 +4398,18 @@
* Deprecated the majority of all the testing assertions and replaced them with a much smaller core and access to all the collections the old assertions relied on. That way the regular test/unit assertions can be used against these. Added documentation about how to use it all.
* Added a wide range of new Javascript effects:
- * Effect.Puff zooms the element out and makes it smoothly transparent at the same time, giving a "puff" illusion #996 [thomas@fesch.at]
+ * Effect.Puff zooms the element out and makes it smoothly transparent at the same time, giving a "puff" illusion #996 *thomas@fesch.at*
After the animation is completed, the display property will be set to none.
This effect will work on relative and absolute positioned elements.
- * Effect.Appear as the opposite of Effect.Fade #990 [thomas@fesch.at]
+ * Effect.Appear as the opposite of Effect.Fade #990 *thomas@fesch.at*
You should return elements with style="display:none;" or a like class for this to work best and have no chance of flicker.
- * Effect.Squish for scaling down an element and making it disappear at the end #972 [thomas@fesch.at]
+ * Effect.Squish for scaling down an element and making it disappear at the end #972 *thomas@fesch.at*
- * Effect.Scale for smoothly scaling images or text up and down #972 [thomas@fesch.at]
+ * Effect.Scale for smoothly scaling images or text up and down #972 *thomas@fesch.at*
- * Effect.Fade which smoothly turns opacity from 100 to 0 and then hides the element #960 [thomas@fesch.at]
+ * Effect.Fade which smoothly turns opacity from 100 to 0 and then hides the element #960 *thomas@fesch.at*
* Added Request#xml_http_request? (and an alias xhr?) to that'll return true when the request came from one of the Javascript helper methods (Ajax). This can be used to give one behavior for modern browsers supporting Ajax, another to old browsers #1127 *Sam Stephenson*
@@ -4537,7 +4547,7 @@
* Fixed routing and helpers to make Rails work on non-vhost setups #826 *Nicholas Seckar/Tobias Lütke*
-* Added a much improved Flash module that allows for finer-grained control on expiration and allows you to flash the current action #839 [Caio Chassot]. Example of flash.now:
+* Added a much improved Flash module that allows for finer-grained control on expiration and allows you to flash the current action #839 *Caio Chassot*. Example of flash.now:
class SomethingController < ApplicationController
def save
@@ -4554,7 +4564,7 @@
end
end
-* Added to_param call for parameters when composing an url using url_for from something else than strings #812 [Sam Stephenson]. Example:
+* Added to_param call for parameters when composing an url using url_for from something else than strings #812 *Sam Stephenson*. Example:
class Page
  def initialize(number)
@@ -4583,7 +4593,7 @@
* Added that the html options disabled, readonly, and multiple can all be treated as booleans. So specifying <tt>disabled => :true</tt> will give <tt>disabled="disabled"</tt>. #809 *mindel*
-* Added path collection syntax for Routes that will gobble up the rest of the url and pass it on to the controller #830 [rayners]. Example:
+* Added path collection syntax for Routes that will gobble up the rest of the url and pass it on to the controller #830 *rayners*. Example:
map.connect 'categories/*path_info', :controller => 'categories', :action => 'show'
@@ -4600,7 +4610,7 @@
* Removed the reliance on PATH_INFO as it was causing problems for caching and inhibited the new non-vhost support #822 *Nicholas Seckar*
-* Added assigns shortcut for @response.template.assigns to controller test cases [Jeremy Kemper]. Example:
+* Added assigns shortcut for @response.template.assigns to controller test cases *Jeremy Kemper*. Example:
Before:
@@ -5012,7 +5022,7 @@
* Added that ActiveRecordHelper#form now calls url_for on the :action option.
-* Added all the HTTP methods as alternatives to the generic "process" for functional testing #276 [Tobias Lütke]. Examples:
+* Added all the HTTP methods as alternatives to the generic "process" for functional testing #276 *Tobias Lütke*. Examples:
# Calls Controller#miletone with a GET request
process :milestone
@@ -5185,7 +5195,7 @@
* Added assert_flash_equal(expected, key, message), assert_session_equal(expected, key, message),
assert_assigned_equal(expected, key, message) to test the contents of flash, session, and template assigns.
-* Improved the failure report on assert_success when the action triggered a redirection [alexey].
+* Improved the failure report on assert_success when the action triggered a redirection *alexey*.
* Added "markdown" to accompany "textilize" as a TextHelper method for converting text to HTML using the Markdown syntax.
BlueCloth must be installed in order for this method to become available.
@@ -5260,7 +5270,7 @@
*Builder is created by Jim Weirich*
-* Added much improved support for functional testing [what-a-day].
+* Added much improved support for functional testing *what-a-day*.
# Old style
def test_failing_authenticate
@@ -5289,7 +5299,7 @@
following the suggestion from Matz on:
http://groups.google.com/groups?th=e3a4e68ba042f842&seekm=c3sioe%241qvm%241%40news.cybercity.dk#link14
-* Added caching for compiled ERb templates. On Basecamp, it gave between 8.5% and 71% increase in performance [Andreas Schwarz].
+* Added caching for compiled ERb templates. On Basecamp, it gave between 8.5% and 71% increase in performance *Andreas Schwarz*.
* Added implicit counter variable to render_collection_of_partials [Marcel Molina Jr.]. From the docs:
@@ -5316,7 +5326,7 @@
:confirm => 'Are you sure?', the link will be guarded with a JS popup asking that question.
If the user accepts, the link is processed, otherwise not.
-* Added link_to_unless_current as a UrlHelper method [Sam Stephenson]. Documentation:
+* Added link_to_unless_current as a UrlHelper method *Sam Stephenson*. Documentation:
Creates a link tag of the given +name+ using an URL created by the set of +options+, unless the current
controller, action, and id are the same as the link's, in which case only the name is returned (or the
@@ -5447,7 +5457,7 @@
So this will render "advertiser/_ad.rhtml" and pass the local variable +ad+ for
the template to display.
-* Improved send_file by allowing a wide range of options to be applied [Jeremy Kemper]:
+* Improved send_file by allowing a wide range of options to be applied *Jeremy Kemper*:
Sends the file by streaming it 4096 bytes at a time. This way the
whole file doesn't need to be read into memory at once. This makes
@@ -5698,7 +5708,7 @@
* Fixed that exceptions raised during filters are now also caught by the default rescues
-* Added new around_filter for doing before and after filtering with a single object [Florian Weber]:
+* Added new around_filter for doing before and after filtering with a single object *Florian Weber*:
class WeblogController < ActionController::Base
around_filter BenchmarkingFilter.new
@@ -5724,7 +5734,7 @@
end
end
-* Added the options for specifying a different name and id for the form helper methods than what is guessed [Florian Weber]:
+* Added the options for specifying a different name and id for the form helper methods than what is guessed *Florian Weber*:
text_field "post", "title"
...just gives: <input id="post_title" name="post[title]" size="30" type="text" value="" />
diff --git a/actionpack/MIT-LICENSE b/actionpack/MIT-LICENSE
index 7ad1051066..810daf856c 100644
--- a/actionpack/MIT-LICENSE
+++ b/actionpack/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2011 David Heinemeier Hansson
+Copyright (c) 2004-2012 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb
index 594ba7a7b8..4972c6bede 100644
--- a/actionpack/lib/action_controller/metal/http_authentication.rb
+++ b/actionpack/lib/action_controller/metal/http_authentication.rb
@@ -1,4 +1,4 @@
-require 'active_support/base64'
+require 'base64'
require 'active_support/core_ext/object/blank'
module ActionController
@@ -141,11 +141,11 @@ module ActionController
end
def decode_credentials(request)
- ActiveSupport::Base64.decode64(request.authorization.split(' ', 2).last || '')
+ ::Base64.decode64(request.authorization.split(' ', 2).last || '')
end
def encode_credentials(user_name, password)
- "Basic #{ActiveSupport::Base64.strict_encode64("#{user_name}:#{password}")}"
+ "Basic #{::Base64.strict_encode64("#{user_name}:#{password}")}"
end
def authentication_request(controller, realm)
@@ -289,7 +289,7 @@ module ActionController
t = time.to_i
hashed = [t, secret_key]
digest = ::Digest::MD5.hexdigest(hashed.join(":"))
- ActiveSupport::Base64.strict_encode64("#{t}:#{digest}")
+ ::Base64.strict_encode64("#{t}:#{digest}")
end
# Might want a shorter timeout depending on whether the request
@@ -298,7 +298,7 @@ module ActionController
# allow a user to use new nonce without prompting user again for their
# username and password.
def validate_nonce(secret_key, request, value, seconds_to_timeout=5*60)
- t = ActiveSupport::Base64.decode64(value).split(":").first.to_i
+ t = ::Base64.decode64(value).split(":").first.to_i
nonce(secret_key, t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout
end
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 7470897659..ac2e0fcb83 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -252,6 +252,12 @@ module ActionController
# end
# end
#
+ # You can also send a real document in the simulated HTTP request.
+ #
+ # def test_create
+ # json = {:book => { :title => "Love Hina" }}.to_json
+ # post :create, json
+ #
# == Special instance variables
#
# ActionController::TestCase will also automatically provide the following instance
@@ -376,23 +382,23 @@ module ActionController
end
# Executes a request simulating GET HTTP method and set/volley the response
- def get(action, parameters = nil, session = nil, flash = nil)
- process(action, parameters, session, flash, "GET")
+ def get(action, *args)
+ process(action, "GET", *args)
end
# Executes a request simulating POST HTTP method and set/volley the response
- def post(action, parameters = nil, session = nil, flash = nil)
- process(action, parameters, session, flash, "POST")
+ def post(action, *args)
+ process(action, "POST", *args)
end
# Executes a request simulating PUT HTTP method and set/volley the response
- def put(action, parameters = nil, session = nil, flash = nil)
- process(action, parameters, session, flash, "PUT")
+ def put(action, *args)
+ process(action, "PUT", *args)
end
# Executes a request simulating DELETE HTTP method and set/volley the response
- def delete(action, parameters = nil, session = nil, flash = nil)
- process(action, parameters, session, flash, "DELETE")
+ def delete(action, *args)
+ process(action, "DELETE", *args)
end
# Executes a request simulating HEAD HTTP method and set/volley the response
@@ -423,19 +429,20 @@ module ActionController
end
end
- def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
+ def process(action, http_method = 'GET', *args)
+ check_required_ivars
+ http_method, args = handle_old_process_api(http_method, args)
+
+ if args.first.is_a?(String)
+ @request.env['RAW_POST_DATA'] = args.shift
+ end
+
+ parameters, session, flash = args
+
# Ensure that numbers and symbols passed as params are converted to
# proper params, as is the case when engaging rack.
parameters = paramify_values(parameters)
- # Sanity check for required instance variables so we can give an
- # understandable error message.
- %w(@routes @controller @request @response).each do |iv_name|
- if !(instance_variable_names.include?(iv_name) || instance_variable_names.include?(iv_name.to_sym)) || instance_variable_get(iv_name).nil?
- raise "#{iv_name} is nil: make sure you set it in your test's setup method."
- end
- end
-
@request.recycle!
@response.recycle!
@controller.response_body = nil
@@ -496,6 +503,26 @@ module ActionController
end
private
+ def check_required_ivars
+ # Sanity check for required instance variables so we can give an
+ # understandable error message.
+ %w(@routes @controller @request @response).each do |iv_name|
+ if !(instance_variable_names.include?(iv_name) || instance_variable_names.include?(iv_name.to_sym)) || instance_variable_get(iv_name).nil?
+ raise "#{iv_name} is nil: make sure you set it in your test's setup method."
+ end
+ end
+ end
+
+ def handle_old_process_api(http_method, args)
+ # 4.0: Remove this method.
+ if http_method.is_a?(Hash)
+ ActiveSupport::Deprecation.warn("TestCase#process now expects the HTTP method as second argument: process(action, http_method, params, session, flash)")
+ args.unshift(http_method)
+ http_method = args.last.is_a?(String) ? args.last : "GET"
+ end
+
+ [http_method, args]
+ end
def build_request_uri(action, parameters)
unless @request.env["PATH_INFO"]
diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb
index 070ffbdceb..a9542a7d1b 100644
--- a/actionpack/lib/action_dispatch.rb
+++ b/actionpack/lib/action_dispatch.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2011 David Heinemeier Hansson
+# Copyright (c) 2004-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/actionpack/lib/action_dispatch/routing.rb b/actionpack/lib/action_dispatch/routing.rb
index fa300b4a16..2f6b9d266d 100644
--- a/actionpack/lib/action_dispatch/routing.rb
+++ b/actionpack/lib/action_dispatch/routing.rb
@@ -284,10 +284,5 @@ module ActionDispatch
SEPARATORS = %w( / . ? ) #:nodoc:
HTTP_METHODS = [:get, :head, :post, :put, :delete, :options] #:nodoc:
-
- # A helper module to hold URL related helpers.
- module Helpers #:nodoc:
- include PolymorphicRoutes
- end
end
end
diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb
index 10b3e212e6..9d0a3e9993 100644
--- a/actionpack/lib/action_dispatch/routing/route_set.rb
+++ b/actionpack/lib/action_dispatch/routing/route_set.rb
@@ -123,11 +123,6 @@ module ActionDispatch
routes.length
end
- def install(destinations = [ActionController::Base, ActionView::Base])
- helper = @module
- destinations.each { |d| d.module_eval { include helper } }
- end
-
private
def url_helper_name(name, kind = :url)
:"#{name}_#{kind}"
@@ -276,14 +271,15 @@ module ActionDispatch
@prepend.each { |blk| eval_block(blk) }
end
- def install_helpers(destinations)
- destinations.each { |d| d.module_eval { include Helpers } }
- named_routes.install(destinations)
- end
-
- module MountedHelpers
+ module MountedHelpers #:nodoc:
+ extend ActiveSupport::Concern
+ include UrlFor
end
+ # Contains all the mounted helpers accross different
+ # engines and the `main_app` helper for the application.
+ # You can include this in your classes if you want to
+ # access routes for other engines.
def mounted_helpers
MountedHelpers
end
@@ -294,7 +290,7 @@ module ActionDispatch
routes = self
MountedHelpers.class_eval do
define_method "_#{name}" do
- RoutesProxy.new(routes, self._routes_context)
+ RoutesProxy.new(routes, _routes_context)
end
end
@@ -306,29 +302,40 @@ module ActionDispatch
end
def url_helpers
- routes = self
+ @url_helpers ||= begin
+ routes = self
+
+ Module.new do
+ extend ActiveSupport::Concern
+ include UrlFor
+
+ # Define url_for in the singleton level so one can do:
+ # Rails.application.routes.url_helpers.url_for(args)
+ @_routes = routes
+ class << self
+ delegate :url_for, :to => '@_routes'
+ end
- @url_helpers ||= Module.new {
- extend ActiveSupport::Concern
- include UrlFor
+ # Make named_routes available in the module singleton
+ # as well, so one can do:
+ # Rails.application.routes.url_helpers.posts_path
+ extend routes.named_routes.module
- @_routes = routes
- def self.url_for(options)
- @_routes.url_for options
- end
+ # Any class that includes this module will get all
+ # named routes...
+ include routes.named_routes.module
- extend routes.named_routes.module
+ # plus a singleton class method called _routes ...
+ included do
+ singleton_class.send(:redefine_method, :_routes) { routes }
+ end
- # ROUTES TODO: install_helpers isn't great... can we make a module with the stuff that
- # we can include?
- # Yes plz - JP
- included do
- routes.install_helpers([self])
- singleton_class.send(:redefine_method, :_routes) { routes }
+ # And an instance method _routes. Note that
+ # UrlFor (included in this module) add extra
+ # conveniences for working with @_routes.
+ define_method(:_routes) { @_routes || routes }
end
-
- define_method(:_routes) { @_routes || routes }
- }
+ end
end
def empty?
diff --git a/actionpack/lib/action_dispatch/routing/routes_proxy.rb b/actionpack/lib/action_dispatch/routing/routes_proxy.rb
index f7d5f6397d..73af5920ed 100644
--- a/actionpack/lib/action_dispatch/routing/routes_proxy.rb
+++ b/actionpack/lib/action_dispatch/routing/routes_proxy.rb
@@ -16,6 +16,10 @@ module ActionDispatch
end
end
+ def respond_to?(method, include_private = false)
+ super || routes.url_helpers.respond_to?(method)
+ end
+
def method_missing(method, *args)
if routes.url_helpers.respond_to?(method)
self.class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
diff --git a/actionpack/lib/action_dispatch/routing/url_for.rb b/actionpack/lib/action_dispatch/routing/url_for.rb
index 6c2a98ab15..ee6616c5d3 100644
--- a/actionpack/lib/action_dispatch/routing/url_for.rb
+++ b/actionpack/lib/action_dispatch/routing/url_for.rb
@@ -8,7 +8,8 @@ module ActionDispatch
#
# <b>Tip:</b> If you need to generate URLs from your models or some other place,
# then ActionController::UrlFor is what you're looking for. Read on for
- # an introduction.
+ # an introduction. In general, this module should not be included on its own,
+ # as it is usually included by url_helpers (as in Rails.application.routes.url_helpers).
#
# == URL generation from parameters
#
@@ -84,7 +85,6 @@ module ActionDispatch
include PolymorphicRoutes
included do
- # TODO: with_routing extends @controller with url_helpers, trickling down to including this module which overrides its default_url_options
unless method_defined?(:default_url_options)
# Including in a class uses an inheritable hash. Modules get a plain hash.
if respond_to?(:class_attribute)
@@ -151,16 +151,17 @@ module ActionDispatch
end
protected
- def _with_routes(routes)
- old_routes, @_routes = @_routes, routes
- yield
- ensure
- @_routes = old_routes
- end
- def _routes_context
- self
- end
+ def _with_routes(routes)
+ old_routes, @_routes = @_routes, routes
+ yield
+ ensure
+ @_routes = old_routes
+ end
+
+ def _routes_context
+ self
+ end
end
end
end
diff --git a/actionpack/lib/action_pack.rb b/actionpack/lib/action_pack.rb
index 914b13dbfb..39c7faf740 100644
--- a/actionpack/lib/action_pack.rb
+++ b/actionpack/lib/action_pack.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2011 David Heinemeier Hansson
+# Copyright (c) 2004-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb
index c24109a547..349a3fcc6e 100644
--- a/actionpack/lib/action_view.rb
+++ b/actionpack/lib/action_view.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2011 David Heinemeier Hansson
+# Copyright (c) 2004-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 653e12c7d8..5dbba3c4a7 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -306,6 +306,20 @@ module ActionView
end
alias_method :path_to_audio, :audio_path # aliased to avoid conflicts with an audio_path named route
+ # Computes the path to a font asset in the public fonts directory.
+ # Full paths from the document root will be passed through.
+ #
+ # ==== Examples
+ # font_path("font") # => /fonts/font
+ # font_path("font.ttf") # => /fonts/font.ttf
+ # font_path("dir/font.ttf") # => /fonts/dir/font.ttf
+ # font_path("/dir/font.ttf") # => /dir/font.ttf
+ # font_path("http://www.example.com/dir/font.ttf") # => http://www.example.com/dir/font.ttf
+ def font_path(source)
+ asset_paths.compute_public_path(source, 'fonts')
+ end
+ alias_method :path_to_font, :font_path # aliased to avoid conflicts with an font_path named route
+
# Returns an html image tag for the +source+. The +source+ can be a full
# path or a file that exists in your public images directory.
#
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 5a301ca9b1..d46ee4faef 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -1270,7 +1270,7 @@ module ActionView
@multipart = nil
end
- (field_helpers - %w(label check_box radio_button fields_for hidden_field file_field)).each do |selector|
+ (field_helpers - [:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each do |selector|
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def #{selector}(method, options = {}) # def text_field(method, options = {})
@template.send( # @template.send(
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index c34b3f6f26..976ae5a76d 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -63,13 +63,18 @@ module Sprockets
end
alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
- def javascript_path(source)
+ def font_path(source)
path_to_asset(source)
end
+ alias_method :path_to_font, :font_path # aliased to avoid conflicts with an font_path named route
+
+ def javascript_path(source)
+ path_to_asset(source, :ext => 'js')
+ end
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with an javascript_path named route
def stylesheet_path(source)
- path_to_asset(source)
+ path_to_asset(source, :ext => 'css')
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with an stylesheet_path named route
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb
index fab70c71d6..bdbf158b36 100644
--- a/actionpack/test/controller/action_pack_assertions_test.rb
+++ b/actionpack/test/controller/action_pack_assertions_test.rb
@@ -159,20 +159,6 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase
assert_equal @response.body, 'request method: GET'
end
- def test_redirect_to_named_route
- with_routing do |set|
- set.draw do
- match 'route_one', :to => 'action_pack_assertions#nothing', :as => :route_one
- match ':controller/:action'
- end
- set.install_helpers([ActionController::Base, ActionView::Base])
-
- process :redirect_to_named_route
- assert_redirected_to 'http://test.host/route_one'
- assert_redirected_to route_one_url
- end
- end
-
def test_string_constraint
with_routing do |set|
set.draw do
diff --git a/actionpack/test/controller/http_basic_authentication_test.rb b/actionpack/test/controller/http_basic_authentication_test.rb
index 364e96d4f6..7286b249c7 100644
--- a/actionpack/test/controller/http_basic_authentication_test.rb
+++ b/actionpack/test/controller/http_basic_authentication_test.rb
@@ -132,6 +132,6 @@ class HttpBasicAuthenticationTest < ActionController::TestCase
private
def encode_credentials(username, password)
- "Basic #{ActiveSupport::Base64.encode64("#{username}:#{password}")}"
+ "Basic #{::Base64.encode64("#{username}:#{password}")}"
end
end
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_case_test.rb
index b3b7ece518..73b860ac18 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_case_test.rb
@@ -171,6 +171,21 @@ XML
assert_equal params.to_query, @response.body
end
+
+ def test_document_body_and_params_with_post
+ post :test_params, :id => 1
+ assert_equal("{\"id\"=>\"1\", \"controller\"=>\"test_test/test\", \"action\"=>\"test_params\"}", @response.body)
+ end
+
+ def test_document_body_with_post
+ post :render_body, "document body"
+ assert_equal "document body", @response.body
+ end
+
+ def test_document_body_with_put
+ put :render_body, "document body"
+ assert_equal "document body", @response.body
+ end
def test_process_without_flash
process :set_flash
@@ -178,12 +193,12 @@ XML
end
def test_process_with_flash
- process :set_flash, nil, nil, { "test" => "value" }
+ process :set_flash, "GET", nil, nil, { "test" => "value" }
assert_equal '>value<', flash['test']
end
def test_process_with_flash_now
- process :set_flash_now, nil, nil, { "test_now" => "value_now" }
+ process :set_flash_now, "GET", nil, nil, { "test_now" => "value_now" }
assert_equal '>value_now<', flash['test_now']
end
@@ -196,7 +211,7 @@ XML
end
def test_process_with_session_arg
- process :no_op, nil, { 'string' => 'value1', :symbol => 'value2' }
+ process :no_op, "GET", nil, { 'string' => 'value1', :symbol => 'value2' }
assert_equal 'value1', session['string']
assert_equal 'value1', session[:string]
assert_equal 'value2', session['symbol']
@@ -227,18 +242,25 @@ XML
end
def test_process_with_request_uri_with_params
- process :test_uri, :id => 7
+ process :test_uri, "GET", :id => 7
assert_equal "/test_test/test/test_uri/7", @response.body
end
+
+ def test_process_with_old_api
+ assert_deprecated do
+ process :test_uri, :id => 7
+ assert_equal "/test_test/test/test_uri/7", @response.body
+ end
+ end
def test_process_with_request_uri_with_params_with_explicit_uri
@request.env['PATH_INFO'] = "/explicit/uri"
- process :test_uri, :id => 7
+ process :test_uri, "GET", :id => 7
assert_equal "/explicit/uri", @response.body
end
def test_process_with_query_string
- process :test_query_string, :q => 'test'
+ process :test_query_string, "GET", :q => 'test'
assert_equal "q=test", @response.body
end
@@ -250,9 +272,9 @@ XML
end
def test_multiple_calls
- process :test_only_one_param, :left => true
+ process :test_only_one_param, "GET", :left => true
assert_equal "OK", @response.body
- process :test_only_one_param, :right => true
+ process :test_only_one_param, "GET", :right => true
assert_equal "OK", @response.body
end
diff --git a/actionpack/test/dispatch/prefix_generation_test.rb b/actionpack/test/dispatch/prefix_generation_test.rb
index 93eccaecbd..bd5b5edab0 100644
--- a/actionpack/test/dispatch/prefix_generation_test.rb
+++ b/actionpack/test/dispatch/prefix_generation_test.rb
@@ -30,6 +30,7 @@ module TestGenerationPrefix
match "/url_to_application", :to => "inside_engine_generating#url_to_application"
match "/polymorphic_path_for_engine", :to => "inside_engine_generating#polymorphic_path_for_engine"
match "/conflicting_url", :to => "inside_engine_generating#conflicting"
+ match "/foo", :to => "never#invoked", :as => :named_helper_that_should_be_invoked_only_in_respond_to_test
end
routes
@@ -152,6 +153,8 @@ module TestGenerationPrefix
RailsApplication.routes.default_url_options = {}
end
+ include BlogEngine.routes.mounted_helpers
+
# Inside Engine
test "[ENGINE] generating engine's url use SCRIPT_NAME from request" do
get "/pure-awesomeness/blog/posts/1"
@@ -219,6 +222,10 @@ module TestGenerationPrefix
end
# Inside any Object
+ test "[OBJECT] proxy route should override respond_to?() as expected" do
+ assert_respond_to blog_engine, :named_helper_that_should_be_invoked_only_in_respond_to_test_path
+ end
+
test "[OBJECT] generating engine's route includes prefix" do
assert_equal "/awesome/blog/posts/1", engine_object.post_path(:id => 1)
end
diff --git a/actionpack/test/dispatch/request/xml_params_parsing_test.rb b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
index d8fa751548..0984f00066 100644
--- a/actionpack/test/dispatch/request/xml_params_parsing_test.rb
+++ b/actionpack/test/dispatch/request/xml_params_parsing_test.rb
@@ -41,7 +41,7 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest
test "parses single file" do
with_test_routing do
- xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></person>"
+ xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{::Base64.encode64('ABC')}</avatar></person>"
post "/parse", xml, default_headers
assert_response :ok
@@ -55,7 +55,7 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest
test "logs error if parsing unsuccessful" do
with_test_routing do
output = StringIO.new
- xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar></pineapple>"
+ xml = "<person><name>David</name><avatar type='file' name='me.jpg' content_type='image/jpg'>#{::Base64.encode64('ABC')}</avatar></pineapple>"
post "/parse", xml, default_headers.merge('action_dispatch.show_exceptions' => true, 'action_dispatch.logger' => Logger.new(output))
assert_response :error
output.rewind && err = output.read
@@ -80,8 +80,8 @@ class XmlParamsParsingTest < ActionDispatch::IntegrationTest
<person>
<name>David</name>
<avatars>
- <avatar type='file' name='me.jpg' content_type='image/jpg'>#{ActiveSupport::Base64.encode64('ABC')}</avatar>
- <avatar type='file' name='you.gif' content_type='image/gif'>#{ActiveSupport::Base64.encode64('DEF')}</avatar>
+ <avatar type='file' name='me.jpg' content_type='image/jpg'>#{::Base64.encode64('ABC')}</avatar>
+ <avatar type='file' name='you.gif' content_type='image/gif'>#{::Base64.encode64('DEF')}</avatar>
</avatars>
</person>
end_body
diff --git a/actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf b/actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/actionpack/test/fixtures/sprockets/app/fonts/dir/font.ttf
diff --git a/actionpack/test/fixtures/sprockets/app/fonts/font.ttf b/actionpack/test/fixtures/sprockets/app/fonts/font.ttf
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/actionpack/test/fixtures/sprockets/app/fonts/font.ttf
diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb
index 64fdd53e73..1c591bdcc2 100644
--- a/actionpack/test/template/sprockets_helper_test.rb
+++ b/actionpack/test/template/sprockets_helper_test.rb
@@ -24,6 +24,7 @@ class SprocketsHelperTest < ActionView::TestCase
@assets.append_path(FIXTURES.join("sprockets/app/javascripts"))
@assets.append_path(FIXTURES.join("sprockets/app/stylesheets"))
@assets.append_path(FIXTURES.join("sprockets/app/images"))
+ @assets.append_path(FIXTURES.join("sprockets/app/fonts"))
application = Struct.new(:config, :assets).new(config, @assets)
Rails.stubs(:application).returns(application)
@@ -147,8 +148,19 @@ class SprocketsHelperTest < ActionView::TestCase
path_to_image("logo.png")
end
+ test "font_path" do
+ assert_match %r{/assets/font-[0-9a-f]+.ttf},
+ font_path("font.ttf")
+
+ assert_match %r{/assets/font-[0-9a-f]+.ttf},
+ path_to_font("font.ttf")
+ end
+
test "javascript_path" do
assert_match %r{/assets/application-[0-9a-f]+.js},
+ javascript_path("application")
+
+ assert_match %r{/assets/application-[0-9a-f]+.js},
javascript_path("application.js")
assert_match %r{/assets/application-[0-9a-f]+.js},
@@ -157,6 +169,9 @@ class SprocketsHelperTest < ActionView::TestCase
test "stylesheet_path" do
assert_match %r{/assets/application-[0-9a-f]+.css},
+ stylesheet_path("application")
+
+ assert_match %r{/assets/application-[0-9a-f]+.css},
stylesheet_path("application.css")
assert_match %r{/assets/application-[0-9a-f]+.css},
@@ -186,6 +201,17 @@ class SprocketsHelperTest < ActionView::TestCase
asset_path("/images/logo.gif")
end
+ test "font path through asset_path" do
+ assert_match %r{/assets/font-[0-9a-f]+.ttf},
+ asset_path('font.ttf')
+
+ assert_match %r{/assets/dir/font-[0-9a-f]+.ttf},
+ asset_path("dir/font.ttf")
+
+ assert_equal "http://www.example.com/fonts/font.ttf",
+ asset_path("http://www.example.com/fonts/font.ttf")
+ end
+
test "javascript path through asset_path" do
assert_match %r{/assets/application-[0-9a-f]+.js},
asset_path(:application, :ext => "js")
diff --git a/activemodel/MIT-LICENSE b/activemodel/MIT-LICENSE
index 7ad1051066..810daf856c 100644
--- a/activemodel/MIT-LICENSE
+++ b/activemodel/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2011 David Heinemeier Hansson
+Copyright (c) 2004-2012 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/activemodel/lib/active_model.rb b/activemodel/lib/active_model.rb
index 9fc308375f..85514e63fd 100644
--- a/activemodel/lib/active_model.rb
+++ b/activemodel/lib/active_model.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2011 David Heinemeier Hansson
+# Copyright (c) 2004-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/activemodel/lib/active_model/mass_assignment_security/permission_set.rb b/activemodel/lib/active_model/mass_assignment_security/permission_set.rb
index a1fcdf1a38..9661349503 100644
--- a/activemodel/lib/active_model/mass_assignment_security/permission_set.rb
+++ b/activemodel/lib/active_model/mass_assignment_security/permission_set.rb
@@ -13,7 +13,7 @@ module ActiveModel
end
def deny?(key)
- raise NotImplementedError, "#deny?(key) suppose to be overwritten"
+ raise NotImplementedError, "#deny?(key) supposed to be overwritten"
end
protected
diff --git a/activerecord/MIT-LICENSE b/activerecord/MIT-LICENSE
index c73d1af096..03bde18130 100644
--- a/activerecord/MIT-LICENSE
+++ b/activerecord/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2011 David Heinemeier Hansson
+Copyright (c) 2004-2012 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb
index 4f194cb6cf..78e958442f 100644
--- a/activerecord/lib/active_record.rb
+++ b/activerecord/lib/active_record.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2011 David Heinemeier Hansson
+# Copyright (c) 2004-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb
index 1759a41d93..4183c222de 100644
--- a/activerecord/lib/active_record/associations/builder/belongs_to.rb
+++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb
@@ -33,8 +33,10 @@ module ActiveRecord::Associations::Builder
method_name = "belongs_to_counter_cache_before_destroy_for_#{name}"
mixin.redefine_method(method_name) do
- record = send(name)
- record.class.decrement_counter(cache_column, record.id) unless record.nil?
+ unless marked_for_destruction?
+ record = send(name)
+ record.class.decrement_counter(cache_column, record.id) unless record.nil?
+ end
end
model.before_destroy(method_name)
diff --git a/activerecord/lib/active_record/associations/builder/has_many.rb b/activerecord/lib/active_record/associations/builder/has_many.rb
index 9c24f40690..fc6799fb15 100644
--- a/activerecord/lib/active_record/associations/builder/has_many.rb
+++ b/activerecord/lib/active_record/associations/builder/has_many.rb
@@ -31,12 +31,7 @@ module ActiveRecord::Associations::Builder
mixin.redefine_method(dependency_method_name) do
send(name).each do |o|
# No point in executing the counter update since we're going to destroy the parent anyway
- counter_method = ('belongs_to_counter_cache_before_destroy_for_' + self.class.name.downcase).to_sym
- if o.respond_to?(counter_method)
- class << o
- self
- end.send(:define_method, counter_method, Proc.new {})
- end
+ o.mark_for_destruction
end
send(name).delete_all
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index c59c00f424..9ea8cf864c 100644
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -445,7 +445,8 @@ module ActiveRecord
self.all_loaded_fixtures = {}
def self.create_fixtures(fixtures_directory, table_names, class_names = {})
- table_names = [table_names].flatten.map { |n| n.to_s }
+ table_names = Array(table_names).map(&:to_s)
+ class_names = class_names.stringify_keys
# FIXME: Apparently JK uses this.
connection = block_given? ? yield : ActiveRecord::Base.connection
@@ -464,7 +465,7 @@ module ActiveRecord
fixtures_map[fixture_name] = new( # ActiveRecord::Fixtures.new
connection,
fixture_name,
- class_names[fixture_name] || default_fixture_model_name(fixture_name),
+ class_names[fixture_name.to_s] || default_fixture_model_name(fixture_name),
::File.join(fixtures_directory, path))
end
@@ -728,6 +729,7 @@ module ActiveRecord
self.pre_loaded_fixtures = false
self.fixture_class_names = Hash.new do |h, fixture_name|
+ fixture_name = fixture_name.to_s
h[fixture_name] = ActiveRecord::Fixtures.default_fixture_model_name(fixture_name)
end
end
@@ -754,8 +756,9 @@ module ActiveRecord
def fixtures(*fixture_names)
if fixture_names.first == :all
- fixture_names = Dir["#{fixture_path}/**/*.{yml}"]
- fixture_names.map! { |f| f[(fixture_path.size + 1)..-5] }
+ fixture_names = Dir["#{fixture_path}/**/*.yml"].map { |f|
+ File.basename f, '.yml'
+ }
else
fixture_names = fixture_names.flatten.map { |n| n.to_s }
end
@@ -789,6 +792,7 @@ module ActiveRecord
fixture_names = Array.wrap(fixture_names || fixture_table_names)
methods = Module.new do
fixture_names.each do |fixture_name|
+ fixture_name = fixture_name.to_s
accessor_name = fixture_name.tr('/', '_').to_sym
define_method(accessor_name) do |*fixtures|
diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb
index ffee5a081a..4e27293cb4 100644
--- a/activerecord/lib/active_record/migration/command_recorder.rb
+++ b/activerecord/lib/active_record/migration/command_recorder.rb
@@ -59,7 +59,7 @@ module ActiveRecord
private
def invert_create_table(args)
- [:drop_table, args]
+ [:drop_table, [args.first]]
end
def invert_rename_table(args)
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index 180424641a..822b51e838 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -539,7 +539,7 @@ end
namespace :railties do
namespace :install do
- # desc "Copies missing migrations from Railties (e.g. plugins, engines). You can specify Railties to use with FROM=railtie1,railtie2"
+ # desc "Copies missing migrations from Railties (e.g. engines). You can specify Railties to use with FROM=railtie1,railtie2"
task :migrations => :'db:load_config' do
to_load = ENV['FROM'].blank? ? :all : ENV['FROM'].split(",").map {|n| n.strip }
railties = ActiveSupport::OrderedHash.new
diff --git a/activerecord/lib/active_record/session_store.rb b/activerecord/lib/active_record/session_store.rb
index e3bbd06f7e..1029bed064 100644
--- a/activerecord/lib/active_record/session_store.rb
+++ b/activerecord/lib/active_record/session_store.rb
@@ -51,11 +51,11 @@ module ActiveRecord
class SessionStore < ActionDispatch::Session::AbstractStore
module ClassMethods # :nodoc:
def marshal(data)
- ActiveSupport::Base64.encode64(Marshal.dump(data)) if data
+ ::Base64.encode64(Marshal.dump(data)) if data
end
def unmarshal(data)
- Marshal.load(ActiveSupport::Base64.decode64(data)) if data
+ Marshal.load(::Base64.decode64(data)) if data
end
def drop_table!
@@ -169,11 +169,11 @@ module ActiveRecord
# are implemented as class methods that you may override. By default,
# marshaling data is
#
- # ActiveSupport::Base64.encode64(Marshal.dump(data))
+ # ::Base64.encode64(Marshal.dump(data))
#
# and unmarshaling data is
#
- # Marshal.load(ActiveSupport::Base64.decode64(data))
+ # Marshal.load(::Base64.decode64(data))
#
# This marshaling behavior is intended to store the widest range of
# binary session data in a +text+ column. For higher performance,
diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb
index 26842d3998..2c69bfde5b 100644
--- a/activerecord/test/cases/connection_pool_test.rb
+++ b/activerecord/test/cases/connection_pool_test.rb
@@ -22,7 +22,7 @@ module ActiveRecord
def teardown
super
- @pool.connections.each(&:close)
+ @pool.disconnect!
end
def test_full_pool_exception
@@ -81,7 +81,7 @@ module ActiveRecord
@pool.remove conn
assert_not_equal(conn, @pool.connection)
ensure
- conn.close
+ conn.close if conn
end
def test_active_connection?
diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb
index 859bb7992b..5c67cbfcce 100644
--- a/activerecord/test/cases/fixtures_test.rb
+++ b/activerecord/test/cases/fixtures_test.rb
@@ -65,8 +65,9 @@ class FixturesTest < ActiveRecord::TestCase
end
def test_create_fixtures
- ActiveRecord::Fixtures.create_fixtures(FIXTURES_ROOT, "parrots")
- assert Parrot.find_by_name('Curious George'), 'George is in the database'
+ fixtures = ActiveRecord::Fixtures.create_fixtures(FIXTURES_ROOT, "parrots")
+ assert Parrot.find_by_name('Curious George'), 'George is not in the database'
+ assert fixtures.detect { |f| f.name == 'parrots' }, "no fixtures named 'parrots' in #{fixtures.map(&:name).inspect}"
end
def test_multiple_clean_fixtures
@@ -76,6 +77,13 @@ class FixturesTest < ActiveRecord::TestCase
fixtures_array.each { |fixtures| assert_kind_of(ActiveRecord::Fixtures, fixtures) }
end
+ def test_create_symbol_fixtures
+ fixtures = ActiveRecord::Fixtures.create_fixtures(FIXTURES_ROOT, :collections, :collections => Course) { Course.connection }
+
+ assert Course.find_by_name('Collection'), 'course is not in the database'
+ assert fixtures.detect { |f| f.name == 'collections' }, "no fixtures named 'collections' in #{fixtures.map(&:name).inspect}"
+ end
+
def test_attributes
topics = create_fixtures("topics").first
assert_equal("The First Topic", topics["first"]["title"])
@@ -589,7 +597,7 @@ class FasterFixturesTest < ActiveRecord::TestCase
load_extra_fixture('posts')
assert ActiveRecord::Fixtures.fixture_is_cached?(ActiveRecord::Base.connection, 'posts')
- self.class.setup_fixture_accessors('posts')
+ self.class.setup_fixture_accessors :posts
assert_equal 'Welcome to the weblog', posts(:welcome).title
end
end
diff --git a/activerecord/test/cases/locking_test.rb b/activerecord/test/cases/locking_test.rb
index f7ee83998d..65cd9f9755 100644
--- a/activerecord/test/cases/locking_test.rb
+++ b/activerecord/test/cases/locking_test.rb
@@ -6,6 +6,9 @@ require 'models/reader'
require 'models/legacy_thing'
require 'models/reference'
require 'models/string_key_object'
+require 'models/car'
+require 'models/engine'
+require 'models/wheel'
class LockWithoutDefault < ActiveRecord::Base; end
@@ -224,6 +227,15 @@ class OptimisticLockingTest < ActiveRecord::TestCase
assert_equal lock_version, p1.lock_version
end
end
+
+ def test_polymorphic_destroy_with_dependencies_and_lock_version
+ car = Car.create!
+ car.wheels << Wheel.create!
+ assert_equal 1, car.wheels.count
+ assert car.destroy
+ assert_equal 0, car.wheels.count
+ assert car.destroyed?
+ end
end
class OptimisticLockingWithSchemaChangeTest < ActiveRecord::TestCase
diff --git a/activerecord/test/cases/migration/command_recorder_test.rb b/activerecord/test/cases/migration/command_recorder_test.rb
index d108b456f0..8f136bce2b 100644
--- a/activerecord/test/cases/migration/command_recorder_test.rb
+++ b/activerecord/test/cases/migration/command_recorder_test.rb
@@ -67,6 +67,12 @@ module ActiveRecord
assert_equal [:drop_table, [:system_settings]], drop_table
end
+ def test_invert_create_table_with_options
+ @recorder.record :create_table, [:people_reminders, {:id => false}]
+ drop_table = @recorder.inverse.first
+ assert_equal [:drop_table, [:people_reminders]], drop_table
+ end
+
def test_invert_rename_table
@recorder.record :rename_table, [:old, :new]
rename = @recorder.inverse.first
diff --git a/activerecord/test/models/car.rb b/activerecord/test/models/car.rb
index b9c2e8ec9a..6ff1329d8e 100644
--- a/activerecord/test/models/car.rb
+++ b/activerecord/test/models/car.rb
@@ -9,7 +9,7 @@ class Car < ActiveRecord::Base
has_many :tyres
has_many :engines, :dependent => :destroy
- has_many :wheels, :as => :wheelable
+ has_many :wheels, :as => :wheelable, :dependent => :destroy
scope :incl_tyres, includes(:tyres)
scope :incl_engines, includes(:engines)
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index b8f34bb739..11378c12e5 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -107,6 +107,7 @@ ActiveRecord::Schema.define do
t.string :name
t.integer :engines_count
t.integer :wheels_count
+ t.column :lock_version, :integer, :null => false, :default => 0
end
create_table :categories, :force => true do |t|
diff --git a/activeresource/MIT-LICENSE b/activeresource/MIT-LICENSE
index 216b6e5ba0..187e748f83 100644
--- a/activeresource/MIT-LICENSE
+++ b/activeresource/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2006-2011 David Heinemeier Hansson
+Copyright (c) 2006-2012 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/activeresource/lib/active_resource.rb b/activeresource/lib/active_resource.rb
index 0794a1a800..ab06086631 100644
--- a/activeresource/lib/active_resource.rb
+++ b/activeresource/lib/active_resource.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2006-2011 David Heinemeier Hansson
+# Copyright (c) 2006-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/activeresource/test/cases/authorization_test.rb b/activeresource/test/cases/authorization_test.rb
index 17cd9b30fc..dabc40dfe7 100644
--- a/activeresource/test/cases/authorization_test.rb
+++ b/activeresource/test/cases/authorization_test.rb
@@ -53,7 +53,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["david", "test123"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["david", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_with_username_but_no_password
@@ -62,7 +62,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["david"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["david"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_with_password_but_no_username
@@ -71,7 +71,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["", "test123"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_with_decoded_credentials_from_url
@@ -80,7 +80,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["my@email.com", "123"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["my@email.com", "123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_explicitly_setting_username_and_password
@@ -92,7 +92,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["david", "test123"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["david", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_explicitly_setting_username_but_no_password
@@ -102,7 +102,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["david"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["david"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_explicitly_setting_password_but_no_username
@@ -112,7 +112,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["", "test123"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_if_credentials_supplied_and_auth_type_is_basic
@@ -122,7 +122,7 @@ class AuthorizationTest < Test::Unit::TestCase
authorization = authorization_header["Authorization"].to_s.split
assert_equal "Basic", authorization[0]
- assert_equal ["david", "test123"], ActiveSupport::Base64.decode64(authorization[1]).split(":")[0..1]
+ assert_equal ["david", "test123"], ::Base64.decode64(authorization[1]).split(":")[0..1]
end
def test_authorization_header_if_credentials_supplied_and_auth_type_is_digest
diff --git a/activesupport/MIT-LICENSE b/activesupport/MIT-LICENSE
index 5e8b7a9450..c2bcf1d3e7 100644
--- a/activesupport/MIT-LICENSE
+++ b/activesupport/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2005-2011 David Heinemeier Hansson
+Copyright (c) 2005-2012 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index 9fdc7a3b83..dbf0c25c5c 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2005-2011 David Heinemeier Hansson
+# Copyright (c) 2005-2012 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -52,7 +52,6 @@ module ActiveSupport
# TODO: Narrow this list down
eager_autoload do
autoload :BacktraceCleaner
- autoload :Base64
autoload :BasicObject
autoload :Benchmarkable
autoload :Cache
diff --git a/activesupport/lib/active_support/base64.rb b/activesupport/lib/active_support/base64.rb
deleted file mode 100644
index 41a1a3469d..0000000000
--- a/activesupport/lib/active_support/base64.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require 'base64'
-
-module ActiveSupport
- Base64 = ::Base64
-
- # *DEPRECATED*: Use +Base64.strict_encode64+ instead.
- #
- # Encodes the value as base64 without the newline breaks. This makes the base64 encoding readily usable as URL parameters
- # or memcache keys without further processing.
- #
- # ActiveSupport::Base64.encode64s("Original unencoded string")
- # # => "T3JpZ2luYWwgdW5lbmNvZGVkIHN0cmluZw=="
- def Base64.encode64s(value)
- ActiveSupport::Deprecation.warn "encode64s " \
- "is deprecated. Use Base64.strict_encode64 instead", caller
- strict_encode64(value)
- end
-end
diff --git a/activesupport/lib/active_support/core_ext/class/attribute.rb b/activesupport/lib/active_support/core_ext/class/attribute.rb
index 45bec264ff..305ed4964b 100644
--- a/activesupport/lib/active_support/core_ext/class/attribute.rb
+++ b/activesupport/lib/active_support/core_ext/class/attribute.rb
@@ -110,6 +110,6 @@ class Class
private
def singleton_class?
- !name || '' == name
+ ancestors.first != self
end
end
diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
index 7516f41e0b..d5b590e9f0 100644
--- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
@@ -2,7 +2,7 @@ module Kernel
unless respond_to?(:debugger)
# Starts a debugging session if ruby-debug has been loaded (call rails server --debugger to do load it).
def debugger
- message = "\n***** Debugger requested, but was not available (ensure ruby-debug is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n"
+ message = "\n***** Debugger requested, but was not available (ensure ruby-debug19 is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n"
defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message)
end
alias breakpoint debugger unless respond_to?(:breakpoint)
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index d7181035d3..07b6a940c6 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -206,6 +206,10 @@ module Enumerable
end
end
+class Range
+ def as_json(options = nil) to_s end #:nodoc:
+end
+
class Array
def as_json(options = nil) #:nodoc:
# use encoder as a proxy to call as_json on all elements, to protect from circular references
diff --git a/activesupport/lib/active_support/message_encryptor.rb b/activesupport/lib/active_support/message_encryptor.rb
index 476ba0b3d1..6ec5a04933 100644
--- a/activesupport/lib/active_support/message_encryptor.rb
+++ b/activesupport/lib/active_support/message_encryptor.rb
@@ -1,5 +1,5 @@
require 'openssl'
-require 'active_support/base64'
+require 'base64'
module ActiveSupport
# MessageEncryptor is a simple way to encrypt values which get stored somewhere
@@ -56,12 +56,12 @@ module ActiveSupport
encrypted_data = cipher.update(@serializer.dump(value))
encrypted_data << cipher.final
- [encrypted_data, iv].map {|v| ActiveSupport::Base64.strict_encode64(v)}.join("--")
+ [encrypted_data, iv].map {|v| ::Base64.strict_encode64(v)}.join("--")
end
def _decrypt(encrypted_message)
cipher = new_cipher
- encrypted_data, iv = encrypted_message.split("--").map {|v| ActiveSupport::Base64.decode64(v)}
+ encrypted_data, iv = encrypted_message.split("--").map {|v| ::Base64.decode64(v)}
cipher.decrypt
cipher.key = @secret
diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb
index 7cb5b1e82d..3b27089fa0 100644
--- a/activesupport/lib/active_support/message_verifier.rb
+++ b/activesupport/lib/active_support/message_verifier.rb
@@ -1,4 +1,4 @@
-require 'active_support/base64'
+require 'base64'
require 'active_support/core_ext/object/blank'
module ActiveSupport
@@ -37,14 +37,14 @@ module ActiveSupport
data, digest = signed_message.split("--")
if data.present? && digest.present? && secure_compare(digest, generate_digest(data))
- @serializer.load(ActiveSupport::Base64.decode64(data))
+ @serializer.load(::Base64.decode64(data))
else
raise InvalidSignature
end
end
def generate(value)
- data = ActiveSupport::Base64.strict_encode64(@serializer.dump(value))
+ data = ::Base64.strict_encode64(@serializer.dump(value))
"#{data}--#{generate_digest(data)}"
end
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 8d6c27e381..707544e594 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -10,15 +10,9 @@ require 'active_support/core_ext/kernel/reporting'
module ActiveSupport
class TestCase < ::Test::Unit::TestCase
- if defined? MiniTest
- Assertion = MiniTest::Assertion
- alias_method :method_name, :name if method_defined? :name
- alias_method :method_name, :__name__ if method_defined? :__name__
- else
- Assertion = Test::Unit::AssertionFailedError
-
- undef :default_test
- end
+ Assertion = MiniTest::Assertion
+ alias_method :method_name, :name if method_defined? :name
+ alias_method :method_name, :__name__ if method_defined? :__name__
$tags = {}
def self.for_tag(tag)
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb
index 1ea9a9d7e1..677e9910bb 100644
--- a/activesupport/lib/active_support/xml_mini.rb
+++ b/activesupport/lib/active_support/xml_mini.rb
@@ -1,4 +1,5 @@
require 'time'
+require 'base64'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/string/inflections'
@@ -48,7 +49,7 @@ module ActiveSupport
"symbol" => Proc.new { |symbol| symbol.to_s },
"date" => Proc.new { |date| date.to_s(:db) },
"datetime" => Proc.new { |time| time.xmlschema },
- "binary" => Proc.new { |binary| ActiveSupport::Base64.encode64(binary) },
+ "binary" => Proc.new { |binary| ::Base64.encode64(binary) },
"yaml" => Proc.new { |yaml| yaml.to_yaml }
} unless defined?(FORMATTING)
@@ -64,7 +65,7 @@ module ActiveSupport
"boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.strip) },
"string" => Proc.new { |string| string.to_s },
"yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
- "base64Binary" => Proc.new { |bin| ActiveSupport::Base64.decode64(bin) },
+ "base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) },
"binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) },
"file" => Proc.new { |file, entity| _parse_file(file, entity) }
}
@@ -148,14 +149,14 @@ module ActiveSupport
def _parse_binary(bin, entity) #:nodoc:
case entity['encoding']
when 'base64'
- ActiveSupport::Base64.decode64(bin)
+ ::Base64.decode64(bin)
else
bin
end
end
def _parse_file(file, entity)
- f = StringIO.new(ActiveSupport::Base64.decode64(file))
+ f = StringIO.new(::Base64.decode64(file))
f.extend(FileLike)
f.original_filename = entity['name']
f.content_type = entity['content_type']
diff --git a/activesupport/test/core_ext/base64_ext_test.rb b/activesupport/test/core_ext/base64_ext_test.rb
deleted file mode 100644
index 544c990b3c..0000000000
--- a/activesupport/test/core_ext/base64_ext_test.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'abstract_unit'
-
-class Base64Test < Test::Unit::TestCase
- def test_no_newline_in_encoded_value
- ActiveSupport::Deprecation.silence do
- assert_match(/\n/, ActiveSupport::Base64.encode64("oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"))
- assert_no_match(/\n/, ActiveSupport::Base64.encode64s("oneverylongstringthatwouldnormallybesplitupbynewlinesbytheregularbase64"))
- end
- end
-end
diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb
index 7a620305f3..e50b6c132a 100644
--- a/activesupport/test/core_ext/range_ext_test.rb
+++ b/activesupport/test/core_ext/range_ext_test.rb
@@ -54,7 +54,7 @@ class RangeTest < Test::Unit::TestCase
end
def test_should_include_identical_exclusive_with_floats
- assert (1.0...10.0).include?(1.0...10.0)
+ assert((1.0...10.0).include?(1.0...10.0))
end
def test_blockless_step
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index a6435a763a..bebad18e99 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -38,6 +38,10 @@ class TestJSONEncoding < Test::Unit::TestCase
ArrayTests = [[ ['a', 'b', 'c'], %([\"a\",\"b\",\"c\"]) ],
[ [1, 'a', :b, nil, false], %([1,\"a\",\"b\",null,false]) ]]
+ RangeTests = [[ 1..2, %("1..2")],
+ [ 1...2, %("1...2")],
+ [ 1.5..2.5, %("1.5..2.5")]]
+
SymbolTests = [[ :a, %("a") ],
[ :this, %("this") ],
[ :"a b", %("a b") ]]
diff --git a/activesupport/test/message_encryptor_test.rb b/activesupport/test/message_encryptor_test.rb
index 11142a358f..b544742300 100644
--- a/activesupport/test/message_encryptor_test.rb
+++ b/activesupport/test/message_encryptor_test.rb
@@ -76,10 +76,10 @@ class MessageEncryptorTest < ActiveSupport::TestCase
end
def munge(base64_string)
- bits = ActiveSupport::Base64.decode64(base64_string)
+ bits = ::Base64.decode64(base64_string)
bits.reverse!
- ActiveSupport::Base64.strict_encode64(bits)
+ ::Base64.strict_encode64(bits)
end
end
-end \ No newline at end of file
+end
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 1e7ed17f33..31ff241230 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,5 +1,11 @@
+## Rails 4.0.0 (unreleased) ##
+
+* Rails::Plugin has gone. Instead of adding plugins to vendor/plugins use gems or bundler with path or git dependencies. *Santiago Pastorino*
+
## Rails 3.2.0 (unreleased) ##
+* 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. *Santiago Pastorino*
+
* Guides are available as a single .mobi for the Kindle and free Kindle readers apps. *Michael Pearson & Xavier Noria*
* Allow scaffold/model/migration generators to accept a "index" and "uniq" modifiers, as in: "tracking_id:integer:uniq" in order to generate (unique) indexes. Some types also accept custom options, for instance, you can specify the precision and scale for decimals as "price:decimal{7,2}". *Dmitrii Samoilov*
diff --git a/railties/MIT-LICENSE b/railties/MIT-LICENSE
index c73d1af096..03bde18130 100644
--- a/railties/MIT-LICENSE
+++ b/railties/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2011 David Heinemeier Hansson
+Copyright (c) 2004-2012 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/railties/guides/code/getting_started/README.rdoc b/railties/guides/code/getting_started/README.rdoc
index 7c36f2356e..d2014bd35f 100644
--- a/railties/guides/code/getting_started/README.rdoc
+++ b/railties/guides/code/getting_started/README.rdoc
@@ -86,8 +86,8 @@ programming in general.
Debugger support is available through the debugger command when you start your
Mongrel or WEBrick server with --debugger. This means that you can break out of
execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install ruby-debug to run the server in debugging
-mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
+resume execution! You need to install ruby-debug19 to run the server in debugging
+mode. With gems, use <tt>sudo gem install ruby-debug19</tt>. Example:
class WeblogController < ActionController::Base
def index
@@ -191,7 +191,6 @@ The default directory structure of a generated Ruby on Rails application:
`-- vendor
|-- assets
`-- stylesheets
- `-- plugins
app
Holds all the code that's specific to this particular application.
@@ -256,6 +255,5 @@ test
directory.
vendor
- External libraries that the application depends on. Also includes the plugins
- subdirectory. If the app has frozen rails, those gems also go here, under
- vendor/rails/. This directory is in the load path.
+ External libraries that the application depends on. If the app has frozen rails,
+ those gems also go here, under vendor/rails/. This directory is in the load path.
diff --git a/railties/guides/code/getting_started/config/application.rb b/railties/guides/code/getting_started/config/application.rb
index e16da30f72..5f9010fced 100644
--- a/railties/guides/code/getting_started/config/application.rb
+++ b/railties/guides/code/getting_started/config/application.rb
@@ -18,10 +18,6 @@ module Blog
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
- # Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named.
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
diff --git a/railties/guides/rails_guides/helpers.rb b/railties/guides/rails_guides/helpers.rb
index 45ad9b9588..e6ef656474 100644
--- a/railties/guides/rails_guides/helpers.rb
+++ b/railties/guides/rails_guides/helpers.rb
@@ -11,15 +11,23 @@ module RailsGuides
result << content_tag(:dd, capture(&block))
result
end
-
+
def documents_by_section
@documents_by_section ||= YAML.load_file(File.expand_path('../../source/documents.yaml', __FILE__))
end
-
+
def documents_flat
documents_by_section.map {|section| section['documents']}.flatten
end
+ def finished_documents(documents)
+ documents.reject { |document| document['work_in_progress'] }
+ end
+
+ def docs_for_menu(position)
+ position == 'L' ? documents_by_section.to(3) : documents_by_section.from(4)
+ end
+
def author(name, nick, image = 'credits_pic_blank.gif', &block)
image = "images/#{image}"
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|
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb
index 493102a58f..7103dad1f3 100644
--- a/railties/lib/rails/application.rb
+++ b/railties/lib/rails/application.rb
@@ -1,6 +1,5 @@
require 'active_support/core_ext/hash/reverse_merge'
require 'fileutils'
-require 'rails/plugin'
require 'rails/engine'
module Rails
@@ -9,7 +8,7 @@ module Rails
#
# == Initialization
#
- # Rails::Application is responsible for executing all railties, engines and plugin
+ # Rails::Application is responsible for executing all railties and engines
# initializers. It also executes some bootstrap initializers (check
# Rails::Application::Bootstrap) and finishing initializers, after all the others
# are executed (check Rails::Application::Finisher).
@@ -19,7 +18,7 @@ module Rails
# Besides providing the same configuration as Rails::Engine and Rails::Railtie,
# the application object has several specific configurations, for example
# "allow_concurrency", "cache_classes", "consider_all_requests_local", "filter_parameters",
- # "logger", "reload_plugins" and so forth.
+ # "logger" and so forth.
#
# Check Rails::Application::Configuration to see them all.
#
diff --git a/railties/lib/rails/application/bootstrap.rb b/railties/lib/rails/application/bootstrap.rb
index 78d2e6c913..f96a7d1772 100644
--- a/railties/lib/rails/application/bootstrap.rb
+++ b/railties/lib/rails/application/bootstrap.rb
@@ -28,7 +28,7 @@ module Rails
FileUtils.mkdir_p File.dirname path
end
- f = File.open path, 'w'
+ f = File.open path, 'a'
f.binmode
f.sync = !Rails.env.production? # make sure every write flushes
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index 79b12ad4eb..7b6cb9d8d7 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -10,7 +10,7 @@ module Rails
:cache_classes, :cache_store, :consider_all_requests_local,
:dependency_loading, :exceptions_app, :file_watcher, :filter_parameters,
:force_ssl, :helpers_paths, :logger, :log_tags, :preload_frameworks,
- :railties_order, :relative_url_root, :reload_plugins, :secret_token,
+ :railties_order, :relative_url_root, :secret_token,
:serve_static_assets, :ssl_options, :static_cache_control, :session_options,
:time_zone, :reload_classes_only_on_change
diff --git a/railties/lib/rails/application/railties.rb b/railties/lib/rails/application/railties.rb
index 8f3a3e8bbb..f20a9689de 100644
--- a/railties/lib/rails/application/railties.rb
+++ b/railties/lib/rails/application/railties.rb
@@ -4,7 +4,7 @@ module Rails
class Application < Engine
class Railties < Rails::Engine::Railties
def all(&block)
- @all ||= railties + engines + plugins
+ @all ||= railties + engines
@all.each(&block) if block
@all
end
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index ada150ceec..71fe604e69 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -91,7 +91,7 @@ In addition to those, there are:
destroy Undo code generated with "generate" (short-cut alias: "d")
benchmarker See how fast a piece of code runs
profiler Get profile information from a piece of code
- plugin Install a plugin
+ plugin new Generates skeleton for developing a Rails plugin
runner Run a piece of code in the application environment (short-cut alias: "r")
All commands can be run with -h (or --help) for more information.
diff --git a/railties/lib/rails/commands/plugin.rb b/railties/lib/rails/commands/plugin.rb
deleted file mode 100644
index 4ddd12ae0b..0000000000
--- a/railties/lib/rails/commands/plugin.rb
+++ /dev/null
@@ -1,544 +0,0 @@
-# Rails Plugin Manager.
-#
-# Installing plugins:
-#
-# $ rails plugin install continuous_builder asset_timestamping
-#
-# Specifying revisions:
-#
-# * Subversion revision is a single integer.
-#
-# * Git revision format:
-# - full - 'refs/tags/1.8.0' or 'refs/heads/experimental'
-# - short: 'experimental' (equivalent to 'refs/heads/experimental')
-# 'tag 1.8.0' (equivalent to 'refs/tags/1.8.0')
-#
-#
-# This is Free Software, copyright 2005 by Ryan Tomayko (rtomayko@gmail.com)
-# and is licensed MIT: (http://www.opensource.org/licenses/mit-license.php)
-
-$verbose = false
-
-require 'open-uri'
-require 'fileutils'
-require 'tempfile'
-
-include FileUtils
-
-class RailsEnvironment
- attr_reader :root
-
- def initialize(dir)
- @root = dir
- end
-
- def self.find(dir=nil)
- dir ||= pwd
- while dir.length > 1
- return new(dir) if File.exist?(File.join(dir, 'config', 'environment.rb'))
- dir = File.dirname(dir)
- end
- end
-
- def self.default
- @default ||= find
- end
-
- def self.default=(rails_env)
- @default = rails_env
- end
-
- def install(name_uri_or_plugin)
- if name_uri_or_plugin.is_a? String
- if name_uri_or_plugin =~ /:\/\//
- plugin = Plugin.new(name_uri_or_plugin)
- else
- plugin = Plugins[name_uri_or_plugin]
- end
- else
- plugin = name_uri_or_plugin
- end
- if plugin
- plugin.install
- else
- puts "Plugin not found: #{name_uri_or_plugin}"
- end
- end
-
- def use_svn?
- require 'active_support/core_ext/kernel'
- silence_stderr {`svn --version` rescue nil}
- !$?.nil? && $?.success?
- end
-
- def use_externals?
- use_svn? && File.directory?("#{root}/vendor/plugins/.svn")
- end
-
- def use_checkout?
- # this is a bit of a guess. we assume that if the rails environment
- # is under subversion then they probably want the plugin checked out
- # instead of exported. This can be overridden on the command line
- File.directory?("#{root}/.svn")
- end
-
- def best_install_method
- return :http unless use_svn?
- case
- when use_externals? then :externals
- when use_checkout? then :checkout
- else :export
- end
- end
-
- def externals
- return [] unless use_externals?
- ext = `svn propget svn:externals "#{root}/vendor/plugins"`
- lines = ext.respond_to?(:lines) ? ext.lines : ext
- lines.reject{ |line| line.strip == '' }.map do |line|
- line.strip.split(/\s+/, 2)
- end
- end
-
- def externals=(items)
- unless items.is_a? String
- items = items.map{|name,uri| "#{name.ljust(29)} #{uri.chomp('/')}"}.join("\n")
- end
- Tempfile.open("svn-set-prop") do |file|
- file.write(items)
- file.flush
- system("svn propset -q svn:externals -F \"#{file.path}\" \"#{root}/vendor/plugins\"")
- end
- end
-end
-
-class Plugin
- attr_reader :name, :uri
-
- def initialize(uri, name = nil)
- @uri = uri
- guess_name(uri)
- end
-
- def self.find(name)
- new(name)
- end
-
- def to_s
- "#{@name.ljust(30)}#{@uri}"
- end
-
- def svn_url?
- @uri =~ /svn(?:\+ssh)?:\/\/*/
- end
-
- def git_url?
- @uri =~ /^git:\/\// || @uri =~ /\.git$/
- end
-
- def installed?
- File.directory?("#{rails_env.root}/vendor/plugins/#{name}") \
- or rails_env.externals.detect{ |name, repo| self.uri == repo }
- end
-
- def install(method=nil, options = {})
- method ||= rails_env.best_install_method?
- if :http == method
- method = :export if svn_url?
- method = :git if git_url?
- end
-
- uninstall if installed? and options[:force]
-
- unless installed?
- send("install_using_#{method}", options)
- run_install_hook
- else
- puts "already installed: #{name} (#{uri}). pass --force to reinstall"
- end
- end
-
- def uninstall
- path = "#{rails_env.root}/vendor/plugins/#{name}"
- if File.directory?(path)
- puts "Removing 'vendor/plugins/#{name}'" if $verbose
- run_uninstall_hook
- rm_r path
- else
- puts "Plugin doesn't exist: #{path}"
- end
-
- if rails_env.use_externals?
- # clean up svn:externals
- externals = rails_env.externals
- externals.reject!{|n, u| name == n or name == u}
- rails_env.externals = externals
- end
- end
-
- def info
- tmp = "#{rails_env.root}/_tmp_about.yml"
- if svn_url?
- cmd = "svn export #{@uri} \"#{rails_env.root}/#{tmp}\""
- puts cmd if $verbose
- system(cmd)
- end
- open(svn_url? ? tmp : File.join(@uri, 'about.yml')) do |stream|
- stream.read
- end rescue "No about.yml found in #{uri}"
- ensure
- FileUtils.rm_rf tmp if svn_url?
- end
-
- private
-
- def run_install_hook
- install_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/install.rb"
- load install_hook_file if File.exist? install_hook_file
- end
-
- def run_uninstall_hook
- uninstall_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/uninstall.rb"
- load uninstall_hook_file if File.exist? uninstall_hook_file
- end
-
- def install_using_export(options = {})
- svn_command :export, options
- end
-
- def install_using_checkout(options = {})
- svn_command :checkout, options
- end
-
- def install_using_externals(options = {})
- externals = rails_env.externals
- externals.push([@name, uri])
- rails_env.externals = externals
- install_using_checkout(options)
- end
-
- def install_using_http(options = {})
- root = rails_env.root
- mkdir_p "#{root}/vendor/plugins/#{@name}"
- Dir.chdir "#{root}/vendor/plugins/#{@name}" do
- puts "fetching from '#{uri}'" if $verbose
- fetcher = RecursiveHTTPFetcher.new(uri, -1)
- fetcher.quiet = true if options[:quiet]
- fetcher.fetch
- end
- end
-
- def install_using_git(options = {})
- root = rails_env.root
- mkdir_p(install_path = "#{root}/vendor/plugins/#{name}")
- Dir.chdir install_path do
- init_cmd = "git init"
- init_cmd += " -q" if options[:quiet] and not $verbose
- puts init_cmd if $verbose
- system(init_cmd)
- base_cmd = "git pull --depth 1 #{uri}"
- base_cmd += " -q" if options[:quiet] and not $verbose
- base_cmd += " #{options[:revision]}" if options[:revision]
- puts base_cmd if $verbose
- if system(base_cmd)
- puts "removing: .git .gitignore" if $verbose
- rm_rf %w(.git .gitignore)
- else
- rm_rf install_path
- end
- end
- end
-
- def svn_command(cmd, options = {})
- root = rails_env.root
- mkdir_p "#{root}/vendor/plugins"
- base_cmd = "svn #{cmd} #{uri} \"#{root}/vendor/plugins/#{name}\""
- base_cmd += ' -q' if options[:quiet] and not $verbose
- base_cmd += " -r #{options[:revision]}" if options[:revision]
- puts base_cmd if $verbose
- system(base_cmd)
- end
-
- def guess_name(url)
- @name = File.basename(url)
- if @name == 'trunk' || @name.empty?
- @name = File.basename(File.dirname(url))
- end
- @name.gsub!(/\.git$/, '') if @name =~ /\.git$/
- end
-
- def rails_env
- @rails_env || RailsEnvironment.default
- end
-end
-
-# load default environment and parse arguments
-require 'optparse'
-module Rails
- module Commands
- class Plugin
- attr_reader :environment, :script_name
- def initialize
- @environment = RailsEnvironment.default
- @rails_root = RailsEnvironment.default.root
- @script_name = File.basename($0)
- end
-
- def environment=(value)
- @environment = value
- RailsEnvironment.default = value
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: plugin [OPTIONS] command"
- o.define_head "Rails plugin manager."
-
- o.separator ""
- o.separator "GENERAL OPTIONS"
-
- o.on("-r", "--root=DIR", String,
- "Set an explicit rails app directory.",
- "Default: #{@rails_root}") { |rails_root| @rails_root = rails_root; self.environment = RailsEnvironment.new(@rails_root) }
-
- o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose }
- o.on("-h", "--help", "Show this help message.") { puts o; exit }
-
- o.separator ""
- o.separator "COMMANDS"
-
- o.separator " install Install plugin(s) from known repositories or URLs."
- o.separator " remove Uninstall plugins."
-
- o.separator ""
- o.separator "EXAMPLES"
- o.separator " Install a plugin from a subversion URL:"
- o.separator " #{@script_name} plugin install http://example.com/my_svn_plugin\n"
- o.separator " Install a plugin from a git URL:"
- o.separator " #{@script_name} plugin install git://github.com/SomeGuy/my_awesome_plugin.git\n"
- o.separator " Install a plugin and add a svn:externals entry to vendor/plugins"
- o.separator " #{@script_name} plugin install -x my_svn_plugin\n"
- end
- end
-
- def parse!(args=ARGV)
- general, sub = split_args(args)
- options.parse!(general)
-
- command = general.shift
- if command =~ /^(install|remove)$/
- command = Commands.const_get(command.capitalize).new(self)
- command.parse!(sub)
- else
- puts "Unknown command: #{command}" unless command.blank?
- puts options
- exit 1
- end
- end
-
- def split_args(args)
- left = []
- left << args.shift while args[0] and args[0] =~ /^-/
- left << args.shift if args[0]
- [left, args]
- end
-
- def self.parse!(args=ARGV)
- Plugin.new.parse!(args)
- end
- end
-
- class Install
- def initialize(base_command)
- @base_command = base_command
- @method = :http
- @options = { :quiet => false, :revision => nil, :force => false }
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]"
- o.define_head "Install one or more plugins."
- o.separator ""
- o.separator "Options:"
- o.on( "-x", "--externals",
- "Use svn:externals to grab the plugin.",
- "Enables plugin updates and plugin versioning.") { |v| @method = :externals }
- o.on( "-o", "--checkout",
- "Use svn checkout to grab the plugin.",
- "Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout }
- o.on( "-e", "--export",
- "Use svn export to grab the plugin.",
- "Exports the plugin, allowing you to check it into your local repository. Does not enable updates or add an svn:externals entry.") { |v| @method = :export }
- o.on( "-q", "--quiet",
- "Suppresses the output from installation.",
- "Ignored if -v is passed (rails plugin -v install ...)") { |v| @options[:quiet] = true }
- o.on( "-r REVISION", "--revision REVISION",
- "Checks out the given revision from subversion or git.",
- "Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
- o.on( "-f", "--force",
- "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
- o.separator ""
- o.separator "You can specify plugin names as given in 'plugin list' output or absolute URLs to "
- o.separator "a plugin repository."
- end
- end
-
- def determine_install_method
- best = @base_command.environment.best_install_method
- @method = :http if best == :http and @method == :export
- case
- when (best == :http and @method != :http)
- msg = "Cannot install using subversion because `svn' cannot be found in your PATH"
- when (best == :export and (@method != :export and @method != :http))
- msg = "Cannot install using #{@method} because this project is not under subversion."
- when (best != :externals and @method == :externals)
- msg = "Cannot install using externals because vendor/plugins is not under subversion."
- end
- if msg
- puts msg
- exit 1
- end
- @method
- end
-
- def parse!(args)
- options.parse!(args)
- if args.blank?
- puts options
- exit 1
- end
- environment = @base_command.environment
- install_method = determine_install_method
- puts "Plugins will be installed using #{install_method}" if $verbose
- args.each do |name|
- ::Plugin.find(name).install(install_method, @options)
- end
- rescue StandardError => e
- puts "Plugin not found: #{args.inspect}"
- puts e.inspect if $verbose
- exit 1
- end
- end
-
- class Remove
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} remove name [name]..."
- o.define_head "Remove plugins."
- end
- end
-
- def parse!(args)
- options.parse!(args)
- if args.blank?
- puts options
- exit 1
- end
- root = @base_command.environment.root
- args.each do |name|
- ::Plugin.new(name).uninstall
- end
- end
- end
-
- class Info
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} info name [name]..."
- o.define_head "Shows plugin info at {url}/about.yml."
- end
- end
-
- def parse!(args)
- options.parse!(args)
- args.each do |name|
- puts ::Plugin.find(name).info
- puts
- end
- end
- end
- end
-end
-
-class RecursiveHTTPFetcher
- attr_accessor :quiet
- def initialize(urls_to_fetch, level = 1, cwd = ".")
- @level = level
- @cwd = cwd
- @urls_to_fetch = urls_to_fetch.lines
- @quiet = false
- end
-
- def ls
- @urls_to_fetch.collect do |url|
- if url =~ /^svn(\+ssh)?:\/\/.*/
- `svn ls #{url}`.split("\n").map {|entry| "/#{entry}"} rescue nil
- else
- open(url) do |stream|
- links("", stream.read)
- end rescue nil
- end
- end.flatten
- end
-
- def push_d(dir)
- @cwd = File.join(@cwd, dir)
- FileUtils.mkdir_p(@cwd)
- end
-
- def pop_d
- @cwd = File.dirname(@cwd)
- end
-
- def links(base_url, contents)
- links = []
- contents.scan(/href\s*=\s*\"*[^\">]*/i) do |link|
- link = link.sub(/href="/i, "")
- next if link =~ /svnindex.xsl$/
- next if link =~ /^(\w*:|)\/\// || link =~ /^\./
- links << File.join(base_url, link)
- end
- links
- end
-
- def download(link)
- puts "+ #{File.join(@cwd, File.basename(link))}" unless @quiet
- open(link) do |stream|
- File.open(File.join(@cwd, File.basename(link)), "wb") do |file|
- file.write(stream.read)
- end
- end
- end
-
- def fetch(links = @urls_to_fetch)
- links.each do |l|
- (l =~ /\/$/ || links == @urls_to_fetch) ? fetch_dir(l) : download(l)
- end
- end
-
- def fetch_dir(url)
- @level += 1
- push_d(File.basename(url)) if @level > 0
- open(url) do |stream|
- contents = stream.read
- fetch(links(url, contents))
- end
- pop_d if @level > 0
- @level -= 1
- end
-end
-
-Rails::Commands::Plugin.parse!
diff --git a/railties/lib/rails/engine/configuration.rb b/railties/lib/rails/engine/configuration.rb
index d6015e9c01..d7405cb519 100644
--- a/railties/lib/rails/engine/configuration.rb
+++ b/railties/lib/rails/engine/configuration.rb
@@ -5,7 +5,6 @@ module Rails
class Configuration < ::Rails::Railtie::Configuration
attr_reader :root
attr_writer :middleware, :eager_load_paths, :autoload_once_paths, :autoload_paths
- attr_accessor :plugins
def initialize(root=nil)
super()
@@ -59,7 +58,6 @@ module Rails
paths.add "db/seeds", :with => "db/seeds.rb"
paths.add "vendor", :load_path => true
paths.add "vendor/assets", :glob => "*"
- paths.add "vendor/plugins"
paths
end
end
diff --git a/railties/lib/rails/engine/railties.rb b/railties/lib/rails/engine/railties.rb
index d5ecd2e48d..033d9c4180 100644
--- a/railties/lib/rails/engine/railties.rb
+++ b/railties/lib/rails/engine/railties.rb
@@ -7,18 +7,11 @@ module Rails
end
def all(&block)
- @all ||= plugins
+ @all ||= []
@all.each(&block) if block
@all
end
- def plugins
- @plugins ||= begin
- plugin_names = (@config.plugins || [:all]).map { |p| p.to_sym }
- Plugin.all(plugin_names, @config.paths["vendor/plugins"].existent)
- end
- end
-
def self.railties
@railties ||= ::Rails::Railtie.subclasses.map(&:instance)
end
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb
index 27f8d13ce8..cd277c5097 100644
--- a/railties/lib/rails/generators.rb
+++ b/railties/lib/rails/generators.rb
@@ -38,11 +38,6 @@ module Rails
:test_unit => {
:fixture_replacement => '-r',
- },
-
- :plugin => {
- :generator => '-g',
- :tasks => '-r'
}
}
@@ -62,11 +57,6 @@ module Rails
:stylesheet_engine => :css,
:test_framework => false,
:template_engine => :erb
- },
-
- :plugin => {
- :generator => false,
- :tasks => false
}
}
@@ -195,7 +185,6 @@ module Rails
"#{test}:scaffold",
"#{test}:view",
"#{test}:performance",
- "#{test}:plugin",
"#{template}:controller",
"#{template}:scaffold",
"#{template}:mailer",
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 781d7bf47c..ce62ea463d 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -6,40 +6,6 @@ module Rails
module Generators
module Actions
- # Install a plugin. You must provide either a Subversion url or Git url.
- #
- # For a Git-hosted plugin, you can specify a branch and
- # whether it should be added as a submodule instead of cloned.
- #
- # For a Subversion-hosted plugin you can specify a revision.
- #
- # ==== Examples
- #
- # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
- # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :branch => 'stable'
- # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
- # plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk'
- # plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk', :revision => 1234
- #
- def plugin(name, options)
- log :plugin, name
-
- if options[:git] && options[:submodule]
- options[:git] = "-b #{options[:branch]} #{options[:git]}" if options[:branch]
- in_root do
- run "git submodule add #{options[:git]} vendor/plugins/#{name}", :verbose => false
- end
- elsif options[:git] || options[:svn]
- options[:git] = "-b #{options[:branch]} #{options[:git]}" if options[:branch]
- options[:svn] = "-r #{options[:revision]} #{options[:svn]}" if options[:revision]
- in_root do
- run_ruby_script "script/rails plugin install #{options[:svn] || options[:git]}", :verbose => false
- end
- else
- log "! no git or svn provided for #{name}. Skipping..."
- end
- end
-
# Adds an entry into Gemfile for the supplied gem. If env
# is specified, add the gem to the given environment.
#
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index 2a6bd57df4..f0745df667 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -124,7 +124,6 @@ module Rails
def vendor
vendor_javascripts
vendor_stylesheets
- vendor_plugins
end
def vendor_javascripts
@@ -134,10 +133,6 @@ module Rails
def vendor_stylesheets
empty_directory_with_gitkeep "vendor/assets/stylesheets"
end
-
- def vendor_plugins
- empty_directory_with_gitkeep "vendor/plugins"
- end
end
module Generators
diff --git a/railties/lib/rails/generators/rails/app/templates/README b/railties/lib/rails/generators/rails/app/templates/README
index 7c36f2356e..d2014bd35f 100644
--- a/railties/lib/rails/generators/rails/app/templates/README
+++ b/railties/lib/rails/generators/rails/app/templates/README
@@ -86,8 +86,8 @@ programming in general.
Debugger support is available through the debugger command when you start your
Mongrel or WEBrick server with --debugger. This means that you can break out of
execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install ruby-debug to run the server in debugging
-mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
+resume execution! You need to install ruby-debug19 to run the server in debugging
+mode. With gems, use <tt>sudo gem install ruby-debug19</tt>. Example:
class WeblogController < ActionController::Base
def index
@@ -191,7 +191,6 @@ The default directory structure of a generated Ruby on Rails application:
`-- vendor
|-- assets
`-- stylesheets
- `-- plugins
app
Holds all the code that's specific to this particular application.
@@ -256,6 +255,5 @@ test
directory.
vendor
- External libraries that the application depends on. Also includes the plugins
- subdirectory. If the app has frozen rails, those gems also go here, under
- vendor/rails/. This directory is in the load path.
+ External libraries that the application depends on. If the app has frozen rails,
+ those gems also go here, under vendor/rails/. This directory is in the load path.
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb
index c6dfa1f2dd..bcd3a2ad24 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb
@@ -28,10 +28,6 @@ module <%= app_const_base %>
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
- # Only load the plugins named here, in the order given (default is alphabetical).
- # :all can be used as a placeholder for all plugins not explicitly named.
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
deleted file mode 100644
index 3e27688bb9..0000000000
--- a/railties/lib/rails/plugin.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-require 'rails/engine'
-require 'active_support/core_ext/array/conversions'
-
-module Rails
- # Rails::Plugin is nothing more than a Rails::Engine, but since it's loaded too late
- # in the boot process, it does not have the same configuration powers as a bare
- # Rails::Engine.
- #
- # Opposite to Rails::Railtie and Rails::Engine, you are not supposed to inherit from
- # Rails::Plugin. Rails::Plugin is automatically configured to be an engine by simply
- # placing inside vendor/plugins. Since this is done automatically, you actually cannot
- # declare a Rails::Engine inside your Plugin, otherwise it would cause the same files
- # to be loaded twice. This means that if you want to ship an Engine as gem it cannot
- # be used as plugin and vice-versa.
- #
- # Besides this conceptual difference, the only difference between Rails::Engine and
- # Rails::Plugin is that plugins automatically load the file "init.rb" at the plugin
- # root during the boot process.
- #
- class Plugin < Engine
- def self.global_plugins
- @global_plugins ||= []
- end
-
- def self.inherited(base)
- raise "You cannot inherit from Rails::Plugin"
- end
-
- def self.all(list, paths)
- plugins = []
- paths.each do |path|
- Dir["#{path}/*"].each do |plugin_path|
- plugin = new(plugin_path)
- next unless list.include?(plugin.name) || list.include?(:all)
- if global_plugins.include?(plugin.name)
- warn "WARNING: plugin #{plugin.name} from #{path} was not loaded. Plugin with the same name has been already loaded."
- next
- end
- global_plugins << plugin.name
- plugins << plugin
- end
- end
-
- plugins.sort_by do |p|
- [list.index(p.name) || list.index(:all), p.name.to_s]
- end
- end
-
- attr_reader :name, :path
-
- def railtie_name
- name.to_s
- end
-
- def initialize(root)
- @name = File.basename(root).to_sym
- config.root = root
- end
-
- def config
- @config ||= Engine::Configuration.new
- end
-
- initializer :handle_lib_autoload, :before => :set_load_path do |app|
- autoload = if app.config.reload_plugins
- config.autoload_paths
- else
- config.autoload_once_paths
- end
-
- autoload.concat paths["lib"].existent
- end
-
- initializer :load_init_rb, :before => :load_config_initializers do |app|
- init_rb = File.expand_path("init.rb", root)
- if File.file?(init_rb)
- # This double assignment is to prevent an "unused variable" warning on Ruby 1.9.3.
- config = config = app.config
- # TODO: think about evaling initrb in context of Engine (currently it's
- # always evaled in context of Rails::Application)
- eval(File.read(init_rb), binding, init_rb)
- end
- end
-
- initializer :sanity_check_railties_collision do
- if Engine.subclasses.map { |k| k.root.to_s }.include?(root.to_s)
- raise "\"#{name}\" is a Railtie/Engine and cannot be installed as a plugin"
- end
- end
- end
-end
diff --git a/railties/lib/rails/rack/debugger.rb b/railties/lib/rails/rack/debugger.rb
index 831188eeee..5a78da1731 100644
--- a/railties/lib/rails/rack/debugger.rb
+++ b/railties/lib/rails/rack/debugger.rb
@@ -12,7 +12,7 @@ module Rails
::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
puts "=> Debugger enabled"
rescue LoadError
- puts "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'"
+ puts "You need to install ruby-debug19 to run the server in debugging mode. With gems, use 'gem install ruby-debug19'"
exit
end
diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb
index 07a122e7d0..7fed7c8631 100644
--- a/railties/lib/rails/railtie.rb
+++ b/railties/lib/rails/railtie.rb
@@ -103,11 +103,11 @@ module Rails
# end
# end
#
- # == Application, Plugin and Engine
+ # == Application and Engine
#
# A Rails::Engine is nothing more than a Railtie with some initializers already set.
- # And since Rails::Application and Rails::Plugin are engines, the same configuration
- # described here can be used in all three.
+ # And since Rails::Application is an engine, the same configuration described here
+ # can be used in both.
#
# Be sure to look at the documentation of those specific classes for more information.
#
@@ -117,7 +117,7 @@ module Rails
include Initializable
- ABSTRACT_RAILTIES = %w(Rails::Railtie Rails::Plugin Rails::Engine Rails::Application)
+ ABSTRACT_RAILTIES = %w(Rails::Railtie Rails::Engine Rails::Application)
class << self
private :new
diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake
index 1c28b2c8e6..e09379c8c2 100644
--- a/railties/lib/rails/tasks/documentation.rake
+++ b/railties/lib/rails/tasks/documentation.rake
@@ -55,7 +55,7 @@ namespace :doc do
rdoc.rdoc_files.include('app/**/*.rb')
rdoc.rdoc_files.include('lib/**/*.rb')
}
- Rake::Task['doc:app'].comment = "Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE=\"Custom Title\")"
+ Rake::Task['doc:app'].comment = "Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE=\"Custom Title\")"
# desc 'Generate documentation for the Rails framework.'
RDocTaskWithoutDescriptions.new("rails") { |rdoc|
@@ -108,48 +108,10 @@ namespace :doc do
end
}
- plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }
-
- # desc "Generate documentation for all installed plugins"
- task :plugins => plugins.collect { |plugin| "doc:plugins:#{plugin}" }
-
- # desc "Remove plugin documentation"
- task :clobber_plugins do
- rm_rf 'doc/plugins' rescue nil
- end
-
# desc "Generate Rails Guides"
task :guides do
# FIXME: Reaching outside lib directory is a bad idea
require File.expand_path('../../../../guides/rails_guides', __FILE__)
RailsGuides::Generator.new(Rails.root.join("doc/guides")).generate
end
-
- namespace :plugins do
- # Define doc tasks for each plugin
- plugins.each do |plugin|
- # desc "Generate documentation for the #{plugin} plugin"
- task(plugin => :environment) do
- plugin_base = "vendor/plugins/#{plugin}"
- options = []
- files = Rake::FileList.new
- options << "-o doc/plugins/#{plugin}"
- options << "--title '#{plugin.titlecase} Plugin Documentation'"
- options << '--line-numbers'
- options << '--charset' << 'utf-8'
- options << '-T html'
-
- files.include("#{plugin_base}/lib/**/*.rb")
- if File.exist?("#{plugin_base}/README")
- files.include("#{plugin_base}/README")
- options << "--main '#{plugin_base}/README'"
- end
- files.include("#{plugin_base}/CHANGELOG") if File.exist?("#{plugin_base}/CHANGELOG")
-
- options << files.to_s
-
- sh %(rdoc #{options * ' '})
- end
- end
- end
end
diff --git a/railties/lib/rails/test_unit/testing.rake b/railties/lib/rails/test_unit/testing.rake
index a23d22d607..2c0b167a99 100644
--- a/railties/lib/rails/test_unit/testing.rake
+++ b/railties/lib/rails/test_unit/testing.rake
@@ -45,7 +45,7 @@ end
task :default => :test
-desc 'Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile, test:plugins)'
+desc 'Runs test:units, test:functionals, test:integration together (also available: test:benchmark, test:profile)'
task :test do
Rake::Task[ENV['TEST'] ? 'test:single' : 'test:run'].invoke
end
@@ -119,14 +119,4 @@ namespace :test do
t.libs << 'test'
t.pattern = 'test/performance/**/*_test.rb'
end
-
- Rails::SubTestTask.new(:plugins => :environment) do |t|
- t.libs << "test"
-
- if ENV['PLUGIN']
- t.pattern = "vendor/plugins/#{ENV['PLUGIN']}/test/**/*_test.rb"
- else
- t.pattern = 'vendor/plugins/*/**/test/**/*_test.rb'
- end
- end
end
diff --git a/railties/test/application/paths_test.rb b/railties/test/application/paths_test.rb
index 964cff48cd..84f4408147 100644
--- a/railties/test/application/paths_test.rb
+++ b/railties/test/application/paths_test.rb
@@ -46,7 +46,6 @@ module ApplicationTests
assert_path @paths["app/views"], "app/views"
assert_path @paths["lib"], "lib"
assert_path @paths["vendor"], "vendor"
- assert_path @paths["vendor/plugins"], "vendor/plugins"
assert_path @paths["tmp"], "tmp"
assert_path @paths["config"], "config"
assert_path @paths["config/locales"], "config/locales/en.yml"
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb
index ee288871de..a8c8fcd5b7 100644
--- a/railties/test/generators/actions_test.rb
+++ b/railties/test/generators/actions_test.rb
@@ -9,8 +9,6 @@ class ActionsTest < Rails::Generators::TestCase
def setup
Rails.application = TestApp::Application
super
- @git_plugin_uri = 'git://github.com/technoweenie/restful-authentication.git'
- @svn_plugin_uri = 'svn://svnhub.com/technoweenie/restful-authentication/trunk'
end
def teardown
@@ -37,41 +35,6 @@ class ActionsTest < Rails::Generators::TestCase
assert_file 'lib/test_file.rb', 'heres block data'
end
- def test_plugin_with_git_option_should_run_plugin_install
- generator.expects(:run_ruby_script).once.with("script/rails plugin install #{@git_plugin_uri}", :verbose => false)
- action :plugin, 'restful-authentication', :git => @git_plugin_uri
- end
-
- def test_plugin_with_svn_option_should_run_plugin_install
- generator.expects(:run_ruby_script).once.with("script/rails plugin install #{@svn_plugin_uri}", :verbose => false)
- action :plugin, 'restful-authentication', :svn => @svn_plugin_uri
- end
-
- def test_plugin_with_git_option_and_branch_should_run_plugin_install
- generator.expects(:run_ruby_script).once.with("script/rails plugin install -b stable #{@git_plugin_uri}", :verbose => false)
- action :plugin, 'restful-authentication', :git => @git_plugin_uri, :branch => 'stable'
- end
-
- def test_plugin_with_svn_option_and_revision_should_run_plugin_install
- generator.expects(:run_ruby_script).once.with("script/rails plugin install -r 1234 #{@svn_plugin_uri}", :verbose => false)
- action :plugin, 'restful-authentication', :svn => @svn_plugin_uri, :revision => 1234
- end
-
- def test_plugin_with_git_option_and_submodule_should_use_git_scm
- generator.expects(:run).with("git submodule add #{@git_plugin_uri} vendor/plugins/rest_auth", :verbose => false)
- action :plugin, 'rest_auth', :git => @git_plugin_uri, :submodule => true
- end
-
- def test_plugin_with_git_option_and_submodule_should_use_git_scm
- generator.expects(:run).with("git submodule add -b stable #{@git_plugin_uri} vendor/plugins/rest_auth", :verbose => false)
- action :plugin, 'rest_auth', :git => @git_plugin_uri, :submodule => true, :branch => 'stable'
- end
-
- def test_plugin_with_no_options_should_skip_method
- generator.expects(:run).never
- action :plugin, 'rest_auth', {}
- end
-
def test_add_source_adds_source_to_gemfile
run_generator
action :add_source, 'http://gems.github.com'
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index a15943dfc6..70ef37ee0f 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -32,7 +32,6 @@ DEFAULT_APP_FILES = %w(
test/unit
vendor
vendor/assets
- vendor/plugins
tmp/cache
tmp/cache/assets
)
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index 06b658e7bd..f57737172d 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -178,20 +178,6 @@ module TestHelpers
end
end
- def plugin(name, string = "")
- dir = "#{app_path}/vendor/plugins/#{name}"
- FileUtils.mkdir_p(dir)
-
- File.open("#{dir}/init.rb", 'w') do |f|
- f.puts "::#{name.upcase} = 'loaded'"
- f.puts string
- end
-
- Bukkit.new(dir).tap do |bukkit|
- yield bukkit if block_given?
- end
- end
-
def engine(name)
dir = "#{app_path}/random/#{name}"
FileUtils.mkdir_p(dir)
diff --git a/railties/test/railties/engine_test.rb b/railties/test/railties/engine_test.rb
index 400cae98b2..2813f689c5 100644
--- a/railties/test/railties/engine_test.rb
+++ b/railties/test/railties/engine_test.rb
@@ -151,46 +151,6 @@ module RailtiesTest
assert_equal "foo", last_response.body
end
- test "engine can load its own plugins" do
- @plugin.write "lib/bukkits.rb", <<-RUBY
- module Bukkits
- class Engine < ::Rails::Engine
- end
- end
- RUBY
-
- @plugin.write "vendor/plugins/yaffle/init.rb", <<-RUBY
- config.yaffle_loaded = true
- RUBY
-
- boot_rails
-
- assert Bukkits::Engine.config.yaffle_loaded
- end
-
- test "engine does not load plugins that already exists in application" do
- @plugin.write "lib/bukkits.rb", <<-RUBY
- module Bukkits
- class Engine < ::Rails::Engine
- end
- end
- RUBY
-
- @plugin.write "vendor/plugins/yaffle/init.rb", <<-RUBY
- config.engine_yaffle_loaded = true
- RUBY
-
- app_file "vendor/plugins/yaffle/init.rb", <<-RUBY
- config.app_yaffle_loaded = true
- RUBY
-
- warnings = capture(:stderr) { boot_rails }
-
- assert !warnings.empty?
- assert !Bukkits::Engine.config.respond_to?(:engine_yaffle_loaded)
- assert Rails.application.config.app_yaffle_loaded
- end
-
test "it loads its environment file" do
@plugin.write "lib/bukkits.rb", <<-RUBY
module Bukkits
diff --git a/railties/test/railties/plugin_ordering_test.rb b/railties/test/railties/plugin_ordering_test.rb
deleted file mode 100644
index 1cfaf557e9..0000000000
--- a/railties/test/railties/plugin_ordering_test.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-require "isolation/abstract_unit"
-
-module RailtiesTest
- class PluginOrderingTest < Test::Unit::TestCase
- include ActiveSupport::Testing::Isolation
-
- def setup
- build_app
- $arr = []
- plugin "a_plugin", "$arr << :a"
- plugin "b_plugin", "$arr << :b"
- plugin "c_plugin", "$arr << :c"
- end
-
- def teardown
- teardown_app
- end
-
- def boot_rails
- super
- require "#{app_path}/config/environment"
- end
-
- test "plugins are loaded alphabetically by default" do
- boot_rails
- assert_equal [:a, :b, :c], $arr
- end
-
- test "if specified, only those plugins are loaded" do
- add_to_config "config.plugins = [:b_plugin]"
- boot_rails
- assert_equal [:b], $arr
- end
-
- test "the plugins are initialized in the order they are specified" do
- add_to_config "config.plugins = [:b_plugin, :a_plugin]"
- boot_rails
- assert_equal [:b, :a], $arr
- end
-
- test "if :all is specified, the remaining plugins are loaded in alphabetical order" do
- add_to_config "config.plugins = [:c_plugin, :all]"
- boot_rails
- assert_equal [:c, :a, :b], $arr
- end
-
- test "if :all is at the beginning, it represents the plugins not otherwise specified" do
- add_to_config "config.plugins = [:all, :b_plugin]"
- boot_rails
- assert_equal [:a, :c, :b], $arr
- end
-
- test "plugin order array is strings" do
- add_to_config "config.plugins = %w( c_plugin all )"
- boot_rails
- assert_equal [:c, :a, :b], $arr
- end
-
- test "can require lib file from a different plugin" do
- plugin "foo", "require 'bar'" do |plugin|
- plugin.write "lib/foo.rb", "$foo = true"
- end
-
- plugin "bar", "require 'foo'" do |plugin|
- plugin.write "lib/bar.rb", "$bar = true"
- end
-
- add_to_config "config.plugins = [:foo, :bar]"
-
- boot_rails
-
- assert $foo
- assert $bar
- end
- end
-end
diff --git a/railties/test/railties/plugin_test.rb b/railties/test/railties/plugin_test.rb
deleted file mode 100644
index f307d53cf7..0000000000
--- a/railties/test/railties/plugin_test.rb
+++ /dev/null
@@ -1,123 +0,0 @@
-require "isolation/abstract_unit"
-require "railties/shared_tests"
-
-module RailtiesTest
- class PluginTest < Test::Unit::TestCase
- include ActiveSupport::Testing::Isolation
- include SharedTests
-
- def setup
- build_app
-
- @plugin = plugin "bukkits", "::LEVEL = config.log_level" do |plugin|
- plugin.write "lib/bukkits.rb", "class Bukkits; end"
- plugin.write "lib/another.rb", "class Another; end"
- end
- end
-
- def teardown
- teardown_app
- end
-
- test "Rails::Plugin itself does not respond to config" do
- boot_rails
- assert !Rails::Plugin.respond_to?(:config)
- end
-
- test "cannot inherit from Rails::Plugin" do
- boot_rails
- assert_raise RuntimeError do
- class Foo < Rails::Plugin; end
- end
- end
-
- test "plugin can load the file with the same name in lib" do
- boot_rails
- require "bukkits"
- assert_equal "Bukkits", Bukkits.name
- end
-
- test "plugin gets added to dependency list" do
- boot_rails
- assert_equal "Another", Another.name
- end
-
- test "plugin constants get reloaded if config.reload_plugins is set to true" do
- add_to_config <<-RUBY
- config.reload_plugins = true
- RUBY
-
- boot_rails
-
- assert_equal "Another", Another.name
- ActiveSupport::Dependencies.clear
- @plugin.delete("lib/another.rb")
- assert_raises(NameError) { Another }
- end
-
- test "plugin constants are not reloaded by default" do
- boot_rails
- assert_equal "Another", Another.name
- ActiveSupport::Dependencies.clear
- @plugin.delete("lib/another.rb")
- assert_nothing_raised { Another }
- end
-
- test "it loads the plugin's init.rb file" do
- boot_rails
- assert_equal "loaded", BUKKITS
- end
-
- test "the init.rb file has access to the config object" do
- boot_rails
- assert_equal :debug, LEVEL
- end
-
- test "plugin_init_is_run_before_application_ones" do
- plugin "foo", "$foo = true" do |plugin|
- plugin.write "lib/foo.rb", "module Foo; end"
- end
-
- app_file 'config/initializers/foo.rb', <<-RUBY
- raise "no $foo" unless $foo
- raise "no Foo" unless Foo
- RUBY
-
- boot_rails
- assert $foo
- end
-
- test "plugin should work without init.rb" do
- @plugin.delete("init.rb")
-
- boot_rails
-
- require "bukkits"
- assert_nothing_raised { Bukkits }
- end
-
- test "plugin cannot declare an engine for it" do
- @plugin.write "lib/bukkits.rb", <<-RUBY
- class Bukkits
- class Engine < Rails::Engine
- end
- end
- RUBY
-
- @plugin.write "init.rb", <<-RUBY
- require "bukkits"
- RUBY
-
- rescued = false
-
- begin
- boot_rails
- rescue Exception => e
- rescued = true
- assert_equal '"bukkits" is a Railtie/Engine and cannot be installed as a plugin', e.message
- end
-
- assert rescued, "Expected boot rails to fail"
- end
- end
-end
diff --git a/railties/test/railties/shared_tests.rb b/railties/test/railties/shared_tests.rb
index a15dae2a0a..3630a0937c 100644
--- a/railties/test/railties/shared_tests.rb
+++ b/railties/test/railties/shared_tests.rb
@@ -61,15 +61,6 @@ module RailtiesTest
end
RUBY
- yaffle = plugin "acts_as_yaffle", "::LEVEL = config.log_level" do |plugin|
- plugin.write "lib/acts_as_yaffle.rb", "class ActsAsYaffle; end"
- end
-
- yaffle.write "db/migrate/1_create_yaffles.rb", <<-RUBY
- class CreateYaffles < ActiveRecord::Migration
- end
- RUBY
-
add_to_config "ActiveRecord::Base.timestamped_migrations = false"
boot_rails
@@ -87,14 +78,10 @@ module RailtiesTest
output = `bundle exec rake railties:install:migrations`.split("\n")
- assert File.exists?("#{app_path}/db/migrate/4_create_yaffles.acts_as_yaffle.rb")
assert_no_match(/2_create_users/, output.join("\n"))
- yaffle_migration_order = output.index(output.detect{|o| /Copied migration 4_create_yaffles.acts_as_yaffle.rb from acts_as_yaffle/ =~ o })
bukkits_migration_order = output.index(output.detect{|o| /NOTE: Migration 3_create_sessions.rb from bukkits has been skipped/ =~ o })
- assert_not_nil yaffle_migration_order, "Expected migration to be copied"
assert_not_nil bukkits_migration_order, "Expected migration to be skipped"
- assert_equal(railties.index('acts_as_yaffle') > railties.index('bukkits'), yaffle_migration_order > bukkits_migration_order)
migrations_count = Dir["#{app_path}/db/migrate/*.rb"].length
output = `bundle exec rake railties:install:migrations`