rumble 0.4.1 → 0.5.0

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
  SHA256:
3
- metadata.gz: 377181c0985605edbac92aaae9eb75ffabb3d4b5f6f774fbbd96d5e458af0f41
4
- data.tar.gz: 8ecd2853a4fa114d0f770b83848acccfaaf6a7f0cf7daba64f90d07fa3ae834b
3
+ metadata.gz: 19aa6fb3581db4df5a235311c22d817e083b0987a31fe8c50ca4f5a60e7e2a91
4
+ data.tar.gz: 147d028433f2f2f66aca7783849ca5197b332d163ee998099772ce7316e26593
5
5
  SHA512:
6
- metadata.gz: c7b29b4f45363921b2e459e867fa60c28c6403096255d05f02bb8bd5cc4666369c073cb5c17eb0bdd8826d6fcbf6710637d94a5b413ae0b422d4d5a4a6d27421
7
- data.tar.gz: f6561ef5ea5524887dc3748539465bdb30070a7d024af083daa0fac121bf5791d0ded62211d9a8df3671e91ba0673051c00f45e620ea2eac76e04db474a0dbc2
6
+ metadata.gz: f699b9affdf67116c7c7231be7b0ede4535cf6c8496e1169acb504e3550f0256b9bd033002a82b2727aebcfc8530c5059df5b77562078b2fd041cbb1148185cb
7
+ data.tar.gz: 0c72dcff6b37cd7ab03bb9c657e330365327b1d6fab88f39834385ec5de103a22c8eb2e803a20f469df8b8c21ed3a94dea70fc22df7fa24926d7692e97716c7c
data/README.md CHANGED
@@ -45,6 +45,8 @@ Yegor
45
45
  The list of emails must contain three columns separated by a comma: first
46
46
  name, last name, and email.
47
47
 
48
+ If you want to send via HTTP/SMTP proxy, use `--proxy=host:port`.
49
+
48
50
  # How to contribute
49
51
 
50
52
  Read [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
data/bin/rumble CHANGED
@@ -23,6 +23,7 @@ STDOUT.sync = true
23
23
 
24
24
  require 'slop'
25
25
  require 'mail'
26
+ require 'net/smtp/proxy'
26
27
  require_relative '../lib/rumble'
27
28
  require_relative '../lib/rumble/version'
28
29
 
@@ -61,6 +62,7 @@ begin
61
62
  o.string '--port', 'SMTP port number (25 by default)', default: 25
62
63
  o.string '--user', 'SMTP user name'
63
64
  o.string '--password', 'SMTP password'
65
+ o.string '--proxy', 'HTTP proxy, e.g. "192.168.0.1:8080"'
64
66
  o.string '--subject', 'Email subject', required: true
65
67
  o.string '--letter', 'File name with Liquid template', required: true
66
68
  o.string '--csv', 'CSV file with first name, last name, and email cols'
@@ -78,29 +80,45 @@ begin
78
80
  Encoding.default_external = Encoding::UTF_8
79
81
  Encoding.default_internal = Encoding::UTF_8
80
82
 
83
+ puts 'It is "dry" run, no emails will be actually sent!' if opts[:dry]
84
+
81
85
  Mail.defaults do
82
86
  case opts[:method].downcase.strip
83
87
  when 'sendmail'
88
+ puts "--host=#{opts[:host]} is not allowed w/sendmail" if opts[:host]
89
+ puts "--port=#{opts[:port]} is not allowed w/sendmail" if opts[:port]
90
+ puts "--user=#{opts[:user]} is not allowed w/sendmail" if opts[:user]
91
+ puts '--password is not allowed when using sendmail' if opts[:password]
84
92
  delivery_method :sendmail
85
93
  when 'smtp'
86
94
  raise '--host is required' unless opts[:host]
87
95
  raise '--port is required' unless opts[:port]
88
96
  raise '--user is required' unless opts[:user]
89
97
  raise '--password is required' unless opts[:password]
90
- delivery_method :smtp, {
91
- :address => opts[:host],
92
- :port => opts[:port],
93
- :user_name => opts[:user],
94
- :password => opts[:password],
95
- :enable_starttls_auto => true
96
- }
98
+ if opts[:proxy]
99
+ host, port = opts[:proxy].strip.split(':')
100
+ delivery_method Net::SMTP::Proxy::DeliveryMethod, {
101
+ address: opts[:host],
102
+ port: opts[:port],
103
+ proxy_address: "http://#{host.strip}",
104
+ proxy_port: port,
105
+ openssl_verify_mode: OpenSSL::SSL::VERIFY_NONE,
106
+ domain: 'gmail.com'
107
+ }
108
+ else
109
+ delivery_method :smtp, {
110
+ :address => opts[:host],
111
+ :port => opts[:port],
112
+ :user_name => opts[:user],
113
+ :password => opts[:password],
114
+ :enable_starttls_auto => true
115
+ }
116
+ end
97
117
  else
98
118
  raise "Delivery method #{opts[:method]} is not supported"
99
119
  end
100
120
  end
101
-
102
121
  Rumble::CLI.new(opts).send
103
-
104
122
  rescue StandardError => ex
105
123
  puts "#{Rainbow('ERROR').red} (#{ex.class.name}): #{ex.message}"
106
124
  puts ex.backtrace
@@ -17,6 +17,6 @@ Feature: Command Line Processing
17
17
  How are you?
18
18
 
19
19
  """
20
- When I run bin/rumble with "--test yegor256@gmail.com --host test --user test --password test --subject test --letter a.liquid --from me@example.com --dry --resume test@example.com"
20
+ When I run bin/rumble with "--test=yegor256@gmail.com --subject=test --letter=a.liquid --from=me@example.com --dry --resume=test@example.com"
21
21
  Then Stdout contains "Processed 1 email"
22
22
  And Exit code is zero
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2018-2019 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Rumble
28
- VERSION = '0.4.1'
28
+ VERSION = '0.5.0'
29
29
  end
@@ -25,7 +25,6 @@ require 'English'
25
25
  lib = File.expand_path('lib', __dir__)
26
26
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
27
27
  require_relative 'lib/rumble/version'
28
-
29
28
  Gem::Specification.new do |s|
30
29
  s.specification_version = 2 if s.respond_to? :specification_version=
31
30
  if s.respond_to? :required_rubygems_version=
@@ -48,6 +47,7 @@ Gem::Specification.new do |s|
48
47
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
49
48
  s.add_runtime_dependency 'liquid', '4.0.1'
50
49
  s.add_runtime_dependency 'mail', '2.7.1'
50
+ s.add_runtime_dependency 'net-smtp-proxy', '2.0.0'
51
51
  s.add_runtime_dependency 'rainbow', '3.0.0'
52
52
  s.add_runtime_dependency 'redcarpet', '3.4.0'
53
53
  s.add_runtime_dependency 'slop', '4.6.2'
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.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-21 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.7.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: net-smtp-proxy
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rainbow
43
57
  requirement: !ruby/object:Gem::Requirement