lita-jira 0.7.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/jirahelper/issue.rb +6 -12
- data/lib/jirahelper/misc.rb +2 -1
- data/lib/jirahelper/regex.rb +1 -1
- data/lib/lita/handlers/jira.rb +2 -1
- data/lita-jira.gemspec +3 -3
- data/spec/lita/handlers/jira_spec.rb +8 -5
- metadata +6 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 48c00700fdf50c30b6ad579589c2fd0524c40910
         | 
| 4 | 
            +
              data.tar.gz: 601010e495e0f28b68a3a7f854eb0af1c51bcb63
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9b64f58dc863e610feb45e334859b7b21af89a0ff2dfcde1ee49b82a19702781eeb8bcddba9ea0ac7aa486deeb9a789c2260a814b96a7d1c0877b447bf4ff470
         | 
| 7 | 
            +
              data.tar.gz: 873c4fb13c1f868e55f1edc193aa675178b50cd0dc93b51808ce02b5dfe484b7ad2153f6544328249eaf99dd7b2b1100f6b1b9c29b3bf0a910ae051ff5dfd424
         | 
    
        data/README.md
    CHANGED
    
    | @@ -33,6 +33,7 @@ config.handlers.jira.site     = 'https://your.jira.instance.example.com/' | |
| 33 33 | 
             
            * `ambient` (boolean) - When set to `true`, Lita will show JIRA issue details when a JIRA issue key is mentioned in chat, outside the context of a command. Default: `false`
         | 
| 34 34 | 
             
            * `ignore` (array) - Prevent ambient JIRA issue detection in certain users' messages. Accepts user names, mention names, and IDs. Default: `[]`
         | 
| 35 35 | 
             
            * `rooms` (array) - Limit ambient JIRA issue detection to a certain list of rooms. If unspecified, the bot will respond to detected issues in all rooms.
         | 
| 36 | 
            +
            * `use_ssl` (boolean) - When set to `true`, an SSL connection will be used to JIRA. Set to `false` if you run JIRA over plain http.
         | 
| 36 37 |  | 
| 37 38 | 
             
            ``` ruby
         | 
| 38 39 | 
             
            config.handlers.jira.context = '/myjira'
         | 
| @@ -40,6 +41,7 @@ config.handlers.jira.format = 'one-line' | |
| 40 41 | 
             
            config.handlers.jira.ambient = true
         | 
| 41 42 | 
             
            config.handlers.jira.ignore = ['Jira', 'Github', 'U1234']
         | 
| 42 43 | 
             
            config.handlers.jira.rooms = ['devtools', 'engineering']
         | 
| 44 | 
            +
            config.handlers.jira.use_ssl = false
         | 
| 43 45 | 
             
            ```
         | 
| 44 46 |  | 
| 45 47 | 
             
            ## Usage
         | 
    
        data/lib/jirahelper/issue.rb
    CHANGED
    
    | @@ -2,15 +2,12 @@ | |
| 2 2 | 
             
            module JiraHelper
         | 
| 3 3 | 
             
              # Issues
         | 
| 4 4 | 
             
              module Issue
         | 
| 5 | 
            -
                # NOTE: Prefer this syntax here as it's cleaner
         | 
| 6 | 
            -
                # rubocop:disable Style/RescueEnsureAlignment
         | 
| 7 5 | 
             
                def fetch_issue(key, expected = true)
         | 
| 8 6 | 
             
                  client.Issue.find(key)
         | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 7 | 
            +
                rescue
         | 
| 8 | 
            +
                  log.error('JIRA HTTPError') if expected
         | 
| 9 | 
            +
                  nil
         | 
| 12 10 | 
             
                end
         | 
| 13 | 
            -
                # rubocop:enable Style/RescueEnsureAlignment
         | 
| 14 11 |  | 
| 15 12 | 
             
                # Leverage the jira-ruby Issue.jql search feature
         | 
| 16 13 | 
             
                #
         | 
| @@ -20,15 +17,12 @@ module JiraHelper | |
| 20 17 | 
             
                  client.Issue.jql(jql)
         | 
| 21 18 | 
             
                end
         | 
| 22 19 |  | 
| 23 | 
            -
                # NOTE: Prefer this syntax here as it's cleaner
         | 
| 24 | 
            -
                # rubocop:disable Style/RescueEnsureAlignment
         | 
| 25 20 | 
             
                def fetch_project(key)
         | 
| 26 21 | 
             
                  client.Project.find(key)
         | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 22 | 
            +
                rescue
         | 
| 23 | 
            +
                  log.error('JIRA HTTPError')
         | 
| 24 | 
            +
                  nil
         | 
| 30 25 | 
             
                end
         | 
| 31 | 
            -
                # rubocop:enable Style/RescueEnsureAlignment
         | 
| 32 26 |  | 
| 33 27 | 
             
                # NOTE: Not breaking this function out just yet.
         | 
| 34 28 | 
             
                # rubocop:disable Metrics/AbcSize
         | 
    
        data/lib/jirahelper/misc.rb
    CHANGED
    
    
    
        data/lib/jirahelper/regex.rb
    CHANGED
    
    | @@ -8,6 +8,6 @@ module JiraHelper | |
| 8 8 | 
             
                PROJECT_PATTERN = /(?<project>[a-zA-Z0-9]{1,10})/
         | 
| 9 9 | 
             
                ISSUE_PATTERN   = /(?<issue>#{PROJECT_PATTERN}-[0-9]{1,5}+)/
         | 
| 10 10 | 
             
                EMAIL_PATTERN   = /(?<email>[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+)/i
         | 
| 11 | 
            -
                AMBIENT_PATTERN =  | 
| 11 | 
            +
                AMBIENT_PATTERN = /(\s|^)#{ISSUE_PATTERN}/
         | 
| 12 12 | 
             
              end
         | 
| 13 13 | 
             
            end
         | 
    
        data/lib/lita/handlers/jira.rb
    CHANGED
    
    | @@ -15,6 +15,7 @@ module Lita | |
| 15 15 | 
             
                  config :ambient, required: false, types: [TrueClass, FalseClass], default: false
         | 
| 16 16 | 
             
                  config :ignore, required: false, type: Array, default: []
         | 
| 17 17 | 
             
                  config :rooms, required: false, type: Array
         | 
| 18 | 
            +
                  config :use_ssl, required: false, types: [TrueClass, FalseClass], default: true
         | 
| 18 19 |  | 
| 19 20 | 
             
                  include ::JiraHelper::Issue
         | 
| 20 21 | 
             
                  include ::JiraHelper::Misc
         | 
| @@ -109,7 +110,7 @@ module Lita | |
| 109 110 | 
             
                      return
         | 
| 110 111 | 
             
                    end
         | 
| 111 112 |  | 
| 112 | 
            -
                    return response.reply(t('myissues.empty'))  | 
| 113 | 
            +
                    return response.reply(t('myissues.empty')) if issues.empty?
         | 
| 113 114 |  | 
| 114 115 | 
             
                    response.reply(format_issues(issues))
         | 
| 115 116 | 
             
                  end
         | 
    
        data/lita-jira.gemspec
    CHANGED
    
    | @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            Gem::Specification.new do |spec|
         | 
| 2 2 | 
             
              spec.name          = 'lita-jira'
         | 
| 3 | 
            -
              spec.version       = '0. | 
| 4 | 
            -
              spec.authors       = ['Eric Sigler', 'Matt Critchlow']
         | 
| 5 | 
            -
              spec.email         = ['me@esigler.com', 'matt.critchlow@gmail.com']
         | 
| 3 | 
            +
              spec.version       = '0.8.0'
         | 
| 4 | 
            +
              spec.authors       = ['Eric Sigler', 'Matt Critchlow', 'Tristan Chong', 'Lee Briggs']
         | 
| 5 | 
            +
              spec.email         = ['me@esigler.com', 'matt.critchlow@gmail.com', 'ong@tristaneuan.ch', 'lee@brig.gs']
         | 
| 6 6 | 
             
              spec.description   = 'A JIRA plugin for Lita.'
         | 
| 7 7 | 
             
              spec.summary       = spec.description
         | 
| 8 8 | 
             
              spec.homepage      = 'https://github.com/esigler/lita-jira'
         | 
| @@ -189,9 +189,10 @@ describe Lita::Handlers::Jira, lita_handler: true do | |
| 189 189 | 
             
                  end
         | 
| 190 190 |  | 
| 191 191 | 
             
                  it 'shows details for a detected issue in a message' do
         | 
| 192 | 
            +
                    send_message('XYZ-987')
         | 
| 192 193 | 
             
                    send_message('foo XYZ-987 bar')
         | 
| 193 194 | 
             
                    send_message('foo XYZ-987?')
         | 
| 194 | 
            -
                    expect(replies.size).to eq( | 
| 195 | 
            +
                    expect(replies.size).to eq(3)
         | 
| 195 196 | 
             
                  end
         | 
| 196 197 |  | 
| 197 198 | 
             
                  it 'does not show details for a detected issue in a command' do
         | 
| @@ -200,8 +201,10 @@ describe Lita::Handlers::Jira, lita_handler: true do | |
| 200 201 | 
             
                  end
         | 
| 201 202 |  | 
| 202 203 | 
             
                  it 'does not show details for a issue in a URL-ish context' do
         | 
| 204 | 
            +
                    send_message('http://www.example.com/XYZ-987')
         | 
| 203 205 | 
             
                    send_message('http://www.example.com/XYZ-987.html')
         | 
| 204 206 | 
             
                    send_message('http://www.example.com/someother-XYZ-987.html')
         | 
| 207 | 
            +
                    send_message('TIL http://ruby-doc.org/core-2.3.0/Enumerable.html#method-i-each_slice')
         | 
| 205 208 | 
             
                    expect(replies.size).to eq(0)
         | 
| 206 209 | 
             
                  end
         | 
| 207 210 |  | 
| @@ -281,10 +284,10 @@ describe Lita::Handlers::Jira, lita_handler: true do | |
| 281 284 | 
             
                    grab_request(valid_client)
         | 
| 282 285 | 
             
                    send_command('jira myissues')
         | 
| 283 286 | 
             
                    expect(replies[-3..-1]).to eq([
         | 
| 284 | 
            -
             | 
| 285 | 
            -
             | 
| 286 | 
            -
             | 
| 287 | 
            -
             | 
| 287 | 
            +
                                                    'Here are issues currently assigned to you:',
         | 
| 288 | 
            +
                                                    "[XYZ-987] Some summary text\nStatus: In Progress, assigned to: A Person, fixVersion: Sprint 2, priority: P0\nhttp://jira.local/browse/XYZ-987",
         | 
| 289 | 
            +
                                                    "[XYZ-988] Some summary text 2\nStatus: In Progress 2, assigned to: A Person 2, fixVersion: none, priority: P1\nhttp://jira.local/browse/XYZ-988"
         | 
| 290 | 
            +
                                                  ])
         | 
| 288 291 | 
             
                  end
         | 
| 289 292 |  | 
| 290 293 | 
             
                  it 'shows an error when the search fails' do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,17 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: lita-jira
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.8.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Eric Sigler
         | 
| 8 8 | 
             
            - Matt Critchlow
         | 
| 9 | 
            +
            - Tristan Chong
         | 
| 10 | 
            +
            - Lee Briggs
         | 
| 9 11 | 
             
            autorequire: 
         | 
| 10 12 | 
             
            bindir: bin
         | 
| 11 13 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 14 | 
            +
            date: 2016-02-26 00:00:00.000000000 Z
         | 
| 13 15 | 
             
            dependencies:
         | 
| 14 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 17 | 
             
              name: lita
         | 
| @@ -127,6 +129,8 @@ description: A JIRA plugin for Lita. | |
| 127 129 | 
             
            email:
         | 
| 128 130 | 
             
            - me@esigler.com
         | 
| 129 131 | 
             
            - matt.critchlow@gmail.com
         | 
| 132 | 
            +
            - ong@tristaneuan.ch
         | 
| 133 | 
            +
            - lee@brig.gs
         | 
| 130 134 | 
             
            executables: []
         | 
| 131 135 | 
             
            extensions: []
         | 
| 132 136 | 
             
            extra_rdoc_files: []
         |