ftxt = open 'version.txt', 'r'
version = ftxt.gets.chomp
fpas = open 'version.pas', 'w'
fpas.print <<EOT
unit version;

interface

procedure Init_version;

implementation

uses Rubies, uPhi;

procedure Init_version;
begin
  rb_define_const(mPhi, 'VERSION', rb_str_new2('#{version}'));
end;

end.
EOT

@host = 'www.moriq.com/ruby/archive/'
@version = version.gsub(/0\./, '')
@ap_path = '../doc'

def setup(src, arch='')
  f = open File.join(@ap_path, src), 'w'
  f.print %!<a href="http://#{@host}ap-#{@version}#{arch}.zip">!
  f.print %!ap-#{@version}#{arch}.zip!
  f.print %!</a>!
  f.close
end

setup 'ap-bin.h'
