Permalink
Browse files

Use the Dispatcher for core patches.

  • Loading branch information...
1 parent 6bd3e2c commit 8d1b7a8d8f677427ad0d6c044a848f5adcb7c9db @edavis10 committed Mar 17, 2010
Showing with 14 additions and 23 deletions.
  1. +14 −4 init.rb
  2. +0 −7 lib/billing_time_entry_patch.rb
  3. +0 −6 lib/billing_timesheet_patch.rb
  4. +0 −6 lib/billing_user_patch.rb
View
18 init.rb
@@ -18,10 +18,20 @@
require_dependency 'billing_timesheet_hooks'
require_dependency 'billing_project_hooks'
-# Patches
-require_dependency 'billing_user_patch'
-require_dependency 'billing_time_entry_patch'
-require_dependency 'billing_timesheet_patch'
+# Patches to the Redmine core.
+require 'dispatcher'
+
+Dispatcher.to_prepare :redmine_billing do
+ require_dependency 'principal'
+ require_dependency 'user'
+ User.send(:include, BillingUserPatch)
+
+ require_dependency 'timesheet'
+ Timesheet.send(:include, BillingTimesheetPatch)
+
+ require_dependency 'time_entry'
+ TimeEntry.send(:include, BillingTimeEntryPatch)
+end
Redmine::Plugin.register :redmine_billing do
name 'Redmine Billing plugin'
View
7 lib/billing_time_entry_patch.rb
@@ -1,5 +1,3 @@
-require_dependency 'time_entry'
-
# Patches Redmine's Time Entries dynamically. Adds a relationship
# Time Entry belongs to a Vendor Invoice
module BillingTimeEntryPatch
@@ -23,8 +21,3 @@ module ClassMethods
module InstanceMethods
end
end
-
-# Add module
-TimeEntry.send(:include, BillingTimeEntryPatch)
-
-
View
6 lib/billing_timesheet_patch.rb
@@ -1,5 +1,3 @@
-require_dependency 'timesheet'
-
# Patches Timesheets dynamically.
module BillingTimesheetPatch
def self.included(base) # :nodoc:
@@ -23,7 +21,3 @@ module InstanceMethods
end
end
-# Add module
-Timesheet.send(:include, BillingTimesheetPatch)
-
-
View
6 lib/billing_user_patch.rb
@@ -1,6 +1,3 @@
-require_dependency 'principal'
-require_dependency 'user'
-
# Patches Redmine's Users dynamically. Adds a relationship
# User has and belongs to many Vendor Invoice
module BillingUserPatch
@@ -24,7 +21,4 @@ module InstanceMethods
end
end
-# Add module
-User.send(:include, BillingUserPatch)
-

0 comments on commit 8d1b7a8

Please sign in to comment.