post_office 0.2.1 → 0.3.0
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 +12 -2
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/post_office +20 -0
- data/lib/startup_item.rb +47 -0
- data/pkg/post_office-0.2.1.gem +0 -0
- data/post_office.gemspec +2 -1
- data/startup_item/PostOffice/PostOffice +27 -0
- data/startup_item/PostOffice/StartupParameters.plist +19 -0
- metadata +9 -5
data/README.md
CHANGED
|
@@ -54,13 +54,23 @@ It's possible to start PostOffice as a daemon using post_officed:
|
|
|
54
54
|
-h, --help Show this message
|
|
55
55
|
--version Show version
|
|
56
56
|
|
|
57
|
+
Mac OS X Startup Item
|
|
58
|
+
---------------------
|
|
59
|
+
|
|
60
|
+
PostOffice daemon can be started on Mac OS X system startup.
|
|
61
|
+
|
|
62
|
+
sudo post_office [options]
|
|
63
|
+
|
|
64
|
+
--install-osx-startup-item Installs Post Office as OS X Startup Item
|
|
65
|
+
--remove-osx-startup-item Removes Post Office as OS X Startup Item
|
|
66
|
+
|
|
67
|
+
The Startup Item is stored in */Library/StartupItems/PostOffice*
|
|
68
|
+
|
|
57
69
|
Planned features
|
|
58
70
|
----------------
|
|
59
71
|
|
|
60
72
|
* Ability to use custom ports for SMTP and POP
|
|
61
73
|
* Growl notifications
|
|
62
|
-
* Mac OS X Startup Item / launchctl service
|
|
63
74
|
* Store mail in tempfiles instead of in-memory array
|
|
64
|
-
* Tests :)
|
|
65
75
|
|
|
66
76
|
Contributions are welcome! Feel free to fork and send a pull request through Github.
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.3.0
|
data/bin/post_office
CHANGED
|
@@ -24,6 +24,14 @@ optparse = OptionParser.new do |opts|
|
|
|
24
24
|
opts.on( '-l', '--logfile FILE', 'Write log to FILE. Outputs to STDOUT (or /var/log/post_office.log when daemonized) by default.' ) do |file|
|
|
25
25
|
options[:logfile] = file
|
|
26
26
|
end
|
|
27
|
+
|
|
28
|
+
options[:startup_item] = nil
|
|
29
|
+
opts.on('--install-osx-startup-item', 'Installs Post Office as OS X Startup Item') do
|
|
30
|
+
options[:startup_item] = :install
|
|
31
|
+
end
|
|
32
|
+
opts.on('--remove-osx-startup-item', 'Removes Post Office as OS X Startup Item') do
|
|
33
|
+
options[:startup_item] = :remove
|
|
34
|
+
end
|
|
27
35
|
|
|
28
36
|
opts.on( '-h', '--help', 'Display this screen' ) do
|
|
29
37
|
puts opts
|
|
@@ -33,6 +41,18 @@ end
|
|
|
33
41
|
|
|
34
42
|
optparse.parse!
|
|
35
43
|
|
|
44
|
+
#
|
|
45
|
+
# OS X Startup Item
|
|
46
|
+
#
|
|
47
|
+
if options[:startup_item]
|
|
48
|
+
require 'startup_item.rb'
|
|
49
|
+
case options[:startup_item]
|
|
50
|
+
when :install then StartupItem.install
|
|
51
|
+
when :remove then StartupItem.remove
|
|
52
|
+
end
|
|
53
|
+
exit
|
|
54
|
+
end
|
|
55
|
+
|
|
36
56
|
#
|
|
37
57
|
# Create our logger
|
|
38
58
|
#
|
data/lib/startup_item.rb
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
class StartupItem
|
|
2
|
+
def self.install
|
|
3
|
+
target_path = File.join("/","Library","StartupItems")
|
|
4
|
+
|
|
5
|
+
# We cannot install this twice
|
|
6
|
+
if File.exists?(File.join(target_path,"PostOffice"))
|
|
7
|
+
puts "PostOffice Startup Item is already installed."
|
|
8
|
+
exit
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# We need /usr/bin/post_officed for this startup item to function
|
|
12
|
+
unless File.exists?(File.join("/","usr","bin","post_officed"))
|
|
13
|
+
puts "Error: missing /usr/bin/post_officed. Have you gem install post_office?"
|
|
14
|
+
exit
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
puts "Installing Post Office Mac OS X Startup Item..."
|
|
18
|
+
|
|
19
|
+
# Make sure /Library/StartupItems exists
|
|
20
|
+
FileUtils.mkdir_p(target_path)
|
|
21
|
+
|
|
22
|
+
source = File.join(File.dirname(__FILE__), "..", "startup_item", "PostOffice")
|
|
23
|
+
destination = File.join(target_path, "PostOffice")
|
|
24
|
+
|
|
25
|
+
FileUtils.cp_r(source, destination)
|
|
26
|
+
|
|
27
|
+
puts "Successfully installed Startup Item!"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.remove
|
|
31
|
+
target_path = File.join("/","Library","StartupItems")
|
|
32
|
+
|
|
33
|
+
unless File.exists?(File.join(target_path,"PostOffice"))
|
|
34
|
+
puts "PostOffice Startup Item not installed."
|
|
35
|
+
exit
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
puts "removing Post Office Mac OS X Startup Item..."
|
|
39
|
+
FileUtils.rm_rf(File.join(target_path, "PostOffice"))
|
|
40
|
+
|
|
41
|
+
unless File.exists?(File.join(target_path,"PostOffice"))
|
|
42
|
+
puts "Successfully removed Startup Item!"
|
|
43
|
+
else
|
|
44
|
+
puts "Unable to remove Startup Item: hae you used sudo?"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
Binary file
|
data/post_office.gemspec
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{post_office}
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.1"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Rene van Lieshout"]
|
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
|
28
28
|
"lib/store.rb",
|
|
29
29
|
"pkg/post_office-0.1.0.gem",
|
|
30
30
|
"pkg/post_office-0.2.0.gem",
|
|
31
|
+
"pkg/post_office-0.2.1.gem",
|
|
31
32
|
"post_office.gemspec"
|
|
32
33
|
]
|
|
33
34
|
s.homepage = %q{http://github.com/bluerail/post_office}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# Post Office Daemon
|
|
5
|
+
##
|
|
6
|
+
|
|
7
|
+
. /etc/rc.common
|
|
8
|
+
|
|
9
|
+
StartService ()
|
|
10
|
+
{
|
|
11
|
+
ConsoleMessage "Starting PostOffice"
|
|
12
|
+
/usr/bin/post_officed start
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
StopService ()
|
|
16
|
+
{
|
|
17
|
+
ConsoleMessage "Stopping PostOffice"
|
|
18
|
+
/usr/bin/post_officed stop
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
RestartService ()
|
|
22
|
+
{
|
|
23
|
+
ConsoleMessage "Restarting PostOffice"
|
|
24
|
+
/usr/bin/post_officed restart
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
RunService "$1"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>Description</key>
|
|
6
|
+
<string>Post Office Daemon</string>
|
|
7
|
+
<key>OrderPreference</key>
|
|
8
|
+
<string>None</string>
|
|
9
|
+
<key>Provides</key>
|
|
10
|
+
<array>
|
|
11
|
+
<string>PostOffice</string>
|
|
12
|
+
</array>
|
|
13
|
+
<key>Uses</key>
|
|
14
|
+
<array>
|
|
15
|
+
<string>Network</string>
|
|
16
|
+
<string>Disks</string>
|
|
17
|
+
</array>
|
|
18
|
+
</dict>
|
|
19
|
+
</plist>
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: post_office
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 19
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
version: 0.
|
|
8
|
+
- 3
|
|
9
|
+
- 0
|
|
10
|
+
version: 0.3.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Rene van Lieshout
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
18
|
+
date: 2011-05-18 00:00:00 +02:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies: []
|
|
21
21
|
|
|
@@ -37,10 +37,14 @@ files:
|
|
|
37
37
|
- lib/generic_server.rb
|
|
38
38
|
- lib/pop_server.rb
|
|
39
39
|
- lib/smtp_server.rb
|
|
40
|
+
- lib/startup_item.rb
|
|
40
41
|
- lib/store.rb
|
|
41
42
|
- pkg/post_office-0.1.0.gem
|
|
42
43
|
- pkg/post_office-0.2.0.gem
|
|
44
|
+
- pkg/post_office-0.2.1.gem
|
|
43
45
|
- post_office.gemspec
|
|
46
|
+
- startup_item/PostOffice/PostOffice
|
|
47
|
+
- startup_item/PostOffice/StartupParameters.plist
|
|
44
48
|
has_rdoc: true
|
|
45
49
|
homepage: http://github.com/bluerail/post_office
|
|
46
50
|
licenses: []
|