Sha256: 003a8745d26a685aea177d8308ac7bc9c767d47e777e356b0f3527c80c045b20

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require 'jiralicious'
require 'json'

module Stove
  class JIRA
    JIRA_URL = 'https://tickets.opscode.com'

    Jiralicious.configure do |config|
      config.username = Stove::Config['jira_username']
      config.password = Stove::Config['jira_password']
      config.uri      = JIRA_URL
    end

    class << self
      def unreleased_tickets_for(component)
        jql = [
          'project = COOK',
          'resolution = Fixed',
          'status = "Fix Committed"',
          'component = ' + component.inspect
        ].join(' AND ')
        Stove::Logger.debug "JQL: #{jql.inspect}"

        Jiralicious.search(jql).issues
      end

      # Comment and close a particular issue.
      #
      # @param [Jiralicious::Issue] ticket
      #   the JIRA ticket
      # @param [Stove::Cookbook] cookbook
      #   the cookbook to release
      def comment_and_close(ticket, cookbook)
        comment = "Released in [#{cookbook.version}|#{cookbook.url}]"

        transition = Jiralicious::Issue::Transitions.find(ticket.jira_key).find do |key, value|
          !value.is_a?(String) && value.name == 'Close'
        end.last

        Jiralicious::Issue::Transitions.go(ticket.jira_key, transition.id, { comment: comment })
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stove-1.1.2 lib/stove/jira.rb
stove-1.1.0 lib/stove/jira.rb
stove-1.0.1 lib/stove/jira.rb
stove-1.0.0 lib/stove/jira.rb