lib/masterview/initializer.rb in masterview-0.2.0 vs lib/masterview/initializer.rb in masterview-0.2.1

- old
+ new

@@ -423,11 +423,11 @@ @mv_code_base_dir = File.expand_path( File.dirname(__FILE__) ) builtin_directives_path = File.join( mv_code_base_dir, 'directives') @mv_installation_dir = File.expand_path( "#{File.dirname(__FILE__)}/../.." ) #ISSUE: should probably also detect std console or breakpointer launch scripts [DJL 10-Jun-2006] - @rails_runner_scripts_pattern = /server|dispatch/ + @rails_runner_scripts_pattern = /server|dispatch|mongrel_rails/ @has_rails_context = (defined?(::RAILS_ROOT) != nil) decide_if_running_rails # only run if auto parsing and when launching server, check if need to update mv files @@ -749,10 +749,14 @@ def set_module_constants #:nodoc: config = configuration + # create loaded feature map - this map will track exactly what was loaded taking into account failures, so it can differ + # from what is configured. key = feature symbol, value = true if enabled and loaded + MasterView.const_set('LoadedFeatures', {} ) + # we don't record root_path or config_dir_path - their purpose is satisfied # by the time we're done processing this installation configuration MasterView.const_set('DefaultDirectiveLoadPaths', config.directive_paths.clone) # clone before freezing @@ -821,10 +825,11 @@ else io_mgr.erb = RailsErbCacheMIOTree.new( config.generated_file_default_extension, :logging => true) end io_mgr.backup = FileMIOTree.new( config.rebuild_backups_tmp_dir_path ) if config.rebuild_backups_tmp_dir_path MasterView.const_set('IOMgr', io_mgr) + MasterView::LoadedFeatures[:tidy_template_read] = config.default_parser_options[:tidy] end # Initialize MasterView::Log with a logger which emits to std output, default DEBUG level def initialize_logger #:nodoc: #?return if defined?(Log) @@ -835,10 +840,11 @@ return if ! configuration.on_rails? enable_mv_admin_pages parse_templates_at_startup enable_reparse_changed_templates enable_rails_erb_direct + MasterView::Log.info{ 'MasterView plugin initialized - Version '+MasterView::VERSION::STRING } end # install the MasterviewController to support masterview admin pages in the site def enable_mv_admin_pages #:nodoc: return if ! configuration.enable_admin_pages #MasterView::EnableMasterViewAdminPages @@ -881,9 +887,10 @@ require 'masterview/extras/watcher' MasterView::Log.debug { 'Parsing MasterView templates...' } MasterView::IOMgr.template.find(:pattern => MasterView::TemplateFilenamePattern) do |mio| MasterView::Parser.parse_mio(mio, MasterView::IOMgr.erb) end + MasterView::LoadedFeatures[:rails_parse_at_startup] = true end end def enable_reparse_changed_templates #:nodoc: if configuration.reparse_changed_masterview_templates #MasterView::ReparseChangedMasterViewTemplates