lazylead 0.11.4 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc491194d58199a3949bbf63fb5dc6ea8a303dede1c5b646410fad4335e3363d
4
- data.tar.gz: a451b8e278fa971abb3bd7453ab1d907d94a803a3fa3e42aca87dc7ab24687e0
3
+ metadata.gz: 43563f79f164a2094eda0d74d373eaa3e90d564b1d653e49adb8c1c588d049d8
4
+ data.tar.gz: 3d7491056be166fed7667721827723dce02ddc7d529a4ac08c690d871e2df8d0
5
5
  SHA512:
6
- metadata.gz: 94c13ca434970b74119f1a8490110167e72cd384350f84fed34165af17062327ce0259696aa6b5f3e38a232595d169865f7f9231b995f430eaae319c0f3c15c1
7
- data.tar.gz: bfb59ad495bf98f793400b0347951850cf556dfb055460bd6ec01e02947c6834c752343ada126f18f6c30dbe524ac51c004164082c455ad18f2add1f2e6d02ae
6
+ metadata.gz: a2417a507a95b490d518c875635588c7eaedde588dd7c62c359f445d227afadae0625f52e05f998db69d45aa8c92f33910337f278b01ef42ea1904110ed01b7f
7
+ data.tar.gz: a8bb2a796784644fffdde7de78fe3726a4a718f0f769a19d030316f0dcaa6b57fbb6ff32e0e19a98d833a85dc246afadb1170a6c4c392761e0ada75918780c21
data/.circleci/config.yml CHANGED
@@ -11,6 +11,7 @@ jobs:
11
11
  - run: |
12
12
  apk add libc-dev gcc make git sqlite sqlite-dev sqlite-libs
13
13
  bundler install
14
+ - run: rubocop -A
14
15
  - run: bundle exec rake test rubocop sqlint xcop
15
16
  deploy:
16
17
  machine: true
@@ -0,0 +1,35 @@
1
+ insert into teams (id, name, properties)
2
+ values (1, 'Dream team with lazylead', '{}');
3
+ insert into systems(id, properties)
4
+ values (1, '{"type":"Lazylead::Jira", "site":"${jira_url}", "context_path":""}');
5
+ insert into tasks (name, schedule, enabled, id, system, team_id, action, properties)
6
+ values ('Expired due dates',
7
+ 'cron:* * * * *',
8
+ 'true',
9
+ 1, 1, 1,
10
+ 'Lazylead::Task::AssigneeAlert',
11
+ '{
12
+ "sql": "resolution = unresolved and due < startOfDay()",
13
+ "cc": "their@lead.com",
14
+ "subject": "[LL] Expired due dates",
15
+ "template": "lib/messages/due_date_expired.erb",
16
+ "postman": "Lazylead::FilePostman"
17
+ }');
18
+ insert into tasks (name, schedule, enabled, id, system, team_id, action, properties)
19
+ values ('Reporter''s ticket score in Spring Data MongoDB',
20
+ 'cron:* * * * *',
21
+ 'true',
22
+ 2, 1, 1,
23
+ 'Lazylead::Task::Accuracy',
24
+ '{
25
+ "from": "ll@fake.com",
26
+ "to": "lead@fake.com",
27
+ "rules": "Lazylead::Stacktrace,Lazylead::Testcase",
28
+ "fields": "attachment,description,environment,components,versions,reporter,labels,priority,duedate,summary",
29
+ "colors": "{\"0\":\"#FF4F33\",\"30\":\"#FEC15E\",\"50\":\"#19DD1E\"}",
30
+ "jql": "type=Bug and project =''Spring Data MongoDB'' and key >= DATAMONGO-1530 and key <= DATAMONGO-1600",
31
+ "silent": "true",
32
+ "subject": "[LL] Reporter''s ticket score in Spring Data MongoDB",
33
+ "template": "lib/messages/accuracy.erb",
34
+ "postman":"Lazylead::FilePostman"
35
+ }');
data/.rubocop.yml CHANGED
@@ -89,6 +89,9 @@ Style/FormatStringToken:
89
89
  - "lib/lazylead/task/accuracy/accuracy.rb"
90
90
  Style/IfWithBooleanLiteralBranches: # (new in 1.9)
91
91
  Enabled: true
92
+ # @todo #/DEV Enable Style/OpenStructUse rule, for now its disabled due to rubocop upgrade
93
+ Style/OpenStructUse:
94
+ Enabled: false
92
95
  Lint/RaiseException:
93
96
  Enabled: true
94
97
  Lint/StructNewOverride:
@@ -208,4 +211,6 @@ Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
208
211
  Performance/RedundantSplitRegexpArgument: # (new in 1.10)
209
212
  Enabled: true
210
213
  Gemspec/DateAssignment: # (new in 1.10)
211
- Enabled: true
214
+ Enabled: true
215
+ Gemspec/RequireMFA:
216
+ Enabled: false
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.4"
35
+ s.version = "0.12.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.11.4!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.12.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
@@ -58,11 +58,11 @@ tasks instead of solving technical problems."
58
58
  s.add_runtime_dependency "activerecord", "6.1.3"
59
59
  s.add_runtime_dependency "backtrace", "0.3"
60
60
  s.add_runtime_dependency "colorize", "0.8.1"
61
- s.add_runtime_dependency "faraday", "1.8.0"
61
+ s.add_runtime_dependency "faraday", "2.1.0"
62
62
  s.add_runtime_dependency "get_process_mem", "0.2.7"
63
63
  s.add_runtime_dependency "inifile", "3.0.0"
64
- s.add_runtime_dependency "jira-ruby", "2.1.5"
65
- s.add_runtime_dependency "json", "2.5.1"
64
+ s.add_runtime_dependency "jira-ruby", "2.2.0"
65
+ s.add_runtime_dependency "json", "2.6.1"
66
66
  s.add_runtime_dependency "logging", "2.3.0"
67
67
  s.add_runtime_dependency "mail", "2.7.1"
68
68
  s.add_runtime_dependency "memory_profiler", "1.0.0"
@@ -71,34 +71,35 @@ tasks instead of solving technical problems."
71
71
  s.add_runtime_dependency "railties", "6.1.3"
72
72
  s.add_runtime_dependency "require_all", "3.0.0"
73
73
  s.add_runtime_dependency "rubyzip", "2.3.2"
74
- s.add_runtime_dependency "rufus-scheduler", "3.8.0"
74
+ s.add_runtime_dependency "rufus-scheduler", "3.8.1"
75
75
  s.add_runtime_dependency "slop", "4.9.1"
76
76
  s.add_runtime_dependency "sqlite3", "1.4.2"
77
- s.add_runtime_dependency "tempfile", "0.1.1"
77
+ s.add_runtime_dependency "tempfile", "0.1.2"
78
78
  s.add_runtime_dependency "tilt", "2.0.10"
79
79
  s.add_runtime_dependency "tzinfo", "2.0.4"
80
- s.add_runtime_dependency "tzinfo-data", "1.2021.2"
80
+ s.add_runtime_dependency "tzinfo-data", "1.2021.5"
81
81
  s.add_runtime_dependency "vcs4sql", "0.1.1"
82
82
  s.add_runtime_dependency "viewpoint", "1.1.1"
83
83
  s.add_runtime_dependency "zaru", "0.3.0"
84
84
  s.add_development_dependency "codecov", "0.6.0"
85
85
  s.add_development_dependency "guard", "2.18.0"
86
86
  s.add_development_dependency "guard-minitest", "2.4.6"
87
- s.add_development_dependency "minitest", "5.14.4"
87
+ s.add_development_dependency "minitest", "5.15.0"
88
88
  s.add_development_dependency "minitest-fail-fast", "0.1.0"
89
89
  s.add_development_dependency "minitest-hooks", "1.5.0"
90
- s.add_development_dependency "minitest-reporters", "1.4.3"
90
+ s.add_development_dependency "minitest-reporters", "1.5.0"
91
91
  s.add_development_dependency "net-ping", "2.0.8"
92
92
  s.add_development_dependency "rake", "13.0.6"
93
93
  s.add_development_dependency "random-port", "0.5.1"
94
- s.add_development_dependency "rdoc", "6.3.2"
95
- s.add_development_dependency "rubocop", "1.22.0"
96
- s.add_development_dependency "rubocop-minitest", "0.15.1"
97
- s.add_development_dependency "rubocop-performance", "1.11.5"
94
+ s.add_development_dependency "rdoc", "6.4.0"
95
+ s.add_development_dependency "rubocop", "1.24.1"
96
+ s.add_development_dependency "rubocop-minitest", "0.17.0"
97
+ s.add_development_dependency "rubocop-performance", "1.13.1"
98
98
  s.add_development_dependency "rubocop-rake", "0.6.0"
99
- s.add_development_dependency "rubocop-rspec", "2.5.0"
99
+ s.add_development_dependency "rubocop-rspec", "2.7.0"
100
100
  s.add_development_dependency "ruby-prof", "1.4.3"
101
101
  s.add_development_dependency "sqlint", "0.2.0"
102
- s.add_development_dependency "tempfile", "0.1.1"
102
+ s.add_development_dependency "tempfile", "0.1.2"
103
103
  s.add_development_dependency "xcop", "0.6.3"
104
+ s.metadata = { "rubygems_mfa_required" => "false" }
104
105
  end
@@ -34,8 +34,9 @@ module Lazylead
34
34
  class Confluence
35
35
  def initialize(conf)
36
36
  @conf = conf
37
- @http = Faraday.new(url: @conf.url)
38
- @http.basic_auth(@conf.user, @conf.pass)
37
+ @http = Faraday.new(url: @conf.url) do |conn|
38
+ conn.request :authorization, :basic, @conf.user, @conf.pass
39
+ end
39
40
  end
40
41
 
41
42
  # Confluence instance url like
@@ -217,9 +217,10 @@ module Lazylead
217
217
  retries ||= 0
218
218
  @orig.exec
219
219
  @orig
220
- rescue StandardError
220
+ rescue StandardError => e
221
221
  sleep(props.fetch("attempt_wait", 0).to_f) if props.key? "attempt_wait"
222
222
  retry if (retries += 1) < props.fetch("attempt", 0).to_i
223
+ raise e if props.key? "rethrow"
223
224
  @orig
224
225
  end
225
226
  end
@@ -116,6 +116,7 @@ module Lazylead
116
116
  def send(opts)
117
117
  if opts.msg_to.empty?
118
118
  @log.warn "ll-015: Email can't be sent as 'to' is empty, more: '#{opts}'"
119
+ ""
119
120
  else
120
121
  file = filename(opts)
121
122
  File.open(file, "w") do |f|
@@ -125,15 +126,15 @@ module Lazylead
125
126
  end
126
127
  @log.debug "Mail '#{opts['subject']}' for #{opts.msg_to} sent to " \
127
128
  "'#{file.to_s.colorize(:light_blue)}'"
129
+ file
128
130
  end
129
131
  end
130
132
 
131
133
  # Assemble file name where email to be print
132
134
  def filename(opts)
133
- File.join(
134
- @env.fetch("file_postman_dir", "."),
135
- Zaru.sanitize!("#{Time.now.nsec}-#{opts['subject']}.html")
136
- )
135
+ dir = @env.fetch("file_postman_dir", ".")
136
+ FileUtils.mkdir_p(dir) unless File.exist?(dir)
137
+ File.join(dir, Zaru.sanitize!("#{Time.now.nsec}-#{opts['subject']}.html"))
137
138
  end
138
139
  end
139
140
  end
@@ -47,14 +47,10 @@ module Lazylead
47
47
  raise "ll-002: task can't be a null" if task.nil?
48
48
  @trigger.method(task.type).call(task.unit) do
49
49
  ActiveRecord::Base.connection_pool.with_connection do
50
- if task.props.key? "no_logs"
51
- ORM::Retry.new(task, @log).exec
52
- else
53
- ORM::Retry.new(
54
- ORM::Verbose.new(task, @log),
55
- @log
56
- ).exec
57
- end
50
+ t = task
51
+ t = ORM::Verbose.new(t, @log) unless t.props.key? "no_logs"
52
+ t = ORM::Retry.new(t, @log)
53
+ t.exec
58
54
  end
59
55
  end
60
56
  @log.debug "Task scheduled: #{task}"
@@ -27,9 +27,15 @@ require_relative "attachment"
27
27
  module Lazylead
28
28
  # Check that ticket has video record(s) with reproducing results.
29
29
  class Records < Lazylead::Attachment
30
- def initialize(ext = [])
30
+ # @param ext
31
+ # The list of video records file extensions.
32
+ # @param size
33
+ # The minimum size of video records in bytes.
34
+ # Default value is 5KB.
35
+ def initialize(ext = [], size = 5 * 1024)
31
36
  super("Internal reproducing results (video)", 5, "Attachments")
32
37
  @ext = ext
38
+ @size = size
33
39
  return unless @ext.empty?
34
40
  @ext = %w[.webm .mkv .flv .flv .vob .ogv .ogg .drc .gif .gifv .mng .avi
35
41
  .mts .m2ts .ts .mov .qt .wmv .yuv .rm .rmvb .viv .asf .amv .mp4
@@ -39,6 +45,7 @@ module Lazylead
39
45
 
40
46
  # Ensure that ticket has an attachment with video-file extension
41
47
  def matches?(attach)
48
+ return false if attach.attrs["size"].to_i < @size
42
49
  return true if @ext.any? { |e| e.eql? File.extname(attach.attrs["filename"]).downcase }
43
50
  return false if attach.attrs["mimeType"].nil?
44
51
  @ext.any? { |e| attach.attrs["mimeType"].end_with? "/#{e[1..]}" }
@@ -53,7 +53,7 @@ module Lazylead
53
53
  end
54
54
 
55
55
  def run(_, _, _)
56
- File.open(@path, "w") { |f| f.write Time.now }
56
+ File.write(@path, Time.now)
57
57
  end
58
58
  end
59
59
  end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 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 "forwardable"
26
+
27
+ module Lazylead
28
+ # @todo #533/DEV Git `grep` command is required like Lazylead::SVN::Grep
29
+ #
30
+ # @todo #533/DEV Git `touch` command is required like Lazylead::SVN::Touch
31
+ #
32
+ # @todo #533/DEV Git `diff` command is required like Lazylead::SVN::Diff
33
+ module Git
34
+ #
35
+ # SVN commit built from command-line stdout (OS#run).
36
+ #
37
+ class Commit
38
+ def initialize(raw)
39
+ @raw = raw
40
+ end
41
+
42
+ def to_s
43
+ "#{id} #{msg}"
44
+ end
45
+
46
+ # @todo #/DEV Git Commit#id implementation is required based on `git` ruby gem
47
+ def id; end
48
+
49
+ # @todo #/DEV Git Commit#author implementation is required based on `git` ruby gem
50
+ def author; end
51
+
52
+ # @todo #/DEV Git Commit#time implementation is required based on `git` ruby gem
53
+ def time; end
54
+
55
+ # @todo #/DEV Git Commit#msg implementation is required based on `git` ruby gem
56
+ def msg; end
57
+
58
+ # @todo #/DEV Git Commit#lines implementation is required based on `git` ruby gem
59
+ def lines; end
60
+
61
+ # @todo #/DEV Git Commit#header implementation is required based on `git` ruby gem
62
+ def header; end
63
+
64
+ # The modified lines contains expected text
65
+ # @todo #/DEV Git Commit#includes? implementation is required based on `git` ruby gem
66
+ def includes?(text); end
67
+ end
68
+
69
+ #
70
+ # Git commits built from command-line stdout (OS#run).
71
+ #
72
+ # @todo #/DEV Git Commits implementation is required based on `git` ruby gem
73
+ class Commits
74
+ extend Forwardable
75
+ def_delegators :@all, :each, :map, :select, :empty?
76
+
77
+ def initialize(stdout)
78
+ @stdout = stdout
79
+ end
80
+ end
81
+ end
82
+ end
@@ -38,8 +38,7 @@ module Lazylead
38
38
  def run(sys, postman, opts)
39
39
  assignments = sys.issues(opts["jql"], opts.jira_defaults)
40
40
  .group_by(&:assignee)
41
- .map { |user, tasks| [user.id, Teammate.new(user, tasks)] }
42
- .to_h
41
+ .to_h { |user, tasks| [user.id, Teammate.new(user, tasks)] }
43
42
  opts.slice("team", ",")
44
43
  .map { |m| m.split(":") }
45
44
  .each { |id, name| assignments[id] = Free.new(id, name) unless assignments.key? id }
@@ -87,9 +87,9 @@ module Lazylead
87
87
  # Fill pre-defined fields for sub-tasks from parent ticket
88
88
  # and post comment to ticket with clarification.
89
89
  def propagate
90
- expected = @fields.collect { |f| [f, @issue.fields[f]] }.to_h
90
+ expected = @fields.to_h { |f| [f, @issue.fields[f]] }
91
91
  @subtasks.each do |subtask|
92
- actual = @fields.collect { |f| [f, subtask.fields[f]] }.to_h
92
+ actual = @fields.to_h { |f| [f, subtask.fields[f]] }
93
93
  diff = diff(expected, actual)
94
94
  next if diff.empty?
95
95
  subtask.save(fields: diff)
@@ -23,5 +23,5 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  module Lazylead
26
- VERSION = "0.11.4"
26
+ VERSION = "0.12.0"
27
27
  end
data/readme.md CHANGED
@@ -50,9 +50,9 @@ Join our telegram chat [lazylead](https://t.me/lazyleads) for discussions.
50
50
  | Notify about tickets matches predefined multiple conditions | ✅ | ⌛ | ⌛ | ❌ | ❌ |
51
51
  | Link automatically the ticket and Confluence page if link found in ticket's comments/description | ✅ | ⌛ | ⌛ | ❌ | ❌ |
52
52
  | Notify about tickets assigned to your team members not by effective managers| ✅ | ⌛ | ⌛ | ❌ | ❌ |
53
- | Notify about modifications of important files in VCS | ❌ | ⌛ | ❌ | ✅ | |
54
- | Notify about diff changes for past X period in VCS | ❌ | ⌛ | ❌ | ✅ | |
55
- | Notify about changes with some text for past X period in VCS | ❌ | ⌛ | ❌ | ✅ | |
53
+ | Notify about modifications of important files in VCS | ❌ | ⌛ | ❌ | ✅ | 🚴 |
54
+ | Notify about diff changes for past X period in VCS | ❌ | ⌛ | ❌ | ✅ | 🚴 |
55
+ | Notify about changes with some text for past X period in VCS | ❌ | ⌛ | ❌ | ✅ | 🚴 |
56
56
  | [Notify when someone outside of your team changed the due date on tickets for your team](lib/lazylead/task/micromanager.rb)| ✅ | ⌛ | ❌ | ❌ | ❌ |
57
57
  | [Notify when someone outside of your team assigned a ticket directly to the developer](lib/lazylead/task/assignment.rb)| ✅ | ⌛ | ❌ | ❌ | ❌ |
58
58
 
@@ -64,8 +64,11 @@ Join our telegram chat [lazylead](https://t.me/lazyleads) for discussions.
64
64
  | [mail.google.com](lib/lazylead/postman.rb) | Emails | 🌵 |
65
65
  | calendar.google.com | Calendar | ⌛ |
66
66
  | slack.com | Notifications | ⌛ |
67
+ | GitHub | VCS + CI/CD | ⌛ |
68
+ | GitLab | VCS + CI/CD | ⌛ |
69
+ | BitBucket | VCS + CI/CD | ⌛ |
67
70
 
68
- - implemented, ⌛ - planned, 🌵 - implemented, but not tested, ❌ - not supported/planned.
71
+ 🚴🏽 - in-progress, ⌛ - planned, ✅ - implemented, 🌵 - implemented, but not tested, ❌ - not supported/planned.
69
72
 
70
73
  New ideas, bugs, suggestions or questions are welcome [via GitHub issues](https://github.com/dgroup/lazylead/issues/new)!
71
74
 
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 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/opts"
28
+ require_relative "../../lib/lazylead/salt"
29
+ require_relative "../../lib/lazylead/smtp"
30
+ require_relative "../../lib/lazylead/postman"
31
+
32
+ module Lazylead
33
+ class FilePostmanTest < Lazylead::Test
34
+ test "send email to html file" do
35
+ assert_path_exists FilePostman.new(Log.new, "file_postman_dir" => "test/resources")
36
+ .send(
37
+ Opts.new(
38
+ "to" => "to@email.com",
39
+ "from" => "from@email.com",
40
+ "attachments" => ["readme.md"],
41
+ "subject" => "[LL] FilePostmanTest attachment",
42
+ "template" => "lib/messages/savepoint.erb"
43
+ )
44
+ )
45
+ end
46
+ end
47
+ end
@@ -57,36 +57,4 @@ module Lazylead
57
57
  )
58
58
  end
59
59
  end
60
-
61
- class StdoutPostmanTest < Lazylead::Test
62
- # @todo #495/DEV Find way to capture the STDOUT in order to test the email sending.
63
- # Right now its just visual verification.
64
- test "send email to stdout" do
65
- StdoutPostman.new.send(
66
- Opts.new(
67
- "to" => "to@email.com",
68
- "from" => "from@email.com",
69
- "attachments" => ["readme.md"],
70
- "subject" => "[LL] Attachments",
71
- "template" => "lib/messages/savepoint.erb"
72
- )
73
- )
74
- end
75
- end
76
-
77
- class FilePostmanTest < Lazylead::Test
78
- # @todo #/DEV add new assert method which consume the file name and check existence on the disk
79
- test "send email to html file" do
80
- FilePostman.new(Log.new, "file_postman_dir" => "test/resources")
81
- .send(
82
- Opts.new(
83
- "to" => "to@email.com",
84
- "from" => "from@email.com",
85
- "attachments" => ["readme.md"],
86
- "subject" => "[LL] Attachments",
87
- "template" => "lib/messages/savepoint.erb"
88
- )
89
- )
90
- end
91
- end
92
60
  end
@@ -81,5 +81,16 @@ module Lazylead
81
81
  )
82
82
  ).exec.attempts
83
83
  end
84
+
85
+ test "throw error" do
86
+ assert_raises(RuntimeError, "network issue") do
87
+ ORM::Retry.new(
88
+ FakeTask.new(
89
+ proc { raise "network issue" },
90
+ { "rethrow" => "true" }
91
+ )
92
+ ).exec
93
+ end
94
+ end
84
95
  end
85
96
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The MIT License
4
+ #
5
+ # Copyright (c) 2019-2021 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/opts"
28
+ require_relative "../../lib/lazylead/salt"
29
+ require_relative "../../lib/lazylead/smtp"
30
+ require_relative "../../lib/lazylead/postman"
31
+
32
+ module Lazylead
33
+ class StdoutPostmanTest < Lazylead::Test
34
+ # @todo #495/DEV Find way to capture the STDOUT in order to test the email sending.
35
+ # Right now its just visual verification.
36
+ test "send email to stdout" do
37
+ StdoutPostman.new.send(
38
+ Opts.new(
39
+ "to" => "to@email.com",
40
+ "from" => "from@email.com",
41
+ "attachments" => ["readme.md"],
42
+ "subject" => "[LL] Attachments",
43
+ "template" => "lib/messages/savepoint.erb"
44
+ )
45
+ )
46
+ end
47
+ end
48
+ end
@@ -32,7 +32,10 @@ module Lazylead
32
32
  assert Records.new.passed(
33
33
  OpenStruct.new(
34
34
  attachments: [
35
- OpenStruct.new(attrs: { "filename" => "failed case 1.mp4" })
35
+ OpenStruct.new(attrs: {
36
+ "filename" => "failed case 1.mp4",
37
+ "size" => 6 * 1024
38
+ })
36
39
  ]
37
40
  )
38
41
  )
@@ -42,7 +45,10 @@ module Lazylead
42
45
  assert Records.new.passed(
43
46
  OpenStruct.new(
44
47
  attachments: [
45
- OpenStruct.new(attrs: { "filename" => "failed case 2.avi" })
48
+ OpenStruct.new(attrs: {
49
+ "filename" => "failed case 2.avi",
50
+ "size" => 6 * 1024
51
+ })
46
52
  ]
47
53
  )
48
54
  )
@@ -52,7 +58,10 @@ module Lazylead
52
58
  refute Records.new.passed(
53
59
  OpenStruct.new(
54
60
  attachments: [
55
- OpenStruct.new(attrs: { "filename" => "failed case 2.txt" })
61
+ OpenStruct.new(attrs: {
62
+ "filename" => "failed case 2.txt",
63
+ "size" => 6 * 1024
64
+ })
56
65
  ]
57
66
  )
58
67
  )
@@ -62,25 +71,39 @@ module Lazylead
62
71
  assert Records.new.passed(
63
72
  OpenStruct.new(
64
73
  attachments: [
65
- OpenStruct.new(
66
- attrs: {
67
- "filename" => "snapshot.png",
68
- "mimeType" => "image/gif"
69
- }
70
- )
74
+ OpenStruct.new(attrs: {
75
+ "filename" => "snapshot.png",
76
+ "mimeType" => "image/gif",
77
+ "size" => 6 * 1024
78
+ })
71
79
  ]
72
80
  )
73
81
  )
74
82
  end
75
83
 
76
84
  test "mime type is xlsx" do
85
+ refute Records.new.passed(
86
+ OpenStruct.new(
87
+ attachments: [
88
+ OpenStruct.new(attrs: {
89
+ "filename" => "snapshot.xlsx",
90
+ "mimeType" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
91
+ "size" => 6 * 1024
92
+ })
93
+ ]
94
+ )
95
+ )
96
+ end
97
+
98
+ test "empty gif" do
77
99
  refute Records.new.passed(
78
100
  OpenStruct.new(
79
101
  attachments: [
80
102
  OpenStruct.new(
81
103
  attrs: {
82
- "filename" => "snapshot.xlsx",
83
- "mimeType" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
104
+ "filename" => "steps.gif",
105
+ "mimeType" => "image/gif",
106
+ "size" => "0"
84
107
  }
85
108
  )
86
109
  ]
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.4
4
+ version: 0.12.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: 2021-10-03 00:00:00.000000000 Z
11
+ date: 2022-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.8.0
61
+ version: 2.1.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 1.8.0
68
+ version: 2.1.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: get_process_mem
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,28 +100,28 @@ dependencies:
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 2.1.5
103
+ version: 2.2.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 2.1.5
110
+ version: 2.2.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: json
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 2.5.1
117
+ version: 2.6.1
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 2.5.1
124
+ version: 2.6.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: logging
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - '='
242
242
  - !ruby/object:Gem::Version
243
- version: 3.8.0
243
+ version: 3.8.1
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - '='
249
249
  - !ruby/object:Gem::Version
250
- version: 3.8.0
250
+ version: 3.8.1
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: slop
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -282,14 +282,14 @@ dependencies:
282
282
  requirements:
283
283
  - - '='
284
284
  - !ruby/object:Gem::Version
285
- version: 0.1.1
285
+ version: 0.1.2
286
286
  type: :runtime
287
287
  prerelease: false
288
288
  version_requirements: !ruby/object:Gem::Requirement
289
289
  requirements:
290
290
  - - '='
291
291
  - !ruby/object:Gem::Version
292
- version: 0.1.1
292
+ version: 0.1.2
293
293
  - !ruby/object:Gem::Dependency
294
294
  name: tilt
295
295
  requirement: !ruby/object:Gem::Requirement
@@ -324,14 +324,14 @@ dependencies:
324
324
  requirements:
325
325
  - - '='
326
326
  - !ruby/object:Gem::Version
327
- version: 1.2021.2
327
+ version: 1.2021.5
328
328
  type: :runtime
329
329
  prerelease: false
330
330
  version_requirements: !ruby/object:Gem::Requirement
331
331
  requirements:
332
332
  - - '='
333
333
  - !ruby/object:Gem::Version
334
- version: 1.2021.2
334
+ version: 1.2021.5
335
335
  - !ruby/object:Gem::Dependency
336
336
  name: vcs4sql
337
337
  requirement: !ruby/object:Gem::Requirement
@@ -422,14 +422,14 @@ dependencies:
422
422
  requirements:
423
423
  - - '='
424
424
  - !ruby/object:Gem::Version
425
- version: 5.14.4
425
+ version: 5.15.0
426
426
  type: :development
427
427
  prerelease: false
428
428
  version_requirements: !ruby/object:Gem::Requirement
429
429
  requirements:
430
430
  - - '='
431
431
  - !ruby/object:Gem::Version
432
- version: 5.14.4
432
+ version: 5.15.0
433
433
  - !ruby/object:Gem::Dependency
434
434
  name: minitest-fail-fast
435
435
  requirement: !ruby/object:Gem::Requirement
@@ -464,14 +464,14 @@ dependencies:
464
464
  requirements:
465
465
  - - '='
466
466
  - !ruby/object:Gem::Version
467
- version: 1.4.3
467
+ version: 1.5.0
468
468
  type: :development
469
469
  prerelease: false
470
470
  version_requirements: !ruby/object:Gem::Requirement
471
471
  requirements:
472
472
  - - '='
473
473
  - !ruby/object:Gem::Version
474
- version: 1.4.3
474
+ version: 1.5.0
475
475
  - !ruby/object:Gem::Dependency
476
476
  name: net-ping
477
477
  requirement: !ruby/object:Gem::Requirement
@@ -520,56 +520,56 @@ dependencies:
520
520
  requirements:
521
521
  - - '='
522
522
  - !ruby/object:Gem::Version
523
- version: 6.3.2
523
+ version: 6.4.0
524
524
  type: :development
525
525
  prerelease: false
526
526
  version_requirements: !ruby/object:Gem::Requirement
527
527
  requirements:
528
528
  - - '='
529
529
  - !ruby/object:Gem::Version
530
- version: 6.3.2
530
+ version: 6.4.0
531
531
  - !ruby/object:Gem::Dependency
532
532
  name: rubocop
533
533
  requirement: !ruby/object:Gem::Requirement
534
534
  requirements:
535
535
  - - '='
536
536
  - !ruby/object:Gem::Version
537
- version: 1.22.0
537
+ version: 1.24.1
538
538
  type: :development
539
539
  prerelease: false
540
540
  version_requirements: !ruby/object:Gem::Requirement
541
541
  requirements:
542
542
  - - '='
543
543
  - !ruby/object:Gem::Version
544
- version: 1.22.0
544
+ version: 1.24.1
545
545
  - !ruby/object:Gem::Dependency
546
546
  name: rubocop-minitest
547
547
  requirement: !ruby/object:Gem::Requirement
548
548
  requirements:
549
549
  - - '='
550
550
  - !ruby/object:Gem::Version
551
- version: 0.15.1
551
+ version: 0.17.0
552
552
  type: :development
553
553
  prerelease: false
554
554
  version_requirements: !ruby/object:Gem::Requirement
555
555
  requirements:
556
556
  - - '='
557
557
  - !ruby/object:Gem::Version
558
- version: 0.15.1
558
+ version: 0.17.0
559
559
  - !ruby/object:Gem::Dependency
560
560
  name: rubocop-performance
561
561
  requirement: !ruby/object:Gem::Requirement
562
562
  requirements:
563
563
  - - '='
564
564
  - !ruby/object:Gem::Version
565
- version: 1.11.5
565
+ version: 1.13.1
566
566
  type: :development
567
567
  prerelease: false
568
568
  version_requirements: !ruby/object:Gem::Requirement
569
569
  requirements:
570
570
  - - '='
571
571
  - !ruby/object:Gem::Version
572
- version: 1.11.5
572
+ version: 1.13.1
573
573
  - !ruby/object:Gem::Dependency
574
574
  name: rubocop-rake
575
575
  requirement: !ruby/object:Gem::Requirement
@@ -590,14 +590,14 @@ dependencies:
590
590
  requirements:
591
591
  - - '='
592
592
  - !ruby/object:Gem::Version
593
- version: 2.5.0
593
+ version: 2.7.0
594
594
  type: :development
595
595
  prerelease: false
596
596
  version_requirements: !ruby/object:Gem::Requirement
597
597
  requirements:
598
598
  - - '='
599
599
  - !ruby/object:Gem::Version
600
- version: 2.5.0
600
+ version: 2.7.0
601
601
  - !ruby/object:Gem::Dependency
602
602
  name: ruby-prof
603
603
  requirement: !ruby/object:Gem::Requirement
@@ -632,14 +632,14 @@ dependencies:
632
632
  requirements:
633
633
  - - '='
634
634
  - !ruby/object:Gem::Version
635
- version: 0.1.1
635
+ version: 0.1.2
636
636
  type: :development
637
637
  prerelease: false
638
638
  version_requirements: !ruby/object:Gem::Requirement
639
639
  requirements:
640
640
  - - '='
641
641
  - !ruby/object:Gem::Version
642
- version: 0.1.1
642
+ version: 0.1.2
643
643
  - !ruby/object:Gem::Dependency
644
644
  name: xcop
645
645
  requirement: !ruby/object:Gem::Requirement
@@ -682,6 +682,7 @@ files:
682
682
  - ".docker/readme.md"
683
683
  - ".docker/vcs.dockerfile"
684
684
  - ".docs/accuracy.md"
685
+ - ".docs/accuracy.sql"
685
686
  - ".docs/accuracy_email.jpg"
686
687
  - ".docs/accuracy_jira_comment.jpg"
687
688
  - ".docs/duedate_expired.md"
@@ -759,6 +760,7 @@ files:
759
760
  - lib/lazylead/task/confluence_ref.rb
760
761
  - lib/lazylead/task/echo.rb
761
762
  - lib/lazylead/task/fix_version.rb
763
+ - lib/lazylead/task/git/git.rb
762
764
  - lib/lazylead/task/loading.rb
763
765
  - lib/lazylead/task/micromanager.rb
764
766
  - lib/lazylead/task/missing_comment.rb
@@ -791,6 +793,7 @@ files:
791
793
  - test/lazylead/cli/app_test.rb
792
794
  - test/lazylead/confluence_test.rb
793
795
  - test/lazylead/exchange_test.rb
796
+ - test/lazylead/file_postman_test.rb
794
797
  - test/lazylead/model_test.rb
795
798
  - test/lazylead/opts_test.rb
796
799
  - test/lazylead/postman_test.rb
@@ -798,6 +801,7 @@ files:
798
801
  - test/lazylead/salt_test.rb
799
802
  - test/lazylead/smoke_test.rb
800
803
  - test/lazylead/smtp_test.rb
804
+ - test/lazylead/stdout_postman_test.rb
801
805
  - test/lazylead/system/jira_test.rb
802
806
  - test/lazylead/task/accuracy/accuracy_test.rb
803
807
  - test/lazylead/task/accuracy/affected_build_test.rb
@@ -842,9 +846,10 @@ files:
842
846
  homepage: http://github.com/dgroup/lazylead
843
847
  licenses:
844
848
  - MIT
845
- metadata: {}
849
+ metadata:
850
+ rubygems_mfa_required: 'false'
846
851
  post_install_message: |-
847
- Thanks for installing Lazylead v0.11.4!
852
+ Thanks for installing Lazylead v0.12.0!
848
853
  Read our blog posts: https://lazylead.org
849
854
  Stay in touch with the community in Telegram: https://t.me/lazylead
850
855
  Follow us on Twitter: https://twitter.com/lazylead
@@ -874,6 +879,7 @@ test_files:
874
879
  - test/lazylead/cli/app_test.rb
875
880
  - test/lazylead/confluence_test.rb
876
881
  - test/lazylead/exchange_test.rb
882
+ - test/lazylead/file_postman_test.rb
877
883
  - test/lazylead/model_test.rb
878
884
  - test/lazylead/opts_test.rb
879
885
  - test/lazylead/postman_test.rb
@@ -881,6 +887,7 @@ test_files:
881
887
  - test/lazylead/salt_test.rb
882
888
  - test/lazylead/smoke_test.rb
883
889
  - test/lazylead/smtp_test.rb
890
+ - test/lazylead/stdout_postman_test.rb
884
891
  - test/lazylead/system/jira_test.rb
885
892
  - test/lazylead/task/accuracy/accuracy_test.rb
886
893
  - test/lazylead/task/accuracy/affected_build_test.rb