mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Require missing libraries and check for defined ActionController constant so ActionView can be used standalone
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
require 'set'
|
||||
|
||||
module Mime
|
||||
SET = []
|
||||
EXTENSION_LOOKUP = Hash.new { |h, k| h[k] = Type.new(k) unless k.blank? }
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
require 'action_view/helpers/tag_helper'
|
||||
require 'html/document'
|
||||
|
||||
begin
|
||||
require 'html/document'
|
||||
rescue LoadError
|
||||
html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner"
|
||||
if File.directory?(html_scanner_path)
|
||||
$:.unshift html_scanner_path
|
||||
require 'html/document'
|
||||
end
|
||||
end
|
||||
|
||||
module ActionView
|
||||
module Helpers #:nodoc:
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
require 'action_view/helpers/tag_helper'
|
||||
require 'html/document'
|
||||
|
||||
begin
|
||||
require 'html/document'
|
||||
rescue LoadError
|
||||
html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner"
|
||||
if File.directory?(html_scanner_path)
|
||||
$:.unshift html_scanner_path
|
||||
require 'html/document'
|
||||
end
|
||||
end
|
||||
|
||||
module ActionView
|
||||
module Helpers #:nodoc:
|
||||
|
||||
@@ -72,7 +72,7 @@ module ActionView
|
||||
end_src
|
||||
|
||||
begin
|
||||
logger = Base.logger
|
||||
logger = defined? ActionController && Base.logger
|
||||
logger.debug "Compiling template #{render_symbol}" if logger
|
||||
|
||||
ActionView::Base::CompiledTemplates.module_eval(source, filename, 0)
|
||||
|
||||
@@ -16,7 +16,11 @@ module ActionView
|
||||
memoize :counter_name
|
||||
|
||||
def render(view, local_assigns = {})
|
||||
ActionController::Base.benchmark("Rendered #{path_without_format_and_extension}", Logger::DEBUG, false) do
|
||||
if defined? ActionController
|
||||
ActionController::Base.benchmark("Rendered #{path_without_format_and_extension}", Logger::DEBUG, false) do
|
||||
super
|
||||
end
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
require 'action_controller/mime_type'
|
||||
|
||||
module ActionView #:nodoc:
|
||||
class Template
|
||||
extend TemplateHandlers
|
||||
|
||||
Reference in New Issue
Block a user