lazylead 0.5.2 → 0.6.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 +4 -4
- data/lazylead.gemspec +3 -2
- data/lib/lazylead/opts.rb +1 -0
- data/lib/lazylead/postman.rb +4 -3
- data/lib/lazylead/system/jira.rb +21 -4
- data/lib/lazylead/task/accuracy/accuracy.rb +1 -1
- data/lib/lazylead/task/accuracy/logs.rb +5 -3
- data/lib/lazylead/task/accuracy/servers.rb +1 -1
- data/lib/lazylead/task/accuracy/stacktrace.rb +50 -10
- data/lib/lazylead/task/accuracy/testcase.rb +12 -6
- data/lib/lazylead/task/assignment.rb +96 -0
- data/lib/lazylead/task/fix_version.rb +4 -0
- data/lib/lazylead/task/svn/diff.rb +76 -0
- data/lib/lazylead/task/svn/grep.rb +111 -0
- data/lib/lazylead/task/svn/touch.rb +101 -0
- data/lib/lazylead/version.rb +1 -1
- data/lib/messages/illegal_assignee_change.erb +123 -0
- data/lib/messages/illegal_fixversion_change.erb +2 -0
- data/lib/messages/svn_diff.erb +110 -0
- data/lib/messages/{svn_log.erb → svn_diff_attachment.erb} +0 -0
- data/lib/messages/svn_grep.erb +114 -0
- data/test/lazylead/system/jira_test.rb +6 -7
- data/test/lazylead/task/accuracy/logs_test.rb +62 -2
- data/test/lazylead/task/accuracy/stacktrace_test.rb +227 -0
- data/test/lazylead/task/accuracy/testcase_test.rb +10 -0
- data/test/lazylead/task/assignment_test.rb +53 -0
- data/test/lazylead/task/svn/diff_test.rb +97 -0
- data/test/lazylead/task/svn/grep_test.rb +61 -0
- data/test/lazylead/task/{touch_test.rb → svn/touch_test.rb} +7 -34
- metadata +33 -7
- data/lib/lazylead/task/touch.rb +0 -119
@@ -207,6 +207,16 @@ module Lazylead
|
|
207
207
|
{color:#DE10AA}AR{color}: YYYY"
|
208
208
|
end
|
209
209
|
|
210
|
+
test "tc with colored bold ar er" do
|
211
|
+
assert testcase? "*TC:*
|
212
|
+
# Step 1
|
213
|
+
# Step 2
|
214
|
+
# Step ..
|
215
|
+
# Step N
|
216
|
+
*{color:#00673A}ER{color}* = XXXX
|
217
|
+
*{color:#DE10AA}AR{color}* = YYYY"
|
218
|
+
end
|
219
|
+
|
210
220
|
# ensure that issue description has a test case, AR and ER
|
211
221
|
def testcase?(desc)
|
212
222
|
Testcase.new.passed(OpenStruct.new(description: desc))
|
@@ -0,0 +1,53 @@
|
|
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 "mail"
|
26
|
+
|
27
|
+
require_relative "../../test"
|
28
|
+
require_relative "../../../lib/lazylead/smtp"
|
29
|
+
require_relative "../../../lib/lazylead/opts"
|
30
|
+
require_relative "../../../lib/lazylead/postman"
|
31
|
+
require_relative "../../../lib/lazylead/task/assignment"
|
32
|
+
|
33
|
+
module Lazylead
|
34
|
+
class AssignmentTest < Lazylead::Test
|
35
|
+
test "alert in case assignee changed by not authorized person" do
|
36
|
+
Lazylead::Smtp.new.enable
|
37
|
+
Task::Assignment.new.run(
|
38
|
+
NoAuthJira.new("https://jira.spring.io"),
|
39
|
+
Postman.new,
|
40
|
+
Opts.new(
|
41
|
+
"to" => "lead@company.com",
|
42
|
+
"from" => "ll@company.com",
|
43
|
+
"jql" => "key in ('DATAJDBC-480') and assignee is not empty",
|
44
|
+
"allowed" => "tom,mike,bob",
|
45
|
+
"subject" => "Assignment: How dare you?",
|
46
|
+
"template" => "lib/messages/illegal_assignee_change.erb"
|
47
|
+
)
|
48
|
+
)
|
49
|
+
assert_email "Assignment: How dare you?",
|
50
|
+
%w[DATAJDBC-480 01-Apr-2020 Minor Mark\ Paluch tom,mike,bob EntityInstantiators]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,97 @@
|
|
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 "mail"
|
26
|
+
require_relative "../../../test"
|
27
|
+
require_relative "../../../../lib/lazylead/smtp"
|
28
|
+
require_relative "../../../../lib/lazylead/opts"
|
29
|
+
require_relative "../../../../lib/lazylead/postman"
|
30
|
+
require_relative "../../../../lib/lazylead/task/svn/diff"
|
31
|
+
|
32
|
+
module Lazylead
|
33
|
+
class DiffTest < Lazylead::Test
|
34
|
+
test "changes since revision" do
|
35
|
+
skip "No svn credentials provided" unless env? "svn_log_user",
|
36
|
+
"svn_log_password"
|
37
|
+
skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
|
38
|
+
Lazylead::Smtp.new.enable
|
39
|
+
Task::Svn::Diff.new.run(
|
40
|
+
[],
|
41
|
+
Postman.new,
|
42
|
+
Opts.new(
|
43
|
+
"from" => "svnlog@test.com",
|
44
|
+
"svn_url" => "https://svn.riouxsvn.com/touch4ll",
|
45
|
+
"svn_user" => ENV["svn_log_user"],
|
46
|
+
"svn_password" => ENV["svn_log_password"],
|
47
|
+
"commit_url" => "https://view.commit.com?rev=",
|
48
|
+
"user" => "https://user.com?id=",
|
49
|
+
"to" => "lead@fake.com",
|
50
|
+
"since_rev" => "1",
|
51
|
+
"subject" => "[SVN] Changed since rev1",
|
52
|
+
"template" => "lib/messages/svn_diff.erb",
|
53
|
+
"template-attachment" => "lib/messages/svn_diff_attachment.erb"
|
54
|
+
)
|
55
|
+
)
|
56
|
+
assert_email_line "[SVN] Changed since rev1",
|
57
|
+
%w[r2 by dgroup at 2020-08-16]
|
58
|
+
end
|
59
|
+
|
60
|
+
test "changes since revision with attachment" do
|
61
|
+
skip "No svn credentials provided" unless env? "svn_log_user",
|
62
|
+
"svn_log_password"
|
63
|
+
skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
|
64
|
+
skip "No postman credentials provided" unless env? "LL_SMTP_HOST",
|
65
|
+
"LL_SMTP_PORT",
|
66
|
+
"LL_SMTP_USER",
|
67
|
+
"LL_SMTP_PASS",
|
68
|
+
"LL_SMTP_TO",
|
69
|
+
"LL_SMTP_FROM"
|
70
|
+
Lazylead::Smtp.new(
|
71
|
+
Log.new,
|
72
|
+
NoSalt.new,
|
73
|
+
smtp_host: ENV["LL_SMTP_HOST"],
|
74
|
+
smtp_port: ENV["LL_SMTP_PORT"],
|
75
|
+
smtp_user: ENV["LL_SMTP_USER"],
|
76
|
+
smtp_pass: ENV["LL_SMTP_PASS"]
|
77
|
+
).enable
|
78
|
+
Task::Svn::Diff.new.run(
|
79
|
+
[],
|
80
|
+
Postman.new,
|
81
|
+
Opts.new(
|
82
|
+
"from" => ENV["LL_SMTP_FROM"],
|
83
|
+
"svn_url" => "https://svn.riouxsvn.com/touch4ll",
|
84
|
+
"svn_user" => ENV["svn_log_user"],
|
85
|
+
"svn_password" => ENV["svn_log_password"],
|
86
|
+
"commit_url" => "https://view.commit.com?rev=",
|
87
|
+
"user" => "https://user.com?id=",
|
88
|
+
"to" => ENV["LL_SMTP_TO"],
|
89
|
+
"since_rev" => "1",
|
90
|
+
"subject" => "[SVN] Changed since rev1",
|
91
|
+
"template" => "lib/messages/svn_diff.erb",
|
92
|
+
"template-attachment" => "lib/messages/svn_diff_attachment.erb"
|
93
|
+
)
|
94
|
+
)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,61 @@
|
|
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 "mail"
|
26
|
+
require_relative "../../../test"
|
27
|
+
require_relative "../../../../lib/lazylead/smtp"
|
28
|
+
require_relative "../../../../lib/lazylead/opts"
|
29
|
+
require_relative "../../../../lib/lazylead/postman"
|
30
|
+
require_relative "../../../../lib/lazylead/task/svn/grep"
|
31
|
+
|
32
|
+
module Lazylead
|
33
|
+
class GrepTest < Lazylead::Test
|
34
|
+
test "changes with text" do
|
35
|
+
skip "No svn credentials provided" unless env? "svn_log_user",
|
36
|
+
"svn_log_password"
|
37
|
+
skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
|
38
|
+
Lazylead::Smtp.new.enable
|
39
|
+
Task::Svn::Grep.new.run(
|
40
|
+
[],
|
41
|
+
Postman.new,
|
42
|
+
Opts.new(
|
43
|
+
"from" => "svnlog@test.com",
|
44
|
+
"text" => "ping,https://github.com/dgroup/lazylead",
|
45
|
+
"svn_url" => "https://svn.riouxsvn.com/touch4ll",
|
46
|
+
"svn_user" => ENV["svn_log_user"],
|
47
|
+
"svn_password" => ENV["svn_log_password"],
|
48
|
+
"commit_url" => "https://view.commit.com?rev=",
|
49
|
+
"user" => "https://user.com?id=",
|
50
|
+
"to" => "lead@fake.com",
|
51
|
+
"now" => "2020-08-17T00:00:00+01:00",
|
52
|
+
"period" => "864000",
|
53
|
+
"subject" => "[SVN] Changes with text",
|
54
|
+
"template" => "lib/messages/svn_grep.erb"
|
55
|
+
)
|
56
|
+
)
|
57
|
+
assert_email_line "[SVN] Changes with text",
|
58
|
+
%w[r2 by dgroup at 2020-08-16]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -23,20 +23,20 @@
|
|
23
23
|
# OR OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
|
25
25
|
require "mail"
|
26
|
-
require_relative "
|
27
|
-
require_relative "
|
28
|
-
require_relative "
|
29
|
-
require_relative "
|
30
|
-
require_relative "
|
26
|
+
require_relative "../../../test"
|
27
|
+
require_relative "../../../../lib/lazylead/smtp"
|
28
|
+
require_relative "../../../../lib/lazylead/opts"
|
29
|
+
require_relative "../../../../lib/lazylead/postman"
|
30
|
+
require_relative "../../../../lib/lazylead/task/svn/touch"
|
31
31
|
|
32
32
|
module Lazylead
|
33
|
-
class
|
33
|
+
class TouchTest < Lazylead::Test
|
34
34
|
test "important files changed in svn repo" do
|
35
35
|
skip "No svn credentials provided" unless env? "svn_touch_user",
|
36
36
|
"svn_touch_password"
|
37
37
|
skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
|
38
38
|
Lazylead::Smtp.new.enable
|
39
|
-
Task::
|
39
|
+
Task::Svn::Touch.new.run(
|
40
40
|
[],
|
41
41
|
Postman.new,
|
42
42
|
Opts.new(
|
@@ -58,31 +58,4 @@ module Lazylead
|
|
58
58
|
%w[3 dgroup /189.md Add\ description\ for\ 189\ issue]
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
62
|
-
class SvnLogTest < Lazylead::Test
|
63
|
-
test "changes since revision" do
|
64
|
-
skip "No svn credentials provided" unless env? "svn_log_user",
|
65
|
-
"svn_log_password"
|
66
|
-
skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
|
67
|
-
Lazylead::Smtp.new.enable
|
68
|
-
Task::SvnLog.new.run(
|
69
|
-
[],
|
70
|
-
Postman.new,
|
71
|
-
Opts.new(
|
72
|
-
"from" => "svnlog@test.com",
|
73
|
-
"svn_url" => "https://svn.riouxsvn.com/touch4ll",
|
74
|
-
"svn_user" => ENV["svn_log_user"],
|
75
|
-
"svn_password" => ENV["svn_log_password"],
|
76
|
-
"commit_url" => "https://view.commit.com?rev=",
|
77
|
-
"user" => "https://user.com?id=",
|
78
|
-
"to" => "lead@fake.com",
|
79
|
-
"since_rev" => "1",
|
80
|
-
"subject" => "[SVN] Changed since rev1",
|
81
|
-
"template" => "lib/messages/svn_log.erb"
|
82
|
-
)
|
83
|
-
)
|
84
|
-
assert_email_line "[SVN] Changed since rev1",
|
85
|
-
%w[r2 by dgroup at 2020-08-16]
|
86
|
-
end
|
87
|
-
end
|
88
61
|
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.
|
4
|
+
version: 0.6.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-
|
11
|
+
date: 2020-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - '='
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 2.0.10
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: tmpdir
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - '='
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 0.1.0
|
244
|
+
type: :runtime
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - '='
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 0.1.0
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
252
|
name: tzinfo
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -616,20 +630,26 @@ files:
|
|
616
630
|
- lib/lazylead/task/accuracy/testcase.rb
|
617
631
|
- lib/lazylead/task/accuracy/wiki.rb
|
618
632
|
- lib/lazylead/task/alert.rb
|
633
|
+
- lib/lazylead/task/assignment.rb
|
619
634
|
- lib/lazylead/task/confluence_ref.rb
|
620
635
|
- lib/lazylead/task/echo.rb
|
621
636
|
- lib/lazylead/task/fix_version.rb
|
622
637
|
- lib/lazylead/task/missing_comment.rb
|
623
638
|
- lib/lazylead/task/propagate_down.rb
|
624
639
|
- lib/lazylead/task/savepoint.rb
|
625
|
-
- lib/lazylead/task/
|
640
|
+
- lib/lazylead/task/svn/diff.rb
|
641
|
+
- lib/lazylead/task/svn/grep.rb
|
642
|
+
- lib/lazylead/task/svn/touch.rb
|
626
643
|
- lib/lazylead/version.rb
|
627
644
|
- lib/messages/accuracy.erb
|
628
645
|
- lib/messages/due_date_expired.erb
|
646
|
+
- lib/messages/illegal_assignee_change.erb
|
629
647
|
- lib/messages/illegal_fixversion_change.erb
|
630
648
|
- lib/messages/missing_comment.erb
|
631
649
|
- lib/messages/savepoint.erb
|
632
|
-
- lib/messages/
|
650
|
+
- lib/messages/svn_diff.erb
|
651
|
+
- lib/messages/svn_diff_attachment.erb
|
652
|
+
- lib/messages/svn_grep.erb
|
633
653
|
- lib/messages/svn_touch.erb
|
634
654
|
- license.txt
|
635
655
|
- readme.md
|
@@ -657,6 +677,7 @@ files:
|
|
657
677
|
- test/lazylead/task/accuracy/testcase_test.rb
|
658
678
|
- test/lazylead/task/accuracy/wiki_test.rb
|
659
679
|
- test/lazylead/task/assignee_alert_test.rb
|
680
|
+
- test/lazylead/task/assignment_test.rb
|
660
681
|
- test/lazylead/task/confluence_ref_test.rb
|
661
682
|
- test/lazylead/task/duedate_test.rb
|
662
683
|
- test/lazylead/task/echo_test.rb
|
@@ -664,7 +685,9 @@ files:
|
|
664
685
|
- test/lazylead/task/missing_comment_test.rb
|
665
686
|
- test/lazylead/task/propagate_down_test.rb
|
666
687
|
- test/lazylead/task/savepoint_test.rb
|
667
|
-
- test/lazylead/task/
|
688
|
+
- test/lazylead/task/svn/diff_test.rb
|
689
|
+
- test/lazylead/task/svn/grep_test.rb
|
690
|
+
- test/lazylead/task/svn/touch_test.rb
|
668
691
|
- test/lazylead/version_test.rb
|
669
692
|
- test/sqlite_test.rb
|
670
693
|
- test/test.rb
|
@@ -675,7 +698,7 @@ licenses:
|
|
675
698
|
- MIT
|
676
699
|
metadata: {}
|
677
700
|
post_install_message: |-
|
678
|
-
Thanks for installing Lazylead v0.
|
701
|
+
Thanks for installing Lazylead v0.6.0!
|
679
702
|
Read our blog posts: https://lazylead.org
|
680
703
|
Stay in touch with the community in Telegram: https://t.me/lazylead
|
681
704
|
Follow us on Twitter: https://twitter.com/lazylead
|
@@ -724,6 +747,7 @@ test_files:
|
|
724
747
|
- test/lazylead/task/accuracy/testcase_test.rb
|
725
748
|
- test/lazylead/task/accuracy/wiki_test.rb
|
726
749
|
- test/lazylead/task/assignee_alert_test.rb
|
750
|
+
- test/lazylead/task/assignment_test.rb
|
727
751
|
- test/lazylead/task/confluence_ref_test.rb
|
728
752
|
- test/lazylead/task/duedate_test.rb
|
729
753
|
- test/lazylead/task/echo_test.rb
|
@@ -731,7 +755,9 @@ test_files:
|
|
731
755
|
- test/lazylead/task/missing_comment_test.rb
|
732
756
|
- test/lazylead/task/propagate_down_test.rb
|
733
757
|
- test/lazylead/task/savepoint_test.rb
|
734
|
-
- test/lazylead/task/
|
758
|
+
- test/lazylead/task/svn/diff_test.rb
|
759
|
+
- test/lazylead/task/svn/grep_test.rb
|
760
|
+
- test/lazylead/task/svn/touch_test.rb
|
735
761
|
- test/lazylead/version_test.rb
|
736
762
|
- test/sqlite_test.rb
|
737
763
|
- test/test.rb
|
data/lib/lazylead/task/touch.rb
DELETED
@@ -1,119 +0,0 @@
|
|
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 "nokogiri"
|
26
|
-
require "active_support/core_ext/hash/conversions"
|
27
|
-
require_relative "../salt"
|
28
|
-
require_relative "../opts"
|
29
|
-
|
30
|
-
module Lazylead
|
31
|
-
module Task
|
32
|
-
#
|
33
|
-
# Send notification about modification of critical files in svn repo.
|
34
|
-
#
|
35
|
-
class SvnTouch
|
36
|
-
def initialize(log = Log.new)
|
37
|
-
@log = log
|
38
|
-
end
|
39
|
-
|
40
|
-
def run(_, postman, opts)
|
41
|
-
files = opts.slice("files", ",")
|
42
|
-
commits = touch(files, opts)
|
43
|
-
postman.send(opts.merge(entries: commits)) unless commits.empty?
|
44
|
-
end
|
45
|
-
|
46
|
-
# Return all svn commits for a particular date range, which are touching
|
47
|
-
# somehow the critical files within the svn repo.
|
48
|
-
def touch(files, opts)
|
49
|
-
xpath = files.map { |f| "contains(text(),\"#{f}\")" }.join(" or ")
|
50
|
-
svn_log(opts).xpath("//logentry[paths/path[#{xpath}]]")
|
51
|
-
.map(&method(:to_entry))
|
52
|
-
.each do |e|
|
53
|
-
if e.paths.path.respond_to? :delete_if
|
54
|
-
e.paths.path.delete_if { |p| files.none? { |f| p.include? f } }
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
# Return all svn commits for particular date range in repo
|
60
|
-
def svn_log(opts)
|
61
|
-
now = if opts.key? "now"
|
62
|
-
DateTime.parse(opts["now"])
|
63
|
-
else
|
64
|
-
DateTime.now
|
65
|
-
end
|
66
|
-
start = (now.to_time - opts["period"].to_i).to_datetime
|
67
|
-
cmd = [
|
68
|
-
"svn log --no-auth-cache",
|
69
|
-
"--username #{opts.decrypt('svn_user', 'svn_salt')}",
|
70
|
-
"--password #{opts.decrypt('svn_password', 'svn_salt')}",
|
71
|
-
"--xml -v -r {#{start}}:{#{now}} #{opts['svn_url']}"
|
72
|
-
]
|
73
|
-
raw = `#{cmd.join(" ")}`
|
74
|
-
Nokogiri.XML(raw, nil, "UTF-8")
|
75
|
-
end
|
76
|
-
|
77
|
-
# Convert single revision(XML text) to entry object.
|
78
|
-
# Entry object is a simple ruby struct object.
|
79
|
-
def to_entry(xml)
|
80
|
-
e = to_struct(Hash.from_xml(xml.to_s.strip)).logentry
|
81
|
-
if e.paths.path.respond_to? :each
|
82
|
-
e.paths.path.each(&:strip!)
|
83
|
-
else
|
84
|
-
e.paths.path.strip!
|
85
|
-
end
|
86
|
-
e
|
87
|
-
end
|
88
|
-
|
89
|
-
# Make a simple ruby struct object from hash hierarchically,
|
90
|
-
# considering nested hash(es) (if applicable)
|
91
|
-
def to_struct(hsh)
|
92
|
-
OpenStruct.new(
|
93
|
-
hsh.transform_values { |v| v.is_a?(Hash) ? to_struct(v) : v }
|
94
|
-
)
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
#
|
99
|
-
# Send notification about modification of svn files since particular
|
100
|
-
# revision.
|
101
|
-
#
|
102
|
-
class SvnLog
|
103
|
-
def initialize(log = Log.new)
|
104
|
-
@log = log
|
105
|
-
end
|
106
|
-
|
107
|
-
def run(_, postman, opts)
|
108
|
-
cmd = [
|
109
|
-
"svn log --diff --no-auth-cache",
|
110
|
-
"--username #{opts.decrypt('svn_user', 'svn_salt')}",
|
111
|
-
"--password #{opts.decrypt('svn_password', 'svn_salt')}",
|
112
|
-
"-r#{opts['since_rev']}:HEAD #{opts['svn_url']}"
|
113
|
-
]
|
114
|
-
stdout = `#{cmd.join(" ")}`
|
115
|
-
postman.send(opts.merge(stdout: stdout)) unless stdout.blank?
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|