adzap-ar_mailer 1.4.1 → 1.4.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/History.txt CHANGED
@@ -1,3 +1,15 @@
1
+ = 1.4.2
2
+
3
+ * New Features
4
+ * Added Ruby based linux init.d script for handling daemon startup using yaml
5
+ config file. See files share/linux/ar_sendmail and ar_sendmail.conf
6
+ * Bugs fixed
7
+ * Proper handling for relative and absolute paths for the pid file
8
+ * Removed hoe dependency since we need the explicit gemspec file for github and
9
+ not deploying to RubyForge its not as useful.
10
+ * Moved old BSD rc.d script to share/bsd folder
11
+ * Updated README with github gem install, docs and init script info
12
+
1
13
  = 1.4.1
2
14
 
3
15
  * Bugs fixed
data/Manifest.txt CHANGED
@@ -7,7 +7,9 @@ bin/ar_sendmail
7
7
  lib/action_mailer/ar_mailer.rb
8
8
  lib/action_mailer/ar_sendmail.rb
9
9
  lib/smtp_tls.rb
10
- share/ar_sendmail
10
+ share/bsd/ar_sendmail
11
+ share/linux/ar_sendmail
12
+ share/linux/ar_sendmail.conf
11
13
  test/action_mailer.rb
12
14
  test/test_armailer.rb
13
15
  test/test_arsendmail.rb
data/README.txt CHANGED
@@ -10,6 +10,10 @@ Documentation:
10
10
 
11
11
  http://seattlerb.org/ar_mailer
12
12
 
13
+ and for forked additions
14
+
15
+ http://github.com/adzap/ar_mailer/wikis
16
+
13
17
  Bugs:
14
18
 
15
19
  http://rubyforge.org/tracker/?func=add&group_id=1513&atid=5921
@@ -20,11 +24,17 @@ Even delivering email to the local machine may take too long when you have to
20
24
  send hundreds of messages. ar_mailer allows you to store messages into the
21
25
  database for later delivery by a separate process, ar_sendmail.
22
26
 
23
- == Installing ar_mailer
27
+ == Installing ar_mailer (forked)
28
+
29
+ Install the gem from GitHub gems server:
30
+
31
+ First, if you haven't already
32
+
33
+ $ sudo gem sources -a http://gems.github.com
24
34
 
25
- Just install the gem:
35
+ Then
26
36
 
27
- $ sudo gem install ar_mailer
37
+ $ sudo gem install adzap-ar_mailer
28
38
 
29
39
  See ActionMailer::ARMailer for instructions on converting to ARMailer.
30
40
 
@@ -33,7 +43,13 @@ See ar_sendmail -h for options to ar_sendmail.
33
43
  NOTE: You may need to delete an smtp_tls.rb file if you have one lying
34
44
  around. ar_mailer supplies it own.
35
45
 
36
- === ar_sendmail on FreeBSD or NetBSD
46
+ === init.d/rc.d scripts
37
47
 
38
- An rc.d script is included in share/ar_sendmail.
48
+ For Linux both script and demo config files are in share/linux.
49
+ See ar_sendmail.conf for setting up your config. Copy the ar_sendmail file
50
+ to /etc/init.d/ and make it executable. Then for Debian based distros run
51
+ 'sudo update-rc.d ar_sendmail defaults' and it should work. Make sure you have
52
+ the config file /etc/ar_sendmail.conf in place before starting.
39
53
 
54
+ For FreeBSD or NetBSD script is share/bsd/ar_sendmail. This is old and does not
55
+ support the config file unless someone wants to submit a patch.
data/Rakefile CHANGED
@@ -1,14 +1,60 @@
1
- require 'hoe'
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+
6
+ $:.unshift(File.expand_path(File.dirname(__FILE__) + '/lib'))
2
7
 
3
8
  require './lib/action_mailer/ar_sendmail'
9
+
10
+ ar_mailer_gemspec = Gem::Specification.new do |s|
11
+ s.name = %q{ar_mailer}
12
+ s.version = ActionMailer::ARSendmail::VERSION
13
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
14
+ s.authors = ["Eric Hodel"]
15
+ s.date = %q{2008-07-04}
16
+ s.default_executable = %q{ar_sendmail}
17
+ s.description = %q{Even delivering email to the local machine may take too long when you have to send hundreds of messages. ar_mailer allows you to store messages into the database for later delivery by a separate process, ar_sendmail.}
18
+ s.email = %q{drbrain@segment7.net}
19
+ s.executables = ["ar_sendmail"]
20
+ s.extra_rdoc_files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.txt"]
21
+ s.files = ["History.txt", "LICENSE.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/ar_sendmail", "lib/action_mailer/ar_mailer.rb", "lib/action_mailer/ar_sendmail.rb", "lib/smtp_tls.rb", "share/bsd/ar_sendmail", "share/linux/ar_sendmail", "share/linux/ar_sendmail.conf", "test/action_mailer.rb", "test/test_armailer.rb", "test/test_arsendmail.rb"]
22
+ s.has_rdoc = true
23
+ s.homepage = %q{http://seattlerb.org/ar_mailer}
24
+ s.rdoc_options = ["--main", "README.txt"]
25
+ s.require_paths = ["lib"]
26
+ s.rubyforge_project = %q{seattlerb}
27
+ s.rubygems_version = %q{1.2.0}
28
+ s.summary = %q{A two-phase delivery agent for ActionMailer}
29
+ s.test_files = ["test/test_armailer.rb", "test/test_arsendmail.rb"]
30
+ end
4
31
 
5
- Hoe.new 'ar_mailer', ActionMailer::ARSendmail::VERSION do |s|
6
- s.rubyforge_name = 'seattlerb'
7
- s.summary = s.paragraphs_of('README.txt', 1).join(' ')
8
- s.description = s.paragraphs_of('README.txt', 9).join(' ')
9
- s.url = s.paragraphs_of('README.txt', 5).join(' ')
10
- s.author = 'Eric Hodel'
11
- s.email = 'drbrain@segment7.net'
12
- s.changes = s.paragraphs_of('History.txt', 0..1).join("\n\n")
32
+ Rake::GemPackageTask.new(ar_mailer_gemspec) do |pkg|
33
+ pkg.gem_spec = ar_mailer_gemspec
34
+ end
35
+
36
+ namespace :gem do
37
+ namespace :spec do
38
+ desc "Update ar_mailer.gemspec"
39
+ task :generate do
40
+ File.open("ar_mailer.gemspec", "w") do |f|
41
+ f.puts(ar_mailer_gemspec.to_ruby)
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ desc "Build packages and install"
48
+ task :install => :package do
49
+ sh %{sudo gem install --local pkg/ar_mailer-#{ActionMailer::ARSendmail::VERSION}}
13
50
  end
14
51
 
52
+ desc 'Default: run unit tests.'
53
+ task :default => :test
54
+
55
+ desc 'Test the ar_mailer gem.'
56
+ Rake::TestTask.new(:test) do |t|
57
+ t.libs << 'lib' << 'test'
58
+ t.pattern = 'test/**/test_*.rb'
59
+ t.verbose = true
60
+ end
@@ -54,7 +54,7 @@ class ActionMailer::ARSendmail
54
54
  ##
55
55
  # The version of ActionMailer::ARSendmail you are running.
56
56
 
57
- VERSION = '1.4.1'
57
+ VERSION = '1.4.2'
58
58
 
59
59
  ##
60
60
  # Maximum number of times authentication will be consecutively retried
@@ -351,7 +351,7 @@ end
351
351
 
352
352
  if options[:Daemon] then
353
353
  require 'webrick/server'
354
- @@pid_file = File.expand_path(options[:Pidfile])
354
+ @@pid_file = File.expand_path(options[:Pidfile], options[:Chdir])
355
355
  if File.exists? @@pid_file
356
356
  # check to see if process is actually running
357
357
  pid = ''
File without changes
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # ar_sendmail Startup script for ar_mailer by Adam Meehan
4
+ #
5
+ # chkconfig: - 85 15
6
+ # description: ar_sendmail manages sending emails for Rails apps.
7
+ #
8
+ require 'yaml'
9
+
10
+ # Config file app mailers
11
+ config_file = '/etc/ar_sendmail.conf'
12
+
13
+ begin
14
+ config = YAML::load(IO.read(config_file))
15
+ rescue Errno::ENOENT
16
+ puts "Config file not found at '#{config_file}'!"
17
+ exit
18
+ end
19
+
20
+ default_options = {'pidfile' => './log/ar_sendmail.pid'}.merge(config.delete('defaults') || {})
21
+
22
+ command, app_name = *ARGV
23
+
24
+ def start(app, options)
25
+ switches = ""
26
+ options.each {|k, v| switches << " --#{k} #{v}"}
27
+ STDOUT.write "Starting mailer for #{app} in #{options['environment']} mode ... "
28
+ status = system("ar_sendmail -d #{switches}") ? "started" : "failed"
29
+ puts status
30
+ end
31
+
32
+ def stop(app, options)
33
+ path = options['chdir']
34
+ pid_file = File.expand_path(options['pidfile'], path)
35
+ if File.exist? pid_file
36
+ begin
37
+ pid = open(pid_file).read.to_i
38
+ STDOUT.write "Stopping mailer for #{app}... "
39
+ Process.kill('TERM', pid)
40
+ puts "stopped"
41
+ rescue Errno::ESRCH
42
+ puts "Mailer process does not exist. Is not running."
43
+ end
44
+ else
45
+ puts "Skipping mailer for #{app}, no pid file."
46
+ end
47
+ end
48
+
49
+ def restart(app, options)
50
+ puts "Restarting mailer for #{app} ..."
51
+ stop app, options
52
+ start app, options
53
+ end
54
+
55
+ def command_error(msg)
56
+ puts msg
57
+ exit
58
+ end
59
+
60
+ if ['start', 'stop', 'restart'].include?(command)
61
+ apps = config
62
+ if app_name
63
+ command_error "No such app defined in ar_sendmail config" unless config.include?(app_name)
64
+ app_options = config[app_name]
65
+ command_error "Must specify chdir for app in ar_sendmail config" if app_options['chdir'].nil?
66
+ apps = {app_name => app_options}
67
+ end
68
+
69
+ apps.each do |app, options|
70
+ options = default_options.merge(options)
71
+ send(command, app, options)
72
+ end
73
+ else
74
+ command_error "Usage: ar_sendmail {start|stop|restart} [optional app_name]"
75
+ end
@@ -0,0 +1,30 @@
1
+ # This is a configuration file for ar_sendmail daemon init.d script
2
+ #
3
+ # Define the settings for each app which has a mailer that you want start
4
+ # automatically on startup.
5
+ #
6
+ # You can define an optional defaults section which will apply to all
7
+ # applications unless the setting is specified under the applications specific
8
+ # config.
9
+ #
10
+ # Settings not specified in either the defaults or app config section will
11
+ # be implied by the gem binary defaults. The option names are the same as the
12
+ # long format binary option switches. Run 'ar_sendmail -h' to see option switches
13
+ # and default values.
14
+ #
15
+ # Copy this file to /etc/ar_sendmail.conf and it will be read by the init.d
16
+ # script.
17
+ #
18
+
19
+ ## Demo app config
20
+ #
21
+ #defaults:
22
+ # batch-size: 10
23
+ # max-age: 0
24
+ # delay: 60
25
+ #
26
+ #app_name:
27
+ # chdir: /var/www/apps/app_name
28
+ # environment: production
29
+ # pidfile: ./log/ar_sendmail.pid
30
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adzap-ar_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Hodel
@@ -9,18 +9,10 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-03 00:00:00 -07:00
12
+ date: 2008-07-04 00:00:00 -07:00
13
13
  default_executable: ar_sendmail
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.7.0
23
- version:
14
+ dependencies: []
15
+
24
16
  description: Even delivering email to the local machine may take too long when you have to send hundreds of messages. ar_mailer allows you to store messages into the database for later delivery by a separate process, ar_sendmail.
25
17
  email: drbrain@segment7.net
26
18
  executables:
@@ -42,7 +34,9 @@ files:
42
34
  - lib/action_mailer/ar_mailer.rb
43
35
  - lib/action_mailer/ar_sendmail.rb
44
36
  - lib/smtp_tls.rb
45
- - share/ar_sendmail
37
+ - share/bsd/ar_sendmail
38
+ - share/linux/ar_sendmail
39
+ - share/linux/ar_sendmail.conf
46
40
  - test/action_mailer.rb
47
41
  - test/test_armailer.rb
48
42
  - test/test_arsendmail.rb