reaction_mailer 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -20,7 +20,9 @@ Install it:
20
20
  ## Usage
21
21
 
22
22
  Usage: remail [options] file1 file2 ...
23
-
23
+ remail [options] directory
24
+ remail [options] -p
25
+
24
26
  -u, --username USERNAME Gmail Username
25
27
  -w, --password PASSWORD Gmail Password
26
28
  -t, --to EMAIL Send the email to who?
data/bin/remail CHANGED
@@ -9,7 +9,9 @@ require 'pp'
9
9
  options = Hash.new(false)
10
10
 
11
11
  OptionParser.new do|opts|
12
- opts.banner = "Usage: remail [options] file1 file2 ... \n\n"
12
+ opts.banner = "Usage: remail [options] file1 file2 ... \n" +
13
+ " remail [options] directory\n" +
14
+ " remail [options] -p\n\n"
13
15
 
14
16
  opts.on( '-u', '--username USERNAME', "Gmail Username" ) do|u|
15
17
  options[:user] = u
@@ -36,24 +38,17 @@ end.parse!
36
38
  options[:user] = ask("Enter your gmail username: ") unless options[:user]
37
39
  options[:pass] = ask("Enter your gmail password: ") { |q| q.echo = "*" } unless options[:pass]
38
40
 
39
- if /@(.*$)/.match(options[:user])
40
- domain = /@(.*$)/.match(options[:user])[1]
41
- else
42
- domain = 'gmail.com'
43
- end
44
-
45
- mail_settings = {
46
- :address => "smtp.gmail.com",
47
- :port => 587,
48
- :domain => domain,
49
- :user_name => options[:user],
50
- :password => options[:pass],
51
- :authentication => 'plain',
52
- :enable_starttls_auto => true
53
- }
41
+ domain = options[:user][/@(.*$)/] || 'gmail.com'
54
42
 
55
43
  Mail.defaults do
56
- delivery_method :smtp, mail_settings
44
+ delivery_method :smtp, :address => "smtp.gmail.com",
45
+ :port => 587,
46
+ :domain => domain,
47
+ :user_name => options[:user],
48
+ :password => options[:pass],
49
+ :authentication => 'plain',
50
+ :enable_starttls_auto => true
51
+
57
52
  retriever_method :pop3, :address => "localhost",
58
53
  :port => 2220,
59
54
  :user_name => 'reaction',
@@ -62,13 +57,20 @@ end
62
57
 
63
58
 
64
59
 
65
- unless options[:pop]
66
- mail = []
67
- ARGV.each do |f|
60
+ mail = []
61
+ ARGV.each do |f|
62
+ if File.directory?(f)
63
+ Dir[f+"*"].each do |m|
64
+ if File.file? m
65
+ mail << Mail.read(m)
66
+ end
67
+ end
68
+ elsif File.file? f
68
69
  mail << Mail.read(f)
69
70
  end
70
- else
71
- mail = Mail.all
71
+ end
72
+ if options[:pop]
73
+ mail << Mail.all
72
74
  end
73
75
 
74
76
  mail.each do |mail|
@@ -1,3 +1,3 @@
1
1
  module ReactionMailer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reaction_mailer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ed Robinson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-27 00:00:00 Z
18
+ date: 2012-08-28 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: highline