Sha256: b1b0dd81f58f8b7dc1b1bcae4108ceff481b766d0229b4f460400aa0b7d90a30

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

module IssueTrackers
  class CloudfujiTracker < ::IssueTracker
    Label = "cloudfuji"
    Fields = [
      [:project_id, {
        :label       => "Project Ido ID",
        :placeholder => "Ido ID of project to create task on"
      }]
    ]

    def create_issue(problem, reported_by)
      if ::Cloudfuji::Platform.on_cloudfuji?
        err = problem.errs.last

        event = {
          :category => :project_task,
          :name     => :created,
          :data     => {
            :ido_id          => err.ido_id,
            :title           => issue_title(problem),
            :description     => body_template.result(binding),
            :task_type       => 'bug',
            :state           => 'unscheduled',
            :requested_by_id => reported_by.ido_id,
            :project_id      => project_id,
            :labels          => "errbit"
          }
        }

        puts "Publishing Cloudfuji Event: #{event.inspect}"

        ::Cloudfuji::Event.publish(event)

        # Display 'pending' message until tracker responds with url
        problem.update_attribute :issue_link, "pending"
      end
    end

    def body_template
      @@body_template ||= ERB.new(File.read(File.expand_path("../../../views/issue_trackers/cloudfuji_body.txt.erb", __FILE__)).gsub(/^\s*/, ''))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
errbit_cloudfuji-0.2.3 app/models/issue_trackers/cloudfuji_tracker.rb