lazylead 0.7.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.docker/docker-compose.yml +1 -1
  3. data/.docs/duedate_expired.md +1 -1
  4. data/.rubocop.yml +20 -3
  5. data/Gemfile +1 -1
  6. data/Rakefile +2 -2
  7. data/bin/lazylead +4 -1
  8. data/lazylead.gemspec +15 -14
  9. data/lib/lazylead.rb +2 -2
  10. data/lib/lazylead/allocated.rb +1 -1
  11. data/lib/lazylead/cc.rb +17 -23
  12. data/lib/lazylead/cli/app.rb +1 -1
  13. data/lib/lazylead/confluence.rb +1 -1
  14. data/lib/lazylead/email.rb +1 -1
  15. data/lib/lazylead/exchange.rb +1 -1
  16. data/lib/lazylead/home.rb +1 -1
  17. data/lib/lazylead/log.rb +12 -1
  18. data/lib/lazylead/model.rb +6 -8
  19. data/lib/lazylead/opts.rb +6 -3
  20. data/lib/lazylead/postman.rb +1 -1
  21. data/{Guardfile → lib/lazylead/requires.rb} +13 -8
  22. data/lib/lazylead/salt.rb +1 -1
  23. data/lib/lazylead/schedule.rb +1 -1
  24. data/lib/lazylead/smtp.rb +1 -1
  25. data/lib/lazylead/system/empty.rb +1 -1
  26. data/lib/lazylead/system/fake.rb +1 -1
  27. data/lib/lazylead/system/jira.rb +30 -25
  28. data/lib/lazylead/system/synced.rb +1 -1
  29. data/lib/lazylead/task/accuracy/accuracy.rb +36 -28
  30. data/lib/lazylead/task/accuracy/affected_build.rb +1 -1
  31. data/lib/lazylead/task/accuracy/attachment.rb +1 -1
  32. data/lib/lazylead/task/accuracy/environment.rb +1 -1
  33. data/lib/lazylead/task/accuracy/logs.rb +1 -1
  34. data/lib/lazylead/task/accuracy/onlyll.rb +6 -8
  35. data/lib/lazylead/task/accuracy/records.rb +1 -1
  36. data/lib/lazylead/task/accuracy/requirement.rb +1 -1
  37. data/lib/lazylead/task/accuracy/screenshots.rb +60 -0
  38. data/lib/lazylead/task/accuracy/servers.rb +1 -1
  39. data/lib/lazylead/task/accuracy/stacktrace.rb +1 -1
  40. data/lib/lazylead/task/accuracy/testcase.rb +1 -1
  41. data/lib/lazylead/task/accuracy/wiki.rb +1 -1
  42. data/lib/lazylead/task/{alert.rb → alert/alert.rb} +6 -6
  43. data/lib/lazylead/task/alert/alertif.rb +75 -0
  44. data/lib/lazylead/task/alert/changed_to.rb +58 -0
  45. data/lib/lazylead/task/assignment.rb +3 -5
  46. data/lib/lazylead/task/confluence_ref.rb +1 -1
  47. data/lib/lazylead/task/echo.rb +1 -1
  48. data/lib/lazylead/task/fix_version.rb +1 -1
  49. data/lib/lazylead/task/loading.rb +98 -0
  50. data/lib/lazylead/task/micromanager.rb +87 -0
  51. data/lib/lazylead/task/missing_comment.rb +1 -1
  52. data/lib/lazylead/task/propagate_down.rb +3 -3
  53. data/lib/lazylead/task/savepoint.rb +1 -1
  54. data/lib/lazylead/task/svn/diff.rb +29 -7
  55. data/lib/lazylead/task/svn/grep.rb +1 -1
  56. data/lib/lazylead/task/svn/touch.rb +1 -1
  57. data/lib/lazylead/version.rb +2 -2
  58. data/lib/messages/accuracy.erb +1 -1
  59. data/lib/messages/alertif.erb +134 -0
  60. data/lib/messages/created_recently.erb +110 -0
  61. data/lib/messages/illegal_duedate_change.erb +120 -0
  62. data/lib/messages/loading.erb +122 -0
  63. data/readme.md +26 -18
  64. data/test/lazylead/allocated_test.rb +1 -1
  65. data/test/lazylead/cc_test.rb +1 -1
  66. data/test/lazylead/cli/app_test.rb +2 -2
  67. data/test/lazylead/confluence_test.rb +1 -1
  68. data/test/lazylead/exchange_test.rb +1 -1
  69. data/test/lazylead/model_test.rb +1 -1
  70. data/test/lazylead/opts_test.rb +1 -1
  71. data/test/lazylead/postman_test.rb +1 -1
  72. data/test/lazylead/salt_test.rb +1 -1
  73. data/test/lazylead/smoke_test.rb +1 -1
  74. data/test/lazylead/smtp_test.rb +1 -1
  75. data/test/lazylead/system/jira_test.rb +10 -1
  76. data/test/lazylead/task/accuracy/accuracy_test.rb +1 -1
  77. data/test/lazylead/task/accuracy/affected_build_test.rb +1 -1
  78. data/test/lazylead/task/accuracy/attachment_test.rb +1 -1
  79. data/test/lazylead/task/accuracy/environment_test.rb +1 -1
  80. data/test/lazylead/task/accuracy/logs_test.rb +1 -1
  81. data/test/lazylead/task/accuracy/onlyll_test.rb +1 -1
  82. data/test/lazylead/task/accuracy/records_test.rb +1 -1
  83. data/test/lazylead/task/accuracy/score_test.rb +40 -2
  84. data/test/lazylead/task/accuracy/screenshots_test.rb +126 -0
  85. data/test/lazylead/task/accuracy/servers_test.rb +1 -1
  86. data/test/lazylead/task/accuracy/stacktrace_test.rb +1 -1
  87. data/test/lazylead/task/accuracy/testcase_test.rb +1 -1
  88. data/test/lazylead/task/accuracy/wiki_test.rb +1 -1
  89. data/test/lazylead/task/alert/alertif_test.rb +54 -0
  90. data/test/lazylead/task/{assignee_alert_test.rb → alert/assignee_alert_test.rb} +10 -10
  91. data/test/lazylead/task/alert/changed_to_test.rb +42 -0
  92. data/test/lazylead/task/assignment_test.rb +1 -1
  93. data/test/lazylead/task/confluence_ref_test.rb +1 -1
  94. data/test/lazylead/task/created_recently_test.rb +53 -0
  95. data/test/lazylead/task/duedate_test.rb +2 -2
  96. data/test/lazylead/task/echo_test.rb +1 -1
  97. data/test/lazylead/task/fix_version_test.rb +1 -1
  98. data/test/lazylead/task/loading_test.rb +55 -0
  99. data/test/lazylead/task/micromanager_test.rb +54 -0
  100. data/test/lazylead/task/missing_comment_test.rb +1 -1
  101. data/test/lazylead/task/propagate_down_test.rb +1 -1
  102. data/test/lazylead/task/savepoint_test.rb +1 -1
  103. data/test/lazylead/task/svn/diff_test.rb +8 -4
  104. data/test/lazylead/task/svn/grep_test.rb +1 -1
  105. data/test/lazylead/task/svn/touch_test.rb +1 -1
  106. data/test/lazylead/version_test.rb +1 -1
  107. data/test/sqlite_test.rb +1 -1
  108. data/test/test.rb +13 -1
  109. data/upgrades/sqlite/001-install-main-lazylead-tables.sql +1 -1
  110. data/upgrades/sqlite/999.testdata.sql +1 -1
  111. metadata +64 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 647614608568a2196a8bcccb556662c3680699121f73a545a0c03b33c208b4a9
4
- data.tar.gz: 37e8e136922de5193b6d7435a1666e4953b425e3fe33667914f186ac3fb3a930
3
+ metadata.gz: 6dd70c73ff657c4598583180a4c21a497e6b303f2eaf7e832aadf966957d363f
4
+ data.tar.gz: 4f5c7ef058b9861e9d17ffbc97aec9651f974fe808ab7a3ee4832c0800f1e50e
5
5
  SHA512:
6
- metadata.gz: b7ca726e4354533c8a9dceb965635508c8b7f5ba4a1115135e27378b4494f5c716a0c06a07dff34798fa2a00a5fcba5baf958229e668954f677e6d710625829d
7
- data.tar.gz: ca4baff71de48ef8afcac503c576b842311a6f74089f45d2e8d6af4f04762df786842e46dfb38d23019aa87e2642b1c4e3e066eae75102bece6fc756e63269d9
6
+ metadata.gz: 5419ceb30c1122db9afe8051f7587dbc2cfc78896c7c83312ee2160bf8a1556a305df1dee41839048cea736a1904373aa3e8a62cbeb345c293bbb146cbd2d7ed
7
+ data.tar.gz: 4fcdb20ab35edaf4f1530680ab19378ae751b8b5964e63b9061fad447ff210ff2f43548f6be3afa5e298c8800391e6fac5f07f124d21c59c509bce3579dfd329
@@ -20,4 +20,4 @@ services:
20
20
  volumes:
21
21
  - .local/dumps:/lazylead/dumps
22
22
  - .local/logs:/lazylead/logs
23
- entrypoint: bin/lazylead --trace --verbose
23
+ entrypoint: bin/lazylead --trace --verbose --log-file /lazylead/logs/ll{{.%Y-%m-%dT%H:%M:%S}}.log
@@ -89,4 +89,4 @@ For simplicity, we are using [docker-compose](https://docs.docker.com/compose/):
89
89
  #### Where is the code?
90
90
  | Logic | Tests | Email Template |
91
91
  | :-----: | :------: | :-----: |
92
- | AssigneeAlert in [alert.rb](../lib/lazylead/task/alert.rb)| [duedate_test.rb](../test/lazylead/task/duedate_test.rb) | [due_date_expired.erb](../lib/messages/due_date_expired.erb) |
92
+ | AssigneeAlert in [alert.rb](../lib/lazylead/task/alert/alert.rb)| [duedate_test.rb](../test/lazylead/task/duedate_test.rb) | [due_date_expired.erb](../lib/messages/due_date_expired.erb) |
data/.rubocop.yml CHANGED
@@ -3,6 +3,7 @@ require:
3
3
  - rubocop-performance
4
4
 
5
5
  AllCops:
6
+ NewCops: enable
6
7
  DisplayCopNames: true
7
8
  DisplayStyleGuide: true
8
9
  TargetRubyVersion: 2.6
@@ -14,6 +15,7 @@ Layout/LineLength:
14
15
  Exclude:
15
16
  - "*.gemspec"
16
17
  - "test/**/*"
18
+ - "bin/lazylead"
17
19
 
18
20
  Metrics/AbcSize:
19
21
  Max: 21
@@ -85,12 +87,20 @@ Style/HashTransformValues:
85
87
  Style/FormatStringToken:
86
88
  Exclude:
87
89
  - "lib/lazylead/task/accuracy/accuracy.rb"
88
-
90
+ Style/IfWithBooleanLiteralBranches: # (new in 1.9)
91
+ Enabled: true
89
92
  Lint/RaiseException:
90
93
  Enabled: true
91
-
92
94
  Lint/StructNewOverride:
93
95
  Enabled: true
96
+ Lint/NumberedParameterAssignment: # (new in 1.9)
97
+ Enabled: true
98
+ Lint/OrAssignmentToConstant: # (new in 1.9)
99
+ Enabled: true
100
+ Lint/SymbolConversion: # (new in 1.9)
101
+ Enabled: true
102
+ Lint/TripleQuotes: # (new in 1.9)
103
+ Enabled: true
94
104
 
95
105
  # @todo #/DEV Add violation regarding methods without documentation using RDoc
96
106
  # https://stackoverflow.com/questions/1681467/how-to-document-ruby-code
@@ -139,7 +149,8 @@ Style/RedundantArgument: # (new in 1.4)
139
149
  Enabled: true
140
150
  Style/SwapValues: # (new in 1.1)
141
151
  Enabled: true
142
-
152
+ Style/HashConversion: # (new in 1.10)
153
+ Enabled: true
143
154
  Minitest/AssertInDelta: # (new in 0.10)
144
155
  Enabled: true
145
156
  Minitest/AssertionInLifecycleHook: # (new in 0.10)
@@ -191,4 +202,10 @@ Performance/Squeeze: # (new in 1.7)
191
202
  Performance/StringInclude: # (new in 1.7)
192
203
  Enabled: true
193
204
  Performance/Sum: # (new in 1.8)
205
+ Enabled: true
206
+ Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
207
+ Enabled: true
208
+ Performance/RedundantSplitRegexpArgument: # (new in 1.10)
209
+ Enabled: true
210
+ Gemspec/DateAssignment: # (new in 1.10)
194
211
  Enabled: true
data/Gemfile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
data/Rakefile CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -45,7 +45,7 @@ def version
45
45
  Gem::Specification.load(Dir["*.gemspec"].first).version
46
46
  end
47
47
 
48
- task default: %i[clean test rubocop sqlint xcop copyright docker]
48
+ task default: %i[clean rubocop test sqlint xcop copyright docker]
49
49
 
50
50
  require "rake/testtask"
51
51
  desc "Run all unit tests"
data/bin/lazylead CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # The MIT License
5
5
  #
6
- # Copyright (c) 2019-2020 Yurii Dubinka
6
+ # Copyright (c) 2019-2021 Yurii Dubinka
7
7
  #
8
8
  # Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  # of this software and associated documentation files (the "Software"),
@@ -70,6 +70,9 @@ Available options:"
70
70
  o.bool "--testdata",
71
71
  "Apply the database VCS migration with test data",
72
72
  default: false
73
+ o.string "--log-file", "The path to the log file"
74
+ o.string "--rolling-age", "The maximum age (in seconds) of a log file before it is rolled. The age can also be given as 'daily', 'weekly', or 'monthly'"
75
+ o.string "--rolling-files", "The number of rolled log files to keep."
73
76
  o.on "--verbose", "Enable extra logging information" do
74
77
  log.verbose
75
78
  end
data/lazylead.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -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.7.2"
35
+ s.version = "0.9.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.7.2!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.9.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
@@ -55,10 +55,10 @@ tasks instead of solving technical problems."
55
55
  s.test_files = s.files.grep(%r{^(test|features)/})
56
56
  s.rdoc_options = ["--charset=UTF-8"]
57
57
  s.extra_rdoc_files = %w[readme.md license.txt]
58
- s.add_runtime_dependency "activerecord", "6.1.1"
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.3.0"
61
+ s.add_runtime_dependency "faraday", "1.4.1"
62
62
  s.add_runtime_dependency "get_process_mem", "0.2.7"
63
63
  s.add_runtime_dependency "inifile", "3.0.0"
64
64
  s.add_runtime_dependency "jira-ruby", "2.1.5"
@@ -67,8 +67,9 @@ tasks instead of solving technical problems."
67
67
  s.add_runtime_dependency "mail", "2.7.1"
68
68
  s.add_runtime_dependency "memory_profiler", "1.0.0"
69
69
  s.add_runtime_dependency "openssl", "2.1.2"
70
- s.add_runtime_dependency "railties", "6.1.1"
70
+ s.add_runtime_dependency "railties", "6.1.3"
71
71
  s.add_runtime_dependency "require_all", "3.0.0"
72
+ s.add_runtime_dependency "rubyzip", "2.3.0"
72
73
  s.add_runtime_dependency "rufus-scheduler", "3.7.0"
73
74
  s.add_runtime_dependency "slop", "4.8.2"
74
75
  s.add_runtime_dependency "sqlite3", "1.4.2"
@@ -77,11 +78,11 @@ tasks instead of solving technical problems."
77
78
  s.add_runtime_dependency "tzinfo", "2.0.4"
78
79
  s.add_runtime_dependency "tzinfo-data", "1.2021.1"
79
80
  s.add_runtime_dependency "vcs4sql", "0.1.1"
80
- s.add_runtime_dependency "viewpoint", "1.1.0"
81
- s.add_development_dependency "codecov", "0.4.1"
81
+ s.add_runtime_dependency "viewpoint", "1.1.1"
82
+ s.add_development_dependency "codecov", "0.5.1"
82
83
  s.add_development_dependency "guard", "2.16.2"
83
84
  s.add_development_dependency "guard-minitest", "2.4.6"
84
- s.add_development_dependency "minitest", "5.14.3"
85
+ s.add_development_dependency "minitest", "5.14.4"
85
86
  s.add_development_dependency "minitest-fail-fast", "0.1.0"
86
87
  s.add_development_dependency "minitest-hooks", "1.5.0"
87
88
  s.add_development_dependency "minitest-reporters", "1.4.3"
@@ -89,12 +90,12 @@ tasks instead of solving technical problems."
89
90
  s.add_development_dependency "rake", "13.0.3"
90
91
  s.add_development_dependency "random-port", "0.5.1"
91
92
  s.add_development_dependency "rdoc", "6.3.0"
92
- s.add_development_dependency "rubocop", "1.8.1"
93
- s.add_development_dependency "rubocop-minitest", "0.10.3"
94
- s.add_development_dependency "rubocop-performance", "1.9.2"
93
+ s.add_development_dependency "rubocop", "1.13.0"
94
+ s.add_development_dependency "rubocop-minitest", "0.11.1"
95
+ s.add_development_dependency "rubocop-performance", "1.11.0"
95
96
  s.add_development_dependency "rubocop-rake", "0.5.1"
96
- s.add_development_dependency "rubocop-rspec", "2.1.0"
97
- s.add_development_dependency "sqlint", "0.1.10"
97
+ s.add_development_dependency "rubocop-rspec", "2.2.0"
98
+ s.add_development_dependency "sqlint", "0.2.0"
98
99
  s.add_development_dependency "tempfile", "0.1.1"
99
100
  s.add_development_dependency "xcop", "0.6.2"
100
101
  end
data/lib/lazylead.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -37,7 +37,7 @@ require_relative "lazylead/system/jira"
37
37
  require_relative "lazylead/system/empty"
38
38
  require_relative "lazylead/system/fake"
39
39
  require_relative "lazylead/system/synced"
40
- require_relative "lazylead/task/alert"
40
+ require_relative "lazylead/task/alert/alert"
41
41
  require_relative "lazylead/task/confluence_ref"
42
42
  require_relative "lazylead/task/echo"
43
43
  require_relative "lazylead/task/fix_version"
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
data/lib/lazylead/cc.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -80,13 +80,11 @@ module Lazylead
80
80
  end
81
81
 
82
82
  def cc
83
- @cc ||= begin
84
- if @text.include? ","
85
- @text.split(",").map(&:strip).select { |e| e[@regxp] }
86
- elsif @text[@regxp]
87
- [@text.strip]
88
- end
89
- end
83
+ @cc ||= if @text.include? ","
84
+ @text.split(",").map(&:strip).select { |e| e[@regxp] }
85
+ elsif @text[@regxp]
86
+ [@text.strip]
87
+ end
90
88
  end
91
89
 
92
90
  def each(&block)
@@ -125,15 +123,13 @@ module Lazylead
125
123
  end
126
124
 
127
125
  def to_h
128
- @to_h ||= begin
129
- if @orig.is_a? Hash
130
- @orig.each_with_object({}) do |i, o|
131
- o[i.first] = Lazylead::PlainCC.new(i.last).cc
132
- end
133
- else
134
- {}
135
- end
136
- end
126
+ @to_h ||= if @orig.is_a? Hash
127
+ @orig.each_with_object({}) do |i, o|
128
+ o[i.first] = Lazylead::PlainCC.new(i.last).cc
129
+ end
130
+ else
131
+ {}
132
+ end
137
133
  end
138
134
  end
139
135
 
@@ -151,12 +147,10 @@ module Lazylead
151
147
  end
152
148
 
153
149
  def to_h
154
- @to_h ||= begin
155
- components.each_with_object({}) do |c, h|
156
- email = lead(c.attrs["id"])
157
- next if email.nil? || email.blank?
158
- h[c.attrs["name"]] = email
159
- end
150
+ @to_h ||= components.each_with_object({}) do |c, h|
151
+ email = lead(c.attrs["id"])
152
+ next if email.nil? || email.blank?
153
+ h[c.attrs["name"]] = email
160
154
  end
161
155
  end
162
156
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
data/lib/lazylead/home.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
data/lib/lazylead/log.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -74,6 +74,15 @@ module Lazylead
74
74
  )
75
75
  )
76
76
 
77
+ if ARGV.include? "--log-file"
78
+ name = ARGV[ARGV.find_index("--log-file") + 1]
79
+ age = "daily"
80
+ age = ARGV[ARGV.find_index("--rolling-age") + 1] if ARGV.include? "--rolling-age"
81
+ files = 7
82
+ files = ARGV[ARGV.find_index("--rolling-files") + 1] if ARGV.include? "--rolling-files"
83
+ FILE_APPENDER = Logging.appenders.rolling_file("file", filename: name, age: age, keep: files)
84
+ end
85
+
77
86
  # Nothing to log
78
87
  NOTHING = Logging.logger["nothing"]
79
88
  NOTHING.level = :off
@@ -83,12 +92,14 @@ module Lazylead
83
92
  DEBUG = Logging.logger["debug"]
84
93
  DEBUG.level = :debug
85
94
  DEBUG.add_appenders "stdout"
95
+ DEBUG.add_appenders(FILE_APPENDER) if ARGV.include? "--log-file"
86
96
  DEBUG.freeze
87
97
 
88
98
  # Alerts/errors
89
99
  ERRORS = Logging.logger["errors"]
90
100
  ERRORS.level = :error
91
101
  ERRORS.add_appenders "stdout"
102
+ ERRORS.add_appenders(FILE_APPENDER) if ARGV.include? "--log-file"
92
103
  ERRORS.freeze
93
104
  end
94
105
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -135,13 +135,11 @@ module Lazylead
135
135
  end
136
136
 
137
137
  def props
138
- @props ||= begin
139
- if team.nil?
140
- Opts.new(env(to_hash))
141
- else
142
- Opts.new(env(team.to_hash.merge(to_hash)))
143
- end
144
- end
138
+ @props ||= if team.nil?
139
+ Opts.new(env(to_hash))
140
+ else
141
+ Opts.new(env(team.to_hash.merge(to_hash)))
142
+ end
145
143
  end
146
144
 
147
145
  def postman
data/lib/lazylead/opts.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # The MIT License
4
4
  #
5
- # Copyright (c) 2019-2020 Yurii Dubinka
5
+ # Copyright (c) 2019-2021 Yurii Dubinka
6
6
  #
7
7
  # Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  # of this software and associated documentation files (the "Software"),
@@ -34,8 +34,7 @@ module Lazylead
34
34
  # License:: MIT
35
35
  class Opts
36
36
  extend Forwardable
37
- def_delegators :@origin, :[], :[]=, :to_s, :key?, :fetch, :except, :each,
38
- :each_pair, :sort_by
37
+ def_delegators :@origin, :[], :[]=, :to_s, :key?, :fetch, :except, :each, :each_pair, :sort_by
39
38
 
40
39
  def initialize(origin = {})
41
40
  @origin = origin
@@ -139,5 +138,9 @@ module Lazylead
139
138
  def numeric?(key)
140
139
  to_h[key].to_i.positive?
141
140
  end
141
+
142
+ def construct(field, delim: ",")
143
+ slice(field, delim).map(&:constantize).map(&:new)
144
+ end
142
145
  end
143
146
  end