public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
Server documentation

Added documentation for Merb::Server methods.

Signed-off-by: Michael D. Ivey <ivey@gweezlebur.com>
Janne Asmala (author)
Tue Feb 12 22:50:22 -0800 2008
ivey (committer)
Wed Feb 13 13:57:16 -0800 2008
commit  b3d1385cd1b950d1ce32e709cc1b937d1755c3d1
tree    04d99370e31cbcab57c204f5d0e30eb203cf5775
parent  bdfa396c8c4c6dda7a9a4a3a7adaa30b8d39fb85
...
1
2
3
4
 
5
6
7
8
 
 
 
 
 
 
 
 
 
 
 
 
9
10
11
...
33
34
35
36
 
 
 
 
 
 
37
38
39
...
43
44
45
46
 
 
 
 
 
 
 
47
48
49
...
69
70
71
72
 
 
73
74
75
...
94
95
96
97
 
 
 
 
 
 
 
 
 
98
99
100
...
104
105
106
107
 
 
 
 
 
 
 
 
 
108
109
110
...
115
116
117
118
119
120
121
 
 
 
 
 
 
 
 
122
123
124
...
137
138
139
140
141
 
142
...
1
2
3
 
4
5
6
7
 
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
44
45
46
 
47
48
49
50
51
52
53
54
55
...
59
60
61
 
62
63
64
65
66
67
68
69
70
71
...
91
92
93
 
94
95
96
97
98
...
117
118
119
 
120
121
122
123
124
125
126
127
128
129
130
131
...
135
136
137
 
138
139
140
141
142
143
144
145
146
147
148
149
...
154
155
156
 
 
 
 
157
158
159
160
161
162
163
164
165
166
167
...
180
181
182
 
183
184
185
0
@@ -1,11 +1,22 @@
0
 require 'etc'
0
 module Merb
0
   
0
- # Server encapsulates the management of merb daemons
0
+ # Server encapsulates the management of Merb daemons.
0
   class Server
0
     class << self
0
 
0
- # Start a merb server, in either foreground, daemonized or cluster mode
0
+ # Start a Merb server, in either foreground, daemonized or cluster mode.
0
+ #
0
+ # ==== Parameters
0
+ # port<~to_i>::
0
+ # The port to which the first server instance should bind to.
0
+ # Subsequent server instances bind to the immediately following ports.
0
+ # cluster<~to_i>::
0
+ # Number of servers to run in a cluster.
0
+ #
0
+ # ==== Alternatives
0
+ # If cluster is left out, then one process will be started. This process
0
+ # will be daemonized if Merb::Config[:daemonize] is true.
0
       def start(port, cluster=nil)
0
         @port = port
0
         @cluster = cluster
0
@@ -33,7 +44,12 @@ module Merb
0
         end
0
       end
0
 
0
- # Check to see if there is already a merb running on this port
0
+ # ==== Parameters
0
+ # port<~to_s>:: The port to check for Merb instances on.
0
+ #
0
+ # ==== Returns
0
+ # Boolean::
0
+ # True if Merb is running on the specified port.
0
       def alive?(port)
0
         f = "#{Merb.dir_for(:log)}" / "merb.#{port}.pid"
0
         pid = IO.read(f).chomp.to_i
0
@@ -43,7 +59,13 @@ module Merb
0
         false
0
       end
0
 
0
- # Killa merb process with a certain signal.
0
+ # ==== Parameters
0
+ # port<~to_s>:: The port of the Merb process to kill.
0
+ # sig<~to_s>:: The signal to send to the process. Defaults to 9.
0
+ #
0
+ # ==== Alternatives
0
+ # If you pass "all" as the port, the signal will be sent to all Merb
0
+ # processes.
0
       def kill(port, sig=9)
0
         Merb::BootLoader::BuildFramework.run
0
         begin
0
@@ -69,7 +91,8 @@ module Merb
0
         end
0
       end
0
 
0
- # Daemonize a merb server running on a specified port
0
+ # ==== Parameters
0
+ # port<~to_s>:: The port of the Merb process to daemonize.
0
       def daemonize(port)
0
         fork do
0
           Process.setsid
0
@@ -94,7 +117,15 @@ module Merb
0
         end
0
       end
0
 
0
- # Remove PID file from the filesystem
0
+ # Removes a PID file from the filesystem.
0
+ #
0
+ # ==== Parameters
0
+ # port<~to_s>::
0
+ # The port of the Merb process to whom the the PID file belongs to.
0
+ #
0
+ # ==== Alternatives
0
+ # If Merb::Config[:pid_file] has been specified, that will be used
0
+ # instead of the port based PID file.
0
       def remove_pid_file(port)
0
         if Merb::Config[:pid_file]
0
           pidfile = Merb::Config[:pid_file]
0
@@ -104,7 +135,15 @@ module Merb
0
         FileUtils.rm(pidfile) if File.exist?(pidfile)
0
       end
0
 
0
- # Store PID file on the filesystem
0
+ # Stores a PID file on the filesystem.
0
+ #
0
+ # ==== Parameters
0
+ # port<~to_s>::
0
+ # The port of the Merb process to whom the the PID file belongs to.
0
+ #
0
+ # ==== Alternatives
0
+ # If Merb::Config[:pid_file] has been specified, that will be used
0
+ # instead of the port based PID file.
0
       def store_pid(port)
0
         FileUtils.mkdir_p(Merb.dir_for(:log)) unless File.directory?(Merb.dir_for(:log))
0
         if Merb::Config[:pid_file]
0
@@ -115,10 +154,14 @@ module Merb
0
         File.open(pidfile, 'w'){ |f| f.write("#{Process.pid}") }
0
       end
0
           
0
- # Change privileges of the process
0
- # to the specified user and group.
0
- # if you only specify user, group
0
- # will be the same as user.
0
+ # Change privileges of the process to the specified user and group.
0
+ #
0
+ # ==== Parameters
0
+ # user<String>:: The user who should own the server process.
0
+ # group<String>:: The group who should own the server process.
0
+ #
0
+ # ==== Alternatives
0
+ # If group is left out, the user will be used as the group.
0
       def change_privilege(user, group=user)
0
         Merb.logger.info "Changing privileges to #{user}:#{group}"
0
         
0
@@ -137,4 +180,4 @@ module Merb
0
       end
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end
0
\ No newline at end of file

Comments

    No one has commented yet.