Converted the REDMINE_SUPPORTED_SCM constant to a class

Now SCMs can be added or removed using a simple API, instead of being
hardcoded:

  Redmine::Scm::Base.add('ScmName')
  Redmine::Scm::Base.delete('ScmName')

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3440 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis
2010-02-16 22:41:59 +00:00
parent b3330d3995
commit 9e22faa640
5 changed files with 34 additions and 4 deletions
+8 -1
View File
@@ -7,6 +7,7 @@ require 'redmine/themes'
require 'redmine/hook'
require 'redmine/plugin'
require 'redmine/wiki_formatting'
require 'redmine/scm/base'
begin
require_library_or_gem 'RMagick' unless Object.const_defined?(:Magick)
@@ -21,7 +22,13 @@ else
FCSV = CSV
end
REDMINE_SUPPORTED_SCM = %w( Subversion Darcs Mercurial Cvs Bazaar Git Filesystem )
Redmine::Scm::Base.add "Subversion"
Redmine::Scm::Base.add "Darcs"
Redmine::Scm::Base.add "Mercurial"
Redmine::Scm::Base.add "Cvs"
Redmine::Scm::Base.add "Bazaar"
Redmine::Scm::Base.add "Git"
Redmine::Scm::Base.add "Filesystem"
# Permissions
Redmine::AccessControl.map do |map|
+23
View File
@@ -0,0 +1,23 @@
module Redmine
module Scm
class Base
class << self
def all
@scms
end
# Add a new SCM adapter and repository
def add(scm_name)
@scms ||= []
@scms << scm_name
end
# Remove a SCM adapter from Redmine's list of supported scms
def delete(scm_name)
@scms.delete(scm_name)
end
end
end
end
end