diff --git a/config/routes.rb b/config/routes.rb index c1d1209..2586caf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,10 +20,16 @@ # When a new exception report is recieved, it will be compared to existing bug issues. # If there is a match, the existing issue will be updated # if not a new bug issue will be generated. -ActionController::Routing::Routes.draw do |map| - map.connect '/exceptionhandler', :controller => 'exceptionhandler', :action => 'index' - map.connect '/exceptionhandler/maps', :controller => 'maps', :action => 'index' - map.connect '/uploadFile', :controller => 'maps', :action => 'uploadFile' - map.connect '/exceptionhandler/maps/delete/:map', :controller => 'maps', :action => 'deleteMap' - map.connect '/exceptionhandler/maps/new', :controller => 'maps', :action => 'new' +if Rails::VERSION::MAJOR >= 3 + #RedmineApp::Application.routes.draw do + #match 'exceptionhandler', :to => 'exceptionhandler#index', :via => [:get, :post] + #end +else + ActionController::Routing::Routes.draw do |map| + map.connect '/exceptionhandler', :controller => 'exceptionhandler', :action => 'index' + map.connect '/exceptionhandler/maps', :controller => 'maps', :action => 'index' + map.connect '/uploadFile', :controller => 'maps', :action => 'uploadFile' + map.connect '/exceptionhandler/maps/delete/:map', :controller => 'maps', :action => 'deleteMap' + map.connect '/exceptionhandler/maps/new', :controller => 'maps', :action => 'new' + end end diff --git a/init.rb b/init.rb index fd93f2e..d55fbb8 100644 --- a/init.rb +++ b/init.rb @@ -1,5 +1,23 @@ require 'redmine' +::Rails.logger.info 'Starting Exception Report Handler for Redmine' + +if Rails::VERSION::MAJOR >= 3 + + ActionDispatch::Callbacks.to_prepare do + require_dependency 'issue' + require_dependency 'project' + #require_dependency 'customfield' + require_dependency 'time' + #require_dependency 'issuepriority' + require_dependency 'user' + #require_dependency 'issuestatus' + require_dependency 'tracker' + require_dependency 'tempfile' + require_dependency 'open3' + end +end + Redmine::Plugin.register :redmine_exception_handler do name 'Redmine Exception Handler plugin' author 'Rick Barrette '