Browse files

Merge pull request #6 from EugZol/master

Support of subdomains
  • Loading branch information...
2 parents d136f97 + 5f3e8d4 commit 018ba68494442b75f70df6d5770466e159c28ba0 @pyromaniac committed Aug 28, 2011
Showing with 9 additions and 3 deletions.
  1. +8 −2 lib/hoof/application.rb
  2. +1 −1 lib/hoof/http_server.rb
View
10 lib/hoof/application.rb
@@ -9,8 +9,14 @@ def initialize name
def start
unless running?
- load_rvm
- system "cd #{root} && bundle exec unicorn_rails -c #{File.join(File.dirname(__FILE__), 'unicorn_config.rb')} -l #{sock} -D"
+ rvmrc = ""
+ if File.exists?(root + '/.rvmrc')
+ rvmrc = File.read(root + '/.rvmrc').chomp
+ rvmrc << " exec "
+ else
+ load_rvm
+ end
+ system "cd #{root} && #{rvmrc}bundle exec unicorn_rails -c #{File.join(File.dirname(__FILE__), 'unicorn_config.rb')} -l #{sock} -D"
end
end
View
2 lib/hoof/http_server.rb
@@ -20,7 +20,7 @@ def process_http_request
host = @http_headers.scan(/Host:\s*([-a-zA-z.]*)\000/)[0][0].gsub(/:\d+$/, '')
close_connection and return unless host =~ /.dev$/
- name = host.gsub(/.dev$/, '')
+ name = host.split('.')[-2]
application = Hoof.find name
if application

0 comments on commit 018ba68

Please sign in to comment.