Dynamically load all Hooks & Patches

This commit is contained in:
2026-01-20 08:12:34 -05:00
parent b712c328ba
commit 7d644f0619

16
init.rb
View File

@@ -8,14 +8,6 @@
# #
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Dynamically load all Hooks & Patches
ActiveSupport::Reloader.to_prepare do
Dir::foreach(File.join(File.dirname(__FILE__), 'lib')) do |file|
next unless /\.rb$/ =~ file
require_dependency file
end
end
Redmine::Plugin.register :redmine_qbo do Redmine::Plugin.register :redmine_qbo do
# About # About
@@ -26,7 +18,7 @@ Redmine::Plugin.register :redmine_qbo do
url 'https://github.com/rickbarrette/redmine_qbo' url 'https://github.com/rickbarrette/redmine_qbo'
author_url 'https://barrettefabrication.com' author_url 'https://barrettefabrication.com'
settings :default => {'empty' => true}, :partial => 'qbo/settings' settings :default => {'empty' => true}, :partial => 'qbo/settings'
requires_redmine :version_or_higher => '6.0.0' requires_redmine :version_or_higher => '6.1.0'
# Add safe attributes for core models # Add safe attributes for core models
Issue.safe_attributes 'customer_id' Issue.safe_attributes 'customer_id'
@@ -52,3 +44,9 @@ Redmine::Plugin.register :redmine_qbo do
menu :top_menu, :vehicles, { :controller => :vehicles, :action => :index }, :caption => 'Vehicles', :if => Proc.new { User.current.logged? } menu :top_menu, :vehicles, { :controller => :vehicles, :action => :index }, :caption => 'Vehicles', :if => Proc.new { User.current.logged? }
end end
# Dynamically load all Hooks & Patches
Dir::foreach(File.join(File.dirname(__FILE__), 'lib')) do |file|
next unless file.end_with?('.rb')
require_relative "lib/#{file.delete_suffix(".rb") }"
end