lazylead 0.1.2 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3406ba1a6961d5be8547e8c8b9791bfacdeac1fd8f886964469baf4508a5129
4
- data.tar.gz: c3401bf20c25f5496a3a2f99ddac4dd64cef7a7249e2ad488cd32d67d0d021b1
3
+ metadata.gz: dc28e9d71a966a27880ceac0418cf722b6994e57e60301dc53808cb6bb57e3f2
4
+ data.tar.gz: 48724243edda1c24e01e75ea50a63a0775869493696f116485125a90097c7877
5
5
  SHA512:
6
- metadata.gz: 5c1c52b3ac90af6227419af7599ef576eafaade4f1d9cbdace293d1a7c9f6f17bce5e09f6ffafcfae4dc3ab12cc819d9106060c271e49248bf1eeb2687123a34
7
- data.tar.gz: b13c9f451e782e248096f0bbfc65882e61eb6118fcf87a34309be4bcba9d25cf55eec177f04605047c898fb6161629ca35b387af208d9675371bb4fb502d4555
6
+ metadata.gz: 1748fbb1289cefc4f893d4353544bc635f8942a9df33a0375f57ea14bafa135197ff328e9af4ae7d38fe7fcbc8a9cec6398c10aebd5a1a96a65f6047742ca0f7
7
+ data.tar.gz: 9646375b7bcfc1ae3e61ee6075c8eb26055953a423ab6b9c9ccd04311c672dcbcd4310cf9bd7b1a0b06bbdb57c8a186ac7352cdba894972204bb64cee3a7fdac
@@ -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.1.2"
35
+ s.version = "0.2.0"
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.1.2!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.2.0!
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
@@ -92,13 +92,19 @@ module Lazylead
92
92
  log.debug("Task ##{id} '#{name}' is started")
93
93
  action.constantize
94
94
  .new(log)
95
- .run(system.connect(log), postman(log), props)
95
+ .run(system.connect(log), postman(log), props(log))
96
96
  log.debug("Task ##{id} '#{name}' is completed")
97
97
  end
98
98
 
99
- def props
100
- return @prop if defined? @prop
101
- @prop = team.to_hash.merge(to_hash)
99
+ def props(log = Log::NOTHING)
100
+ @props ||= begin
101
+ if team.nil?
102
+ log.warn("Team for task #{id} isn't defined.")
103
+ to_hash
104
+ else
105
+ team.to_hash.merge(to_hash)
106
+ end
107
+ end
102
108
  end
103
109
 
104
110
  def postman(log = Log::NOTHING)
@@ -193,6 +193,10 @@ module Lazylead
193
193
  def inspect
194
194
  to_s
195
195
  end
196
+
197
+ def status
198
+ @issue.status.attrs["name"]
199
+ end
196
200
  end
197
201
 
198
202
  # The jira issue comments
@@ -23,5 +23,5 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  module Lazylead
26
- VERSION = "0.1.2"
26
+ VERSION = "0.2.0"
27
27
  end
data/readme.md CHANGED
@@ -26,7 +26,7 @@ The idea of automatic management is not new, for example [Zerocracy](https://www
26
26
  I like this idea, but large companies/projects are not ready yet for such a decisive breakthrough and need step-by-step solutions such as [lazylead](https://github.com/dgroup/lazylead).
27
27
  I think you remember how [static code analysis](https://en.wikipedia.org/wiki/Static_program_analysis) treated at in the past; today we have a huge toolkit (pmd, checkstyle, qulice, rubocop, peon, etc) for each language that allows you to avoid routine issues and remove from the code reviewer the unnecessary load.
28
28
 
29
- Join our [telegram group](https://t.me/lazyleads) for discussions.
29
+ Join our telegram group [lazylead.org](https://t.me/lazyleads) for discussions.
30
30
 
31
31
  | Daily annoying task | Jira | Github | Trello |
32
32
  | :--------------------------------------------------------------------- | :---: | :----: | :----: |
@@ -127,7 +127,7 @@ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
127
127
  Modify you [sqlite](https://sqlite.com/index.html) file(`ll.db`) using [DB Browser](https://sqlitebrowser.org/) or any similar tool.
128
128
  Please change the `<youremail.com>` to your email address in order to be in CC when developer get the notification:
129
129
  ```sql
130
- insert into teams (id, name, properties)
130
+ insert into teams (id, name, properties)
131
131
  values (1, 'Dream team with lazylead', '{}');
132
132
  insert into systems(id, properties)
133
133
  values (1,'{"type":"Lazylead::Jira", "username":"${jira_user}", "password":"${jira_password}", "site":"${jira_url}", "context_path":""}');
@@ -106,5 +106,13 @@ module Lazylead
106
106
  .first
107
107
  .history[2]["id"]
108
108
  end
109
+
110
+ test "issue has expected status" do
111
+ assert_equal "Closed",
112
+ NoAuthJira.new("https://jira.spring.io")
113
+ .issues("key='DATAJDBC-480'")
114
+ .first
115
+ .status
116
+ end
109
117
  end
110
118
  end
@@ -0,0 +1,47 @@
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/log"
27
+ require_relative "../../../lib/lazylead/smtp"
28
+ require_relative "../../../lib/lazylead/postman"
29
+ require_relative "../../../lib/lazylead/schedule"
30
+ require_relative "../../../lib/lazylead/model"
31
+ require_relative "../../../lib/lazylead/cli/app"
32
+ require_relative "../../../lib/lazylead/system/jira"
33
+ require_relative "../../../lib/lazylead/task/alert"
34
+
35
+ module Lazylead
36
+ class AssigneeAlertTest < Lazylead::Test
37
+ test "issue #154: undefined method to_hash for nil object" do
38
+ CLI::App.new(Log::NOTHING, NoSchedule.new).run(
39
+ home: ".",
40
+ sqlite: "test/resources/#{no_ext(__FILE__)}.#{__method__}.db",
41
+ vcs4sql: "upgrades/sqlite",
42
+ testdata: true
43
+ )
44
+ assert_equal "lead@fake.com", ORM::Task.find(154).props["cc"]
45
+ end
46
+ end
47
+ end
@@ -80,10 +80,8 @@ module Lazylead
80
80
  "subject" => "[DD] HMCHT!",
81
81
  "template" => "lib/messages/due_date_expired.erb"
82
82
  )
83
- assert_words %w[STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView],
84
- Mail::TestMailer.deliveries
85
- .filter { |m| m.subject.eql? "[DD] HMCHT!" }
86
- .first.body.parts.first.body
83
+ assert_email "[DD] HMCHT!",
84
+ %w[STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
87
85
  end
88
86
 
89
87
  test "send notification about bunch of tickets" do
@@ -98,10 +96,8 @@ module Lazylead
98
96
  "to" => "big.boss@example.com",
99
97
  "addressee" => "Boss"
100
98
  )
101
- assert_words %w[Hi Boss STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView],
102
- Mail::TestMailer.deliveries
103
- .filter { |m| m.subject.eql? "ALRT: Frozen" }
104
- .first.body.parts.first.body
99
+ assert_email "ALRT: Frozen",
100
+ %w[Hi Boss STS-3599 2013-11-08 Major Miles\ Parker Use JavaFX WebView]
105
101
  end
106
102
 
107
103
  test "cc got notification" do
@@ -43,10 +43,8 @@ module Lazylead
43
43
  "subject" => "FixVersion: How dare you?",
44
44
  "template" => "lib/messages/illegal_fixversion_change.erb"
45
45
  )
46
- assert_words %w[DATAJDBC-480 01-Apr-2020 Minor Mark\ Paluch tom,mike,bob EntityInstantiators],
47
- Mail::TestMailer.deliveries
48
- .filter { |m| m.subject.eql? "FixVersion: How dare you?" }
49
- .first.body.parts.first.body
46
+ assert_email "FixVersion: How dare you?",
47
+ %w[DATAJDBC-480 01-Apr-2020 Minor Mark\ Paluch tom,mike,bob EntityInstantiators]
50
48
  end
51
49
  end
52
50
  end
@@ -47,10 +47,8 @@ module Lazylead
47
47
  "template" => "lib/messages/missing_comment.erb",
48
48
  "template_details" => "reference to <a href='file://ftp/path'>ftp</a>"
49
49
  )
50
- assert_words %w[DATAJDBC-523 Major Mark\ Paluch https://github.com/spring-projects/spring-data-jdbc/commit/aadbb667ed1d61139d5ac51a06eb3dd1b39316db#diff-510a5041bb8a0575e97fedf105606b83R130],
51
- Mail::TestMailer.deliveries
52
- .filter { |m| m.subject.eql? "Expected ftp link is missing" }
53
- .first.body.parts.first.body
50
+ assert_email "Expected ftp link is missing",
51
+ %w[DATAJDBC-523 Major Mark\ Paluch https://github.com/spring-projects/spring-data-jdbc/commit/aadbb667ed1d61139d5ac51a06eb3dd1b39316db#diff-510a5041bb8a0575e97fedf105606b83R130]
54
52
  end
55
53
  end
56
54
  end
@@ -37,6 +37,7 @@ require "minitest/reporters"
37
37
  require "concurrent"
38
38
  require "timeout"
39
39
  require "active_support"
40
+ require "mail"
40
41
 
41
42
  STDOUT.sync = true
42
43
  Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
@@ -99,5 +100,15 @@ module Lazylead
99
100
  !ENV[keys].blank?
100
101
  end
101
102
  end
103
+
104
+ # Assert that email sent using 'mail' gem in test mode
105
+ # has expected subject and words
106
+ def assert_email(subject, words)
107
+ assert_words words,
108
+ Mail::TestMailer.deliveries
109
+ .filter { |m| m.subject.eql? subject }
110
+ .first
111
+ .body.parts.first.body.raw_source
112
+ end
102
113
  end
103
114
  end
@@ -27,7 +27,8 @@ values (1,
27
27
  (2,
28
28
  '{"type":"Lazylead::Jira", "username":"${jsi_usr}", "password":"${jsi_psw}", "site":"https://jira.spring.io", "context_path":""}');
29
29
  insert into teams(id, name, properties)
30
- values (1, 'BA squad', '{"from":"basquad@fake.com", "usr":"${usr}"}');
30
+ values (1, 'BA squad', '{"from":"basquad@fake.com", "usr":"${usr}"}'),
31
+ (154, 'Team for issue #154', '{"cc":"lead@fake.com"}');
31
32
  insert into tasks(name, cron, enabled, id, system, team_id, action, properties)
32
33
  values ('echo', '* * * * *', 'false', 1, 1, 1, 'Lazylead::Task::Echo', '{}'),
33
34
  ('expired due date', '* * * * *', 'false', 2, 1, 1,
@@ -36,4 +37,5 @@ values ('echo', '* * * * *', 'false', 1, 1, 1, 'Lazylead::Task::Echo', '{}'),
36
37
  ('task with cc', '* * * * *', 'false', 3, 1, 1, 'Lazylead::Task::Echo',
37
38
  '{"cc":"leelakenny@mail.com,maciecrane@mail.com"}'),
38
39
  ('task', '* * * * *', 'false', 4, 2, 1, 'Lazylead::Task::Echo', '{}'),
39
- ('pman', '', '', 5, 2, 1, '', '{"postman":"Lazylead::Postman"}');
40
+ ('pman', '', '', 5, 2, 1, '', '{"postman":"Lazylead::Postman"}'),
41
+ ('issue 154', '* * * * *', 'false', 154, 1, 154, 'Lazylead::Task::AssigneeAlert', '{}');
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.1.2
4
+ version: 0.2.0
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-06-15 00:00:00.000000000 Z
11
+ date: 2020-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -769,6 +769,7 @@ files:
769
769
  - test/lazylead/smoke_test.rb
770
770
  - test/lazylead/smtp_test.rb
771
771
  - test/lazylead/system/jira_test.rb
772
+ - test/lazylead/task/assignee_alert_test.rb
772
773
  - test/lazylead/task/confluence_ref_test.rb
773
774
  - test/lazylead/task/duedate_test.rb
774
775
  - test/lazylead/task/echo_test.rb
@@ -785,7 +786,7 @@ licenses:
785
786
  - MIT
786
787
  metadata: {}
787
788
  post_install_message: |-
788
- Thanks for installing Lazylead v0.1.2!
789
+ Thanks for installing Lazylead v0.2.0!
789
790
  Read our blog posts: https://lazylead.org
790
791
  Stay in touch with the community in Telegram: https://t.me/lazylead
791
792
  Follow us on Twitter: https://twitter.com/lazylead
@@ -819,6 +820,7 @@ test_files:
819
820
  - test/lazylead/smoke_test.rb
820
821
  - test/lazylead/smtp_test.rb
821
822
  - test/lazylead/system/jira_test.rb
823
+ - test/lazylead/task/assignee_alert_test.rb
822
824
  - test/lazylead/task/confluence_ref_test.rb
823
825
  - test/lazylead/task/duedate_test.rb
824
826
  - test/lazylead/task/echo_test.rb