lazylead 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.docs/accuracy.md +2 -2
  3. data/.docs/duedate_expired.md +3 -3
  4. data/.docs/propagate_down.md +3 -3
  5. data/.gitattributes +1 -0
  6. data/Rakefile +2 -0
  7. data/bin/lazylead +1 -1
  8. data/lazylead.gemspec +2 -2
  9. data/lib/lazylead/exchange.rb +15 -8
  10. data/lib/lazylead/model.rb +35 -1
  11. data/lib/lazylead/opts.rb +12 -0
  12. data/lib/lazylead/schedule.rb +16 -15
  13. data/lib/lazylead/system/jira.rb +39 -0
  14. data/lib/lazylead/task/accuracy/accuracy.rb +4 -8
  15. data/lib/lazylead/task/accuracy/affected_build.rb +2 -6
  16. data/lib/lazylead/task/accuracy/attachment.rb +44 -0
  17. data/lib/lazylead/task/accuracy/environment.rb +39 -0
  18. data/lib/lazylead/task/accuracy/logs.rb +40 -0
  19. data/lib/lazylead/task/accuracy/records.rb +45 -0
  20. data/lib/lazylead/task/accuracy/requirement.rb +9 -0
  21. data/lib/lazylead/task/accuracy/servers.rb +50 -0
  22. data/lib/lazylead/task/accuracy/stacktrace.rb +63 -0
  23. data/lib/lazylead/task/accuracy/testcase.rb +75 -0
  24. data/lib/lazylead/task/accuracy/wiki.rb +41 -0
  25. data/lib/lazylead/task/echo.rb +18 -0
  26. data/lib/lazylead/task/fix_version.rb +9 -2
  27. data/lib/lazylead/task/touch.rb +23 -8
  28. data/lib/lazylead/version.rb +1 -1
  29. data/lib/messages/svn_log.erb +117 -0
  30. data/license.txt +1 -1
  31. data/readme.md +5 -5
  32. data/test/lazylead/cli/app_test.rb +11 -11
  33. data/test/lazylead/system/jira_test.rb +30 -0
  34. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  35. data/test/lazylead/task/accuracy/affected_build_test.rb +2 -2
  36. data/test/lazylead/task/accuracy/attachment_test.rb +50 -0
  37. data/test/lazylead/task/accuracy/environment_test.rb +42 -0
  38. data/test/lazylead/task/accuracy/logs_test.rb +78 -0
  39. data/test/lazylead/task/accuracy/records_test.rb +60 -0
  40. data/test/lazylead/task/accuracy/servers_test.rb +66 -0
  41. data/test/lazylead/task/accuracy/stacktrace_test.rb +113 -0
  42. data/test/lazylead/task/accuracy/testcase_test.rb +205 -0
  43. data/test/lazylead/task/accuracy/wiki_test.rb +40 -0
  44. data/test/lazylead/task/touch_test.rb +28 -1
  45. data/test/test.rb +16 -0
  46. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +1 -5
  47. data/upgrades/sqlite/999.testdata.sql +12 -17
  48. metadata +28 -4
  49. data/.travis.yml +0 -16
@@ -37,7 +37,7 @@ module Lazylead
37
37
  skip "No internet connection to riouxsvn.com" unless ping? "riouxsvn.com"
38
38
  Lazylead::Smtp.new.enable
39
39
  Task::SvnTouch.new.run(
40
- nil,
40
+ [],
41
41
  Postman.new,
42
42
  Opts.new(
43
43
  "svn_url" => "https://svn.riouxsvn.com/touch4ll",
@@ -58,4 +58,31 @@ 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
61
88
  end
@@ -111,6 +111,22 @@ module Lazylead
111
111
  .body.parts.first.body.raw_source
112
112
  end
113
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
+
114
130
  # Ping remote host
115
131
  # https://github.com/eitoball/net-ping
116
132
  # https://stackoverflow.com/a/35508446/6916890
@@ -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
- cron text not null,
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
- '{"type":"Lazylead::Jira", "username":"", "password":"", "site":"https://jira.spring.io", "context_path":""}'),
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, cron, enabled, id, system, team_id, action, properties)
33
- values ('echo', '* * * * *', 'false', 1, 1, 1, 'Lazylead::Task::Echo', '{}'),
34
- ('expired due date', '* * * * *', 'false', 2, 1, 1,
35
- 'Lazylead::Task::Notification',
36
- '{"sql":"filter=100500","subject":"[DD] PDTN!","template":"lib/messages/due_date_expired.erb"}'),
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', '* * * * *', 'false', 154, 1, 154, 'Lazylead::Task::AssigneeAlert', '{}'),
42
- ('task with complex cc', '* * * * *', 'false', 165, 1, 1, 'Lazylead::Task::Echo',
43
- '{"cc":{"type":"Lazylead::PredefinedCC","opts": {"jvm":"tom@fake.com","jdbc":"mike@fake.com"}}}'),
44
- ('issue 171', '* * * * *', 'false', 171, 1, 1, 'Lazylead::Task::Echo', '{"envkey":"${key171}"}'),
45
- ('issue 195', '* * * * *', 'false', 195, 1, 1, 'Lazylead::Task::Accuracy', '{"key":"value"}');
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.3
4
+ version: 0.5.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-08-16 00:00:00.000000000 Z
11
+ date: 2020-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -576,7 +576,6 @@ files:
576
576
  - ".ruby-version"
577
577
  - ".rultor.yml"
578
578
  - ".simplecov"
579
- - ".travis.yml"
580
579
  - CNAME
581
580
  - Gemfile
582
581
  - Guardfile
@@ -607,7 +606,15 @@ files:
607
606
  - lib/lazylead/system/synced.rb
608
607
  - lib/lazylead/task/accuracy/accuracy.rb
609
608
  - lib/lazylead/task/accuracy/affected_build.rb
609
+ - lib/lazylead/task/accuracy/attachment.rb
610
+ - lib/lazylead/task/accuracy/environment.rb
611
+ - lib/lazylead/task/accuracy/logs.rb
612
+ - lib/lazylead/task/accuracy/records.rb
610
613
  - lib/lazylead/task/accuracy/requirement.rb
614
+ - lib/lazylead/task/accuracy/servers.rb
615
+ - lib/lazylead/task/accuracy/stacktrace.rb
616
+ - lib/lazylead/task/accuracy/testcase.rb
617
+ - lib/lazylead/task/accuracy/wiki.rb
611
618
  - lib/lazylead/task/alert.rb
612
619
  - lib/lazylead/task/confluence_ref.rb
613
620
  - lib/lazylead/task/echo.rb
@@ -622,6 +629,7 @@ files:
622
629
  - lib/messages/illegal_fixversion_change.erb
623
630
  - lib/messages/missing_comment.erb
624
631
  - lib/messages/savepoint.erb
632
+ - lib/messages/svn_log.erb
625
633
  - lib/messages/svn_touch.erb
626
634
  - license.txt
627
635
  - readme.md
@@ -639,6 +647,14 @@ files:
639
647
  - test/lazylead/system/jira_test.rb
640
648
  - test/lazylead/task/accuracy/accuracy_test.rb
641
649
  - test/lazylead/task/accuracy/affected_build_test.rb
650
+ - test/lazylead/task/accuracy/attachment_test.rb
651
+ - test/lazylead/task/accuracy/environment_test.rb
652
+ - test/lazylead/task/accuracy/logs_test.rb
653
+ - test/lazylead/task/accuracy/records_test.rb
654
+ - test/lazylead/task/accuracy/servers_test.rb
655
+ - test/lazylead/task/accuracy/stacktrace_test.rb
656
+ - test/lazylead/task/accuracy/testcase_test.rb
657
+ - test/lazylead/task/accuracy/wiki_test.rb
642
658
  - test/lazylead/task/assignee_alert_test.rb
643
659
  - test/lazylead/task/confluence_ref_test.rb
644
660
  - test/lazylead/task/duedate_test.rb
@@ -658,7 +674,7 @@ licenses:
658
674
  - MIT
659
675
  metadata: {}
660
676
  post_install_message: |-
661
- Thanks for installing Lazylead v0.4.3!
677
+ Thanks for installing Lazylead v0.5.0!
662
678
  Read our blog posts: https://lazylead.org
663
679
  Stay in touch with the community in Telegram: https://t.me/lazylead
664
680
  Follow us on Twitter: https://twitter.com/lazylead
@@ -697,6 +713,14 @@ test_files:
697
713
  - test/lazylead/system/jira_test.rb
698
714
  - test/lazylead/task/accuracy/accuracy_test.rb
699
715
  - test/lazylead/task/accuracy/affected_build_test.rb
716
+ - test/lazylead/task/accuracy/attachment_test.rb
717
+ - test/lazylead/task/accuracy/environment_test.rb
718
+ - test/lazylead/task/accuracy/logs_test.rb
719
+ - test/lazylead/task/accuracy/records_test.rb
720
+ - test/lazylead/task/accuracy/servers_test.rb
721
+ - test/lazylead/task/accuracy/stacktrace_test.rb
722
+ - test/lazylead/task/accuracy/testcase_test.rb
723
+ - test/lazylead/task/accuracy/wiki_test.rb
700
724
  - test/lazylead/task/assignee_alert_test.rb
701
725
  - test/lazylead/task/confluence_ref_test.rb
702
726
  - test/lazylead/task/duedate_test.rb
@@ -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)"