lazylead 0.11.0 → 0.11.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: 25f9021629329ee9ec02db8d6d8d51a0daaffcfccdc6e63627e12644f5775aab
4
- data.tar.gz: 5560dc06b0b2c67ce56ff918ebe3eeb1b28d0bf22457c3c539f0229cf7db8690
3
+ metadata.gz: 333915b333e6a6ed286d3ee7e5b984b30ec77745195d0a522b38453c8946bddd
4
+ data.tar.gz: 3ad06509a4714b6317a0f013f61a74e3c3de05b58c424de6faf435fe877c7079
5
5
  SHA512:
6
- metadata.gz: 1240d3399f5d17087f3e844dbebe1c838f152dac9ac11635dcb4697ba5ec9c391b69dc7ccf140966e8a83fa95f12607bb46e32f50b768187335f1c43ed9b1aed
7
- data.tar.gz: 92da12e36cba95581298efc6a3899af2f24e61d0be558b40e919fa8a5a98f871dbb565c5f1e8b7d1ad5cc53768deec7e5cc0edec94a1510cc4663e8c0abf53b8
6
+ metadata.gz: db6709844e1f8175a32fadef567cc661d469ce2fd6fbd69050726bb9d0368e41133765b730c4efb5da353c074db2d9a875e51dfffa3e408b65279a13e7f33b33
7
+ data.tar.gz: 2189335ff6852e008d489d582653de84653413396283e92724e7ae2c058549dc8a7d0d11d13f431020ec62517179bcab758b05571aa5067a614f64a4f86116d2
data/lazylead.gemspec CHANGED
@@ -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.11.0"
35
+ s.version = "0.11.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.11.0!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.11.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
@@ -98,5 +98,5 @@ tasks instead of solving technical problems."
98
98
  s.add_development_dependency "rubocop-rspec", "2.4.0"
99
99
  s.add_development_dependency "sqlint", "0.2.0"
100
100
  s.add_development_dependency "tempfile", "0.1.1"
101
- s.add_development_dependency "xcop", "0.6.2"
101
+ s.add_development_dependency "xcop", "0.6.3"
102
102
  end
data/lib/lazylead/opts.rb CHANGED
@@ -64,7 +64,8 @@ module Lazylead
64
64
  def jira_defaults
65
65
  {
66
66
  max_results: fetch("max_results", 50),
67
- fields: jira_fields
67
+ fields: jira_fields,
68
+ limit: to_h["limit"]
68
69
  }
69
70
  end
70
71
 
@@ -64,11 +64,11 @@ module Lazylead
64
64
  total = jira.Issue.jql(jql, max_results: 0)
65
65
  @log.debug "Found #{total} ticket(s) in '#{jql}'"
66
66
  loop do
67
- tickets.concat(jira.Issue.jql(jql, opts.merge(start_at: start))
67
+ tickets.concat(jira.Issue.jql(jql, range(start, opts))
68
68
  .map { |i| Lazylead::Issue.new(i, jira) })
69
69
  @log.debug "Fetched #{tickets.size}"
70
- start += opts.find(:max_results, 50)
71
- break if (start > total) || (start >= opts.find(:limit, total))
70
+ start += opts.find(:max_results, 50).to_i
71
+ break if (start > total) || (start >= opts.find(:limit, total).to_i)
72
72
  end
73
73
  tickets
74
74
  end
@@ -83,6 +83,26 @@ module Lazylead
83
83
 
84
84
  private
85
85
 
86
+ # Detect tickets range in remote search result.
87
+ #
88
+ # In jira you may navigate through the search result using following parameters:
89
+ # https://docs.atlassian.com/jira-software/REST/7.3.1/#agile/1.0/epic-getIssuesForEpic
90
+ # :start_at
91
+ # The starting index of the returned issues. Base index: 0. See the 'Pagination' section at
92
+ # the top of this page for more details.
93
+ # :max_results
94
+ # The maximum number of issues to return per page. Default: 50. See the 'Pagination' section
95
+ # at the top of this page for more details. Note, the total number of issues returned is
96
+ # limited by the property 'jira.search.views.default.max' in your JIRA instance. If you
97
+ # exceed this limit, your results will be truncated.
98
+ def range(start, opts)
99
+ limit = opts.find(:limit, 0).to_i
100
+ max_results = opts.find(:max_results, 50).to_i
101
+ opts[:start_at] = start
102
+ opts[:max_results] = [limit, max_results].min if limit.positive?
103
+ opts
104
+ end
105
+
86
106
  def client
87
107
  return @client if defined? @client
88
108
  @opts[:auth_type] = :basic if @opts[:auth_type].nil?
@@ -51,6 +51,7 @@ module Lazylead
51
51
  .each(&:evaluate)
52
52
  .each(&:post)
53
53
  postman.send(opts) unless opts[:tickets].empty?
54
+ opts
54
55
  end
55
56
 
56
57
  # Initialize accuracy rules and configuration for tickets verification.
@@ -23,5 +23,5 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  module Lazylead
26
- VERSION = "0.11.0"
26
+ VERSION = "0.11.1"
27
27
  end
@@ -74,5 +74,28 @@ module Lazylead
74
74
  assert_kind_of Lazylead::Task::Accuracy,
75
75
  ORM::Task.find(195).action.constantize.new
76
76
  end
77
+
78
+ test "one ticket found" do
79
+ Lazylead::Smtp.new.enable
80
+ assert_equal 1,
81
+ Task::Accuracy.new.run(
82
+ NoAuthJira.new("https://jira.spring.io"),
83
+ Postman.new,
84
+ Opts.new(
85
+ "from" => "ll@fake.com",
86
+ "to" => "lead@fake.com",
87
+ "rules" => "Lazylead::AffectedBuild",
88
+ "silent" => "true",
89
+ "colors" => {
90
+ "0" => "#FF4F33",
91
+ "57" => "#19DD1E"
92
+ }.to_json.to_s,
93
+ "jql" => "key > DATAJDBC-490",
94
+ "limit" => "1",
95
+ "subject" => "[LL] Raised tickets",
96
+ "template" => "lib/messages/accuracy.erb"
97
+ )
98
+ )[:tickets].size
99
+ end
77
100
  end
78
101
  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.11.0
4
+ version: 0.11.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: 2021-09-12 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -618,14 +618,14 @@ dependencies:
618
618
  requirements:
619
619
  - - '='
620
620
  - !ruby/object:Gem::Version
621
- version: 0.6.2
621
+ version: 0.6.3
622
622
  type: :development
623
623
  prerelease: false
624
624
  version_requirements: !ruby/object:Gem::Requirement
625
625
  requirements:
626
626
  - - '='
627
627
  - !ruby/object:Gem::Version
628
- version: 0.6.2
628
+ version: 0.6.3
629
629
  description: |-
630
630
  Ticketing systems (Github, Jira, etc.) are strongly
631
631
  integrated into our processes and everyone understands their necessity. As soon
@@ -815,7 +815,7 @@ licenses:
815
815
  - MIT
816
816
  metadata: {}
817
817
  post_install_message: |-
818
- Thanks for installing Lazylead v0.11.0!
818
+ Thanks for installing Lazylead v0.11.1!
819
819
  Read our blog posts: https://lazylead.org
820
820
  Stay in touch with the community in Telegram: https://t.me/lazylead
821
821
  Follow us on Twitter: https://twitter.com/lazylead