Sha256: f69f99b732f5957569b7df309a6f2003f1079ff8805d0a54a0560fbc3e99de37

Contents?: true

Size: 653 Bytes

Versions: 4

Compression:

Stored size: 653 Bytes

Contents

module JenkinsTracker
  module Util

    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
    end

    #def parse_json(str, options = {})
    #  JSON.parse(str, options)
    #end

    def parse_changelog(str)
      results = []

      str.scan(/(\[[#a-zA-Z0-9\s]+\])(.*)/) do |ids, msg|
        parse_tracker_story_ids(ids).each do |id|
          results << OpenStruct.new(:story_id => id, :commit_message => "#{ids}#{msg}".strip)
        end
      end

      results
    end

    def parse_tracker_story_ids(str)
      str.strip.gsub(/[\[#\]]/, '').split(' ').map(&:to_i).reject { |i| i == 0 }
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jenkins_tracker-0.3.0 lib/jenkins_tracker/util.rb
jenkins_tracker-0.2.1 lib/jenkins_tracker/util.rb
jenkins_tracker-0.2.0 lib/jenkins_tracker/util.rb
jenkins_tracker-0.1.0 lib/jenkins_tracker/util.rb