redmine_plugin_locator.rb 944 Bytes
Newer Older
1
#-- encoding: UTF-8
Holger Just's avatar
Holger Just committed
2 3 4
#-- copyright
# ChiliProject is a project management system.
#
Holger Just's avatar
Holger Just committed
5
# Copyright (C) 2010-2012 the ChiliProject Team
Holger Just's avatar
Holger Just committed
6 7 8 9 10 11 12 13 14
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# See doc/COPYRIGHT.rdoc for more details.
#++

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
class RedminePluginLocator < Rails::Plugin::FileSystemLocator
  def initialize(initializer)
    super
    @@instance = self
  end

  def self.instance
    @@instance
  end

  # This locator is not meant for loading plugins
  # The plugin loading is done by the default rails locator, this one is
  # only for querying available plugins easily
  def plugins(for_loading = true)
    return [] if for_loading
    super()
  end

  def has_plugin?(name)
    plugins(false).collect(&:name).include? name.to_s
  end
end