backup 3.0.2 → 3.0.3.build.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/bin/backup +12 -190
  2. metadata +7 -191
  3. data/.gitignore +0 -2
  4. data/.infinity_test +0 -7
  5. data/.rspec +0 -3
  6. data/Gemfile +0 -17
  7. data/Gemfile.lock +0 -88
  8. data/LICENSE.md +0 -24
  9. data/README.md +0 -236
  10. data/backup.gemspec +0 -41
  11. data/lib/backup.rb +0 -148
  12. data/lib/backup/archive.rb +0 -54
  13. data/lib/backup/cli.rb +0 -50
  14. data/lib/backup/compressor/base.rb +0 -17
  15. data/lib/backup/compressor/gzip.rb +0 -61
  16. data/lib/backup/configuration/base.rb +0 -15
  17. data/lib/backup/configuration/compressor/base.rb +0 -10
  18. data/lib/backup/configuration/compressor/gzip.rb +0 -23
  19. data/lib/backup/configuration/database/base.rb +0 -18
  20. data/lib/backup/configuration/database/mongodb.rb +0 -37
  21. data/lib/backup/configuration/database/mysql.rb +0 -37
  22. data/lib/backup/configuration/database/postgresql.rb +0 -37
  23. data/lib/backup/configuration/database/redis.rb +0 -35
  24. data/lib/backup/configuration/encryptor/base.rb +0 -10
  25. data/lib/backup/configuration/encryptor/gpg.rb +0 -17
  26. data/lib/backup/configuration/encryptor/open_ssl.rb +0 -26
  27. data/lib/backup/configuration/helpers.rb +0 -54
  28. data/lib/backup/configuration/notifier/base.rb +0 -39
  29. data/lib/backup/configuration/notifier/mail.rb +0 -52
  30. data/lib/backup/configuration/storage/base.rb +0 -18
  31. data/lib/backup/configuration/storage/cloudfiles.rb +0 -21
  32. data/lib/backup/configuration/storage/dropbox.rb +0 -25
  33. data/lib/backup/configuration/storage/ftp.rb +0 -25
  34. data/lib/backup/configuration/storage/rsync.rb +0 -25
  35. data/lib/backup/configuration/storage/s3.rb +0 -25
  36. data/lib/backup/configuration/storage/scp.rb +0 -25
  37. data/lib/backup/configuration/storage/sftp.rb +0 -25
  38. data/lib/backup/database/base.rb +0 -33
  39. data/lib/backup/database/mongodb.rb +0 -137
  40. data/lib/backup/database/mysql.rb +0 -104
  41. data/lib/backup/database/postgresql.rb +0 -111
  42. data/lib/backup/database/redis.rb +0 -105
  43. data/lib/backup/encryptor/base.rb +0 -17
  44. data/lib/backup/encryptor/gpg.rb +0 -78
  45. data/lib/backup/encryptor/open_ssl.rb +0 -67
  46. data/lib/backup/finder.rb +0 -39
  47. data/lib/backup/logger.rb +0 -80
  48. data/lib/backup/model.rb +0 -249
  49. data/lib/backup/notifier/base.rb +0 -29
  50. data/lib/backup/notifier/binder.rb +0 -32
  51. data/lib/backup/notifier/mail.rb +0 -141
  52. data/lib/backup/notifier/templates/notify_failure.erb +0 -31
  53. data/lib/backup/notifier/templates/notify_success.erb +0 -16
  54. data/lib/backup/storage/base.rb +0 -67
  55. data/lib/backup/storage/cloudfiles.rb +0 -95
  56. data/lib/backup/storage/dropbox.rb +0 -82
  57. data/lib/backup/storage/ftp.rb +0 -114
  58. data/lib/backup/storage/object.rb +0 -45
  59. data/lib/backup/storage/rsync.rb +0 -100
  60. data/lib/backup/storage/s3.rb +0 -108
  61. data/lib/backup/storage/scp.rb +0 -105
  62. data/lib/backup/storage/sftp.rb +0 -106
  63. data/lib/backup/version.rb +0 -72
  64. data/lib/templates/archive +0 -4
  65. data/lib/templates/compressor/gzip +0 -4
  66. data/lib/templates/database/mongodb +0 -10
  67. data/lib/templates/database/mysql +0 -11
  68. data/lib/templates/database/postgresql +0 -11
  69. data/lib/templates/database/redis +0 -10
  70. data/lib/templates/encryptor/gpg +0 -9
  71. data/lib/templates/encryptor/openssl +0 -5
  72. data/lib/templates/notifier/mail +0 -14
  73. data/lib/templates/readme +0 -15
  74. data/lib/templates/storage/cloudfiles +0 -7
  75. data/lib/templates/storage/dropbox +0 -8
  76. data/lib/templates/storage/ftp +0 -8
  77. data/lib/templates/storage/rsync +0 -7
  78. data/lib/templates/storage/s3 +0 -8
  79. data/lib/templates/storage/scp +0 -8
  80. data/lib/templates/storage/sftp +0 -8
  81. data/spec/archive_spec.rb +0 -53
  82. data/spec/backup_spec.rb +0 -11
  83. data/spec/compressor/gzip_spec.rb +0 -59
  84. data/spec/configuration/base_spec.rb +0 -35
  85. data/spec/configuration/compressor/gzip_spec.rb +0 -28
  86. data/spec/configuration/database/base_spec.rb +0 -16
  87. data/spec/configuration/database/mongodb_spec.rb +0 -30
  88. data/spec/configuration/database/mysql_spec.rb +0 -32
  89. data/spec/configuration/database/postgresql_spec.rb +0 -32
  90. data/spec/configuration/database/redis_spec.rb +0 -30
  91. data/spec/configuration/encryptor/gpg_spec.rb +0 -25
  92. data/spec/configuration/encryptor/open_ssl_spec.rb +0 -31
  93. data/spec/configuration/notifier/mail_spec.rb +0 -32
  94. data/spec/configuration/storage/cloudfiles_spec.rb +0 -34
  95. data/spec/configuration/storage/dropbox_spec.rb +0 -40
  96. data/spec/configuration/storage/ftp_spec.rb +0 -40
  97. data/spec/configuration/storage/rsync_spec.rb +0 -37
  98. data/spec/configuration/storage/s3_spec.rb +0 -37
  99. data/spec/configuration/storage/scp_spec.rb +0 -40
  100. data/spec/configuration/storage/sftp_spec.rb +0 -40
  101. data/spec/database/base_spec.rb +0 -30
  102. data/spec/database/mongodb_spec.rb +0 -144
  103. data/spec/database/mysql_spec.rb +0 -150
  104. data/spec/database/postgresql_spec.rb +0 -164
  105. data/spec/database/redis_spec.rb +0 -122
  106. data/spec/encryptor/gpg_spec.rb +0 -57
  107. data/spec/encryptor/open_ssl_spec.rb +0 -102
  108. data/spec/logger_spec.rb +0 -37
  109. data/spec/model_spec.rb +0 -236
  110. data/spec/notifier/mail_spec.rb +0 -97
  111. data/spec/spec_helper.rb +0 -21
  112. data/spec/storage/base_spec.rb +0 -33
  113. data/spec/storage/cloudfiles_spec.rb +0 -102
  114. data/spec/storage/dropbox_spec.rb +0 -89
  115. data/spec/storage/ftp_spec.rb +0 -133
  116. data/spec/storage/object_spec.rb +0 -74
  117. data/spec/storage/rsync_spec.rb +0 -115
  118. data/spec/storage/s3_spec.rb +0 -110
  119. data/spec/storage/scp_spec.rb +0 -129
  120. data/spec/storage/sftp_spec.rb +0 -125
  121. data/spec/version_spec.rb +0 -32
@@ -1,39 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Backup
4
- class Finder
5
- attr_accessor :trigger, :config
6
-
7
- ##
8
- # Initializes a new Backup::Finder object
9
- # and stores the path to the configuration file
10
- def initialize(trigger, config)
11
- @trigger = trigger.to_sym
12
- @config = config
13
- end
14
-
15
- ##
16
- # Tries to find and load the configuration file and return the proper
17
- # backup model configuration (specified by the 'trigger')
18
- def find
19
- unless File.exist?(config)
20
- puts "Could not find a configuration file in '#{config}'."; exit
21
- end
22
-
23
- ##
24
- # Loads the backup configuration file
25
- instance_eval(File.read(config))
26
-
27
- ##
28
- # Iterates through all the instantiated backup models and returns
29
- # the one that matches the specified 'trigger'
30
- Backup::Model.all.each do |model|
31
- if model.trigger.eql?(trigger)
32
- return Backup::Model.current = model
33
- end
34
- end
35
-
36
- puts "Could not find trigger '#{trigger}' in '#{config}'."; exit
37
- end
38
- end
39
- end
@@ -1,80 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Backup
4
- class Logger
5
-
6
- ##
7
- # Outputs a messages to the console and writes it to the backup.log
8
- def self.message(string)
9
- puts loggify(:message, string, :green)
10
- to_file loggify(:message, string)
11
- end
12
-
13
- ##
14
- # Outputs an error to the console and writes it to the backup.log
15
- def self.error(string)
16
- puts loggify(:error, string, :red)
17
- to_file loggify(:error, string)
18
- end
19
-
20
- ##
21
- # Outputs a notice to the console and writes it to the backup.log
22
- def self.warn(string)
23
- puts loggify(:warning, string, :yellow)
24
- to_file loggify(:warning, string)
25
- end
26
-
27
- ##
28
- # Returns the time in [YYYY/MM/DD HH:MM:SS] format
29
- def self.time
30
- Time.now.strftime("%Y/%m/%d %H:%M:%S")
31
- end
32
-
33
- ##
34
- # Builds the string in a log format with the date/time, the type (colorized)
35
- # based on whether it's a message, notice or error, and the message itself.
36
- # ANSI color codes are only used in the console, and are not written to the log
37
- # since it doesn't do anything and just adds more unnecessary bloat to the log file
38
- def self.loggify(type, string, color = false)
39
- return "[#{time}][#{type}] #{string}" unless color
40
- "[#{time}][#{send(color, type)}] #{string}"
41
- end
42
-
43
- ##
44
- # Writes (appends) a string to the backup.log file
45
- def self.to_file(string)
46
- File.open(File.join(LOG_PATH, 'backup.log'), 'a') do |file|
47
- file.write("#{string}\n")
48
- end
49
- end
50
-
51
- ##
52
- # Invokes the #colorize method with the provided string
53
- # and the color code "32" (for green)
54
- def self.green(string)
55
- colorize(string, 32)
56
- end
57
-
58
- ##
59
- # Invokes the #colorize method with the provided string
60
- # and the color code "33" (for yellow)
61
- def self.yellow(string)
62
- colorize(string, 33)
63
- end
64
-
65
- ##
66
- # Invokes the #colorize method the with provided string
67
- # and the color code "31" (for red)
68
- def self.red(string)
69
- colorize(string, 31)
70
- end
71
-
72
- ##
73
- # Wraps the provided string in colorizing tags to provide
74
- # easier to view output to the client
75
- def self.colorize(string, code)
76
- "\e[#{code}m#{string}\e[0m"
77
- end
78
-
79
- end
80
- end
@@ -1,249 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Backup
4
- class Model
5
- include Backup::CLI
6
-
7
- ##
8
- # The trigger is used as an identifier for
9
- # initializing the backup process
10
- attr_accessor :trigger
11
-
12
- ##
13
- # The label is used for a more friendly user output
14
- attr_accessor :label
15
-
16
- ##
17
- # The databases attribute holds an array of database objects
18
- attr_accessor :databases
19
-
20
- ##
21
- # The archives attr_accessor holds an array of archive objects
22
- attr_accessor :archives
23
-
24
- ##
25
- # The encryptors attr_accessor holds an array of encryptor objects
26
- attr_accessor :encryptors
27
-
28
- ##
29
- # The compressors attr_accessor holds an array of compressor objects
30
- attr_accessor :compressors
31
-
32
- ##
33
- # The notifiers attr_accessor holds an array of notifier objects
34
- attr_accessor :notifiers
35
-
36
- ##
37
- # The storages attribute holds an array of storage objects
38
- attr_accessor :storages
39
-
40
- ##
41
- # The time when the backup initiated (in format: 2011.02.20.03.29.59)
42
- attr_accessor :time
43
-
44
- class << self
45
- ##
46
- # The Backup::Model.all class method keeps track of all the models
47
- # that have been instantiated. It returns the @all class variable,
48
- # which contains an array of all the models
49
- attr_accessor :all
50
-
51
- ##
52
- # Contains the current file extension (this changes from time to time after a file
53
- # gets compressed or encrypted so we can keep track of the correct file when new
54
- # extensions get appended to the current file name)
55
- attr_accessor :extension
56
-
57
- ##
58
- # Contains the currently-in-use model. This attribute should get set by Backup::Finder.
59
- # Use Backup::Model.current to retrieve the actual data of the model
60
- attr_accessor :current
61
-
62
- ##
63
- # Returns the full path to the current file (including the current extension).
64
- # To just return the filename and extension without the path, use File.basename(Backup::Model.file)
65
- def file
66
- File.join(TMP_PATH, "#{ TIME }.#{ TRIGGER }.#{ Backup::Model.extension }")
67
- end
68
-
69
- ##
70
- # Returns the temporary trigger path of the current model
71
- # e.g. /Users/Michael/tmp/backup/my_trigger
72
- def tmp_path
73
- File.join(TMP_PATH, TRIGGER)
74
- end
75
- end
76
-
77
- ##
78
- # Accessible through "Backup::Model.all", it stores an array of Backup::Model instances.
79
- # Everytime a new Backup::Model gets instantiated it gets pushed into this array
80
- @all = Array.new
81
-
82
- ##
83
- # Contains the current file extension (should change after each compression or encryption)
84
- @extension = 'tar'
85
-
86
- ##
87
- # Takes a trigger, label and the configuration block and instantiates the model.
88
- # The TIME (time of execution) gets stored in the @time attribute.
89
- # After the instance has evaluated the configuration block and properly set the
90
- # configuration for the model, it will append the newly created "model" instance
91
- # to the @all class variable (Array) so it can be accessed by Backup::Finder
92
- # and any other location
93
- def initialize(trigger, label, &block)
94
- @trigger = trigger
95
- @label = label
96
- @time = TIME
97
-
98
- @databases = Array.new
99
- @archives = Array.new
100
- @encryptors = Array.new
101
- @compressors = Array.new
102
- @storages = Array.new
103
- @notifiers = Array.new
104
-
105
- instance_eval(&block)
106
- Backup::Model.all << self
107
- end
108
-
109
- ##
110
- # Adds a database to the array of databases
111
- # to dump during the backup process
112
- def database(database, &block)
113
- @databases << Backup::Database.const_get(
114
- last_constant(database)
115
- ).new(&block)
116
- end
117
-
118
- ##
119
- # Adds an archive to the array of archives
120
- # to store during the backup process
121
- def archive(name, &block)
122
- @archives << Backup::Archive.new(name, &block)
123
- end
124
-
125
- ##
126
- # Adds an encryptor to the array of encryptors
127
- # to use during the backup process
128
- def encrypt_with(name, &block)
129
- @encryptors << Backup::Encryptor.const_get(
130
- last_constant(name)
131
- ).new(&block)
132
- end
133
-
134
- ##
135
- # Adds a compressor to the array of compressors
136
- # to use during the backup process
137
- def compress_with(name, &block)
138
- @compressors << Backup::Compressor.const_get(
139
- last_constant(name)
140
- ).new(&block)
141
- end
142
-
143
- ##
144
- # Adds a notifier to the array of notifiers
145
- # to use during the backup process
146
- def notify_by(name, &block)
147
- @notifiers << Backup::Notifier.const_get(
148
- last_constant(name)
149
- ).new(&block)
150
- end
151
-
152
- ##
153
- # Adds a storage method to the array of storage
154
- # methods to use during the backup process
155
- def store_with(storage, &block)
156
- @storages << Backup::Storage.const_get(
157
- last_constant(storage)
158
- ).new(&block)
159
- end
160
-
161
- ##
162
- # Performs the backup process
163
- ##
164
- # [Databases]
165
- # Runs all (if any) database objects to dump the databases
166
- ##
167
- # [Archives]
168
- # Runs all (if any) archive objects to package all their
169
- # paths in to a single tar file and places it in the backup folder
170
- ##
171
- # [Package]
172
- # After all the database dumps and archives are placed inside
173
- # the folder, it'll make a single .tar package (archive) out of it
174
- ##
175
- # [Encryption]
176
- # Optionally encrypts the packaged file with one or more encryptors
177
- ##
178
- # [Compression]
179
- # Optionally compresses the packaged file with one or more compressors
180
- ##
181
- # [Storages]
182
- # Runs all (if any) storage objects to store the backups to remote locations
183
- # and (if configured) it'll cycle the files on the remote location to limit the
184
- # amount of backups stored on each individual location
185
- ##
186
- # [Notifiers]
187
- # Runs all (if any) notifier objects when a backup proces finished with or without
188
- # any errors.
189
- ##
190
- # [Cleaning]
191
- # After the whole backup process finishes, it'll go ahead and remove any temporary
192
- # file that it produced. If an exception(error) is raised during this process which
193
- # breaks the process, it'll always ensure it removes the temporary files regardless
194
- # to avoid mass consumption of storage space on the machine
195
- def perform!
196
- begin
197
- databases.each { |d| d.perform! }
198
- archives.each { |a| a.perform! }
199
- package!
200
- compressors.each { |c| c.perform! }
201
- encryptors.each { |e| e.perform! }
202
- storages.each { |s| s.perform! }
203
- notifiers.each { |n| n.perform!(self) }
204
- clean!
205
- rescue Exception => exception
206
- clean!
207
- notifiers.each { |n| n.perform!(self, exception) }
208
- show_exception!(exception)
209
- end
210
- end
211
-
212
- private
213
-
214
- ##
215
- # After all the databases and archives have been dumped and sorted,
216
- # these files will be bundled in to a .tar archive (uncompressed) so it
217
- # becomes a single (transferrable) packaged file.
218
- def package!
219
- Logger.message "Backup started packaging everything to a single archive file."
220
- run("#{ utility(:tar) } -c -C '#{ TMP_PATH }' '#{ TRIGGER }' > '#{ File.join(TMP_PATH, "#{TIME}.#{TRIGGER}.tar") }'")
221
- end
222
-
223
- ##
224
- # Cleans up the temporary files that were created after the backup process finishes
225
- def clean!
226
- Logger.message "Backup started cleaning up the temporary files."
227
- run("#{ utility(:rm) } -rf '#{ File.join(TMP_PATH, TRIGGER) }' '#{ File.join(TMP_PATH, "#{TIME}.#{TRIGGER}.#{Backup::Model.extension}") }'")
228
- end
229
-
230
- ##
231
- # Returns the string representation of the last value of a nested constant
232
- # example:
233
- # Backup::Model::MySQL
234
- # becomes and returns:
235
- # "MySQL"
236
- def last_constant(constant)
237
- constant.to_s.split("::").last
238
- end
239
-
240
- ##
241
- # Formats an exception
242
- def show_exception!(exception)
243
- puts ("=" * 75) + "\nException that got raised:\n#{exception}\n" + ("=" * 75) + "\n" + exception.backtrace.join("\n")
244
- puts ("=" * 75) + "\n\nYou are running Backup version \"#{Backup::Version.current}\" and Ruby version \"#{ENV['RUBY_VERSION']}\".\n"
245
- puts "If you've setup a \"Notification\" in your configuration file, the above error will have been sent."
246
- end
247
-
248
- end
249
- end
@@ -1,29 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Backup
4
- module Notifier
5
- class Base
6
- include Backup::Configuration::Helpers
7
-
8
- ##
9
- # When set to true, the user will be notified by email
10
- # when a backup process ends without raising any exceptions
11
- attr_accessor :on_success
12
- alias :notify_on_success? :on_success
13
-
14
- ##
15
- # When set to true, the user will be notified by email
16
- # when a backup process raises an exception before finishing
17
- attr_accessor :on_failure
18
- alias :notify_on_failure? :on_failure
19
-
20
- ##
21
- # Logs a message to the console and log file to inform
22
- # the client that Backup is notifying about the process
23
- def log!
24
- Logger.message "#{ self.class } started notifying about the process."
25
- end
26
-
27
- end
28
- end
29
- end
@@ -1,32 +0,0 @@
1
- # encoding: utf-8
2
-
3
- module Backup
4
- module Notifier
5
- class Binder
6
-
7
- ##
8
- # Shortcut to create a new instance of a binder, setting
9
- # the instance variables using a Hash of key/values and getting
10
- # the instance's binding. This returns the binding of the new Binder instance
11
- def self.bind(key_and_values = {})
12
- Binder.new(key_and_values).get_binding
13
- end
14
-
15
- ##
16
- # Creates a new Backup::Notifier::Binder instance. Loops through the provided
17
- # Hash to set instance variables
18
- def initialize(key_and_values)
19
- key_and_values.each do |key, value|
20
- instance_variable_set("@#{key}", value)
21
- end
22
- end
23
-
24
- ##
25
- # Returns the binding (needs a wrapper method because #binding is a private method)
26
- def get_binding
27
- binding
28
- end
29
-
30
- end
31
- end
32
- end
@@ -1,141 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ##
4
- # Only load the Mail gem and Erb library when using Mail notifications
5
- require 'mail'
6
- require 'erb'
7
-
8
- module Backup
9
- module Notifier
10
- class Mail < Base
11
-
12
- ##
13
- # Container for the Mail object
14
- attr_accessor :mail
15
-
16
- ##
17
- # Container for the Model object
18
- attr_accessor :model
19
-
20
- ##
21
- # Sender and Receiver email addresses
22
- # Examples:
23
- # sender - my.email.address@gmail.com
24
- # receiver - your.email.address@gmail.com
25
- attr_accessor :from, :to
26
-
27
- ##
28
- # The address to use
29
- # Example: smtp.gmail.com
30
- attr_accessor :address
31
-
32
- ##
33
- # The port to connect to
34
- # Example: 587
35
- attr_accessor :port
36
-
37
- ##
38
- # Your domain (if applicable)
39
- # Example: mydomain.com
40
- attr_accessor :domain
41
-
42
- ##
43
- # Username and Password (sender email's credentials)
44
- # Examples:
45
- # user_name - meskyanichi
46
- # password - my_secret_password
47
- attr_accessor :user_name, :password
48
-
49
- ##
50
- # Authentication type
51
- # Example: plain
52
- attr_accessor :authentication
53
-
54
- ##
55
- # Automatically set TLS
56
- # Example: true
57
- attr_accessor :enable_starttls_auto
58
-
59
- ##
60
- # Instantiates a new Backup::Notifier::Mail object
61
- def initialize(&block)
62
- load_defaults!
63
-
64
- instance_eval(&block) if block_given?
65
-
66
- set_defaults!
67
- end
68
-
69
- ##
70
- # Performs the notification
71
- # Takes an exception object that might've been created if an exception occurred.
72
- # If this is the case it'll invoke notify_failure!(exception), otherwise, if no
73
- # error was raised, it'll go ahead and notify_success!
74
- #
75
- # If'll only perform these if on_success is true or on_failure is true
76
- def perform!(model, exception = false)
77
- @model = model
78
-
79
- if notify_on_success? and exception.eql?(false)
80
- log!
81
- notify_success!
82
- elsif notify_on_failure? and not exception.eql?(false)
83
- log!
84
- notify_failure!(exception)
85
- end
86
- end
87
-
88
- private
89
-
90
- ##
91
- # Sends an email informing the user that the backup operation
92
- # proceeded without any errors
93
- def notify_success!
94
- mail[:subject] = "[Backup::Succeeded] #{model.label} (#{model.trigger})"
95
- mail[:body] = read_template('notify_success', Binder.bind(:model => @model))
96
- mail.deliver!
97
- end
98
-
99
- ##
100
- # Sends an email informing the user that the backup operation
101
- # raised an exception and will send the user the error details
102
- def notify_failure!(exception)
103
- mail[:subject] = "[Backup::Failed] #{model.label} (#{model.trigger})"
104
- mail[:body] = read_template('notify_failure', Binder.bind(:model => @model, :exception => exception))
105
- mail.deliver!
106
- end
107
-
108
- ##
109
- # Configures the Mail gem by setting the defaults.
110
- # Instantiates the @mail object with the @to and @from attributes
111
- def set_defaults!
112
- defaults = {
113
- :address => @address,
114
- :port => @port,
115
- :domain => @domain,
116
- :user_name => @user_name,
117
- :password => @password,
118
- :authentication => @authentication,
119
- :enable_starttls_auto => @enable_starttls_auto
120
- }
121
-
122
- ::Mail.defaults do
123
- delivery_method :smtp, defaults
124
- end
125
-
126
- @mail = ::Mail.new
127
- @mail[:from] = @from
128
- @mail[:to] = @to
129
- end
130
-
131
- ##
132
- # Returns the path to the templates, appended by the passed in argument
133
- def read_template(file, binder)
134
- ERB.new(File.read(
135
- File.join( File.dirname(__FILE__), "templates", "#{file}.erb" )
136
- )).result(binder)
137
- end
138
-
139
- end
140
- end
141
- end