Sha256: 26202c154ffe06a1946a1410903e9b400a8b7ca68ecdc3132157a8661bbcb77d

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

# The MIT License
#
# Copyright (c) 2019-2020 Yurii Dubinka
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom
# the Software is  furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
# OR OTHER DEALINGS IN THE SOFTWARE.

require_relative "attachment"

module Lazylead
  # Check that ticket has log file(s) in attachment.
  class Logs < Lazylead::Attachment
    def initialize
      super("Log files", 2, "Attachments")
    end

    # Ensure that ticket has a '*.log' file more '5KB'
    def matching(attachment)
      name = attachment.attrs["filename"].downcase
      return false unless attachment.attrs["size"].to_i > 5120
      return true if File.extname(name).start_with?(".log", ".txt")
      %w[.log.zip .log.gz .log.tar.gz].any? { |l| name.end_with? l }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lazylead-0.6.1 lib/lazylead/task/accuracy/logs.rb
lazylead-0.6.0 lib/lazylead/task/accuracy/logs.rb