changeset 1122:22ab16c93c1c redmine-2.2-integration

Fixed Dispatcher call to provide compatibility with current version of Redmine.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 08 Jan 2013 16:11:18 +0000
parents 6b49ed91e183
children 48c5fdd6cf10
files plugins/redmine_checkout/init.rb
diffstat 1 files changed, 15 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/redmine_checkout/init.rb	Tue Jan 08 16:08:55 2013 +0000
+++ b/plugins/redmine_checkout/init.rb	Tue Jan 08 16:11:18 2013 +0000
@@ -1,13 +1,12 @@
 require 'redmine'
 
-require 'dispatcher'
-Dispatcher.to_prepare do
+ActionDispatch::Callbacks.to_prepare do
   # Patches
   require_dependency 'checkout/settings_controller_patch'
-  
+
   require_dependency 'checkout/repositories_helper_patch'
   require_dependency 'checkout/repository_patch'
-  
+
   require_dependency 'checkout/settings_helper_patch'
   require_dependency 'checkout/setting_patch'
 end
@@ -22,13 +21,13 @@
   author_url 'http://meine-er.de'
   description 'Add links to the actual repository to the repository view.'
   version '0.5'
-  
+
   requires_redmine :version_or_higher => '0.9'
-  
+
   settings_defaults = HashWithIndifferentAccess.new({
     'display_login' => nil,
     'use_zero_clipboard' => '1',
-    
+
     'display_checkout_info' =>  '1',
     'description_Abstract' => <<-EOF
 The data contained in this repository can be downloaded to your computer using one of several clients.
@@ -37,17 +36,17 @@
 Please select the desired protocol below to get the URL.
 EOF
   })
-  
+
   # this is needed for setting the defaults
   require 'checkout/repository_patch'
-  
+
   CheckoutHelper.supported_scm.each do |scm|
     klazz = "Repository::#{scm}".constantize
-    
+
     settings_defaults["description_#{scm}"] = ''
     settings_defaults["overwrite_description_#{scm}"] = '0'
     settings_defaults["display_command_#{scm}"] = '0'
-    
+
     # access can be one of
     #   read+write => this protocol always allows read/write access
     #   read-only => this protocol always allows read access only
@@ -63,9 +62,9 @@
       :is_default => '1'
     })]
   end
-  
+
   settings :default => settings_defaults, :partial => 'settings/redmine_checkout'
-  
+
   Redmine::WikiFormatting::Macros.register do
     desc <<-EOF
 Creates a checkout link to the actual repository. Example:
@@ -83,10 +82,10 @@
       else
         project = @project
       end
-      
+
       if project && project.repository
         protocols = project.repository.checkout_protocols.select{|p| p.access_rw(User.current)}
-        
+
         if proto.present?
           proto_obj = protocols.find{|p| p.protocol.downcase == proto.downcase}
         else
@@ -94,7 +93,7 @@
         end
       end
       raise "Checkout protocol #{proto} not found" unless proto_obj
-      
+
       cmd = (project.repository.checkout_display_command? && proto_obj.command.present?) ? proto_obj.command.strip + " " : ""
       cmd + link_to(proto_obj.url, proto_obj.url)
     end