Skip to content

Commit

Permalink
added /etc/hosts pseudo-server & MacPorts apache2 pseudo-server
Browse files Browse the repository at this point in the history
  • Loading branch information
everzet committed Jun 25, 2009
1 parent 56dd1b5 commit 12b1433
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/servers/localhost.rb
@@ -0,0 +1,20 @@
module LocalhostServer
def self.config_ok?
true
end

def self.reload
File.open('/etc/hosts.tmp', "w") do |file|
File.foreach("/etc/hosts") do |line|
break if line.match("\# CUSTOM HOSTS")
file.puts line
end
file.puts "\# CUSTOM HOSTS"
File.foreach(Webconfig::WEBCONFIG_PATH + '/gen/localhost.gen.conf') do |line|
file.puts line unless line.match(/^$/)
end
end
FileUtils.cp '/etc/hosts', '/etc/hosts.back'
FileUtils.mv '/etc/hosts.tmp', '/etc/hosts'
end
end
9 changes: 9 additions & 0 deletions lib/servers/mpapache2.rb
@@ -0,0 +1,9 @@
module Mpapache2Server
def self.config_ok?
true
end
def self.reload
system("/opt/local/apache2/bin/apachectl restart")
true
end
end

0 comments on commit 12b1433

Please sign in to comment.