SCMCreator-1895.patch
lib/scm_project_patch.rb (working copy) | ||
---|---|---|
10 | 10 | |
11 | 11 |
safe_attributes 'scm' unless Redmine::VERSION::MAJOR == 1 && Redmine::VERSION::MINOR == 0 # Redmine 1.0.x |
12 | 12 | |
13 |
validates_presence_of :scm, :if => Proc.new { |project| project.new_record? && ScmConfig['auto_create'] == 'force' } |
|
13 |
validates_presence_of :scm, :if => Proc.new { |project| project.new_record? && project.module_enabled?(:repository) && ScmConfig['auto_create'] == 'force' }
|
|
14 | 14 | |
15 | 15 |
validate :repository_exists # FIXME: not sure if this should really be used |
16 | 16 | |
... | ... | |
32 | 32 |
module InstanceMethods |
33 | 33 | |
34 | 34 |
def create_scm |
35 |
if @scm.present? && ScmConfig['auto_create'] |
|
35 |
if @scm.present? && self.module_enabled?(:repository) && ScmConfig['auto_create']
|
|
36 | 36 |
@repository = Repository.factory(@scm) |
37 | 37 |
if @repository |
38 | 38 |
@repository.project = self |
... | ... | |
70 | 70 |
end |
71 | 71 | |
72 | 72 |
def repository_exists |
73 |
if @scm.present? && self.identifier.present? && ScmConfig['auto_create'] |
|
73 |
if @scm.present? && self.identifier.present? && self.module_enabled?(:repository) && ScmConfig['auto_create']
|
|
74 | 74 |
begin |
75 | 75 |
interface = Object.const_get("#{@scm}Creator") |
76 | 76 |
if interface.repository_exists?(self.identifier) |