heel 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,4 +1,7 @@
1
1
  = Changelog
2
+ == Version 0.4.0 - 2007-11-04
3
+
4
+ * Added common log format output to terminal or logfile as appropriate.
2
5
 
3
6
  == Version 0.3.2 - 2007-08-30
4
7
 
@@ -10,7 +13,7 @@
10
13
  * fix failure to find pid file [Bug #13530]
11
14
  * remember to stop releasing software in the wee hours of the morning
12
15
 
13
- === Version 0.3.0
16
+ === Version 0.3.0 - 2007-08-30
14
17
 
15
18
  * update with Launchy requirement 0.3.0
16
19
  * remove unneeded famfamfam icons
@@ -185,11 +185,12 @@ module Heel
185
185
  end
186
186
 
187
187
  entries = entries.sort_by { |e| e.link }
188
-
188
+ res_bytes = 0
189
189
  response.start(200) do |head,out|
190
190
  head['Content-Type'] = 'text/html'
191
- out.write(template.result(binding))
191
+ res_bytes = out.write(template.result(binding))
192
192
  end
193
+ return res_bytes
193
194
  end
194
195
 
195
196
  # this method is essentially the send_file method from
@@ -229,6 +230,7 @@ module Heel
229
230
  if method == ::Mongrel::Const::GET then
230
231
  response.send_file(path,stat.size < ::Mongrel::Const::CHUNK_SIZE * 2)
231
232
  end
233
+ return stat.size
232
234
  end
233
235
 
234
236
  # process the request, returning either the file, a directory
@@ -243,20 +245,30 @@ module Heel
243
245
  ::Mongrel::HttpRequest.unescape(request.params[Mongrel::Const::PATH_INFO])),
244
246
  @document_root)
245
247
  res_type = how_to_respond(req_path)
246
-
248
+ res_size = 0
249
+
247
250
  case res_type
248
251
  when :directory_listing
249
- respond_with_directory_listing(req_path,request,response)
252
+ res_size = respond_with_directory_listing(req_path,request,response)
250
253
  when String
251
- respond_with_send_file(res_type,method,request,response)
254
+ res_size = respond_with_send_file(res_type,method,request,response)
252
255
  when Integer
253
256
  response.status = res_type
254
257
  end
258
+
255
259
 
256
260
  # invalid method
257
261
  else
258
262
  response.start(403) { |head,out| out.write("Only HEAD and GET requests are honored.") }
259
263
  end
264
+ log_line = [ request.params[Mongrel::Const::REMOTE_ADDR], "-", "-", "[#{Time.now.strftime("%d/%b/%Y:%H:%M:%S %Z")}]" ]
265
+ log_line << "\"#{method}"
266
+ log_line << request.params['REQUEST_URI']
267
+ log_line << "#{request.params['HTTP_VERSION']}\""
268
+ log_line << response.status
269
+ log_line << res_size
270
+
271
+ log log_line.join(' ')
260
272
  end
261
273
 
262
274
  # essentially this is strfbytes from facets
@@ -278,7 +290,7 @@ module Heel
278
290
  end
279
291
 
280
292
  def log(msg)
281
- STDERR.print "--> ", msg, "\n"
293
+ STDERR.print msg, "\n"
282
294
  end
283
295
  end
284
296
  end
data/lib/heel/server.rb CHANGED
@@ -196,7 +196,7 @@ module Heel
196
196
  if File.exists?(c_pid_file) then
197
197
  log "ERROR: PID File #{c_pid_file} already exists. Heel may already be running."
198
198
  log "ERROR: Check the Log file #{c_log_file}"
199
- log "ERROR: Heel will not start until the .pid file is cleared."
199
+ log "ERROR: Heel will not start until the .pid file is cleared (`heel --kill' to clean it up)."
200
200
  exit 1
201
201
  end
202
202
  daemonize({:cwd => c_default_dir, :log_file => c_log_file})
data/lib/heel/version.rb CHANGED
@@ -3,8 +3,8 @@ require 'heel'
3
3
  module Heel
4
4
  class Version
5
5
  MAJOR = 0
6
- MINOR = 3
7
- BUILD = 2
6
+ MINOR = 4
7
+ BUILD = 0
8
8
 
9
9
  class << self
10
10
  def to_a
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: heel
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.2
7
- date: 2007-08-30 00:00:00 -06:00
6
+ version: 0.4.0
7
+ date: 2007-11-04 00:00:00 -04:00
8
8
  summary: A mongrel based static file webserver.
9
9
  require_paths:
10
10
  - lib