lazylead 0.5.2 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +7 -2
  3. data/.docker/Dockerfile +17 -6
  4. data/.rubocop.yml +102 -1
  5. data/.simplecov +1 -1
  6. data/Guardfile +1 -1
  7. data/Rakefile +6 -3
  8. data/bin/lazylead +3 -1
  9. data/lazylead.gemspec +31 -26
  10. data/lib/lazylead/cc.rb +21 -20
  11. data/lib/lazylead/cli/app.rb +8 -3
  12. data/lib/lazylead/confluence.rb +9 -2
  13. data/lib/lazylead/email.rb +0 -20
  14. data/lib/lazylead/exchange.rb +16 -28
  15. data/lib/lazylead/model.rb +31 -16
  16. data/lib/lazylead/opts.rb +65 -2
  17. data/lib/lazylead/postman.rb +13 -17
  18. data/lib/lazylead/salt.rb +1 -0
  19. data/lib/lazylead/system/jira.rb +30 -6
  20. data/lib/lazylead/task/accuracy/accuracy.rb +10 -14
  21. data/lib/lazylead/task/accuracy/attachment.rb +2 -6
  22. data/lib/lazylead/task/accuracy/logs.rb +9 -5
  23. data/lib/lazylead/task/accuracy/onlyll.rb +147 -0
  24. data/lib/lazylead/task/accuracy/records.rb +1 -1
  25. data/lib/lazylead/task/accuracy/servers.rb +16 -7
  26. data/lib/lazylead/task/accuracy/stacktrace.rb +50 -10
  27. data/lib/lazylead/task/accuracy/testcase.rb +16 -9
  28. data/lib/lazylead/task/assignment.rb +96 -0
  29. data/lib/lazylead/task/fix_version.rb +6 -0
  30. data/lib/lazylead/task/propagate_down.rb +1 -1
  31. data/lib/lazylead/task/svn/diff.rb +77 -0
  32. data/lib/lazylead/task/svn/grep.rb +139 -0
  33. data/lib/lazylead/task/svn/touch.rb +99 -0
  34. data/lib/lazylead/version.rb +1 -1
  35. data/lib/messages/illegal_assignee_change.erb +123 -0
  36. data/lib/messages/illegal_fixversion_change.erb +8 -0
  37. data/lib/messages/only_ll.erb +107 -0
  38. data/lib/messages/svn_diff.erb +110 -0
  39. data/lib/messages/{svn_log.erb → svn_diff_attachment.erb} +19 -9
  40. data/lib/messages/svn_grep.erb +114 -0
  41. data/test/lazylead/cc_test.rb +1 -0
  42. data/test/lazylead/model_test.rb +20 -0
  43. data/test/lazylead/opts_test.rb +47 -0
  44. data/test/lazylead/postman_test.rb +8 -5
  45. data/test/lazylead/smoke_test.rb +13 -0
  46. data/test/lazylead/smtp_test.rb +1 -4
  47. data/test/lazylead/system/jira_test.rb +6 -7
  48. data/test/lazylead/task/accuracy/attachment_test.rb +1 -1
  49. data/test/lazylead/task/accuracy/logs_test.rb +62 -2
  50. data/test/lazylead/task/accuracy/onlyll_test.rb +138 -0
  51. data/test/lazylead/task/accuracy/servers_test.rb +2 -2
  52. data/test/lazylead/task/accuracy/stacktrace_test.rb +227 -0
  53. data/test/lazylead/task/accuracy/testcase_test.rb +39 -0
  54. data/test/lazylead/task/assignment_test.rb +53 -0
  55. data/test/lazylead/task/duedate_test.rb +3 -10
  56. data/test/lazylead/task/fix_version_test.rb +1 -0
  57. data/test/lazylead/task/propagate_down_test.rb +4 -3
  58. data/test/lazylead/task/savepoint_test.rb +9 -6
  59. data/test/lazylead/task/svn/diff_test.rb +97 -0
  60. data/test/lazylead/task/svn/grep_test.rb +103 -0
  61. data/test/lazylead/task/{touch_test.rb → svn/touch_test.rb} +7 -34
  62. data/test/test.rb +7 -8
  63. data/upgrades/sqlite/999.testdata.sql +3 -1
  64. metadata +141 -55
  65. data/lib/lazylead/task/touch.rb +0 -119
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa4ef974cb7b4799fb96acf04912513098f53c9adbb7f2bff4ea5bd8b498fb7e
4
- data.tar.gz: e9d8aea4a9fe5da7a63e35062cd7c0ff6c7670e1645d031dc27b6cf599d71608
3
+ metadata.gz: 7fec0d2240a9c27715ef0fe82cd614844e0d5a1f3493b8c2230dcea4675f5e8f
4
+ data.tar.gz: de4ea1ea31e59c3145ca4c184c7df50b6295f68180242db0be23eaa7fbf20c21
5
5
  SHA512:
6
- metadata.gz: 897ee5e71b3eb970246cdeca00179b27d0d906e8e457dc384a2b79e25ed1a746f785ebb5981a7deb458aaef78428c6ae63025e42579daea160f3463eb611b455
7
- data.tar.gz: 39850bcbb8e33239d8a5ab74a291f4ec4332067573ee3287775ad3c33c0210faf801358472ff9fc7b1dd531e6aedafc90e5393cf57ee04b32d5a6af120c02bc0
6
+ metadata.gz: 56b73423b8d4d0ab2ba8daa084f24792f418fa14e5ad68b3443c4f3ee23b463b5b69462d2bbe5085259183768b23d00b4d6bdfa0d018910a8becd2a0bf47e729
7
+ data.tar.gz: 51586cfd51223b8dfb6a1dfa7893c9018587bc0339212f757b94d05bfa88f5fa73aafee4c5c9073e0f62cd08eaa8afd20a2657172395cdf8d7ed3031aadd23aa
@@ -22,7 +22,9 @@ jobs:
22
22
  set -e
23
23
  COMMIT_URL="https://github.com/dgroup/lazylead/commit/${CIRCLE_SHA1}"
24
24
  sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" lib/lazylead/version.rb
25
- docker build --build-arg release_tags="${CIRCLE_SHA1}, ${CIRCLE_BRANCH}, ${COMMIT_URL}" --build-arg version="${DOCKER_RELEASE_TAGS:7}" \
25
+ docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
26
+ --build-arg VCS_REF=`git rev-parse --short HEAD` \
27
+ --build-arg version=${DOCKER_RELEASE_TAGS} \
26
28
  -t dgroup/lazylead:$CIRCLE_BRANCH . \
27
29
  -f .docker/Dockerfile
28
30
  echo "Available LL images:"
@@ -42,7 +44,10 @@ jobs:
42
44
  command: |
43
45
  sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" .docker/vcs.dockerfile
44
46
  sed -i "s/0\.0\.0/${DOCKER_RELEASE_TAGS}/g" lib/lazylead/version.rb
45
- docker build -t dgroup/lazylead:${DOCKER_RELEASE_TAGS}-vcs . -f .docker/vcs.dockerfile
47
+ docker build -t dgroup/lazylead:${DOCKER_RELEASE_TAGS}-vcs . -f .docker/vcs.dockerfile \
48
+ --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
49
+ --build-arg VCS_REF=`git rev-parse --short HEAD` \
50
+ --build-arg version=${DOCKER_RELEASE_TAGS}
46
51
  docker push dgroup/lazylead:${DOCKER_RELEASE_TAGS}-vcs
47
52
  - run:
48
53
  name: "Reset tag to master"
@@ -1,14 +1,25 @@
1
1
  FROM ruby:2.6.5-alpine
2
2
 
3
- ARG release_tags
4
3
  ARG version
5
-
6
- LABEL about="https://github.com/dgroup/lazylead" \
7
- ci.contact="yurii.dubinka@gmail.com" \
8
- ci.release.tag="${release_tags}" \
9
- ll.docker.issues="https://github.com/dgroup/lazylead/issues?utf8=✓&q=label%3Adocker"
4
+ ARG BUILD_DATE
5
+ ARG VCS_REF
6
+
7
+ LABEL ll.docker.issues="https://github.com/dgroup/lazylead/issues?utf8=✓&q=label%3Adocker" \
8
+ org.label-schema.build-date=${BUILD_DATE} \
9
+ org.label-schema.name="lazylead" \
10
+ org.label-schema.description="Eliminate the annoying work within ticketing systems (Jira, GitHub, Trello). Allows automating (without admin access) daily actions like tickets fields verification, email notifications by JQL/GQL, meeting requests to your (or teammates) calendar." \
11
+ org.label-schema.url="https://lazylead.org/" \
12
+ org.label-schema.vcs-ref=${VCS_REF} \
13
+ org.label-schema.vcs-url="https://github.com/dgroup/lazylead" \
14
+ org.label-schema.vendor="Yurii Dubinka" \
15
+ org.label-schema.version=${version} \
16
+ org.label-schema.schema-version="1.0"
10
17
 
11
18
  ENV APP_HOME=/lazylead
19
+ ENV VERSION=${version}
20
+ ENV VCS_REF=${VCS_REF}
21
+ ENV COMMIT_URL="https://github.com/dgroup/lazylead/commit/${VCS_REF}"
22
+ ENV BUILD_DATE=${BUILD_DATE}
12
23
 
13
24
  WORKDIR $APP_HOME
14
25
 
@@ -16,10 +16,13 @@ Layout/LineLength:
16
16
  - "test/**/*"
17
17
 
18
18
  Metrics/AbcSize:
19
- Max: 20
19
+ Max: 21
20
20
  Exclude:
21
21
  - "test/**/*"
22
22
 
23
+ Metrics/CyclomaticComplexity:
24
+ Max: 8
25
+
23
26
  Metrics/BlockLength:
24
27
  Exclude:
25
28
  - "*.gemspec"
@@ -91,3 +94,101 @@ Lint/StructNewOverride:
91
94
 
92
95
  # @todo #/DEV Add violation regarding methods without documentation using RDoc
93
96
  # https://stackoverflow.com/questions/1681467/how-to-document-ruby-code
97
+
98
+ Layout/SpaceBeforeBrackets: # (new in 1.7)
99
+ Enabled: true
100
+ Lint/AmbiguousAssignment: # (new in 1.7)
101
+ Enabled: true
102
+ Lint/DeprecatedConstants: # (new in 1.8)
103
+ Enabled: true
104
+ Lint/DuplicateBranch: # (new in 1.3)
105
+ Enabled: true
106
+ Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
107
+ Enabled: true
108
+ Lint/EmptyBlock: # (new in 1.1)
109
+ Enabled: true
110
+ Lint/EmptyClass: # (new in 1.3)
111
+ Enabled: true
112
+ Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
113
+ Enabled: true
114
+ Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
115
+ Enabled: true
116
+ Lint/RedundantDirGlobSort: # (new in 1.8)
117
+ Enabled: true
118
+ Lint/ToEnumArguments: # (new in 1.1)
119
+ Enabled: true
120
+ Lint/UnexpectedBlockArity: # (new in 1.5)
121
+ Enabled: true
122
+ Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
123
+ Enabled: true
124
+ Style/ArgumentsForwarding: # (new in 1.1)
125
+ Enabled: true
126
+ Style/CollectionCompact: # (new in 1.2)
127
+ Enabled: true
128
+ Style/DocumentDynamicEvalDefinition: # (new in 1.1)
129
+ Enabled: true
130
+ Style/EndlessMethod: # (new in 1.8)
131
+ Enabled: true
132
+ Style/HashExcept: # (new in 1.7)
133
+ Enabled: true
134
+ Style/NegatedIfElseCondition: # (new in 1.2)
135
+ Enabled: true
136
+ Style/NilLambda: # (new in 1.3)
137
+ Enabled: true
138
+ Style/RedundantArgument: # (new in 1.4)
139
+ Enabled: true
140
+ Style/SwapValues: # (new in 1.1)
141
+ Enabled: true
142
+
143
+ Minitest/AssertInDelta: # (new in 0.10)
144
+ Enabled: true
145
+ Minitest/AssertionInLifecycleHook: # (new in 0.10)
146
+ Enabled: true
147
+ Minitest/AssertKindOf: # (new in 0.10)
148
+ Enabled: true
149
+ Minitest/AssertOutput: # (new in 0.10)
150
+ Enabled: true
151
+ Minitest/AssertPathExists: # (new in 0.10)
152
+ Enabled: true
153
+ Minitest/AssertSilent: # (new in 0.10)
154
+ Enabled: true
155
+ Minitest/LiteralAsActualArgument: # (new in 0.10)
156
+ Enabled: true
157
+ Minitest/MultipleAssertions: # (new in 0.10)
158
+ Enabled: true
159
+ Minitest/RefuteInDelta: # (new in 0.10)
160
+ Enabled: true
161
+ Minitest/RefuteKindOf: # (new in 0.10)
162
+ Enabled: true
163
+ Minitest/RefutePathExists: # (new in 0.10)
164
+ Enabled: true
165
+ Minitest/TestMethodName: # (new in 0.10)
166
+ Enabled: true
167
+ Minitest/UnspecifiedException: # (new in 0.10)
168
+ Enabled: true
169
+ Performance/AncestorsInclude: # (new in 1.7)
170
+ Enabled: true
171
+ Performance/BigDecimalWithNumericArgument: # (new in 1.7)
172
+ Enabled: true
173
+ Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
174
+ Enabled: true
175
+ Performance/CollectionLiteralInLoop: # (new in 1.8)
176
+ Enabled: true
177
+ Performance/ConstantRegexp: # (new in 1.9)
178
+ Enabled: true
179
+ Performance/MethodObjectAsBlock: # (new in 1.9)
180
+ Enabled: true
181
+ Performance/RedundantSortBlock: # (new in 1.7)
182
+ Enabled: true
183
+ Performance/RedundantStringChars: # (new in 1.7)
184
+ Enabled: true
185
+ Performance/ReverseFirst: # (new in 1.7)
186
+ Enabled: true
187
+ Performance/SortReverse: # (new in 1.7)
188
+ Enabled: true
189
+ Performance/Squeeze: # (new in 1.7)
190
+ Enabled: true
191
+ Performance/StringInclude: # (new in 1.7)
192
+ Enabled: true
193
+ Performance/Sum: # (new in 1.8)
194
+ Enabled: true
data/.simplecov CHANGED
@@ -1,4 +1,4 @@
1
- # encoding: utf-8
1
+ # frozen_string_literal: true
2
2
 
3
3
  SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
4
4
  [SimpleCov::Formatter::HTMLFormatter]
data/Guardfile CHANGED
@@ -25,7 +25,7 @@
25
25
  # Guardfile for Lazylead
26
26
  guard :minitest, all_after_pass: false, all_on_start: false do
27
27
  # with Minitest::Unit
28
- watch(%r{^test/(.*)\/?test_(.*)\.rb$})
28
+ watch(%r{^test/(.*)/?test_(.*)\.rb$})
29
29
  watch(%r{^test/test\.rb$}) { "test" }
30
30
  watch(%r{^lib/lazylead/(.*/)?([^/]+)\.rb$}) do |m|
31
31
  "test/#{m[1]}test_#{m[2]}.rb"
data/Rakefile CHANGED
@@ -125,9 +125,12 @@ end
125
125
 
126
126
  task :docker do
127
127
  puts "Building docker image..."
128
- system "docker-compose -f .docker/docker-compose.yml build "\
129
- " --build-arg release_tags='latest 1.0'"\
130
- " --build-arg version=1.0"
128
+ system <<~CMD
129
+ docker-compose -f .docker/docker-compose.yml build \
130
+ --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
131
+ --build-arg VCS_REF=`git rev-parse --short HEAD` \
132
+ --build-arg version=1.0
133
+ CMD
131
134
  system "docker-compose -f .docker/docker-compose.yml rm --force -s lazylead"
132
135
  system "docker-compose -f .docker/docker-compose.yml up"
133
136
  end
@@ -25,11 +25,12 @@
25
25
 
26
26
  # When sync mode is true, all output is immediately flushed
27
27
  # to the underlying operating system and is not buffered internally.
28
- STDOUT.sync = true
28
+ $stdout.sync = true
29
29
 
30
30
  require "slop"
31
31
  require "sqlite3"
32
32
  require "colorize"
33
+ require "inifile"
33
34
  require "logging"
34
35
  require "backtrace"
35
36
  require "memory_profiler"
@@ -81,6 +82,7 @@ log.debug "Version: #{Lazylead::VERSION.colorize(:green)}"
81
82
  log.debug "Memory footprint at start is " \
82
83
  "#{Lazylead::Allocated.new.to_s.colorize(:light_blue)}."
83
84
  cmd = lambda do
85
+ IniFile.new(filename: "lazylead.ini").each { |_, k, v| ENV[k] = v }
84
86
  Lazylead::CLI::App.new(
85
87
  log,
86
88
  Lazylead::Schedule.new(log: log),
@@ -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.5.2"
35
+ s.version = "0.7.1"
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.5.2!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.7.1!
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,41 +55,46 @@ 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.0.3"
58
+ s.add_runtime_dependency "activerecord", "6.1.1"
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.0.1"
62
- s.add_runtime_dependency "get_process_mem", "0.2.5"
63
- s.add_runtime_dependency "jira-ruby", "1.7.1"
64
- s.add_runtime_dependency "json", "2.3.0"
65
- s.add_runtime_dependency "logging", "2.2.2"
61
+ s.add_runtime_dependency "faraday", "1.3.0"
62
+ s.add_runtime_dependency "get_process_mem", "0.2.7"
63
+ s.add_runtime_dependency "inifile", "3.0.0"
64
+ s.add_runtime_dependency "jira-ruby", "2.1.4"
65
+ s.add_runtime_dependency "json", "2.5.1"
66
+ s.add_runtime_dependency "logging", "2.3.0"
66
67
  s.add_runtime_dependency "mail", "2.7.1"
67
- s.add_runtime_dependency "memory_profiler", "0.9.13"
68
+ s.add_runtime_dependency "memory_profiler", "1.0.0"
68
69
  s.add_runtime_dependency "openssl", "2.1.2"
70
+ s.add_runtime_dependency "railties", "6.1.1"
69
71
  s.add_runtime_dependency "require_all", "3.0.0"
70
- s.add_runtime_dependency "rufus-scheduler", "3.6.0"
71
- s.add_runtime_dependency "slop", "4.4"
72
+ s.add_runtime_dependency "rufus-scheduler", "3.7.0"
73
+ s.add_runtime_dependency "slop", "4.8.2"
72
74
  s.add_runtime_dependency "sqlite3", "1.4.2"
75
+ s.add_runtime_dependency "tempfile", "0.1.1"
73
76
  s.add_runtime_dependency "tilt", "2.0.10"
74
- s.add_runtime_dependency "tzinfo", "1.1"
75
- s.add_runtime_dependency "tzinfo-data", "1.2019.3"
76
- s.add_runtime_dependency "vcs4sql", "0.1.0"
77
+ s.add_runtime_dependency "tzinfo", "2.0.4"
78
+ s.add_runtime_dependency "tzinfo-data", "1.2020.6"
79
+ s.add_runtime_dependency "vcs4sql", "0.1.1"
77
80
  s.add_runtime_dependency "viewpoint", "1.1.0"
78
- s.add_development_dependency "codecov", "0.2.3"
79
- s.add_development_dependency "guard", "2.15.0"
81
+ s.add_development_dependency "codecov", "0.3.0"
82
+ s.add_development_dependency "guard", "2.16.2"
80
83
  s.add_development_dependency "guard-minitest", "2.4.6"
81
- s.add_development_dependency "minitest", "5.11.3"
84
+ s.add_development_dependency "minitest", "5.14.3"
82
85
  s.add_development_dependency "minitest-fail-fast", "0.1.0"
83
86
  s.add_development_dependency "minitest-hooks", "1.5.0"
84
- s.add_development_dependency "minitest-reporters", "1.3.6"
87
+ s.add_development_dependency "minitest-reporters", "1.4.2"
85
88
  s.add_development_dependency "net-ping", "2.0.8"
86
- s.add_development_dependency "rake", "12.3.3"
87
- s.add_development_dependency "random-port", "0.3.1"
88
- s.add_development_dependency "rdoc", "6.1.1"
89
- s.add_development_dependency "rubocop", "0.82"
90
- s.add_development_dependency "rubocop-minitest", "0.5.1"
91
- s.add_development_dependency "rubocop-performance", "1.5.2"
92
- s.add_development_dependency "rubocop-rspec", "1.33.0"
89
+ s.add_development_dependency "rake", "13.0.3"
90
+ s.add_development_dependency "random-port", "0.5.1"
91
+ 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"
95
+ s.add_development_dependency "rubocop-rake", "0.5.1"
96
+ s.add_development_dependency "rubocop-rspec", "2.1.0"
93
97
  s.add_development_dependency "sqlint", "0.1.10"
94
- s.add_development_dependency "xcop", "0.6"
98
+ s.add_development_dependency "tempfile", "0.1.1"
99
+ s.add_development_dependency "xcop", "0.6.2"
95
100
  end
@@ -81,12 +81,12 @@ module Lazylead
81
81
 
82
82
  def cc
83
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
84
+ if @text.include? ","
85
+ @text.split(",").map(&:strip).select { |e| e[@regxp] }
86
+ elsif @text[@regxp]
87
+ [@text.strip]
88
+ end
89
+ end
90
90
  end
91
91
 
92
92
  def each(&block)
@@ -126,14 +126,14 @@ module Lazylead
126
126
 
127
127
  def to_h
128
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
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
137
137
  end
138
138
  end
139
139
 
@@ -145,18 +145,19 @@ module Lazylead
145
145
  # License:: MIT
146
146
  class ComponentCC < Lazylead::PredefinedCC
147
147
  def initialize(prj, jira)
148
+ super({})
148
149
  @prj = prj
149
150
  @jira = jira
150
151
  end
151
152
 
152
153
  def to_h
153
154
  @to_h ||= begin
154
- components.each_with_object({}) do |c, h|
155
- email = lead(c.attrs["id"])
156
- next if email.nil? || email.blank?
157
- h[c.attrs["name"]] = email
158
- end
159
- end
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
160
+ end
160
161
  end
161
162
 
162
163
  private
@@ -57,8 +57,8 @@ module Lazylead
57
57
  private
58
58
 
59
59
  def apply_vcs_migration(opts)
60
- @db = File.expand_path(opts[:home]) + "/" + opts[:sqlite]
61
- vcs = File.expand_path(opts[:home]) + "/" + opts[:vcs4sql]
60
+ @db = "#{File.expand_path(opts[:home])}/#{opts[:sqlite]}"
61
+ vcs = "#{File.expand_path(opts[:home])}/#{opts[:vcs4sql]}"
62
62
  @log.debug "Database: '#{@db.colorize(:light_blue)}', "\
63
63
  "sql migration dir: '#{vcs.colorize(:light_blue)}'"
64
64
  Vcs4sql::Sqlite::Migration.new(@db).upgrade vcs, opts[:testdata]
@@ -81,7 +81,12 @@ module Lazylead
81
81
  @log.warn "ll-001: No tasks found."
82
82
  else
83
83
  todo.find_each do |task|
84
- @schedule.register task
84
+ if task.to_h?
85
+ @schedule.register task
86
+ else
87
+ @log.warn "ll-011: Scheduling skipped due to configuration " \
88
+ "mistake in #{task}"
89
+ end
85
90
  end
86
91
  @schedule.join
87
92
  end
@@ -104,16 +104,23 @@ module Lazylead
104
104
  end
105
105
 
106
106
  # Detect links mentioned in ticket comments
107
+ # @todo #/DEV Refactor this method in order to make it more human-readable and remove the
108
+ # suppresion below
109
+ #
110
+ # rubocop:disable Metrics/CyclomaticComplexity
111
+ # rubocop:disable Metrics/PerceivedComplexity
107
112
  def mentioned_links(ticket)
108
113
  ticket.comments
109
114
  .map { |cmnt| cmnt.attrs["body"] }
110
115
  .select { |cmnt| @confl.any? { |c| cmnt.include? c.url } }
111
- .flat_map { |cmnt| cmnt.split " " }
116
+ .flat_map(&:split)
112
117
  .select { |cmnt| @confl.any? { |c| cmnt.start_with? c.url } }
113
- .map(&method(:to_page_id))
118
+ .map { |url| to_page_id(url) }
114
119
  .reject(&:blank?)
115
120
  .uniq
116
121
  end
122
+ # rubocop:enable Metrics/CyclomaticComplexity
123
+ # rubocop:enable Metrics/PerceivedComplexity
117
124
 
118
125
  # Convert confluence page url to the following format:
119
126
  # http://confluence.com/pages/viewpage.action?pageId=xxxxx
@@ -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.