Class: IssueTracker

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/issue_tracker.rb

Instance Method Summary collapse

Instance Method Details

#trackerObject


12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/issue_tracker.rb', line 12

def tracker
  @tracker ||=
    begin
      klass = ErrbitPlugin::Registry.issue_trackers[self.type_tracker] || ErrbitPlugin::NoneIssueTracker
      # TODO: we need to find out a better way to pass those config to the issue tracker
      klass.new(options.merge(
        github_repo: app.try(:github_repo),
        bitbucket_repo: app.try(:bitbucket_repo)
      ))
    end
end

#type_trackerObject


24
25
26
# File 'app/models/issue_tracker.rb', line 24

def type_tracker
  self.attributes['type_tracker'] ?  self.attributes['type_tracker'] : 'none'
end

#validate_trackerObject

Allow the tracker to validate its own params


29
30
31
32
33
# File 'app/models/issue_tracker.rb', line 29

def validate_tracker
  (tracker.errors || {}).each do |k,v|
    errors.add k, v
  end
end