lazylead 0.5.0 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8358ec8da9d97621f9c5ec28ddfa3114699f260af8ae4fd9632a998263f795e
4
- data.tar.gz: 4a11f6cbd5cffbc91a2b40a5b7fb6c82d608301d16ebba1d8b2155a256101f48
3
+ metadata.gz: b58ee14de8c573012698a15d145941155e6c282249bc2938bf4938c4e677d7cd
4
+ data.tar.gz: 34bed5a73b2186b9e229a121973ad11891037d604faa0134fe31d5a9380ead6a
5
5
  SHA512:
6
- metadata.gz: 31259a7b7305b519f610e68dbbb7649fee65257415aae4a0bfe1a77bdd88f62662279a4689bb18872d37eba4d8c0b6537ddf5f1a1c415762085e507fb39d05ae
7
- data.tar.gz: 2c6bc24efc4696496c8a0c58c697af93377bc7c6d216141138ce8d18f3606104e7a945c715d3657ebc97ede3f97db586da3a6fe57c01f826eb86c61f024f91b7
6
+ metadata.gz: f1a8e4032492f97b2672078c908f37599f3d32a01bf31d7a67911732b90f682410123fb1234e07315b9ccd6d4e675e4b9d4867e06f265c06ace44f33c7d1cb1f
7
+ data.tar.gz: 22f2d3fb9b3ed8a8bb9e2e8f6f29393f65e2ab6bea033c9f0f82741775032098383614f280433f64fcd16dbd6ab6c4c46115b197307c684a9c03ffc736b95714
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.rubygems_version = "2.2"
33
33
  s.required_ruby_version = ">=2.6.5"
34
34
  s.name = "lazylead"
35
- s.version = "0.5.0"
35
+ s.version = "0.5.1"
36
36
  s.license = "MIT"
37
37
  s.summary = "Eliminate the annoying work within bug-trackers."
38
38
  s.description = "Ticketing systems (Github, Jira, etc.) are strongly
@@ -45,7 +45,7 @@ tasks instead of solving technical problems."
45
45
  s.authors = ["Yurii Dubinka"]
46
46
  s.email = "yurii.dubinka@gmail.com"
47
47
  s.homepage = "http://github.com/dgroup/lazylead"
48
- s.post_install_message = "Thanks for installing Lazylead v0.5.0!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.5.1!
49
49
  Read our blog posts: https://lazylead.org
50
50
  Stay in touch with the community in Telegram: https://t.me/lazylead
51
51
  Follow us on Twitter: https://twitter.com/lazylead
@@ -63,8 +63,7 @@ module Lazylead
63
63
  add_attachments(msg, opts)
64
64
  cli.send_message msg
65
65
  close_attachments msg
66
- @log.debug "Email was generated from #{opts} and send by #{__FILE__}. " \
67
- "Here is the body: '#{msg[:body]}'"
66
+ @log.debug "#{__FILE__} sent email based on #{opts}."
68
67
  end
69
68
 
70
69
  def make_msg(to, opts)
@@ -65,8 +65,7 @@ module Lazylead
65
65
  end
66
66
  add_attachments mail, opts
67
67
  mail.deliver
68
- @log.debug "Email was generated from #{opts} and send by #{__FILE__}. " \
69
- "Here is the body: #{html}"
68
+ @log.debug "#{__FILE__} sent email based on #{opts}."
70
69
  end
71
70
 
72
71
  def add_attachments(mail, opts)
@@ -236,10 +236,14 @@ module Lazylead
236
236
  end
237
237
 
238
238
  def add_label(label, *more)
239
- labels = @issue.labels
240
- labels << label
241
- labels += more if more.size.positive?
242
- save!("fields" => { "labels" => labels.uniq })
239
+ lbl = labels
240
+ lbl << label
241
+ lbl += more if more.size.positive?
242
+ save!("fields" => { "labels" => lbl.uniq })
243
+ end
244
+
245
+ def labels
246
+ fields["labels"]
243
247
  end
244
248
 
245
249
  def save!(opts)
@@ -81,7 +81,7 @@ module Lazylead
81
81
  def post
82
82
  return if @opts.key? "silent"
83
83
  @issue.post comment
84
- @issue.add_label "LL.accuracy", "#{(@accuracy / 10) * 10}%"
84
+ @issue.add_label "LL.accuracy", grade(@accuracy)
85
85
  end
86
86
 
87
87
  # The jira comment in markdown format
@@ -132,5 +132,14 @@ module Lazylead
132
132
  .sort_by { |e| e[0] }
133
133
  end
134
134
  end
135
+
136
+ # Calculate grade for accuracy
137
+ # For example,
138
+ # grade(7.5) => 0
139
+ # grade(12) => 10
140
+ # grade(25.5) => 20
141
+ def grade(value)
142
+ (value / 10).floor * 10
143
+ end
135
144
  end
136
145
  end
@@ -55,7 +55,7 @@ module Lazylead
55
55
  # Detect index of line with test case
56
56
  def detect_tc(line, index)
57
57
  return unless @tc.negative?
58
- @tc = index if %w[testcase: tc: teststeps: teststeps].any? do |e|
58
+ @tc = index if %w[testcase: tc: teststeps: teststeps steps:].any? do |e|
59
59
  e.eql? line
60
60
  end
61
61
  end
@@ -23,5 +23,5 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  module Lazylead
26
- VERSION = "0.5.0"
26
+ VERSION = "0.5.1"
27
27
  end
@@ -92,8 +92,8 @@
92
92
  <% details = line.split("|").map(&:strip).reject(&:blank?) %>
93
93
  <p style="background: gainsboro;">
94
94
  <a href="<%= commit_url %><%= details[0][1 .. -1] %>"><%= details[0] %></a>
95
- by<a href="<%= user %><%= details[1] %>"><%= details[1] %></a>
96
- at<span style="color: #275a90;"><%= details[2] %></span>
95
+ by <a href="<%= user %><%= details[1] %>"><%= details[1] %></a>
96
+ at <span style="color: #275a90;"><%= details[2] %></span>
97
97
  </p>
98
98
  <% else %>
99
99
  <% if line.start_with?("+++") || line.start_with?("---") %>
@@ -178,5 +178,13 @@ module Lazylead
178
178
  .first["absent field"]
179
179
  .blank?
180
180
  end
181
+
182
+ test "labels found" do
183
+ assert_includes NoAuthJira.new("https://jira.spring.io")
184
+ .issues("key=XD-3766")
185
+ .first
186
+ .labels,
187
+ "Spring"
188
+ end
181
189
  end
182
190
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2020 Yurii Dubinka
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"),
9
+ # to deal in the Software without restriction, including without limitation
10
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ # and/or sell copies of the Software, and to permit persons to whom
12
+ # the Software is furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included
15
+ # in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
+ # OR OTHER DEALINGS IN THE SOFTWARE.
24
+
25
+ require_relative "../../../test"
26
+ require_relative "../../../../lib/lazylead/task/accuracy/accuracy"
27
+
28
+ module Lazylead
29
+ class ScoreTest < Lazylead::Test
30
+ test "grade is detected" do
31
+ {
32
+ "7": "0",
33
+ "5.5": "0",
34
+ "12": "10",
35
+ "21.5": "20",
36
+ "25.5": "20",
37
+ "57": "50",
38
+ "98": "90",
39
+ "100": "100"
40
+ }.each do |k, v|
41
+ assert_equal v.to_f,
42
+ Lazylead::Score.new({}, {}, {}).grade(k.to_s.to_f)
43
+ end
44
+ end
45
+ end
46
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazylead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yurii Dubinka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-05 00:00:00.000000000 Z
11
+ date: 2020-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -651,6 +651,7 @@ files:
651
651
  - test/lazylead/task/accuracy/environment_test.rb
652
652
  - test/lazylead/task/accuracy/logs_test.rb
653
653
  - test/lazylead/task/accuracy/records_test.rb
654
+ - test/lazylead/task/accuracy/score_test.rb
654
655
  - test/lazylead/task/accuracy/servers_test.rb
655
656
  - test/lazylead/task/accuracy/stacktrace_test.rb
656
657
  - test/lazylead/task/accuracy/testcase_test.rb
@@ -674,7 +675,7 @@ licenses:
674
675
  - MIT
675
676
  metadata: {}
676
677
  post_install_message: |-
677
- Thanks for installing Lazylead v0.5.0!
678
+ Thanks for installing Lazylead v0.5.1!
678
679
  Read our blog posts: https://lazylead.org
679
680
  Stay in touch with the community in Telegram: https://t.me/lazylead
680
681
  Follow us on Twitter: https://twitter.com/lazylead
@@ -717,6 +718,7 @@ test_files:
717
718
  - test/lazylead/task/accuracy/environment_test.rb
718
719
  - test/lazylead/task/accuracy/logs_test.rb
719
720
  - test/lazylead/task/accuracy/records_test.rb
721
+ - test/lazylead/task/accuracy/score_test.rb
720
722
  - test/lazylead/task/accuracy/servers_test.rb
721
723
  - test/lazylead/task/accuracy/stacktrace_test.rb
722
724
  - test/lazylead/task/accuracy/testcase_test.rb