command_line_email 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.
@@ -4,6 +4,13 @@ module CommandLineEmail
|
|
4
4
|
|
5
5
|
class SendMailSetup
|
6
6
|
|
7
|
+
class ConfigFileNotFound < StandardError
|
8
|
+
def initialize(msg)
|
9
|
+
msg ||= "You must provide a mail configuration file. Default location: '~/.command_line_email.yml'"
|
10
|
+
super(msg)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
7
14
|
attr_reader :mail_options, :mail_config_file
|
8
15
|
|
9
16
|
def initialize(config_file = nil)
|
@@ -22,7 +29,13 @@ module CommandLineEmail
|
|
22
29
|
private
|
23
30
|
|
24
31
|
def mail_config
|
25
|
-
@mail_config ||=
|
32
|
+
@mail_config ||= load_mail_config_file(mail_config_file)
|
33
|
+
end
|
34
|
+
|
35
|
+
def load_mail_config_file(mail_config_file)
|
36
|
+
YAML::load(File.open(mail_config_file))
|
37
|
+
rescue
|
38
|
+
raise ConfigFileNotFound, nil, [] # turn off ugly backtrace
|
26
39
|
end
|
27
40
|
|
28
41
|
def set_mail_options
|