; Script generated by the My Inno Setup Extensions Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! [Setup] AppName=P4 API for Ruby AppVerName=P4 API for Ruby 0.1 AppPublisher=Vaccaperna Systems Ltd (Installer only) - Tony Smith for P4 Ruby API AppPublisherURL=http://www.vaccaperna.co.uk AppSupportURL=http://www.vaccaperna.co.uk AppUpdatesURL=http://www.vaccaperna.co.uk DefaultDirName={code:InstallDir} DefaultGroupName=P4Ruby DisableProgramGroupPage=yes DirExistsWarning=no DisableDirPage=yes [Files] Source: "P4.so"; DestDir: "{code:InstallDir}"; CopyMode: alwaysoverwrite; [Icons] Name: "{group}\P4Ruby"; Filename: "{app}\MyProg.exe" [Code] // This section is the Pascal script - various procedures called from above. program Setup; var bRubyInstalled: Boolean; LibPath: String; //--------------------------------------------------- // Called automatically at the start of initialization function InitializeSetup(): Boolean; var TempFile: String; Cmd: String; Quote: String; Lines: TArrayOfString; i: Longint; ResultCode: Integer; begin // Make sure Ruby is installed and work out where to copy library Result := False; TempFile := GenerateUniqueName(GetTempDir(), '.ini'); // Some fiddling to find appropriate way to get output - straight piping didn't seem to work. // It's the "puts $:" which actually puts the resulting set of lines into the temp file Quote := ''''; Cmd := '-e "File.open(' + Quote + TempFile + Quote + ', ' + Quote + 'w' + Quote + ') do |f|; f.puts $: ; end"'; if not InstExec('ruby.exe', Cmd, GetTempDir(), True, False, SW_SHOWMINNOACTIVE, ResultCode) then begin MsgBox('Can''t find ruby.exe in your path - Ruby doesn''t seem to be installed.' + #13#13 'Please fix this and try again!', mbError, MB_OK); end else begin bRubyInstalled := True; if not LoadStringsFromFile(TempFile, Lines) then begin MsgBox('Error loading strings '' from file.', mbError, MB_OK); end else begin // searching for a line like: // c:/ruby167/lib/ruby/1.6/i586-mswin32 // rather than // c:/ruby167/lib/ruby/site_ruby/1.6/i586-mswin32 for i := 0 to GetArrayLength(Lines)-1 do begin if (not Result and (Pos('mswin32', Lines[i]) > 0) and (Pos('site_ruby', Lines[i]) = 0)) then begin LibPath := Lines[i]; StringChange(LibPath, '/', '\'); // Convert to right seperators Result := True; end; end; end; DeleteFile(TempFile); end; end; //---------------------------- function InstallDir(Default: String): String; begin Result := LibPath; end; begin end.
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 2413 | Robert Cowham |
First version of installer for prebuilt Ruby API. Uses freeware My Inno Setup Extensions from http://www.wintax.nl/isx/ |