Skip to content

Commit

Permalink
Merge commit 'mainstream/master'
Browse files Browse the repository at this point in the history
Conflicts:

	actionpack/lib/action_view/helpers/javascript_helper.rb
	activesupport/lib/active_support/dependencies.rb
	activesupport/lib/active_support/inflector.rb
	activesupport/lib/active_support/values/time_zone.rb
  • Loading branch information
lifo committed Jun 25, 2008
2 parents b5e9bad + 670e22e commit 01571c0
Show file tree
Hide file tree
Showing 364 changed files with 7,525 additions and 6,591 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
debug.log
doc/rdoc
activeresource/doc
activerecord/doc
actionpack/doc
Expand Down
62 changes: 61 additions & 1 deletion Rakefile
@@ -1,4 +1,6 @@
require 'rake'
require 'rake/rdoctask'
require 'rake/contrib/sshpublisher'

env = %(PKG_BUILD="#{ENV['PKG_BUILD']}") if ENV['PKG_BUILD']

Expand All @@ -11,11 +13,69 @@ end
desc 'Run all tests by default'
task :default => :test

%w(test rdoc package pgem release).each do |task_name|
%w(test rdoc pgem package release).each do |task_name|
desc "Run #{task_name} task for all projects"
task task_name do
PROJECTS.each do |project|
system %(cd #{project} && #{env} #{$0} #{task_name})
end
end
end


desc "Generate documentation for the Rails framework"
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'doc/rdoc'
rdoc.title = "Ruby on Rails Documentation"

rdoc.options << '--line-numbers' << '--inline-source'
rdoc.options << '-A cattr_accessor=object'
rdoc.options << '--charset' << 'utf-8'

rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : './doc/template/horo'

rdoc.rdoc_files.include('railties/CHANGELOG')
rdoc.rdoc_files.include('railties/MIT-LICENSE')
rdoc.rdoc_files.include('railties/README')
rdoc.rdoc_files.include('railties/lib/{*.rb,commands/*.rb,rails/*.rb,rails_generator/*.rb}')

rdoc.rdoc_files.include('activerecord/README')
rdoc.rdoc_files.include('activerecord/CHANGELOG')
rdoc.rdoc_files.include('activerecord/lib/active_record/**/*.rb')
rdoc.rdoc_files.exclude('activerecord/lib/active_record/vendor/*')

rdoc.rdoc_files.include('activeresource/README')
rdoc.rdoc_files.include('activeresource/CHANGELOG')
rdoc.rdoc_files.include('activeresource/lib/active_resource.rb')
rdoc.rdoc_files.include('activeresource/lib/active_resource/*')

rdoc.rdoc_files.include('actionpack/README')
rdoc.rdoc_files.include('actionpack/CHANGELOG')
rdoc.rdoc_files.include('actionpack/lib/action_controller/**/*.rb')
rdoc.rdoc_files.include('actionpack/lib/action_view/**/*.rb')
rdoc.rdoc_files.exclude('actionpack/lib/action_controller/vendor/*')

rdoc.rdoc_files.include('actionmailer/README')
rdoc.rdoc_files.include('actionmailer/CHANGELOG')
rdoc.rdoc_files.include('actionmailer/lib/action_mailer/base.rb')
rdoc.rdoc_files.exclude('actionmailer/lib/action_mailer/vendor/*')

rdoc.rdoc_files.include('activesupport/README')
rdoc.rdoc_files.include('activesupport/CHANGELOG')
rdoc.rdoc_files.include('activesupport/lib/active_support/**/*.rb')
rdoc.rdoc_files.exclude('activesupport/lib/active_support/vendor/*')
end

# Enhance rdoc task to copy referenced images also
task :rdoc do
FileUtils.mkdir_p "doc/rdoc/files/examples/"
FileUtils.copy "activerecord/examples/associations.png", "doc/rdoc/files/examples/associations.png"
end

desc "Publish API docs for Rails as a whole and for each component"
task :pdoc => :rdoc do
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/api", "doc/rdoc").upload
PROJECTS.each do |project|
system %(cd #{project} && #{env} #{$0} pdoc)
end
end
7 changes: 4 additions & 3 deletions actionmailer/Rakefile
Expand Up @@ -35,7 +35,7 @@ Rake::RDocTask.new { |rdoc|
rdoc.title = "Action Mailer -- Easy email delivery and testing"
rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
rdoc.options << '--charset' << 'utf-8'
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
rdoc.rdoc_files.include('README', 'CHANGELOG')
rdoc.rdoc_files.include('lib/action_mailer.rb')
rdoc.rdoc_files.include('lib/action_mailer/*.rb')
Expand Down Expand Up @@ -76,12 +76,13 @@ end

desc "Publish the API documentation"
task :pgem => [:package] do
Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
Rake::SshFilePublisher.new("wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
`ssh wrath.rubyonrails.org './gemupdate.sh'`
end

desc "Publish the API documentation"
task :pdoc => [:rdoc] do
Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.org", "public_html/am", "doc").upload
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/am", "doc").upload
end

desc "Publish the release files to RubyForge."
Expand Down
8 changes: 4 additions & 4 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -426,8 +426,7 @@ def register_template_extension(extension)
end

def template_root=(root)
write_inheritable_attribute(:template_root, root)
ActionView::TemplateFinder.process_view_paths(root)
write_inheritable_attribute(:template_root, ActionView::ViewLoadPaths.new(Array(root)))
end
end

Expand Down Expand Up @@ -530,14 +529,15 @@ def initialize_defaults(method_name)
end

def render_message(method_name, body)
render :file => method_name, :body => body
render :file => method_name, :body => body, :use_full_path => true
end

def render(opts)
body = opts.delete(:body)
if opts[:file] && opts[:file] !~ /\//
opts[:file] = "#{mailer_name}/#{opts[:file]}"
end
opts[:use_full_path] = true
initialize_template_class(body).render(opts)
end

Expand All @@ -546,7 +546,7 @@ def template_path
end

def initialize_template_class(assigns)
ActionView::Base.new([template_root], assigns, self)
ActionView::Base.new(template_root, assigns, self)
end

def sort_parts(parts, order = [])
Expand Down
6 changes: 3 additions & 3 deletions actionmailer/test/mail_service_test.rb
Expand Up @@ -942,13 +942,13 @@ def test_return_path_with_deliver
class InheritableTemplateRootTest < Test::Unit::TestCase
def test_attr
expected = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
assert_equal expected, FunkyPathMailer.template_root
assert_equal [expected], FunkyPathMailer.template_root.map(&:to_s)

sub = Class.new(FunkyPathMailer)
sub.template_root = 'test/path'

assert_equal 'test/path', sub.template_root
assert_equal expected, FunkyPathMailer.template_root
assert_equal ['test/path'], sub.template_root.map(&:to_s)
assert_equal [expected], FunkyPathMailer.template_root.map(&:to_s)
end
end

Expand Down
26 changes: 26 additions & 0 deletions actionpack/CHANGELOG
@@ -1,3 +1,29 @@
*Edge*

* Fix polymorphic_url with singleton resources. #461 [Tammer Saleh]

* Replaced TemplateFinder abstraction with ViewLoadPaths [Josh Peek]

* Added block-call style to link_to [Sam Stephenson/DHH]. Example:

<% link_to(@profile) do %>
<strong><%= @profile.name %></strong> -- <span>Check it out!!</span>
<% end %>

* Performance: integration test benchmarking and profiling. [Jeremy Kemper]

* Make caching more aware of mime types. Ensure request format is not considered while expiring cache. [Jonathan del Strother]

* Drop ActionController::Base.allow_concurrency flag [Josh Peek]

* More efficient concat and capture helpers. Remove ActionView::Base.erb_variable. [Jeremy Kemper]

* Added page.reload functionality. Resolves #277. [Sean Huber]

* Fixed Request#remote_ip to only raise hell if the HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR doesn't match (not just if they're both present) [Mark Imbriaco, Bradford Folkens]

* Allow caches_action to accept a layout option [José Valim]

* Added Rack processor [Ezra Zygmuntowicz, Josh Peek]


Expand Down
12 changes: 7 additions & 5 deletions actionpack/Rakefile
Expand Up @@ -49,12 +49,14 @@ Rake::RDocTask.new { |rdoc|
rdoc.title = "Action Pack -- On rails from request to response"
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.options << '--charset' << 'utf-8'
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
if ENV['DOC_FILES']
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
else
rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.include(Dir['lib/**/*.rb'] -
Dir['lib/*/vendor/**/*.rb'])
rdoc.rdoc_files.exclude('lib/actionpack.rb')
end
}

Expand Down Expand Up @@ -132,13 +134,13 @@ task :update_js => [ :update_scriptaculous ]

desc "Publish the API documentation"
task :pgem => [:package] do
Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
`ssh davidhh@wrath.rubyonrails.org './gemupdate.sh'`
Rake::SshFilePublisher.new("wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
`ssh wrath.rubyonrails.org './gemupdate.sh'`
end

desc "Publish the API documentation"
task :pdoc => [:rdoc] do
Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.org", "public_html/ap", "doc").upload
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/ap", "doc").upload
end

desc "Publish the release files to RubyForge."
Expand Down
Expand Up @@ -97,7 +97,7 @@ def assert_redirected_to(options = {}, message=nil)
value['controller'] = value['controller'].to_s
if key == :actual && value['controller'].first != '/' && !value['controller'].include?('/')
new_controller_path = ActionController::Routing.controller_relative_to(value['controller'], @controller.class.controller_path)
value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path)
value['controller'] = new_controller_path if value['controller'] != new_controller_path && ActionController::Routing.possible_controllers.include?(new_controller_path) && @response.redirected_to.is_a?(Hash)
end
value['controller'] = value['controller'][1..-1] if value['controller'].first == '/' # strip leading hash
end
Expand Down
35 changes: 12 additions & 23 deletions actionpack/lib/action_controller/base.rb
Expand Up @@ -283,13 +283,6 @@ class Base
@@debug_routes = true
cattr_accessor :debug_routes

# Indicates to Mongrel or Webrick whether to allow concurrent action
# processing. Your controller actions and any other code they call must
# also behave well when called from concurrent threads. Turned off by
# default.
@@allow_concurrency = false
cattr_accessor :allow_concurrency

# Modern REST web services often need to submit complex data to the web application.
# The <tt>@@param_parsers</tt> hash lets you register handlers which will process the HTTP body and add parameters to the
# <tt>params</tt> hash. These handlers are invoked for POST and PUT requests.
Expand Down Expand Up @@ -428,8 +421,7 @@ def view_paths
end

def view_paths=(value)
@view_paths = value
ActionView::TemplateFinder.process_view_paths(value)
@view_paths = ActionView::ViewLoadPaths.new(Array(value)) if value
end

# Adds a view_path to the front of the view_paths array.
Expand All @@ -441,8 +433,7 @@ def view_paths=(value)
#
def prepend_view_path(path)
@view_paths = superclass.view_paths.dup if @view_paths.nil?
view_paths.unshift(*path)
ActionView::TemplateFinder.process_view_paths(path)
@view_paths.unshift(*path)
end

# Adds a view_path to the end of the view_paths array.
Expand All @@ -454,8 +445,7 @@ def prepend_view_path(path)
#
def append_view_path(path)
@view_paths = superclass.view_paths.dup if @view_paths.nil?
view_paths.push(*path)
ActionView::TemplateFinder.process_view_paths(path)
@view_paths.push(*path)
end

# Replace sensitive parameter data from the request log.
Expand Down Expand Up @@ -613,8 +603,8 @@ def process(request, response, method = :perform_action, *arguments) #:nodoc:
#
# This takes the current URL as is and only exchanges the action. In contrast, <tt>url_for :action => 'print'</tt>
# would have slashed-off the path components after the changed action.
def url_for(options = nil) #:doc:
case options || {}
def url_for(options = {}) #:doc:
case options
when String
options
when Hash
Expand Down Expand Up @@ -647,11 +637,11 @@ def session_enabled?

# View load paths for controller.
def view_paths
@template.finder.view_paths
@template.view_paths
end

def view_paths=(value)
@template.finder.view_paths = value # Mutex needed
@template.view_paths = ViewLoadPaths.new(value)
end

# Adds a view_path to the front of the view_paths array.
Expand All @@ -661,7 +651,7 @@ def view_paths=(value)
# self.prepend_view_path(["views/default", "views/custom"])
#
def prepend_view_path(path)
@template.finder.prepend_view_path(path) # Mutex needed
@template.view_paths.unshift(*path)
end

# Adds a view_path to the end of the view_paths array.
Expand All @@ -671,7 +661,7 @@ def prepend_view_path(path)
# self.append_view_path(["views/default", "views/custom"])
#
def append_view_path(path)
@template.finder.append_view_path(path) # Mutex needed
@template.view_paths.push(*path)
end

protected
Expand Down Expand Up @@ -1232,17 +1222,16 @@ def close_session
end

def template_exists?(template_name = default_template_name)
@template.finder.file_exists?(template_name)
@template.file_exists?(template_name)
end

def template_public?(template_name = default_template_name)
@template.file_public?(template_name)
end

def template_exempt_from_layout?(template_name = default_template_name)
extension = @template && @template.finder.pick_template_extension(template_name)
name_with_extension = !template_name.include?('.') && extension ? "#{template_name}.#{extension}" : template_name
@@exempt_from_layout.any? { |ext| name_with_extension =~ ext }
template_name = @template.send(:template_file_from_name, template_name) if @template
@@exempt_from_layout.any? { |ext| template_name.to_s =~ ext }
end

def default_template_name(action_name = self.action_name)
Expand Down

0 comments on commit 01571c0

Please sign in to comment.