command_line_email 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 ||= YAML::load(File.open(mail_config_file))
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
@@ -1,5 +1,5 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  module CommandLineEmail
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_line_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: