ruby-style 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +91 -79
  2. data/lib/style/adapter/generic.rb +9 -0
  3. metadata +5 -2
data/README CHANGED
@@ -28,8 +28,8 @@ Subversion access is available at svn://code.jeremyevans.net/ruby-style/.
28
28
  the fly
29
29
  * Supports both command line and yaml config file configuration
30
30
  * Is easily extensible to support running other frameworks and protocols other
31
- than the included ones (Rails and Ramaze; SCGI, Mongrel, and Evented
32
- Mongrel)
31
+ than the included ones (Rails, Ramaze, and a generic adapter; SCGI, Mongrel,
32
+ and Evented Mongrel)
33
33
 
34
34
  == Running and configuration
35
35
 
@@ -173,44 +173,55 @@ below for information on the adapter_config config file variable.
173
173
  Example Rails+Mongrel style.yaml that listens on ports 8912 and 8193 on any
174
174
  interface, with three listeners per port. Note how the :adapter_config entry
175
175
  is used to set up settings specific to the Rails adapter, such as placing
176
- Rails in development mode.
177
-
178
- ---
179
- :port: 8912
180
- :bind: ""
181
- :fork: 3
182
- :number: 2
183
- :killtime: 1
184
- :adapter: rails
185
- :handler: mongrel
186
- :adapter_config:
187
- :environment: development
188
- :log_file: log/rails-mongrel.log
189
- :docroot: public
190
- :num_processors: 99
191
- :timeout: 100
176
+ Rails in development mode. Ignore the pipes at the beginning of the line,
177
+ blame RDoc limitations.
178
+
179
+ | ---
180
+ | :port: 8912
181
+ | :bind: ""
182
+ | :fork: 3
183
+ | :number: 2
184
+ | :killtime: 1
185
+ | :adapter: rails
186
+ | :handler: mongrel
187
+ | :adapter_config:
188
+ | :environment: development
189
+ | :log_file: log/rails-mongrel.log
190
+ | :docroot: public
191
+ | :num_processors: 99
192
+ | :timeout: 100
192
193
 
193
194
  Example Rails+SCGI style.yaml that has four listeners on port 8912:
194
195
 
195
- ---
196
- :port: 8912
197
- :fork: 4
198
- :number: 1
199
- :adapter: rails
200
- :handler: scgi
201
- :adapter_config:
202
- :logfile: log/railsscgi.log
203
- :maxconns: 10
204
- :environment: production
196
+ | ---
197
+ | :port: 8912
198
+ | :fork: 4
199
+ | :number: 1
200
+ | :adapter: rails
201
+ | :handler: scgi
202
+ | :adapter_config:
203
+ | :logfile: log/railsscgi.log
204
+ | :maxconns: 10
205
+ | :environment: production
205
206
 
206
207
  Very simple configuration that runs Ramaze+Evented Mongrel in unsupervised
207
208
  mode on port 3000.
208
209
 
209
- ---
210
- :port: 3000
211
- :unsupervised: 1
212
- :adapter: ramaze
213
- :handler: evented_mongrel
210
+ | ---
211
+ | :port: 3000
212
+ | :unsupervised: 1
213
+ | :adapter: ramaze
214
+ | :handler: evented_mongrel
215
+
216
+ Using the generic adapter to host a camping application (you are responsible
217
+ for having the camping application in a my_camping_app.rb file in your
218
+ $LOAD_PATH that uses Mongrel to run camping):
219
+
220
+ | ---
221
+ | :port: 3301
222
+ | :adapter: generic
223
+ | :adapter_config:
224
+ | :script: my_camping_app
214
225
 
215
226
  == How restarting works
216
227
 
@@ -219,51 +230,51 @@ killing the exisiting process. It repeats this for all existing child processes
219
230
 
220
231
  For example:
221
232
 
222
- # style idling with three listeners
223
- Thu Sep 6 12:01:47 PDT 2007
224
- 11460 ?? I 0:00.00 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
225
- 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
226
- 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
227
- 27808 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
228
- # Restart occurs, new process started (1207)
229
- Thu Sep 6 12:01:49 PDT 2007
230
- 11460 ?? I 0:00.00 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
231
- 27808 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
232
- 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
233
- 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
234
- 1207 ?? R 0:00.95 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
235
- # Old process killed (27808)
236
- Thu Sep 6 12:01:51 PDT 2007
237
- 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
238
- 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
239
- 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
240
- 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
241
- # New process started (3204)
242
- Thu Sep 6 12:01:53 PDT 2007
243
- 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
244
- 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
245
- 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
246
- 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
247
- 3204 ?? R 0:01.01 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
248
- # Old process killed (6540)
249
- Thu Sep 6 12:01:55 PDT 2007
250
- 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
251
- 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
252
- 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
253
- 3204 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
254
- # New process started (6766)
255
- Thu Sep 6 12:01:57 PDT 2007
256
- 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
257
- 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
258
- 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
259
- 3204 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
260
- 6766 ?? R 0:00.99 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
261
- # Old process killed (272)
262
- Thu Sep 6 12:01:59 PDT 2007
263
- 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
264
- 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
265
- 3204 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
266
- 6766 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
233
+ # style idling with three listeners
234
+ Thu Sep 6 12:01:47 PDT 2007
235
+ 11460 ?? I 0:00.00 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
236
+ 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
237
+ 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
238
+ 27808 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
239
+ # Restart occurs, new process started (1207)
240
+ Thu Sep 6 12:01:49 PDT 2007
241
+ 11460 ?? I 0:00.00 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
242
+ 27808 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
243
+ 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
244
+ 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
245
+ 1207 ?? R 0:00.95 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
246
+ # Old process killed (27808)
247
+ Thu Sep 6 12:01:51 PDT 2007
248
+ 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
249
+ 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
250
+ 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
251
+ 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
252
+ # New process started (3204)
253
+ Thu Sep 6 12:01:53 PDT 2007
254
+ 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
255
+ 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
256
+ 6540 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
257
+ 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
258
+ 3204 ?? R 0:01.01 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
259
+ # Old process killed (6540)
260
+ Thu Sep 6 12:01:55 PDT 2007
261
+ 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
262
+ 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
263
+ 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
264
+ 3204 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
265
+ # New process started (6766)
266
+ Thu Sep 6 12:01:57 PDT 2007
267
+ 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
268
+ 272 ?? I 0:02.52 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
269
+ 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
270
+ 3204 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
271
+ 6766 ?? R 0:00.99 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
272
+ # Old process killed (272)
273
+ Thu Sep 6 12:01:59 PDT 2007
274
+ 11460 ?? I 0:00.01 ruby: RailsMongrelStyle dir:/home/billg/testrails supervisor (ruby)
275
+ 1207 ?? I 0:02.51 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
276
+ 3204 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
277
+ 6766 ?? I 0:02.49 ruby: RailsMongrelStyle dir:/home/billg/testrails port:8912 environment:production (ruby)
267
278
 
268
279
  Result, three brand new listening processes, total time to restart is about 12
269
280
  seconds (2 * (2 killtime * 1 number * 3 fork)).
@@ -277,7 +288,8 @@ Machine were modified to support this.
277
288
 
278
289
  Support for other adapters is easily added by adding the run method to the
279
290
  Style class. This can be easy (as it is with Ramaze), or more difficult (as it
280
- is with Rails). If the adapter uses Rack, it should be fairly simple.
291
+ is with Rails). If the adapter uses Rack, it should be fairly simple. You can
292
+ also just use the generic adapter to specify a string to require.
281
293
 
282
294
  Style loads adapters and handlers from style/{adapter,handler} relative to the
283
295
  load path, so you can add your own adapters and handlers without modifying the
@@ -0,0 +1,9 @@
1
+ class Style
2
+ # This requires config[:adapter_config][:script] || 'style_adapter',
3
+ # which means you can use it to host other supported web frameworks.
4
+ # Those frameworks should start the server that style is currently using,
5
+ # in order to pick up the correct socket.
6
+ def run
7
+ require(config[:adapter_config][:script] || 'style_adapter')
8
+ end
9
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: ruby-style
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.1.0
7
- date: 2008-01-27 00:00:00 -08:00
6
+ version: 1.1.1
7
+ date: 2008-02-23 00:00:00 -08:00
8
8
  summary: Supervised TCPServer, Yielding Listeners Easily
9
9
  require_paths:
10
10
  - lib
@@ -38,11 +38,14 @@ files:
38
38
  - lib/style/handler/evented_mongrel.rb
39
39
  - lib/style/adapter/ramaze.rb
40
40
  - lib/style/adapter/rails.rb
41
+ - lib/style/adapter/generic.rb
41
42
  test_files: []
42
43
 
43
44
  rdoc_options:
44
45
  - --inline-source
45
46
  - --line-numbers
47
+ - README
48
+ - lib
46
49
  extra_rdoc_files: []
47
50
 
48
51
  executables: