lazylead 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b58ee14de8c573012698a15d145941155e6c282249bc2938bf4938c4e677d7cd
4
- data.tar.gz: 34bed5a73b2186b9e229a121973ad11891037d604faa0134fe31d5a9380ead6a
3
+ metadata.gz: aa4ef974cb7b4799fb96acf04912513098f53c9adbb7f2bff4ea5bd8b498fb7e
4
+ data.tar.gz: e9d8aea4a9fe5da7a63e35062cd7c0ff6c7670e1645d031dc27b6cf599d71608
5
5
  SHA512:
6
- metadata.gz: f1a8e4032492f97b2672078c908f37599f3d32a01bf31d7a67911732b90f682410123fb1234e07315b9ccd6d4e675e4b9d4867e06f265c06ace44f33c7d1cb1f
7
- data.tar.gz: 22f2d3fb9b3ed8a8bb9e2e8f6f29393f65e2ab6bea033c9f0f82741775032098383614f280433f64fcd16dbd6ab6c4c46115b197307c684a9c03ffc736b95714
6
+ metadata.gz: 897ee5e71b3eb970246cdeca00179b27d0d906e8e457dc384a2b79e25ed1a746f785ebb5981a7deb458aaef78428c6ae63025e42579daea160f3463eb611b455
7
+ data.tar.gz: 39850bcbb8e33239d8a5ab74a291f4ec4332067573ee3287775ad3c33c0210faf801358472ff9fc7b1dd531e6aedafc90e5393cf57ee04b32d5a6af120c02bc0
data/Rakefile CHANGED
@@ -26,7 +26,7 @@ require "rubygems"
26
26
  require "rake"
27
27
  require "date"
28
28
  require "rdoc"
29
- require "rainbow"
29
+ require "colorize"
30
30
  require "rake/clean"
31
31
 
32
32
  # @todo #/DEV Investigate the possibility of using migrations from active_record
@@ -112,9 +112,10 @@ task :sqlint do
112
112
  total += violations.count { |lint| lint.type == :error }
113
113
  end
114
114
  if total.positive?
115
- abort "#{Rainbow(total).red} SQL violations found."
115
+ abort "#{total.colorize(:red)} SQL violations found."
116
116
  else
117
- puts "#{src.size} files inspected, #{Rainbow('no offenses').green} detected"
117
+ puts "#{src.size} files inspected, #{'no offenses'.colorize(:green)} " \
118
+ "detected"
118
119
  end
119
120
  end
120
121
 
@@ -29,7 +29,7 @@ STDOUT.sync = true
29
29
 
30
30
  require "slop"
31
31
  require "sqlite3"
32
- require "rainbow"
32
+ require "colorize"
33
33
  require "logging"
34
34
  require "backtrace"
35
35
  require "memory_profiler"
@@ -77,8 +77,9 @@ Available options:"
77
77
  exit
78
78
  end
79
79
  end
80
- log.debug("Version: #{Lazylead::VERSION}")
81
- log.debug("Memory footprint at start is #{Lazylead::Allocated.new}")
80
+ log.debug "Version: #{Lazylead::VERSION.colorize(:green)}"
81
+ log.debug "Memory footprint at start is " \
82
+ "#{Lazylead::Allocated.new.to_s.colorize(:light_blue)}."
82
83
  cmd = lambda do
83
84
  Lazylead::CLI::App.new(
84
85
  log,
@@ -103,5 +104,6 @@ if opts["memory-dump"]
103
104
  else
104
105
  code = cmd.call
105
106
  end
106
- log.debug("Memory footprint at the end is #{Lazylead::Allocated.new}")
107
+ log.debug "Memory footprint at the end is " \
108
+ "#{Lazylead::Allocated.new.to_s.colorize(:light_blue)}."
107
109
  exit(code) unless code.zero?
@@ -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.1"
35
+ s.version = "0.5.2"
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.1!
48
+ s.post_install_message = "Thanks for installing Lazylead v0.5.2!
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
@@ -57,6 +57,7 @@ tasks instead of solving technical problems."
57
57
  s.extra_rdoc_files = %w[readme.md license.txt]
58
58
  s.add_runtime_dependency "activerecord", "6.0.3"
59
59
  s.add_runtime_dependency "backtrace", "0.3"
60
+ s.add_runtime_dependency "colorize", "0.8.1"
60
61
  s.add_runtime_dependency "faraday", "1.0.1"
61
62
  s.add_runtime_dependency "get_process_mem", "0.2.5"
62
63
  s.add_runtime_dependency "jira-ruby", "1.7.1"
@@ -65,7 +66,6 @@ tasks instead of solving technical problems."
65
66
  s.add_runtime_dependency "mail", "2.7.1"
66
67
  s.add_runtime_dependency "memory_profiler", "0.9.13"
67
68
  s.add_runtime_dependency "openssl", "2.1.2"
68
- s.add_runtime_dependency "rainbow", "3.0.0"
69
69
  s.add_runtime_dependency "require_all", "3.0.0"
70
70
  s.add_runtime_dependency "rufus-scheduler", "3.6.0"
71
71
  s.add_runtime_dependency "slop", "4.4"
@@ -22,6 +22,7 @@
22
22
  # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
+ require "colorize"
25
26
  require "vcs4sql/sqlite/migration"
26
27
  require_relative "../smtp"
27
28
  require_relative "../schedule"
@@ -58,9 +59,11 @@ module Lazylead
58
59
  def apply_vcs_migration(opts)
59
60
  @db = File.expand_path(opts[:home]) + "/" + opts[:sqlite]
60
61
  vcs = File.expand_path(opts[:home]) + "/" + opts[:vcs4sql]
61
- @log.debug "Database: '#{@db}', sql migration dir: '#{vcs}'"
62
+ @log.debug "Database: '#{@db.colorize(:light_blue)}', "\
63
+ "sql migration dir: '#{vcs.colorize(:light_blue)}'"
62
64
  Vcs4sql::Sqlite::Migration.new(@db).upgrade vcs, opts[:testdata]
63
- @log.debug "Migration applied to #{@db} from #{vcs}"
65
+ @log.debug "Migration applied to '#{@db.colorize(:light_blue)}' from " \
66
+ "'#{vcs.colorize(:light_blue)}'"
64
67
  end
65
68
 
66
69
  def enable_active_record(opts)
@@ -63,7 +63,7 @@ module Lazylead
63
63
  add_attachments(msg, opts)
64
64
  cli.send_message msg
65
65
  close_attachments msg
66
- @log.debug "#{__FILE__} sent email based on #{opts}."
66
+ @log.debug "#{__FILE__} sent '#{opts['subject']}' to '#{to}'."
67
67
  end
68
68
 
69
69
  def make_msg(to, opts)
@@ -23,6 +23,7 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  require "logging"
26
+ require "colorize"
26
27
  require "forwardable"
27
28
 
28
29
  module Lazylead
@@ -68,7 +69,7 @@ module Lazylead
68
69
  Logging.appenders.stdout(
69
70
  "stdout",
70
71
  layout: Logging.layouts.pattern(
71
- pattern: "[%d] %-5l [%X{tid}] %m\n",
72
+ pattern: "[%d] %-5l #{'[%X{tid}]'.colorize(:light_green)} %m\n",
72
73
  color_scheme: "bright"
73
74
  )
74
75
  )
@@ -53,19 +53,25 @@ module Lazylead
53
53
  # Send an email.
54
54
  # :opts :: the mail configuration like to, from, cc, subject, template.
55
55
  def send(opts)
56
- html = make_body(opts)
56
+ mail = make_email(opts)
57
+ mail.deliver
58
+ @log.debug "#{__FILE__} sent '#{mail.subject}' to '#{mail.to}'."
59
+ end
60
+
61
+ # Construct an email based on input arguments
62
+ def make_email(opts)
57
63
  mail = Mail.new
58
64
  mail.to opts[:to] || opts["to"]
59
65
  mail.from opts["from"]
60
66
  mail.cc opts["cc"] if opts.key? "cc"
61
67
  mail.subject opts["subject"]
68
+ html = make_body(opts)
62
69
  mail.html_part do
63
70
  content_type "text/html; charset=UTF-8"
64
71
  body html
65
72
  end
66
73
  add_attachments mail, opts
67
- mail.deliver
68
- @log.debug "#{__FILE__} sent email based on #{opts}."
74
+ mail
69
75
  end
70
76
 
71
77
  def add_attachments(mail, opts)
@@ -23,6 +23,7 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  require "mail"
26
+ require "colorize"
26
27
  require_relative "log"
27
28
  require_relative "salt"
28
29
 
@@ -45,7 +46,8 @@ module Lazylead
45
46
  Mail.defaults do
46
47
  delivery_method :test
47
48
  end
48
- @log.warn "SMTP connection enabled in test mode."
49
+ @log.warn "SMTP connection enabled in " \
50
+ "#{'test'.colorize(:light_yellow)} mode."
49
51
  else
50
52
  setup_smtp
51
53
  end
@@ -237,6 +237,7 @@ module Lazylead
237
237
 
238
238
  def add_label(label, *more)
239
239
  lbl = labels
240
+ lbl = [] if lbl.nil?
240
241
  lbl << label
241
242
  lbl += more if more.size.positive?
242
243
  save!("fields" => { "labels" => lbl.uniq })
@@ -34,7 +34,7 @@ module Lazylead
34
34
  @ext = %w[.webm .mkv .flv .flv .vob .ogv .ogg .drc .gif .gifv .mng .avi
35
35
  .mts .m2ts .ts .mov .qt .wmv .yuv .rm .rmvb .viv .asf .amv .mp4
36
36
  .m4p .m4v .mpg .mp2 .mpeg .mpe .mpv .mpg .mpeg .m2v .m4v .svi
37
- .3gp .3g2 .mxf .roq .nsv .flv .f4v .f4p .f4a .f4b]
37
+ .3gp .3g2 .mxf .roq .nsv .flv .f4v .f4p .f4a .f4b .gif]
38
38
  end
39
39
 
40
40
  # Ensure that ticket has an attachment with video-file extension
@@ -38,15 +38,25 @@ module Lazylead
38
38
  return false if issue.description.nil?
39
39
  @tc = @ar = @er = -1
40
40
  issue.description.split("\n").reject(&:blank?).each_with_index do |l, i|
41
- line = l.gsub(/[^a-zA-Z(:|=)]/, "").downcase
42
- detect_tc line, i
43
- detect_ar line, i
44
- detect_er line, i
41
+ line = escape(l.strip.downcase)
42
+ detect_tc(line, i)
43
+ detect_ar(line, i)
44
+ detect_er(line, i)
45
45
  break if with_tc_ar_er?
46
46
  end
47
47
  with_tc_ar_er?
48
48
  end
49
49
 
50
+ def escape(line)
51
+ if line.include?("{color")
52
+ line.gsub(
53
+ /({color:(#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|[A-Za-z]+)})|{color}/, ""
54
+ )
55
+ else
56
+ line.gsub(/[^a-zA-Z(:|=)]/, "")
57
+ end
58
+ end
59
+
50
60
  # @return true if description has test case, AR and ER
51
61
  def with_tc_ar_er?
52
62
  (@tc.zero? || @tc.positive?) && @ar.positive? && @er.positive?
@@ -23,5 +23,5 @@
23
23
  # OR OTHER DEALINGS IN THE SOFTWARE.
24
24
 
25
25
  module Lazylead
26
- VERSION = "0.5.1"
26
+ VERSION = "0.5.2"
27
27
  end
@@ -197,6 +197,16 @@ module Lazylead
197
197
  [^screenshot-1.png]"
198
198
  end
199
199
 
200
+ test "tc with colored ar er" do
201
+ assert testcase? "*TC:*
202
+ # Step 1
203
+ # Step 2
204
+ # Step ..
205
+ # Step N
206
+ {color:#00673A}ER{color}: XXXX
207
+ {color:#DE10AA}AR{color}: YYYY"
208
+ end
209
+
200
210
  # ensure that issue description has a test case, AR and ER
201
211
  def testcase?(desc)
202
212
  Testcase.new.passed(OpenStruct.new(description: desc))
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.5.1
4
+ version: 0.5.2
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-10-08 00:00:00.000000000 Z
11
+ date: 2020-10-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
@@ -675,7 +675,7 @@ licenses:
675
675
  - MIT
676
676
  metadata: {}
677
677
  post_install_message: |-
678
- Thanks for installing Lazylead v0.5.1!
678
+ Thanks for installing Lazylead v0.5.2!
679
679
  Read our blog posts: https://lazylead.org
680
680
  Stay in touch with the community in Telegram: https://t.me/lazylead
681
681
  Follow us on Twitter: https://twitter.com/lazylead