rumble 0.3.6 → 0.3.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a51ccba36574785b8dd2d788a488ae07e75b0f3
4
- data.tar.gz: 48a6bbca56edc2f794d51c8f23a86229921ab7ca
3
+ metadata.gz: 8444dbb9ae57fe4dfab417bf1c7da4a84277bfe9
4
+ data.tar.gz: 8168715865ba5aace082354653b35775bb900c95
5
5
  SHA512:
6
- metadata.gz: cfe39e14f40697abba205537d122e9ee97fa6ca7596458e290468f09c169cdf6049f76d7b2bb0160b0a81844d860c2b63bd32688b01be5d4231cca207bcf06fe
7
- data.tar.gz: d538aeeaa7b00470a2253bc58ec20c6f8da2af3c23af42ae9e5598ca56e33d52a222f983218c269cf5df437af9873451f2ec79d5508af2afaf876ea7555e142a
6
+ metadata.gz: f9b0ca6cce0f5795e05b938d79b70d41e826cd39c526678835c3ea5462e91aaeec84fab5e521ea875ed297959e9cacb102d968fc9552281fe8b8ea9e5730a5d1
7
+ data.tar.gz: 8a597a9124e33c1866751d39635c545f83b584d8dde02a46b65142f762c7d222612f96d5f86fe0b51c96fa74ffc939a8787b8f5dcb031354bffb6aec393bf30c
data/bin/rumble CHANGED
@@ -55,7 +55,7 @@ begin
55
55
  'Full SMTP From field, e.g. "John Doe <jd@example.com>"',
56
56
  required: true
57
57
  o.string '--host', 'SMTP host name', required: true
58
- o.string '--port', 'SMTP port number', default: 25
58
+ o.string '--port', 'SMTP port number (25 by default)', default: 25
59
59
  o.string '--user', 'SMTP user name', required: true
60
60
  o.string '--password', 'SMTP password', required: true
61
61
  o.string '--subject', 'Email subject', required: true
@@ -64,9 +64,9 @@ begin
64
64
  o.string '--resume', 'Email address from which we should resume'
65
65
  o.string '--skip', 'File name with emails that opted-out (black list)'
66
66
  o.string '--test', 'Email address to use instead of the real user list'
67
- o.string '--col0', 'First name columm', default: 0
68
- o.string '--col1', 'Last name columm', default: 1
69
- o.string '--col2', 'Email columm', default: 2
67
+ o.string '--col-first', 'First name columm (0 by default)', default: 0
68
+ o.string '--col-last', 'Last name columm (1 by default)', default: 1
69
+ o.string '--col-email', 'Email columm (2 by default)', default: 2
70
70
  end
71
71
  rescue Slop::Error => ex
72
72
  raise StandardError, "#{ex.message}, try --help"
data/lib/rumble.rb CHANGED
@@ -44,7 +44,11 @@ module Rumble
44
44
  )
45
45
  skip = @opts[:skip] ? File.readlines(@opts[:skip]).map(&:strip) : []
46
46
  if @opts[:test]
47
- emails = [['John', 'Doe', @opts[:test]]]
47
+ rcpt = []
48
+ rcpt[@opts['col-first'].to_i] = 'John'
49
+ rcpt[@opts['col-last'].to_i] = 'Doe'
50
+ rcpt[@opts['col-email'].to_i] = @opts[:test]
51
+ emails = [rcpt]
48
52
  else
49
53
  raise '--csv is required' unless @opts[:csv]
50
54
  emails = CSV.read(@opts[:csv])
@@ -56,19 +60,21 @@ module Rumble
56
60
  puts "Sending #{emails.length} email(s) as #{from}"
57
61
  domain = from.strip.gsub(/^.+@|>$/)
58
62
  emails.each do |array|
59
- first = (array[@opts[:col0].to_i] || '').strip
60
- last = (array[@opts[:col1].to_i] || '').strip
61
- email = array[@opts[:col2].to_i]
63
+ email = array[@opts['col-email'].to_i]
62
64
  unless email
63
- puts Rainbow('Email is absent').red
65
+ puts "Email is #{Rainbow('absent').red} \
66
+ at the column ##{@opts['col-email'].to_i}: #{array}"
64
67
  next
65
68
  end
66
69
  email = email.strip.downcase
67
70
  if sent.include?(email)
68
- puts Rainbow('duplicate').red
71
+ puts "#{Rainbow('Duplicate').red} at: #{array}"
69
72
  next
70
73
  end
71
74
  sent.push(email)
75
+ first = (array[@opts['col-first'].to_i] || '').strip
76
+ last = (array[@opts['col-last'].to_i] || '').strip
77
+ first, last = first.split(' ', 2) if last.empty? && first.include?(' ')
72
78
  name = "#{first.strip} #{last.strip}".strip
73
79
  address = email
74
80
  address = "#{name} <#{email}>" unless name.empty?
@@ -82,7 +88,7 @@ module Rumble
82
88
  .render(markdown)
83
89
  if ignore
84
90
  if @opts[:resume].downcase != email
85
- puts "ignored, waiting for #{@opts[:resume]}"
91
+ puts "#{Rainbow('ignored').orange}, waiting for #{@opts[:resume]}"
86
92
  next
87
93
  end
88
94
  ignore = false
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Rumble
26
- VERSION = '0.3.6'.freeze
26
+ VERSION = '0.3.7'.freeze
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumble
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-12 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid