lazylead 0.6.1 → 0.6.2
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 +4 -4
- data/lazylead.gemspec +2 -2
- data/lib/lazylead/email.rb +0 -20
- data/lib/lazylead/exchange.rb +16 -28
- data/lib/lazylead/opts.rb +48 -1
- data/lib/lazylead/postman.rb +13 -18
- data/lib/lazylead/task/accuracy/logs.rb +3 -1
- data/lib/lazylead/task/fix_version.rb +4 -2
- data/lib/lazylead/task/svn/diff.rb +5 -13
- data/lib/lazylead/task/svn/grep.rb +21 -0
- data/lib/lazylead/version.rb +1 -1
- data/lib/messages/illegal_fixversion_change.erb +8 -2
- data/lib/messages/svn_diff_attachment.erb +18 -8
- data/lib/messages/svn_grep.erb +1 -1
- data/test/lazylead/opts_test.rb +35 -0
- data/test/lazylead/postman_test.rb +8 -5
- data/test/lazylead/task/fix_version_test.rb +1 -0
- data/test/lazylead/task/savepoint_test.rb +7 -4
- data/test/lazylead/task/svn/grep_test.rb +43 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 669da4d2f993894e78fcd42508429667cb29afe9082012c8dadee88e77dc0518
|
4
|
+
data.tar.gz: '0976452e6d5aaf5e282f468f05620915e73ee5cb2566ff9e4441d094d4f3dc3f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec9719d37253c81db0d59d6d3f216e8d677a8d3a4543776409782236c01428fe97a07e3c58e95150c031506d894a8188b2ce551a2ffa79c4b364edf60774ad8a
|
7
|
+
data.tar.gz: 57662e5ba79d877e4b7310f0ff20fa767e6b4246ba46f7ffd30afeee86215f311dffeb2e947a86c867b3554ac20b1711b1d69edbd493e971c01d170fccd85aed
|
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.6.
|
35
|
+
s.version = "0.6.2"
|
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.6.
|
48
|
+
s.post_install_message = "Thanks for installing Lazylead v0.6.2!
|
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
|
data/lib/lazylead/email.rb
CHANGED
@@ -25,26 +25,6 @@
|
|
25
25
|
require "tilt"
|
26
26
|
|
27
27
|
module Lazylead
|
28
|
-
# Email notifications utilities.
|
29
|
-
module Emailing
|
30
|
-
# Construct html document from template and binds.
|
31
|
-
def make_body(opts)
|
32
|
-
Email.new(
|
33
|
-
opts["template"],
|
34
|
-
opts.merge(version: Lazylead::VERSION)
|
35
|
-
).render
|
36
|
-
end
|
37
|
-
|
38
|
-
# Split text with email addresses by ',' and trim all elements if needed.
|
39
|
-
def split(type, opts)
|
40
|
-
if opts[type].include? ","
|
41
|
-
opts[type].split(",").map(&:strip).reject(&:empty?)
|
42
|
-
else
|
43
|
-
[opts[type]]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
28
|
# An email regarding tickets based on file with markup.
|
49
29
|
#
|
50
30
|
# The 'tilt' gem was used as a template engine.
|
data/lib/lazylead/exchange.rb
CHANGED
@@ -39,8 +39,6 @@ module Lazylead
|
|
39
39
|
# Copyright:: Copyright (c) 2019-2020 Yurii Dubinka
|
40
40
|
# License:: MIT
|
41
41
|
class Exchange
|
42
|
-
include Emailing
|
43
|
-
|
44
42
|
def initialize(
|
45
43
|
log = Log.new, salt = Salt.new("exchange_salt"), opts = ENV.to_h
|
46
44
|
)
|
@@ -52,38 +50,28 @@ module Lazylead
|
|
52
50
|
# Send an email.
|
53
51
|
# :opts :: the mail configuration like from, cc, subject, template.
|
54
52
|
def send(opts)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
53
|
+
if opts.msg_to.empty?
|
54
|
+
@log.warn "ll-012: Email can't be sent to '#{opts.msg_to}," \
|
55
|
+
" more: '#{opts}'"
|
56
|
+
else
|
57
|
+
msg = make_msg opts
|
58
|
+
cli.send_message msg
|
59
|
+
msg[:file_attachments].each(&:close) unless opts.msg_attachments.empty?
|
60
|
+
@log.debug "#{__FILE__} sent '#{opts['subject']}' to '#{opts.msg_to}'."
|
60
61
|
end
|
61
|
-
msg = make_msg(to, opts)
|
62
|
-
msg.update(cc_recipients: opts["cc"]) if opts.key? "cc"
|
63
|
-
add_attachments(msg, opts)
|
64
|
-
cli.send_message msg
|
65
|
-
close_attachments msg
|
66
|
-
@log.debug "#{__FILE__} sent '#{opts['subject']}' to '#{to}'."
|
67
62
|
end
|
68
63
|
|
69
|
-
def make_msg(
|
70
|
-
{
|
64
|
+
def make_msg(opts)
|
65
|
+
msg = {
|
71
66
|
subject: opts["subject"],
|
72
|
-
body:
|
67
|
+
body: opts.msg_body,
|
73
68
|
body_type: "HTML",
|
74
|
-
to_recipients:
|
69
|
+
to_recipients: opts.msg_to
|
75
70
|
}
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
files = split("attachments", opts).map { |f| File.open(f, "r") }
|
81
|
-
msg[:file_attachments] = files
|
82
|
-
end
|
83
|
-
|
84
|
-
def close_attachments(msg)
|
85
|
-
return if msg[:file_attachments].nil? || msg[:file_attachments].empty?
|
86
|
-
msg[:file_attachments].each(&:close)
|
71
|
+
files = opts.msg_attachments.map { |f| File.open(f, "r") }
|
72
|
+
msg[:file_attachments] = files unless files.empty?
|
73
|
+
msg[:cc_recipients] = opts["cc"] if opts.key? "cc"
|
74
|
+
msg
|
87
75
|
end
|
88
76
|
|
89
77
|
private
|
data/lib/lazylead/opts.rb
CHANGED
@@ -34,7 +34,8 @@ module Lazylead
|
|
34
34
|
# License:: MIT
|
35
35
|
class Opts
|
36
36
|
extend Forwardable
|
37
|
-
def_delegators :@origin, :[], :[]=, :to_s, :key?, :fetch, :
|
37
|
+
def_delegators :@origin, :[], :[]=, :to_s, :key?, :fetch, :except, :each,
|
38
|
+
:each_pair, :sort_by
|
38
39
|
|
39
40
|
def initialize(origin = {})
|
40
41
|
@origin = origin
|
@@ -77,5 +78,51 @@ module Lazylead
|
|
77
78
|
return Salt.new(sid).decrypt(text) if ENV.key? sid
|
78
79
|
text
|
79
80
|
end
|
81
|
+
|
82
|
+
def merge(args)
|
83
|
+
return self unless args.is_a? Hash
|
84
|
+
Opts.new @origin.merge(args)
|
85
|
+
end
|
86
|
+
|
87
|
+
# Construct html document from template and binds.
|
88
|
+
def msg_body(template = "template")
|
89
|
+
Email.new(
|
90
|
+
to_h[template],
|
91
|
+
to_h.merge(version: Lazylead::VERSION)
|
92
|
+
).render
|
93
|
+
end
|
94
|
+
|
95
|
+
def msg_to(delim = ",")
|
96
|
+
sliced delim, :to, "to"
|
97
|
+
end
|
98
|
+
|
99
|
+
def msg_cc(delim = ",")
|
100
|
+
sliced delim, :cc, "cc"
|
101
|
+
end
|
102
|
+
|
103
|
+
def msg_from(delim = ",")
|
104
|
+
sliced delim, :from, "from"
|
105
|
+
end
|
106
|
+
|
107
|
+
def msg_attachments(delim = ",")
|
108
|
+
sliced(delim, :attachments, "attachments").select { |f| File.file? f }
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Find the option by key and split by delimiter
|
113
|
+
# Opts.new("key" => "a,b").sliced(",", "key") => [a, b]
|
114
|
+
# Opts.new(key: "a,b").sliced(",", :key) => [a, b]
|
115
|
+
# Opts.new(key: "a,b").sliced(",", "key", :key) => [a, b]
|
116
|
+
# Opts.new(key: "").sliced ",", :key) => []
|
117
|
+
#
|
118
|
+
def sliced(delim, *keys)
|
119
|
+
return [] if keys.empty?
|
120
|
+
key = keys.detect { |k| key? k }
|
121
|
+
val = to_h[key]
|
122
|
+
return [] if val.nil? || val.blank?
|
123
|
+
return val if val.is_a? Array
|
124
|
+
return [val] unless val.include? delim
|
125
|
+
slice key, delim
|
126
|
+
end
|
80
127
|
end
|
81
128
|
end
|
data/lib/lazylead/postman.rb
CHANGED
@@ -44,8 +44,6 @@ module Lazylead
|
|
44
44
|
# Copyright:: Copyright (c) 2019-2020 Yurii Dubinka
|
45
45
|
# License:: MIT
|
46
46
|
class Postman
|
47
|
-
include Emailing
|
48
|
-
|
49
47
|
def initialize(log = Log.new)
|
50
48
|
@log = log
|
51
49
|
end
|
@@ -53,32 +51,29 @@ module Lazylead
|
|
53
51
|
# Send an email.
|
54
52
|
# :opts :: the mail configuration like to, from, cc, subject, template.
|
55
53
|
def send(opts)
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
if opts.msg_to.empty?
|
55
|
+
@log.warn "ll-013: Email can't be sent to '#{opts.msg_to}," \
|
56
|
+
" more: '#{opts}'"
|
57
|
+
else
|
58
|
+
mail = make_email(opts)
|
59
|
+
mail.deliver
|
60
|
+
@log.debug "#{__FILE__} sent '#{mail.subject}' to '#{mail.to}'."
|
61
|
+
end
|
59
62
|
end
|
60
63
|
|
61
64
|
# Construct an email based on input arguments
|
62
65
|
def make_email(opts)
|
63
66
|
mail = Mail.new
|
64
|
-
mail.to opts
|
65
|
-
mail.from opts
|
66
|
-
mail.cc opts
|
67
|
+
mail.to opts.msg_to
|
68
|
+
mail.from opts.msg_from
|
69
|
+
mail.cc opts.msg_cc if opts.key? "cc"
|
67
70
|
mail.subject opts["subject"]
|
68
|
-
html = make_body(opts)
|
69
71
|
mail.html_part do
|
70
72
|
content_type "text/html; charset=UTF-8"
|
71
|
-
body
|
73
|
+
body opts.msg_body
|
72
74
|
end
|
73
|
-
|
75
|
+
opts.msg_attachments.each { |f| mail.add_file f }
|
74
76
|
mail
|
75
77
|
end
|
76
|
-
|
77
|
-
def add_attachments(mail, opts)
|
78
|
-
return unless opts.key?("attachments") || opts.key?(:attachments)
|
79
|
-
attach = opts["attachments"] || opts[:attachments]
|
80
|
-
return if attach.nil?
|
81
|
-
attach.select { |a| File.file? a }.each { |a| mail.add_file a }
|
82
|
-
end
|
83
78
|
end
|
84
79
|
end
|
@@ -36,7 +36,9 @@ module Lazylead
|
|
36
36
|
name = attachment.attrs["filename"].downcase
|
37
37
|
return false unless attachment.attrs["size"].to_i > 5120
|
38
38
|
return true if File.extname(name).start_with?(".log", ".txt")
|
39
|
-
%w[.log.zip .log.gz .log.tar.gz].any?
|
39
|
+
%w[.log.zip .log.gz .log.tar.gz logs.7z log.7z].any? do |l|
|
40
|
+
name.end_with? l
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -86,8 +86,10 @@ module Lazylead
|
|
86
86
|
@issue.add_label("LL.IllegalChangeOfFixVersion") unless @silent
|
87
87
|
end
|
88
88
|
|
89
|
-
def
|
90
|
-
@issue.fields["fixVersions"]
|
89
|
+
def to
|
90
|
+
versions = @issue.fields["fixVersions"]
|
91
|
+
return "" if versions.nil? || versions.empty?
|
92
|
+
versions.map { |x| x["name"] }.join(",")
|
91
93
|
end
|
92
94
|
end
|
93
95
|
end
|
@@ -49,36 +49,28 @@ module Lazylead
|
|
49
49
|
"-r#{opts['since_rev']}:HEAD #{opts['svn_url']}"
|
50
50
|
]
|
51
51
|
stdout = `#{cmd.join(" ")}`
|
52
|
-
send_email
|
52
|
+
send_email postman, opts.merge(stdout: stdout) unless stdout.blank?
|
53
53
|
end
|
54
54
|
|
55
55
|
# Send email with svn log as an attachment.
|
56
56
|
# The attachment won't be stored locally and we'll be removed once
|
57
57
|
# mail sent.
|
58
|
-
def send_email(
|
58
|
+
def send_email(postman, opts)
|
59
59
|
Dir.mktmpdir do |dir|
|
60
60
|
name = "svn-log-#{Date.today.strftime('%d-%b-%Y')}.html"
|
61
61
|
f = File.open(File.join(dir, name), "w")
|
62
62
|
begin
|
63
|
-
f.write
|
63
|
+
f.write opts.msg_body("template-attachment")
|
64
64
|
f.close
|
65
|
-
postman.send opts.merge(
|
65
|
+
postman.send opts.merge(attachments: [f.path])
|
66
66
|
ensure
|
67
67
|
File.delete(f)
|
68
68
|
end
|
69
69
|
rescue StandardError => e
|
70
70
|
@log.error "ll-010: Can't send an email for #{opts} due to " \
|
71
|
-
"#{Backtrace.new(e)}'
|
71
|
+
"#{Backtrace.new(e)}'"
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
75
|
-
# Assemble HTML for attachment based on SVN output
|
76
|
-
def make_attachment(stdout, opts)
|
77
|
-
Email.new(
|
78
|
-
opts["template-attachment"],
|
79
|
-
opts.merge(stdout: stdout, version: Lazylead::VERSION)
|
80
|
-
).render
|
81
|
-
end
|
82
74
|
end
|
83
75
|
end
|
84
76
|
end
|
@@ -107,5 +107,26 @@ module Lazylead
|
|
107
107
|
def header
|
108
108
|
@header ||= lines.first.split(" | ").reject(&:blank?)
|
109
109
|
end
|
110
|
+
|
111
|
+
# Detect SVN diff lines with particular text
|
112
|
+
def diff(text)
|
113
|
+
@diff ||= begin
|
114
|
+
files = affected(text).uniq
|
115
|
+
@commit.split("Index: ")
|
116
|
+
.select { |i| files.any? { |f| i.start_with? f } }
|
117
|
+
.map { |i| i.split "\n" }
|
118
|
+
.flatten
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# Detect affected files with particular text
|
123
|
+
def affected(text)
|
124
|
+
occurrences = lines.each_index.select do |i|
|
125
|
+
lines[i].start_with?("+") && text.any? { |t| lines[i].include? t }
|
126
|
+
end
|
127
|
+
occurrences.map do |occ|
|
128
|
+
lines[2..occ].reverse.find { |l| l.start_with? "Index: " }[7..-1]
|
129
|
+
end
|
130
|
+
end
|
110
131
|
end
|
111
132
|
end
|
data/lib/lazylead/version.rb
CHANGED
@@ -92,7 +92,8 @@
|
|
92
92
|
<tr>
|
93
93
|
<th id="key">Key</th>
|
94
94
|
<th id="priority">Priority</th>
|
95
|
-
<th id="
|
95
|
+
<th id="from">From</th>
|
96
|
+
<th id="to">To</th>
|
96
97
|
<th id="when">When</th>
|
97
98
|
<th id="who">Who</th>
|
98
99
|
<th id="reporter">Reporter</th>
|
@@ -102,7 +103,12 @@
|
|
102
103
|
<tr>
|
103
104
|
<td><a href='<%= v.issue.url %>'><%= v.issue.key %></a></td>
|
104
105
|
<td><%= v.issue.priority %></td>
|
105
|
-
<td><%= v.
|
106
|
+
<td><%= v.last["items"]
|
107
|
+
.select { |h| h["field"] == "Fix Version" }
|
108
|
+
.map { |h| h["fromString"] }
|
109
|
+
.reject(&:blank?)
|
110
|
+
.join(",") %></td>
|
111
|
+
<td><%= v.to %></td>
|
106
112
|
<td><%= DateTime.parse(v.last["created"])
|
107
113
|
.strftime('%d-%b-%Y %I:%M:%S %p') %></td>
|
108
114
|
<td><span style='color: red'><%= v.last["author"]["displayName"] %></span>
|
@@ -64,7 +64,7 @@
|
|
64
64
|
padding: 36px
|
65
65
|
}
|
66
66
|
|
67
|
-
.commit {
|
67
|
+
.commit, .table-of-contents {
|
68
68
|
min-width: 100%;
|
69
69
|
border-radius: 3.5px;
|
70
70
|
overflow: hidden;
|
@@ -74,26 +74,36 @@
|
|
74
74
|
border: 1px solid #BCC6CC;
|
75
75
|
}
|
76
76
|
|
77
|
-
.commit * {
|
77
|
+
.commit *, .table-of-contents * {
|
78
78
|
padding-left: 4px;
|
79
79
|
font-size: 8px;
|
80
80
|
line-height: 15px;
|
81
81
|
}
|
82
|
+
|
83
|
+
.table-of-contents {
|
84
|
+
border: none;
|
85
|
+
}
|
82
86
|
</style>
|
83
87
|
<title>SVN log</title>
|
84
88
|
</head>
|
85
89
|
<body>
|
86
90
|
<p>Hi,</p>
|
87
|
-
<p>
|
91
|
+
<p>Commit(s) since <code><%= since_rev %></code> revision in <a href="<%= svn_url %>"><%= svn_url %></a>:</p>
|
92
|
+
<div id="table-of-contents" class="table-of-contents">
|
93
|
+
<ul>
|
94
|
+
<% stdout.split("------------------------------------------------------------------------").reject(&:blank?).reverse.each do |commit| %>
|
95
|
+
<% details = commit.split("\n").reject(&:blank?).first.split("|").map(&:strip).reject(&:blank?) %>
|
96
|
+
<li><a href="#<%= details[0] %>"><%= details[0] %></a> by <%= details[1] %> at <%= details[2] %></li>
|
97
|
+
<% end %>
|
98
|
+
</ul>
|
99
|
+
</div>
|
88
100
|
<% stdout.split("------------------------------------------------------------------------").reject(&:blank?).reverse.each do |commit| %>
|
89
101
|
<div class="commit">
|
90
102
|
<% commit.split("\n").reject(&:blank?).each_with_index do |line, index| %>
|
91
103
|
<% if index.zero? %>
|
92
104
|
<% details = line.split("|").map(&:strip).reject(&:blank?) %>
|
93
|
-
<p style="background: gainsboro;">
|
94
|
-
<a href="
|
95
|
-
by <a href="<%= user %><%= details[1] %>"><%= details[1] %></a>
|
96
|
-
at <span style="color: #275a90;"><%= details[2] %></span>
|
105
|
+
<p style="background: gainsboro;" id="<%= details[0] %>"><a href="<%= commit_url %><%= details[0][1..-1] %>"><%= details[0] %></a> by <a href="<%= user %><%= details[1] %>"><%= details[1] %></a> at <span style="color: #275a90;"><%= details[2] %></span>
|
106
|
+
<a href="#table-of-contents">↑</a>
|
97
107
|
</p>
|
98
108
|
<% else %>
|
99
109
|
<% if line.start_with?("+++") || line.start_with?("---") %>
|
@@ -103,7 +113,7 @@
|
|
103
113
|
<% elsif line.start_with?("-") %>
|
104
114
|
<p style="<%= "background: lightsalmon;" %>"><%= line.gsub(/[<>]/, '<' => '<', '>' => '>') %></p>
|
105
115
|
<% else %>
|
106
|
-
<p style="background: gainsboro;"><%= line.gsub(/[<>]/,'<' => '<', '>' => '>') %></p>
|
116
|
+
<p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '<', '>' => '>') %></p>
|
107
117
|
<% end %>
|
108
118
|
<% end %>
|
109
119
|
<% end %>
|
data/lib/messages/svn_grep.erb
CHANGED
@@ -93,7 +93,7 @@
|
|
93
93
|
by <a href="<%= user %><%= commit.author %>"><%= commit.author %></a>
|
94
94
|
at <span style="color: #275a90;"><%= commit.time %></span>
|
95
95
|
</p>
|
96
|
-
<% commit.
|
96
|
+
<% commit.diff(text.split(",")).each do |line| %>
|
97
97
|
<% if line.start_with?("+++") || line.start_with?("---") %>
|
98
98
|
<p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '<', '>' => '>') %></p>
|
99
99
|
<% elsif text.split(",").any? { |t| line.include? t } %>
|
data/test/lazylead/opts_test.rb
CHANGED
@@ -66,5 +66,40 @@ module Lazylead
|
|
66
66
|
test "except keys" do
|
67
67
|
assert_equal 1, Opts.new("one" => "1", "two" => "2").except("one").size
|
68
68
|
end
|
69
|
+
|
70
|
+
test "attachment is blank" do
|
71
|
+
assert_empty Opts.new("attachments" => "").msg_attachments
|
72
|
+
end
|
73
|
+
|
74
|
+
test "attachment is nil" do
|
75
|
+
assert_empty Opts.new("attachments" => nil).msg_attachments
|
76
|
+
end
|
77
|
+
|
78
|
+
test "attachment is absent" do
|
79
|
+
assert_empty Opts.new({}).msg_attachments
|
80
|
+
end
|
81
|
+
|
82
|
+
test "attachment is present" do
|
83
|
+
assert_equal %w[readme.md],
|
84
|
+
Opts.new("attachments" => "readme.md").msg_attachments
|
85
|
+
end
|
86
|
+
|
87
|
+
test "attachments are present" do
|
88
|
+
assert_equal %w[readme.md license.txt],
|
89
|
+
Opts.new("attachments" => "readme.md,license.txt")
|
90
|
+
.msg_attachments
|
91
|
+
end
|
92
|
+
|
93
|
+
test "attachments are present as symbol" do
|
94
|
+
assert_equal %w[readme.md license.txt],
|
95
|
+
Opts.new(attachments: " readme.md , license.txt ")
|
96
|
+
.msg_attachments
|
97
|
+
end
|
98
|
+
|
99
|
+
test "attachments is present as array" do
|
100
|
+
assert_equal %w[readme.md license.txt],
|
101
|
+
Opts.new(attachments: %w[readme.md license.txt])
|
102
|
+
.msg_attachments
|
103
|
+
end
|
69
104
|
end
|
70
105
|
end
|
@@ -24,6 +24,7 @@
|
|
24
24
|
|
25
25
|
require_relative "../test"
|
26
26
|
require_relative "../../lib/lazylead/log"
|
27
|
+
require_relative "../../lib/lazylead/opts"
|
27
28
|
require_relative "../../lib/lazylead/salt"
|
28
29
|
require_relative "../../lib/lazylead/smtp"
|
29
30
|
require_relative "../../lib/lazylead/postman"
|
@@ -46,11 +47,13 @@ module Lazylead
|
|
46
47
|
smtp_pass: ENV["LL_SMTP_PASS"]
|
47
48
|
).enable
|
48
49
|
Postman.new.send(
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
Opts.new(
|
51
|
+
"to" => ENV["LL_SMTP_TO"],
|
52
|
+
"from" => ENV["LL_SMTP_FROM"],
|
53
|
+
"attachments" => ["readme.md"],
|
54
|
+
"subject" => "[LL] Attachments",
|
55
|
+
"template" => "lib/messages/savepoint.erb"
|
56
|
+
)
|
54
57
|
)
|
55
58
|
end
|
56
59
|
end
|
@@ -42,6 +42,7 @@ module Lazylead
|
|
42
42
|
"from" => "ll@company.com",
|
43
43
|
"jql" => "key in ('DATAJDBC-480') and fixVersion is not empty",
|
44
44
|
"allowed" => "tom,mike,bob",
|
45
|
+
"fields" => "description,reporter,priority,summary,created,fixVersions",
|
45
46
|
"subject" => "FixVersion: How dare you?",
|
46
47
|
"template" => "lib/messages/illegal_fixversion_change.erb"
|
47
48
|
)
|
@@ -24,6 +24,7 @@
|
|
24
24
|
|
25
25
|
require_relative "../../test"
|
26
26
|
require_relative "../../../lib/lazylead/smtp"
|
27
|
+
require_relative "../../../lib/lazylead/opts"
|
27
28
|
require_relative "../../../lib/lazylead/postman"
|
28
29
|
require_relative "../../../lib/lazylead/task/savepoint"
|
29
30
|
|
@@ -36,10 +37,12 @@ module Lazylead
|
|
36
37
|
Task::Savepoint.new.run(
|
37
38
|
[],
|
38
39
|
Postman.new,
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
Opts.new(
|
41
|
+
"from" => "fake@email.com",
|
42
|
+
"subject" => "[LL] Configuration backup",
|
43
|
+
"template" => "lib/messages/savepoint.erb",
|
44
|
+
"to" => "big.boss@example.com"
|
45
|
+
)
|
43
46
|
)
|
44
47
|
assert_equal 'text/markdown; filename="readme.md"',
|
45
48
|
Mail::TestMailer.deliveries
|
@@ -41,7 +41,7 @@ module Lazylead
|
|
41
41
|
Postman.new,
|
42
42
|
Opts.new(
|
43
43
|
"from" => "svnlog@test.com",
|
44
|
-
"text" => "ping
|
44
|
+
"text" => "ping",
|
45
45
|
"svn_url" => "https://svn.riouxsvn.com/touch4ll",
|
46
46
|
"svn_user" => ENV["svn_log_user"],
|
47
47
|
"svn_password" => ENV["svn_log_password"],
|
@@ -57,5 +57,47 @@ module Lazylead
|
|
57
57
|
assert_email_line "[SVN] Changes with text",
|
58
58
|
%w[r2 by dgroup at 2020-08-16]
|
59
59
|
end
|
60
|
+
|
61
|
+
test "test" do
|
62
|
+
diff = <<~MSG
|
63
|
+
|
64
|
+
r3 | dgroup | 2020-08-16 11:27:01 +0300 (Sun, 16 Aug 2020) | 1 line
|
65
|
+
|
66
|
+
Add description for 189 issue
|
67
|
+
|
68
|
+
Index: 189.md
|
69
|
+
===================================================================
|
70
|
+
--- 189.md (nonexistent)
|
71
|
+
+++ 189.md (revision 3)
|
72
|
+
@@ -0,0 +1,9 @@
|
73
|
+
+*Issue 189*
|
74
|
+
+https://github.com/dgroup/lazylead/issues/189
|
75
|
+
+
|
76
|
+
+Find stable svn repo which can be used for stable test, for
|
77
|
+
+now only floating repo used for testing locally. Also, create a new
|
78
|
+
+method "ping" which can be used during tests like
|
79
|
+
+```ruby
|
80
|
+
+skip "No connection available to svn repo" unless ping("https://riouxsvn.com")
|
81
|
+
+```
|
82
|
+
|
83
|
+
Index: readme.md
|
84
|
+
===================================================================
|
85
|
+
--- readme.md (revision 2)
|
86
|
+
+++ readme.md (revision 3)
|
87
|
+
@@ -3,4 +3,5 @@
|
88
|
+
More
|
89
|
+
- https://github.com/dgroup/lazylead
|
90
|
+
- https://github.com/dgroup/lazylead/blob/master/lib/lazylead/task/touch.rb
|
91
|
+
- - https://github.com/dgroup/lazylead/blob/master/test/lazylead/task/touch_test.rb
|
92
|
+
|
93
|
+
+ - https://github.com/dgroup/lazylead/blob/master/test/lazylead/task/touch_test.rb
|
94
|
+
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
MSG
|
99
|
+
assert_equal 15, Entry.new(diff).diff(%w[ping]).size,
|
100
|
+
"There is one commit with 'ping' word where diff has 14 lines"
|
101
|
+
end
|
60
102
|
end
|
61
103
|
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.6.
|
4
|
+
version: 0.6.2
|
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-
|
11
|
+
date: 2020-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -698,7 +698,7 @@ licenses:
|
|
698
698
|
- MIT
|
699
699
|
metadata: {}
|
700
700
|
post_install_message: |-
|
701
|
-
Thanks for installing Lazylead v0.6.
|
701
|
+
Thanks for installing Lazylead v0.6.2!
|
702
702
|
Read our blog posts: https://lazylead.org
|
703
703
|
Stay in touch with the community in Telegram: https://t.me/lazylead
|
704
704
|
Follow us on Twitter: https://twitter.com/lazylead
|