Permalink
Browse files

consolidate constants appropriately in Heel::Configuration

20080421055048-42483-16458b1b4a8bae4a34b84c79d9a9b06e28b7bc2c.gz
  • Loading branch information...
1 parent 483311b commit ab5c0e2e0ccbccb21d7c33ca3a23de8789513b44 @copiousfreetime committed with git-darcs-import Apr 21, 2008
Showing with 15 additions and 11 deletions.
  1. +1 −1 gemspec.rb
  2. +0 −1 lib/heel.rb
  3. +2 −0 lib/heel/configuration.rb
  4. +1 −2 lib/heel/error_response.rb
  5. +6 −1 lib/heel/logger.rb
  6. +3 −5 lib/heel/server.rb
  7. +2 −1 tasks/config.rb
View
@@ -22,7 +22,7 @@
spec.add_dependency("mime-types", ">= 1.15")
spec.add_dependency("launchy", ">= 0.3.1")
spec.add_dependency("coderay", ">= 0.7.4.215")
-
+
if rdoc = Configuration.for_if_exist?('rdoc') then
spec.has_rdoc = true
spec.extra_rdoc_files = pkg.files.rdoc
View
@@ -4,7 +4,6 @@
#++
module Heel
-
# recursively descend the directory with the same name as this file and do a
# require 'heel/path/to/file'
#
@@ -53,6 +53,8 @@ def self.lib_path(*args)
self.sub_path("lib", *args)
end
+ HOMEPAGE = "http://copiousfreetime.rubyforge.org/heel/"
+
private
def self.sub_path(sub,*args)
sp = ::File.join(root_dir, sub) + File::SEPARATOR
@@ -6,7 +6,6 @@
require 'heel'
require 'rack'
require 'erb'
-require 'tasks/config'
module Heel
@@ -24,7 +23,7 @@ def template
end
def homepage
- @homepage ||= ::Configuration.for("project").homepage
+ @homepage ||= Heel::Configuration::HOMEPAGE
end
end
View
@@ -16,11 +16,16 @@ module Heel
class Logger < ::Rack::CommonLogger
class << self
def log
+ # the log can get closed if daemonized, the at_exit will close it.
+ if @log.closed? then
+ @log = File.open(@log_file, "a")
+ end
@log
end
def log_file=(lf)
- @log = File.open(lf, "a")
+ @log_file = lf
+ @log = File.open(@log_file, "a")
at_exit { @log.close unless @log.closed? }
end
end
View
@@ -227,16 +227,14 @@ def server.name
server.pid_file = pid_file
server.log_file = log_file
- # local variables for the block
- dr = options.document_root
- h = options.highlighting
+ app = Heel::RackApp.new({ :document_root => options.document_root,
+ :highlighting => options.highlighting})
Heel::Logger.log_file = log_file
server.app = Rack::Builder.new {
use Heel::Logger
map "/" do
- run Heel::RackApp.new({ :document_root => dr,
- :highlighting => h})
+ run app
end
map "/heel_css" do
run Rack::File.new(Heel::Configuration.data_path( "css" ))
View
@@ -1,6 +1,7 @@
require 'configuration'
require 'rake'
+require 'heel'
require 'heel/configuration'
require 'heel/version'
@@ -14,7 +15,7 @@
version Heel::VERSION
author "Jeremy Hinegardner"
email "jeremy at hinegardner dot org"
- homepage "http://copiousfreetime.rubyforge.org/heel/"
+ homepage Heel::Configuration::HOMEPAGE
description Utils.section_of("README", "description")
summary description.split(".").first
history "HISTORY"

0 comments on commit ab5c0e2

Please sign in to comment.