lazylead 0.4.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/.docs/accuracy.md +2 -2
- data/.docs/duedate_expired.md +3 -3
- data/.docs/propagate_down.md +3 -3
- data/.gitattributes +1 -0
- data/.github/dependabot.yml +6 -0
- data/Rakefile +6 -3
- data/bin/lazylead +7 -5
- data/lazylead.gemspec +5 -3
- data/lib/lazylead/cli/app.rb +5 -2
- data/lib/lazylead/exchange.rb +15 -9
- data/lib/lazylead/log.rb +2 -1
- data/lib/lazylead/model.rb +35 -1
- data/lib/lazylead/opts.rb +13 -0
- data/lib/lazylead/postman.rb +13 -7
- data/lib/lazylead/schedule.rb +16 -15
- data/lib/lazylead/smtp.rb +3 -1
- data/lib/lazylead/system/jira.rb +65 -4
- data/lib/lazylead/task/accuracy/accuracy.rb +13 -8
- data/lib/lazylead/task/accuracy/affected_build.rb +2 -6
- data/lib/lazylead/task/accuracy/attachment.rb +44 -0
- data/lib/lazylead/task/accuracy/environment.rb +39 -0
- data/lib/lazylead/task/accuracy/logs.rb +42 -0
- data/lib/lazylead/task/accuracy/records.rb +45 -0
- data/lib/lazylead/task/accuracy/requirement.rb +9 -0
- data/lib/lazylead/task/accuracy/servers.rb +50 -0
- data/lib/lazylead/task/accuracy/stacktrace.rb +103 -0
- data/lib/lazylead/task/accuracy/testcase.rb +91 -0
- data/lib/lazylead/task/accuracy/wiki.rb +41 -0
- data/lib/lazylead/task/assignment.rb +96 -0
- data/lib/lazylead/task/echo.rb +18 -0
- data/lib/lazylead/task/fix_version.rb +13 -2
- 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_diff_attachment.erb +117 -0
- data/lib/messages/svn_grep.erb +114 -0
- data/lib/messages/svn_touch.erb +1 -1
- data/license.txt +1 -1
- data/readme.md +5 -5
- data/test/lazylead/cli/app_test.rb +11 -11
- data/test/lazylead/system/jira_test.rb +41 -4
- data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
- data/test/lazylead/task/accuracy/affected_build_test.rb +2 -2
- data/test/lazylead/task/accuracy/attachment_test.rb +50 -0
- data/test/lazylead/task/accuracy/environment_test.rb +42 -0
- data/test/lazylead/task/accuracy/logs_test.rb +138 -0
- data/test/lazylead/task/accuracy/records_test.rb +60 -0
- data/test/lazylead/task/accuracy/score_test.rb +46 -0
- data/test/lazylead/task/accuracy/servers_test.rb +66 -0
- data/test/lazylead/task/accuracy/stacktrace_test.rb +340 -0
- data/test/lazylead/task/accuracy/testcase_test.rb +225 -0
- data/test/lazylead/task/accuracy/wiki_test.rb +40 -0
- data/test/lazylead/task/{touch_test.rb → assignment_test.rb} +17 -27
- data/test/lazylead/task/svn/diff_test.rb +97 -0
- data/test/lazylead/task/svn/grep_test.rb +61 -0
- data/test/lazylead/task/svn/touch_test.rb +61 -0
- data/test/test.rb +25 -0
- data/upgrades/sqlite/001-install-main-lazylead-tables.sql +1 -5
- data/upgrades/sqlite/999.testdata.sql +12 -17
- metadata +88 -21
- data/.travis.yml +0 -16
- data/lib/lazylead/task/touch.rb +0 -102
@@ -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/touch"
|
31
|
+
|
32
|
+
module Lazylead
|
33
|
+
class TouchTest < Lazylead::Test
|
34
|
+
test "important files changed in svn repo" do
|
35
|
+
skip "No svn credentials provided" unless env? "svn_touch_user",
|
36
|
+
"svn_touch_password"
|
37
|
+
skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
|
38
|
+
Lazylead::Smtp.new.enable
|
39
|
+
Task::Svn::Touch.new.run(
|
40
|
+
[],
|
41
|
+
Postman.new,
|
42
|
+
Opts.new(
|
43
|
+
"svn_url" => "https://svn.riouxsvn.com/touch4ll",
|
44
|
+
"svn_user" => ENV["svn_touch_user"],
|
45
|
+
"svn_password" => ENV["svn_touch_password"],
|
46
|
+
"commit_url" => "https://view.commit.com?rev=",
|
47
|
+
"user" => "https://user.com?id=",
|
48
|
+
"to" => "lead@fake.com",
|
49
|
+
"from" => "ll@fake.com",
|
50
|
+
"now" => "2020-08-17T00:00:00+01:00",
|
51
|
+
"period" => "864000",
|
52
|
+
"files" => "189.md,absent.txt",
|
53
|
+
"subject" => "[SVN] Important files have been changed!",
|
54
|
+
"template" => "lib/messages/svn_touch.erb"
|
55
|
+
)
|
56
|
+
)
|
57
|
+
assert_email "[SVN] Important files have been changed!",
|
58
|
+
%w[3 dgroup /189.md Add\ description\ for\ 189\ issue]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/test/test.rb
CHANGED
@@ -110,5 +110,30 @@ module Lazylead
|
|
110
110
|
.first
|
111
111
|
.body.parts.first.body.raw_source
|
112
112
|
end
|
113
|
+
|
114
|
+
# Assert that email sent using 'mail' gem in test mode
|
115
|
+
# has expected subject and line with expected words
|
116
|
+
# @todo #/DEV Gem 'mail' sends email as a single line, find a way how to add
|
117
|
+
# symbol '\n' to each line for email during unit testing.
|
118
|
+
def assert_email_line(subject, words)
|
119
|
+
words = [words] unless words.respond_to? :each
|
120
|
+
mail = Mail::TestMailer.deliveries
|
121
|
+
.filter { |m| m.subject.eql? subject }
|
122
|
+
.first
|
123
|
+
.body.parts.first.body.raw_source
|
124
|
+
.split("\n")
|
125
|
+
.reject(&:blank?)
|
126
|
+
assert mail.any? { |line| words.all? { |w| line.include? w } },
|
127
|
+
"Words '#{words.join(',')}' wasn't found in '#{mail.join('\n')}'"
|
128
|
+
end
|
129
|
+
|
130
|
+
# Ping remote host
|
131
|
+
# https://github.com/eitoball/net-ping
|
132
|
+
# https://stackoverflow.com/a/35508446/6916890
|
133
|
+
# https://rubygems.org/gems/net-ping/versions/2.0.8
|
134
|
+
def ping?(host)
|
135
|
+
require "net/ping"
|
136
|
+
Net::Ping::External.new(host).ping?
|
137
|
+
end
|
113
138
|
end
|
114
139
|
end
|
@@ -46,11 +46,7 @@ create table if not exists tasks
|
|
46
46
|
(
|
47
47
|
id integer primary key,
|
48
48
|
name text not null,
|
49
|
-
|
50
|
-
-- @todo #/DEV task.cron - add support for non-cron based schedule like at, once, every.
|
51
|
-
-- More details:
|
52
|
-
-- https://github.com/jmettraux/rufus-scheduler
|
53
|
-
-- https://stackoverflow.com/questions/46691666/using-constantize-to-invoke-both-a-class-and-method-from-separate-strings
|
49
|
+
schedule text not null,
|
54
50
|
system integer not null,
|
55
51
|
action text not null,
|
56
52
|
team_id integer not null,
|
@@ -22,24 +22,19 @@
|
|
22
22
|
* OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
*/
|
24
24
|
insert into systems(id, properties)
|
25
|
-
values (1,
|
26
|
-
|
27
|
-
(2,
|
28
|
-
'{"type":"Lazylead::Jira", "username":"${jsi_usr}", "password":"${jsi_psw}", "site":"https://jira.spring.io", "context_path":""}');
|
25
|
+
values (1,'{"type":"Lazylead::Jira", "username":"", "password":"", "site":"https://jira.spring.io", "context_path":""}'),
|
26
|
+
(2,'{"type":"Lazylead::Jira", "username":"${jsi_usr}", "password":"${jsi_psw}", "site":"https://jira.spring.io", "context_path":""}');
|
29
27
|
insert into teams(id, name, properties)
|
30
28
|
values (1, 'BA squad', '{"from":"basquad@fake.com", "usr":"${usr}"}'),
|
31
29
|
(154, 'Team for issue #154', '{"cc":"lead@fake.com"}');
|
32
|
-
insert into tasks(name,
|
33
|
-
values ('echo', '
|
34
|
-
('expired due date', '
|
35
|
-
|
36
|
-
|
37
|
-
('task with cc', '* * * * *', 'false', 3, 1, 1, 'Lazylead::Task::Echo',
|
38
|
-
'{"cc":"leelakenny@mail.com,maciecrane@mail.com"}'),
|
39
|
-
('task', '* * * * *', 'false', 4, 2, 1, 'Lazylead::Task::Echo', '{}'),
|
30
|
+
insert into tasks(name, schedule, enabled, id, system, team_id, action, properties)
|
31
|
+
values ('echo', 'cron:* * * * *', 'false', 1, 1, 1, 'Lazylead::Task::Echo', '{}'),
|
32
|
+
('expired due date', 'cron:* * * * *', 'false', 2, 1, 1,'Lazylead::Task::Notification','{"sql":"filter=100500","subject":"[DD] PDTN!","template":"lib/messages/due_date_expired.erb"}'),
|
33
|
+
('task with cc', 'cron:* * * * *', 'false', 3, 1, 1, 'Lazylead::Task::Echo','{"cc":"leelakenny@mail.com,maciecrane@mail.com"}'),
|
34
|
+
('task', 'cron:* * * * *', 'false', 4, 2, 1, 'Lazylead::Task::Echo', '{}'),
|
40
35
|
('pman', '', '', 5, 2, 1, '', '{"postman":"Lazylead::Postman"}'),
|
41
|
-
('issue 154', '
|
42
|
-
('task with complex cc', '
|
43
|
-
|
44
|
-
('issue
|
45
|
-
('issue
|
36
|
+
('issue 154', '', 'false', 154, 1, 154, 'Lazylead::Task::AssigneeAlert', '{}'),
|
37
|
+
('task with complex cc', '', 'false', 165, 1, 1, 'Lazylead::Task::Echo','{"cc":{"type":"Lazylead::PredefinedCC","opts": {"jvm":"tom@fake.com","jdbc":"mike@fake.com"}}}'),
|
38
|
+
('issue 171', '', 'false', 171, 1, 1, 'Lazylead::Task::Echo', '{"envkey":"${key171}"}'),
|
39
|
+
('issue 195', '', 'false', 195, 1, 1, 'Lazylead::Task::Accuracy', '{"key":"value"}'),
|
40
|
+
('issue 130', 'in:0.001s', 'true', 130, 1, 1, 'Lazylead::Task::EchoIO', '{}');
|
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
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.8.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.8.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: faraday
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,20 +164,6 @@ dependencies:
|
|
150
164
|
- - '='
|
151
165
|
- !ruby/object:Gem::Version
|
152
166
|
version: 2.1.2
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: rainbow
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - '='
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 3.0.0
|
160
|
-
type: :runtime
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - '='
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 3.0.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: require_all
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|
@@ -388,6 +402,20 @@ dependencies:
|
|
388
402
|
- - '='
|
389
403
|
- !ruby/object:Gem::Version
|
390
404
|
version: 1.3.6
|
405
|
+
- !ruby/object:Gem::Dependency
|
406
|
+
name: net-ping
|
407
|
+
requirement: !ruby/object:Gem::Requirement
|
408
|
+
requirements:
|
409
|
+
- - '='
|
410
|
+
- !ruby/object:Gem::Version
|
411
|
+
version: 2.0.8
|
412
|
+
type: :development
|
413
|
+
prerelease: false
|
414
|
+
version_requirements: !ruby/object:Gem::Requirement
|
415
|
+
requirements:
|
416
|
+
- - '='
|
417
|
+
- !ruby/object:Gem::Version
|
418
|
+
version: 2.0.8
|
391
419
|
- !ruby/object:Gem::Dependency
|
392
420
|
name: rake
|
393
421
|
requirement: !ruby/object:Gem::Requirement
|
@@ -553,6 +581,7 @@ files:
|
|
553
581
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
554
582
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
555
583
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
584
|
+
- ".github/dependabot.yml"
|
556
585
|
- ".github/tasks.yml"
|
557
586
|
- ".github/trello.md"
|
558
587
|
- ".gitignore"
|
@@ -561,7 +590,6 @@ files:
|
|
561
590
|
- ".ruby-version"
|
562
591
|
- ".rultor.yml"
|
563
592
|
- ".simplecov"
|
564
|
-
- ".travis.yml"
|
565
593
|
- CNAME
|
566
594
|
- Gemfile
|
567
595
|
- Guardfile
|
@@ -592,21 +620,36 @@ files:
|
|
592
620
|
- lib/lazylead/system/synced.rb
|
593
621
|
- lib/lazylead/task/accuracy/accuracy.rb
|
594
622
|
- lib/lazylead/task/accuracy/affected_build.rb
|
623
|
+
- lib/lazylead/task/accuracy/attachment.rb
|
624
|
+
- lib/lazylead/task/accuracy/environment.rb
|
625
|
+
- lib/lazylead/task/accuracy/logs.rb
|
626
|
+
- lib/lazylead/task/accuracy/records.rb
|
595
627
|
- lib/lazylead/task/accuracy/requirement.rb
|
628
|
+
- lib/lazylead/task/accuracy/servers.rb
|
629
|
+
- lib/lazylead/task/accuracy/stacktrace.rb
|
630
|
+
- lib/lazylead/task/accuracy/testcase.rb
|
631
|
+
- lib/lazylead/task/accuracy/wiki.rb
|
596
632
|
- lib/lazylead/task/alert.rb
|
633
|
+
- lib/lazylead/task/assignment.rb
|
597
634
|
- lib/lazylead/task/confluence_ref.rb
|
598
635
|
- lib/lazylead/task/echo.rb
|
599
636
|
- lib/lazylead/task/fix_version.rb
|
600
637
|
- lib/lazylead/task/missing_comment.rb
|
601
638
|
- lib/lazylead/task/propagate_down.rb
|
602
639
|
- lib/lazylead/task/savepoint.rb
|
603
|
-
- lib/lazylead/task/
|
640
|
+
- lib/lazylead/task/svn/diff.rb
|
641
|
+
- lib/lazylead/task/svn/grep.rb
|
642
|
+
- lib/lazylead/task/svn/touch.rb
|
604
643
|
- lib/lazylead/version.rb
|
605
644
|
- lib/messages/accuracy.erb
|
606
645
|
- lib/messages/due_date_expired.erb
|
646
|
+
- lib/messages/illegal_assignee_change.erb
|
607
647
|
- lib/messages/illegal_fixversion_change.erb
|
608
648
|
- lib/messages/missing_comment.erb
|
609
649
|
- lib/messages/savepoint.erb
|
650
|
+
- lib/messages/svn_diff.erb
|
651
|
+
- lib/messages/svn_diff_attachment.erb
|
652
|
+
- lib/messages/svn_grep.erb
|
610
653
|
- lib/messages/svn_touch.erb
|
611
654
|
- license.txt
|
612
655
|
- readme.md
|
@@ -624,7 +667,17 @@ files:
|
|
624
667
|
- test/lazylead/system/jira_test.rb
|
625
668
|
- test/lazylead/task/accuracy/accuracy_test.rb
|
626
669
|
- test/lazylead/task/accuracy/affected_build_test.rb
|
670
|
+
- test/lazylead/task/accuracy/attachment_test.rb
|
671
|
+
- test/lazylead/task/accuracy/environment_test.rb
|
672
|
+
- test/lazylead/task/accuracy/logs_test.rb
|
673
|
+
- test/lazylead/task/accuracy/records_test.rb
|
674
|
+
- test/lazylead/task/accuracy/score_test.rb
|
675
|
+
- test/lazylead/task/accuracy/servers_test.rb
|
676
|
+
- test/lazylead/task/accuracy/stacktrace_test.rb
|
677
|
+
- test/lazylead/task/accuracy/testcase_test.rb
|
678
|
+
- test/lazylead/task/accuracy/wiki_test.rb
|
627
679
|
- test/lazylead/task/assignee_alert_test.rb
|
680
|
+
- test/lazylead/task/assignment_test.rb
|
628
681
|
- test/lazylead/task/confluence_ref_test.rb
|
629
682
|
- test/lazylead/task/duedate_test.rb
|
630
683
|
- test/lazylead/task/echo_test.rb
|
@@ -632,7 +685,9 @@ files:
|
|
632
685
|
- test/lazylead/task/missing_comment_test.rb
|
633
686
|
- test/lazylead/task/propagate_down_test.rb
|
634
687
|
- test/lazylead/task/savepoint_test.rb
|
635
|
-
- 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
|
636
691
|
- test/lazylead/version_test.rb
|
637
692
|
- test/sqlite_test.rb
|
638
693
|
- test/test.rb
|
@@ -643,7 +698,7 @@ licenses:
|
|
643
698
|
- MIT
|
644
699
|
metadata: {}
|
645
700
|
post_install_message: |-
|
646
|
-
Thanks for installing Lazylead v0.
|
701
|
+
Thanks for installing Lazylead v0.6.0!
|
647
702
|
Read our blog posts: https://lazylead.org
|
648
703
|
Stay in touch with the community in Telegram: https://t.me/lazylead
|
649
704
|
Follow us on Twitter: https://twitter.com/lazylead
|
@@ -682,7 +737,17 @@ test_files:
|
|
682
737
|
- test/lazylead/system/jira_test.rb
|
683
738
|
- test/lazylead/task/accuracy/accuracy_test.rb
|
684
739
|
- test/lazylead/task/accuracy/affected_build_test.rb
|
740
|
+
- test/lazylead/task/accuracy/attachment_test.rb
|
741
|
+
- test/lazylead/task/accuracy/environment_test.rb
|
742
|
+
- test/lazylead/task/accuracy/logs_test.rb
|
743
|
+
- test/lazylead/task/accuracy/records_test.rb
|
744
|
+
- test/lazylead/task/accuracy/score_test.rb
|
745
|
+
- test/lazylead/task/accuracy/servers_test.rb
|
746
|
+
- test/lazylead/task/accuracy/stacktrace_test.rb
|
747
|
+
- test/lazylead/task/accuracy/testcase_test.rb
|
748
|
+
- test/lazylead/task/accuracy/wiki_test.rb
|
685
749
|
- test/lazylead/task/assignee_alert_test.rb
|
750
|
+
- test/lazylead/task/assignment_test.rb
|
686
751
|
- test/lazylead/task/confluence_ref_test.rb
|
687
752
|
- test/lazylead/task/duedate_test.rb
|
688
753
|
- test/lazylead/task/echo_test.rb
|
@@ -690,7 +755,9 @@ test_files:
|
|
690
755
|
- test/lazylead/task/missing_comment_test.rb
|
691
756
|
- test/lazylead/task/propagate_down_test.rb
|
692
757
|
- test/lazylead/task/savepoint_test.rb
|
693
|
-
- 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
|
694
761
|
- test/lazylead/version_test.rb
|
695
762
|
- test/sqlite_test.rb
|
696
763
|
- test/test.rb
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.6.5
|
4
|
-
cache: bundler
|
5
|
-
branches:
|
6
|
-
only:
|
7
|
-
- master
|
8
|
-
install:
|
9
|
-
- travis_retry bundle update
|
10
|
-
- gem install pdd -v 0.20.5
|
11
|
-
script:
|
12
|
-
- pdd -f /dev/null
|
13
|
-
- export RUBYOPT="-W0"
|
14
|
-
- rake --quiet
|
15
|
-
after_success:
|
16
|
-
- "bash <(curl -s https://codecov.io/bash)"
|
data/lib/lazylead/task/touch.rb
DELETED
@@ -1,102 +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
|
-
url = opts["svn_url"]
|
62
|
-
usr = decrypt(opts["svn_user"])
|
63
|
-
psw = decrypt(opts["svn_password"])
|
64
|
-
now = if opts.key? "now"
|
65
|
-
DateTime.parse(opts["now"])
|
66
|
-
else
|
67
|
-
DateTime.now
|
68
|
-
end
|
69
|
-
start = (now.to_time - opts["period"].to_i).to_datetime
|
70
|
-
raw = `svn log --no-auth-cache --username #{usr} --password #{psw}
|
71
|
-
--xml -v -r {#{start}}:{#{now}} #{url}`
|
72
|
-
Nokogiri.XML(raw, nil, "UTF-8")
|
73
|
-
end
|
74
|
-
|
75
|
-
# Decrypt text using cryptography salt
|
76
|
-
def decrypt(text, sid = "svn_salt")
|
77
|
-
return Salt.new(sid).decrypt(text) if ENV.key? sid
|
78
|
-
text
|
79
|
-
end
|
80
|
-
|
81
|
-
# Convert single revision(XML text) to entry object.
|
82
|
-
# Entry object is a simple ruby struct object.
|
83
|
-
def to_entry(xml)
|
84
|
-
e = to_struct(Hash.from_xml(xml.to_s.strip)).logentry
|
85
|
-
if e.paths.path.respond_to? :each
|
86
|
-
e.paths.path.each(&:strip!)
|
87
|
-
else
|
88
|
-
e.paths.path.strip!
|
89
|
-
end
|
90
|
-
e
|
91
|
-
end
|
92
|
-
|
93
|
-
# Make a simple ruby struct object from hash hierarchically,
|
94
|
-
# considering nested hash(es) (if applicable)
|
95
|
-
def to_struct(hsh)
|
96
|
-
OpenStruct.new(
|
97
|
-
hsh.transform_values { |v| v.is_a?(Hash) ? to_struct(v) : v }
|
98
|
-
)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|