This will generate entries for every folder in your /Sites folder so that you can address your local machine as client1.box, client2.box etc. "box' in this case is the name you give the machine in the "Sharing" prefpane. Very convenient for rapid multisite work.
ATTN: this is OS X only but you can refactor it to work on *X.
1
2
3 SitesDir = '/Sites'
4 DomainSuffix = `hostname`.gsub('.local', '').downcase.gsub(/\s/, '')
5
6
7 `nidump hosts .`.split("\n").uniq.sort.each do | dir |
8 next unless (dir.split('.').pop == DomainSuffix)
9 host = dir.split("\t").pop
10 cmd = `niutil -destroy . /machines/#{host}`
11 end
12
13 Dir.entries(SitesDir).each do | entry |
14 next if (!File.stat("#{SitesDir}/#{entry}").directory? || entry == '.' || entry == '..')
15 puts "> Adding website #{entry}.#{DomainSuffix}"
16 `niutil -create . /machines/#{entry}.#{DomainSuffix}`
17 `niutil -createprop . /machines/#{entry}.#{DomainSuffix} ip_address 127.0.0.1`
18 end