version = $*[0]
File.open("version.rb","w"){|f| f.puts 'Version = %p' % (version || "unstable") }

`rm -r ../site/iogii-#{version}` if version && Dir.exist?("../site/iogii-#{version}")

`cd ../site; mkdir iogii-#{version}; cp -r ../src iogii-#{version}/src; tar -czf iogii-#{version}.tgz iogii-#{version}; rm -r iogii-#{version}` if version

`ruby web/mk1file.rb > iogii && chmod +x iogii`
if version
  `cp iogii ../site/iogii-#{version}`
  `cp iogii ../site/iogii`
  `cp engine.hs ../site/engine-#{version}.hs`
  `cp engine.hs ../site/engine.hs`
end
