diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/README rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/README --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/README 2004-06-27 20:07:57.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/README 2004-07-26 18:46:52.000000000 +0200 @@ -2,7 +2,7 @@ The latter is just for playing with the internals. Both are available on the site. -Usage: ruby init.rb application[.rb[w]] [--rubyscript2exe-rubyw|--rubyscript2exe-ruby] [--rubyscript2exe-msvcr71] + Usage: ruby init.rb application[.rb[w]] [--rubyscript2exe-rubyw|--rubyscript2exe-ruby] For more information, see http://www.erikveen.dds.nl/rubyscript2exe/ . diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/eee.pas rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/eee.pas --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/eee.pas 2004-06-27 19:52:18.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/eee.pas 2004-07-26 16:46:37.000000000 +0200 @@ -6,6 +6,14 @@ SysUtils, Dos; +const + + {$IFDEF LINUX} + slash = ´/´; + {$ELSE} + slash = ´\´; + {$ENDIF} + type header = record @@ -18,7 +26,7 @@ length : longint; number : longint; who : string[255]; - exename : string[32]; + exename : string[255]; end; var @@ -33,13 +41,11 @@ tekst1 : string[255]; tekst2 : string; s : string[255]; - c : string; - p : string; + i : longint; + dir : string[255]; h : header; t : tail; teller : longint; - i : longint; - dir : string[255]; parms : string; quotedparms : string; justextract : boolean; @@ -87,7 +93,7 @@ chdir(dir); {$I-} - rmdir(path + ´\´); + rmdir(path + slash); if (ioresult <> 0) then begin // writeln(´Couldn´´t delete directory ´ + path + ´ (Known Error).´); end; @@ -162,183 +168,360 @@ end; -procedure pakin; +procedure pakin_f(var outfile: file; klasse: string[1]; tekst: string[255]; entry: string[255]; var t: tail); + +var + infile : file of byte; + h : header; + +begin + + h.klasse := klasse; + h.tekst := tekst; + + assign(infile, entry); + reset(infile, 1); + h.length := filesize(infile); + t.length := t.length + h.length + sizeof(h); + blockwrite(outfile, h, sizeof(h)); + blockcopy(infile, outfile, h.length, true); + close(infile); + + t.number := t.number + 1; + +end; + + +procedure pakin_d(var outfile: file; klasse: string[1]; tekst: string[255]; entry: string[255]; var t: tail); + +var + h : header; + +begin + + entry := entry; + + h.klasse := klasse; + h.tekst := tekst; + h.length := 0; + t.length := t.length + sizeof(h); + + blockwrite(outfile, h, sizeof(h)); + + t.number := t.number + 1; + +end; + + +procedure pakin_r(var outfile: file; klasse: string[1]; tekst: string[255]; entry: string[255]; var t: tail); + +var + f : file; + sr : searchrec; + dir : string[255]; + attr : word; begin - assign(outfile, paramstr(2)); - rewrite(outfile, 1); + klasse := klasse; + + pakin_d(outfile, ´d´, tekst, entry, t); + + getdir(0, dir); + chdir(entry); - assign(eeefile, paramstr(1)); - reset(eeefile); + findfirst(´*.*´, anyfile or directory, sr); + while(doserror = 0) do begin + assign(f, sr.name); // Foutje in 1.9.2 ??? + getfattr(f, attr); // Foutje in 1.9.2 ??? - if (paramcount > 2) then begin - assign(infile, paramstr(3)); - t.exename := paramstr(3); + if (attr and directory > 0) then begin + if ((not (sr.name = ´.´)) and (not (sr.name = ´..´))) then begin + pakin_r(outfile, ´r´, tekst + slash + sr.name, sr.name, t); + end; end else begin - assign(infile, paramstr(0)); - t.exename := paramstr(0); + pakin_f(outfile, ´f´, tekst + slash + sr.name, sr.name, t); end; - reset(infile, 1); - blockcopy(infile, outfile, filesize(infile), false); - close(infile); + findnext(sr); + end; + findclose(sr); - t.length := 0; - t.number := 0; - t.who := me; + chdir(dir); - s := ´\´; - i := pos(s, t.exename); - while (i > 0) do begin - t.exename := copy(t.exename, i+length(s), length(t.exename)-(i+length(s))+1); - i := pos(s, t.exename); - end; - - repeat - readln(eeefile, s); - - if (not (s = ´´) and not (copy(s, 1, 1) = ´#´)) then begin - klasse := copy(s, 1, 1); - tekst1 := copy(s, 3, length(s)-2); - - // writeln(h.klasse, ´ ´, h.tekst); - - if (klasse = ´f´) then begin - h.klasse := klasse; - h.tekst := tekst1; - - assign(infile, h.tekst); - reset(infile, 1); - h.length := filesize(infile); - t.length := t.length + h.length + sizeof(h); - blockwrite(outfile, h, sizeof(h)); - blockcopy(infile, outfile, h.length, true); - close(infile); - end; +end; - if (klasse = ´c´) then begin - h.klasse := klasse; - h.tekst := tekst1; - h.length := 0; - t.length := t.length + sizeof(h); - blockwrite(outfile, h, sizeof(h)); - end; +procedure pakin_c(var outfile: file; klasse: string[1]; tekst: string[255]; entry: string[255]; var t: tail); - if (klasse = ´t´) then begin - h.klasse := klasse; - h.tekst := tekst1; - h.length := 0; - t.length := t.length + sizeof(h); +var + h : header; - blockwrite(outfile, h, sizeof(h)); - end; +begin + + entry := entry; + + h.klasse := klasse; + h.tekst := tekst; + h.length := 0; + t.length := t.length + sizeof(h); + + blockwrite(outfile, h, sizeof(h)); + + t.number := t.number + 1; + +end; + + +procedure pakin_t(var outfile: file; klasse: string[1]; tekst: string[255]; entry: string[255]; var t: tail); + +var + h : header; + +begin + + entry := entry; + + h.klasse := klasse; + h.tekst := tekst; + h.length := 0; + t.length := t.length + sizeof(h); + + blockwrite(outfile, h, sizeof(h)); + + t.number := t.number + 1; + +end; + + +procedure pakin; + +begin + + assign(outfile, paramstr(2)); + rewrite(outfile, 1); + + assign(eeefile, paramstr(1)); + reset(eeefile); + + if (paramcount > 2) then begin + assign(infile, paramstr(3)); + t.exename := paramstr(3); + end + else begin + assign(infile, paramstr(0)); + t.exename := paramstr(0); + end; + + reset(infile, 1); + blockcopy(infile, outfile, filesize(infile), false); + close(infile); + + t.length := 0; + t.number := 0; + t.who := me; + + s := slash; + i := pos(s, t.exename); + while (i > 0) do begin + t.exename := copy(t.exename, i+length(s), length(t.exename)-(i+length(s))+1); + i := pos(s, t.exename); + end; + + repeat + readln(eeefile, s); - t.number := t.number + 1; + if (not (s = ´´) and not (copy(s, 1, 1) = ´#´)) then begin + klasse := copy(s, 1, 1); + tekst1 := copy(s, 3, length(s)-2); + + case klasse[1] of + ´f´: pakin_f(outfile, klasse, tekst1, tekst1, t); + ´d´: pakin_d(outfile, klasse, tekst1, tekst1, t); + ´r´: pakin_r(outfile, klasse, tekst1, tekst1, t); + ´c´: pakin_c(outfile, klasse, tekst1, tekst1, t); + ´t´: pakin_t(outfile, klasse, tekst1, tekst1, t); end; - until eof(eeefile); + end; + until eof(eeefile); - t.length := t.length + sizeof(t); + t.length := t.length + sizeof(t); - blockwrite(outfile, t, sizeof(t)); + blockwrite(outfile, t, sizeof(t)); - close(eeefile); + close(eeefile); - close(outfile); + close(outfile); end; -procedure pakuit; +procedure pakuit_f(var infile: file; var outfile: file; tekst: string[255]; var h: header); begin - randomize; + assign(outfile, workdir + slash + tekst); + rewrite(outfile, 1); - getdir(0, dir); - chdir(tempdir); - {$I-} - repeat - str(random(1000), s); - workdir := ´eee.´ + s; - mkdir(workdir); - until (ioresult = 0); - {$I+} + blockcopy(infile, outfile, h.length, true); - workdir := tempdir + ´\´ + workdir; - chdir(dir); + close(outfile); - assign(infile, paramstr(0)); - reset(infile, 1); - blockeat(infile, filesize(infile)-t.length); +end; - try - for teller := 1 to t.number do begin - blockread(infile, h, sizeof(h)); +procedure pakuit_d(var infile: file; var outfile: file; tekst: string[255]; var h: header); - tekst2 := h.tekst; +begin - s := ´%tempdir%´; - i := pos(s, tekst2); - while (i > 0) do begin - tekst2 := copy(tekst2, 1, i-1) + workdir + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); - i := pos(s, tekst2); - end; + infile := infile; + outfile := outfile; + h := h; - s := ´%parms%´; - i := pos(s, tekst2); - while (i > 0) do begin - tekst2 := copy(tekst2, 1, i-1) + parms + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); - i := pos(s, tekst2); - end; + mkdir(workdir + slash + tekst); + +end; - s := ´%quotedparms%´; - i := pos(s, tekst2); - while (i > 0) do begin - tekst2 := copy(tekst2, 1, i-1) + quotedparms + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); - i := pos(s, tekst2); - end; - // writeln(h.klasse, ´ ´, tekst2); +procedure pakuit_c(var infile: file; var outfile: file; tekst: string[255]; var h: header); - if (h.klasse = ´f´) then begin - assign(outfile, workdir + ´\´ + tekst2); - rewrite(outfile, 1); +var + c : string; + p : string; + i : longint; - blockcopy(infile, outfile, h.length, true); +begin - close(outfile); - end; + infile := infile; + outfile := outfile; + h := h; + + {$IFDEF LINUX} + c := getenv(´SHELL´); + p := ´-c "´ + tekst + ´"´; + {$ELSE} + i := pos(´ ´, tekst); + if (i = 0) then begin + c := tekst; + p := ´´; + end + else begin + c := copy(tekst, 1, i-1); + p := copy(tekst, i+1, length(tekst)-i); + end; + {$ENDIF} - if (h.klasse = ´c´) then begin - i := pos(´ ´, tekst2); - c := copy(tekst2, 1, i-1); - p := copy(tekst2, i+1, length(tekst2)-i); - executeprocess(c, p); - end; + executeprocess(c, p); - if (h.klasse = ´t´) then begin - getdir(0, dir); - chdir(workdir); - i := pos(´ ´, tekst2); - c := copy(tekst2, 1, i-1); - p := copy(tekst2, i+1, length(tekst2)-i); - executeprocess(c, p); - chdir(dir); - end; - end; +end; + + +procedure pakuit_t(var infile: file; var outfile: file; tekst: string[255]; var h: header); + +var + c : string; + p : string; + i : longint; + dir : string[255]; + +begin + + infile := infile; + outfile := outfile; + h := h; + + {$IFDEF LINUX} + c := getenv(´SHELL´); + p := ´-c "´ + tekst + ´"´; + {$ELSE} + i := pos(´ ´, tekst); + if (i = 0) then begin + c := tekst; + p := ´´; + end + else begin + c := copy(tekst, 1, i-1); + p := copy(tekst, i+1, length(tekst)-i); + end; + {$ENDIF} + + getdir(0, dir); + chdir(workdir); + executeprocess(c, p); + chdir(dir); + +end; + + +procedure pakuit; + +begin + + randomize; + + getdir(0, dir); + chdir(tempdir); + {$I-} + repeat + str(random(1000), s); + workdir := ´eee.´ + s; + mkdir(workdir); + until (ioresult = 0); + {$I+} + + workdir := tempdir + slash + workdir; + chdir(dir); + + assign(infile, paramstr(0)); + reset(infile, 1); + blockeat(infile, filesize(infile)-t.length); + + try + + for teller := 1 to t.number do begin + blockread(infile, h, sizeof(h)); + + klasse := h.klasse; + tekst2 := h.tekst; - finally + s := ´%tempdir%´; + i := pos(s, tekst2); + while (i > 0) do begin + tekst2 := copy(tekst2, 1, i-1) + workdir + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); + i := pos(s, tekst2); + end; - close(infile); + s := ´%parms%´; + i := pos(s, tekst2); + while (i > 0) do begin + tekst2 := copy(tekst2, 1, i-1) + parms + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); + i := pos(s, tekst2); + end; - recursivedelete(workdir); + s := ´%quotedparms%´; + i := pos(s, tekst2); + while (i > 0) do begin + tekst2 := copy(tekst2, 1, i-1) + quotedparms + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); + i := pos(s, tekst2); + end; + case klasse[1] of + ´f´: pakuit_f(infile, outfile, tekst2, h); + ´d´: pakuit_d(infile, outfile, tekst2, h); + ´c´: pakuit_c(infile, outfile, tekst2, h); + ´t´: pakuit_t(infile, outfile, tekst2, h); + end; end; + finally + + close(infile); + + recursivedelete(workdir); + + end; + end; @@ -347,40 +530,47 @@ begin assign(infile, paramstr(0)); - reset(infile, 1); + reset(infile, 1); - assign(outfile, t.exename); - rewrite(outfile); - blockcopy(infile, outfile, filesize(infile)-t.length, false); - close(outfile); + assign(outfile, t.exename); + rewrite(outfile); + blockcopy(infile, outfile, filesize(infile)-t.length, false); + close(outfile); - assign(eeefile, ´app.eee´); - rewrite(eeefile); + assign(eeefile, ´app.eee´); + rewrite(eeefile); - try + try - for teller := 1 to t.number do begin - blockread(infile, h, sizeof(h)); + for teller := 1 to t.number do begin + blockread(infile, h, sizeof(h)); - writeln(eeefile, h.klasse, ´ ´, h.tekst); + writeln(eeefile, h.klasse, ´ ´, h.tekst); - if (h.klasse = ´f´) then begin - assign(outfile, h.tekst); - rewrite(outfile, 1); + if (h.klasse = ´f´) then begin + assign(outfile, h.tekst); + rewrite(outfile, 1); - blockcopy(infile, outfile, h.length, true); + blockcopy(infile, outfile, h.length, true); - close(outfile); - end; + close(outfile); end; - finally + if (h.klasse = ´d´) then begin + {$I-} + mkdir(h.tekst); + if (ioresult = 0) then; + {$I+} + end; + end; + + finally - close(eeefile); + close(eeefile); - close(infile); + close(infile); - end; + end; end; @@ -388,6 +578,10 @@ begin tempdir := getenv(´TEMP´); + if (tempdir = ´´) then begin + tempdir := ´/tmp´ + end; + me := ´EEE: Dit is mijn herkennigsstring voor het herkennen van pakin of pakuit mode.´; diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/ev/ftools.rb rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/ev/ftools.rb --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/ev/ftools.rb 2004-06-27 19:57:16.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/ev/ftools.rb 2004-07-26 19:15:25.000000000 +0200 @@ -1,87 +0,0 @@ -require "ftools" - -class Dir - def Dir.mkdirrec(dir) - pdir = File.dirname(dir) - - if not pdir.empty? and not FileTest.directory?(pdir) - mkdirrec (pdir) - end - - Dir.mkdir(dir) rescue nil - end -end - -class File - def self.rm_rf(entry) - if FileTest.file?(entry) - File.delete(entry) - end - - if FileTest.directory?(entry) - pdir = Dir.pwd - - Dir.chdir(entry) - Dir.new(".").each do |e| - rm_rf(e) if not [".", ".."].include?(e) - end - Dir.chdir(pdir) - - Dir.rmdir(entry) - end - end - - def self.rollbackup(file, mode=nil) - backupfile = file + ".RB.BACKUP" - controlfile = file + ".RB.CONTROL" - - File.touch(file) unless File.file?(file) - - # Rollback - - if File.file?(backupfile) and File.file?(controlfile) - $stdout.puts "Restoring #{file}..." - - File.copy(backupfile, file) # Rollback from phase 3 - end - - # Reset - - File.delete(backupfile) if File.file?(backupfile) # Reset from phase 2 or 3 - File.delete(controlfile) if File.file?(controlfile) # Reset from phase 3 or 4 - - # Backup - - File.copy(file, backupfile) # Enter phase 2 - File.touch(controlfile) # Enter phase 3 - - # The real thing - - if block_given? - if mode.nil? - yield - else - File.open(file, mode) do |f| - yield(f) - end - end - end - - # Cleanup - - File.delete(backupfile) # Enter phase 4 - File.delete(controlfile) # Enter phase 5 - - # Return, like File.open - - if block_given? - return nil - else - return File.open(file, (mode or "r")) - end - end - - def self.touch(file) - File.open(file, "a"){|f|} - end -end diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb 2004-06-27 19:55:16.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb 2004-07-26 19:15:21.000000000 +0200 @@ -6,6 +6,7 @@ rescue NameError def oldlocation(file="") dir = ENV["OLDDIR"] + res = nil if block_given? pdir = Dir.pwd @@ -26,6 +27,7 @@ rescue NameError def newlocation(file="") dir = ENV["NEWDIR"] + res = nil if block_given? pdir = Dir.pwd diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/init.rb rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/init.rb --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/init.rb 2004-06-27 19:54:07.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/init.rb 2004-07-26 18:48:26.000000000 +0200 @@ -1,33 +1,9 @@ require "ev/oldandnewlocation" -require "ev/ftools" +require "ftools" require "rbconfig" -module RubyScript2Exe - -def self.execute(command) - command = command.gsub(/^\.\//, "").gsub(/\//, "\\\\") - - system(command) -end - -def self.copy(from, to) - from = from.gsub(/^\.\//, "").gsub(/\//, "\\\\") - to = to.gsub(/^\.\//, "").gsub(/\//, "\\\\") - - File.copy(from, to) -end - -def self.move(from, to) - from = from.gsub(/^\.\//, "").gsub(/\//, "\\\\") - to = to.gsub(/^\.\//, "").gsub(/\//, "\\\\") - - File.move(from, to) -end - script = ARGV.shift -msvcr71 = ARGV.include?("--rubyscript2exe-msvcr71") - rubyw = false rubyw = true if script =~ /\.rbw$/ rubyw = false if ARGV.include?("--rubyscript2exe-ruby") @@ -38,67 +14,53 @@ end bindir = Config::CONFIG["bindir"] -rubyexe = "ruby.exe" -rubyexe = "rubyw.exe" if rubyw libruby = Config::CONFIG["LIBRUBY_SO"] -msvcr71 = "msvcr71.dll" if msvcr71 if not script.nil? script = "#{script}.rb" if not script =~ /\.rbw?$/ app = File.basename(script.gsub(/\.rbw?$/, "")) + libdir = File.expand_path("lib") puts "Tracing #{app}..." oldlocation do - tar = FileTest.file?("tar.exe") - copy(newlocation("tar.exe"), "tar.exe") if not tar - - execute("#{bindir}/ruby -r ´#{newlocation("require2tar.rb")}´ ´#{script}´ #{ARGV.collect{|a| "´" + a + "´"}.join(" ")}") - - File.delete("tar.exe") if not tar + system("#{bindir}/ruby -r ´#{newlocation("require2lib.rb")}´ ´#{script}´ ´#{libdir}´ #{ARGV.collect{|a| "´" + a + "´"}.join(" ")}".gsub(/^\.\//, "").gsub(/\//, "\\\\")) end - puts "Gathering files..." + puts "Copying files..." - copy("#{bindir}/ruby.exe", "ruby.exe") - copy("#{bindir}/rubyw.exe", "rubyw.exe") - copy("#{bindir}/#{libruby}", libruby) - copy("#{bindir}/#{msvcr71}", msvcr71) if msvcr71 - move("#{oldlocation("rubyrequired.tar")}", "rubyrequired.tar") - copy("#{oldlocation(script)}", "app.rb") + Dir.mkdir("bin") + Dir.mkdir("app") - puts "Packing..." + File.copy("#{bindir}/ruby.exe" , "bin/ruby.exe" ) + File.copy("#{bindir}/rubyw.exe" , "bin/rubyw.exe" ) + File.copy("#{bindir}/#{libruby}" , "bin/#{libruby}" ) + File.copy("#{bindir}/msvcr71.dll" , "bin/msvcr71.dll" ) if File.file?("#{bindir}/msvcr71.dll") + File.copy("#{oldlocation(script)}" , "app/app.rb" ) - execute("#{bindir}/ruby tar2rubyscript.rb rubyrequired.tar") - - puts "Creating #{app}.exe ..." + puts "Creating #{app}.exe..." File.open("app.eee", "w") do |f| - f.puts "f ruby.exe" - f.puts "f rubyw.exe" - f.puts "f #{libruby}" - f.puts "f #{msvcr71}" if msvcr71 - f.puts "f rubyrequired.rb" - f.puts "f app.rb" + f.puts "r bin" + f.puts "r lib" + f.puts "r app" - f.puts "t #{rubyexe} rubyrequired.rb --tar2rubyscript-justextract" + rubyexe = "ruby.exe" + rubyexe = "rubyw.exe" if rubyw - f.puts "c %tempdir%/#{rubyexe} -I %tempdir%/rubyrequired %tempdir%/app.rb %quotedparms%" + f.puts "c %tempdir%/bin/#{rubyexe} -I %tempdir%/lib %tempdir%/app/app.rb %quotedparms%" end - if rubyw - eeeexe = "eeew.exe" - else - eeeexe = "eee.exe" - end + eeeexe = "eee.exe" + eeeexe = "eeew.exe" if rubyw + appexe = "#{app}.exe" + appico = "#{app}.ico" - execute("./eee app.eee #{app}.exe #{eeeexe}") - - copy("#{app}.exe", oldlocation) + system(".\\eee app.eee #{appexe} #{eeeexe}") oldlocation do - system("reshacker -modify %s, %s, %s, icon,appicon," % [newlocation("#{app}.exe"), "#{app}.exe", "#{app}.ico"]) if File.file?("#{app}.ico") - end -end + File.copy(newlocation(appexe), appexe) + system("reshacker -modify #{newlocation(appexe)}, #{appexe}, #{appico}, icon,appicon,") if File.file?(appico) + end end diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/require2lib.rb rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/require2lib.rb --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/require2lib.rb 2004-07-26 19:15:25.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/require2lib.rb 2004-07-26 19:15:21.000000000 +0200 @@ -0,0 +1,56 @@ +require "ftools" +require "rbconfig" + +module Require + JUSTEV = ARGV.include?("--require2lib-justev") + JUSTSITE = ARGV.include?("--require2lib-justsite") + + ARGV.delete_if do |arg| + arg =~ /^--require2lib-/ + end + + ORGDIR = Dir.pwd + THISFILE = File.expand_path(__FILE__) + LIBDIR = File.expand_path(ARGV.shift) + SITEDIR = Config::CONFIG["sitedir"] + + at_exit do + Dir.chdir(ORGDIR) + + Require.gatherlibs + end + + def self.gatherlibs + $stderr.puts "Gathering files..." + + File.makedirs(LIBDIR) + + $".each do |req| + if not JUSTEV or req =~ /^ev\// + catch :found do + $:.each do |lib| + fromfile = File.expand_path(req, lib) + tofile = File.expand_path(req, LIBDIR) + + if FileTest.file?(fromfile) + unless fromfile == tofile or fromfile == THISFILE + if JUSTSITE and fromfile.include?(SITEDIR) + $stderr.puts "Skipped #{fromfile} ." + else + #$stderr.puts "Found #{fromfile} ." + + File.makedirs(File.dirname(tofile)) + File.copy(fromfile, tofile) + end + end + + throw :found + end + end + + $stderr.puts "Can´t find #{req} ." unless req =~ /^ev\// + end + end + end + end +end diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/require2tar.rb rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/require2tar.rb --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/require2tar.rb 2004-06-27 19:51:17.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/require2tar.rb 2004-07-26 19:15:25.000000000 +0200 @@ -1,92 +0,0 @@ -require "ftools" - -JustCopy = ARGV.include?("--require2tar-justcopy") -JustEV = ARGV.include?("--require2tar-justev") - -ARGV.delete_if do |arg| - arg =~ /^--require2tar-/ -end - -Require2TarDir = Dir.pwd - -at_exit do - Dir.chdir Require2TarDir - Require.createtar -end - -module Require - def self.createtar - temp = (ENV["TEMP"] or "/tmp") - tmpdir = File.expand_path("rubyrequired2tar.#{Process.pid}", temp) - tardir = "rubyrequired" - tarfile = "rubyrequired.tar" - todir = File.expand_path(tardir, tmpdir) - - File.makedirs(tmpdir) - - $".delete_if{|req| not req =~ /^ev\//} if JustEV - - $".each do |req| - found = false - - $:.each do |lib| - if not found - file = File.expand_path(req, lib) - if FileTest.file?(file) - found = true - fromfile = file - tofile = File.expand_path(req, todir) - tofile = req if JustCopy - - #puts "Found #{fromfile} ." - - File.makedirs(File.dirname(tofile)) - File.copy(fromfile, tofile) - end - end - end - - if not found - puts "Can´t find #{req} ." if not req =~ /^ev\// - end - end - - if not JustCopy - File.copy("tar.exe", File.expand_path("tar.exe", tmpdir)) if FileTest.file?("tar.exe") - - pdir = Dir.pwd - Dir.chdir(tmpdir) - puts "Creating #{tarfile}..." - - system("tar chf #{tarfile} #{tardir}") - - s = File.expand_path(tarfile, pdir) - s = s.gsub(/^\.\//, "").gsub(/\//, "\\\\") - - File.move(tarfile, s) - Dir.chdir(pdir) - end - - File.rm_rf(tmpdir) - end -end - -class File - def self.rm_rf(entry) - if FileTest.file?(entry) - File.delete(entry) - end - - if FileTest.directory?(entry) - pdir = Dir.pwd - - Dir.chdir(entry) - Dir.new(".").each do |e| - rm_rf(e) if not [".", ".."].include?(e) - end - Dir.chdir(pdir) - - Dir.rmdir(entry) - end - end -end diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/tar2rubyscript.rb rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/tar2rubyscript.rb --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/tar2rubyscript.rb 2004-06-27 19:51:01.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/tar2rubyscript.rb 2004-07-26 19:15:25.000000000 +0200 @@ -1,81 +0,0 @@ -require "ev/oldandnewlocation" - -scriptfile = "tarrubyscript.rb" -tarfile = oldlocation(ARGV.shift) -rbfile = oldlocation(ARGV.shift) -licensefile = oldlocation(ARGV.shift) - -if tarfile.nil? - exit 1 -end - -tarfile.dup.gsub!(/[\/\\]$/, "") - -if not FileTest.exist?(tarfile) - $stderr.puts "#{tarfile} doesn´t exist." - exit -end - -if not licensefile.nil? and not FileTest.file?(licensefile) - $stderr.puts "#{licensefile} doesn´t exist." - exit -end - -script = nil -archive = nil - -File.open(scriptfile) {|f| script = f.read} - -if FileTest.file?(tarfile) - File.open(tarfile, "rb") {|f| archive = [f.read].pack("m").split("\n").collect{|s| "# " + s}.join("\n")} -end - -if FileTest.directory?(tarfile) - orgdir = Dir.pwd - - Dir.chdir(tarfile) - - if FileTest.file?("tar2rubyscript.bat") - $stderr.puts "\".\\tar2rubyscript.bat\"" - system(".\\tar2rubyscript.bat") - end - - if FileTest.file?("tar2rubyscript.sh") - $stderr.puts "\". ./tar2rubyscript.sh\"" - system("sh -c \". ./tar2rubyscript.sh\"") - end - - Dir.chdir("..") - - begin - tar = "tar" - IO.popen("#{tar} ch #{tarfile.sub(/.*[\/\\]/, "")}", "rb") {|f| archive = [f.read].pack("m").split("\n").collect{|s| "# " + s}.join("\n")} - rescue - tar = newlocation("tar.exe") - IO.popen("#{tar} ch #{tarfile.sub(/.*[\/\\]/, "")}", "rb") {|f| archive = [f.read].pack("m").split("\n").collect{|s| "# " + s}.join("\n")} - end - - Dir.chdir(orgdir) -end - -if not licensefile.nil? - lic = nil ; File.open(licensefile) {|f| lic = f.readlines} - - lic.collect! do |line| - line.gsub!(/[\r\n]/, "") - line = "# #{line}" unless line =~ /^[ \t]*#/ - line - end - - script = "# License, not of this script, but of the application it contains:\n#\n" + lic.join("\n") + "\n\n" + script -end - -rbfile = tarfile.gsub(/\.tar$/, "") + ".rb" if (rbfile.nil? or File.basename(rbfile) == "-") - -File.open(rbfile, "wb") do |f| - f.write script - f.write "\n" - f.write "\n" - f.write archive - f.write "\n" -end diff -ur rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/tarrubyscript.rb rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/tarrubyscript.rb --- rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/tarrubyscript.rb 2004-06-27 19:51:04.000000000 +0200 +++ rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/tarrubyscript.rb 2004-07-26 19:15:25.000000000 +0200 @@ -1,367 +0,0 @@ -# License of this script, not of the application it contains: -# -# Copyright Erik Veenstra <tar2rubyscript@erikveen.dds.nl> -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License, -# version 2, as published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free -# Software Foundation, Inc., 59 Temple Place, Suite 330, -# Boston, MA 02111-1307 USA. - -# Tar2RubyScript constants - -JustExtract = ARGV.include?("--tar2rubyscript-justextract") -ToTar = ARGV.include?("--tar2rubyscript-totar") - -ARGV.concat [] - -ARGV.delete_if do |arg| - arg =~ /^--tar2rubyscript-/ -end - -# Tar constants - -BLOCKSIZE = 512 - -NAMELEN = 100 -MODELEN = 8 -UIDLEN = 8 -GIDLEN = 8 -CHKSUMLEN = 8 -SIZELEN = 12 -MAGICLEN = 8 -MODTIMELEN = 12 -UNAMELEN = 32 -GNAMELEN = 32 -DEVLEN = 8 - -TMAGIC = "ustar" -GNU_TMAGIC = "ustar " -SOLARIS_TMAGIC = "ustar\00000" - -MAGICS = [TMAGIC, GNU_TMAGIC, SOLARIS_TMAGIC] - -LF_OLDFILE = ´\0´ -LF_FILE = ´0´ -LF_LINK = ´1´ -LF_SYMLINK = ´2´ -LF_CHAR = ´3´ -LF_BLOCK = ´4´ -LF_DIR = ´5´ -LF_FIFO = ´6´ -LF_CONTIG = ´7´ - -class Reader - def initialize(filehandle) - @fp = filehandle - end - - def extract - each do |entry| - entry.extract - end - end - - def each - @fp.rewind - - while entry = next_entry - yield(entry) - end - end - - def next_entry - buf = @fp.read(BLOCKSIZE) - - if buf.length < BLOCKSIZE or buf == "\000" * BLOCKSIZE - entry = nil - else - entry = Entry.new(buf, @fp) - end - - entry - end -end - -class Entry - attr_reader(:header, :data) - - def initialize(header, fp) - @header = Header.new(header) - - if @header.file? - padding = (BLOCKSIZE - (@header.size % BLOCKSIZE)) % BLOCKSIZE - - @data = fp.read(@header.size) if @header.size > 0 - dummy = fp.read(padding) if padding > 0 - end - end - - def extract - if not @header.name.empty? - if @header.dir? - begin - Dir.mkdir(@header.name, @header.mode) - rescue SystemCallError => e - puts "Couldn´t create dir #{@header.name}: " + e.message - end - else - if @header.file? - begin - File.open(@header.name, "wb") do |fp| - fp.write(@data) - fp.chmod(@header.mode) - end - rescue => e - puts "Couldn´t create file #{@header.name}: " + e.message - end - else - puts "Couldn´t handle entry #{@header.name}" - end - end - - #File.chown(@header.uid, @header.gid, @header.name) - #File.utime(Time.now, @header.mtime, @header.name) - end - end -end - -class Header - attr_reader(:name, :uid, :gid, :size, :mtime, :uname, :gname, :mode) - - def initialize(header) - fields = header.unpack(´A100 A8 A8 A8 A12 A12 A8 A1 A100 A8 A32 A32 A8 A8´) - types = [´str´, ´oct´, ´oct´, ´oct´, ´oct´, ´time´, ´oct´, ´str´, ´str´, ´str´, ´str´, ´str´, ´oct´, ´oct´] - - begin - converted = [] - while field = fields.shift - type = types.shift - - case type - when ´str´ then converted.push(field) - when ´oct´ then converted.push(field.oct) - when ´time´ then converted.push(Time::at(field.oct)) - end - end - - @name, @mode, @uid, @gid, @size, @mtime, @chksum, @linkflag, @linkname, @magic, @uname, @gname, @devmajor, @devminor = converted - - @name.gsub!(/^\.\//, "") - - @raw = header - rescue ArgumentError => e - raise "Couldn´t determine a real value for a field (#{field})" - end - - raise "Magic header value #{@magic.inspect} is invalid." if not MAGICS.include?(@magic) - - @linkflag = LF_FILE if @linkflag == LF_OLDFILE or @linkflag == LF_CONTIG - @linkflag = LF_DIR if @name[-1] == ´/´ and @linkflag == LF_FILE - @linkname = @linkname[1,-1] if @linkname[0] == ´/´ - @size = 0 if @size < 0 - @name = @linkname + ´/´ + @name if @linkname.size > 0 - end - - def file? - @linkflag == LF_FILE - end - - def dir? - @linkflag == LF_DIR - end -end - -class TempSpace - def initialize - @archive = File.new($0, "rb").read.gsub(/\r/, "").split(/\n\n/)[-1].split("\n").collect{|s| s[2..-1]}.join("\n").unpack("m").shift - @olddir = Dir.pwd - temp = ENV["TEMP"] - temp = "/tmp" if temp.nil? - @tempdir = "#{temp}/tar2rubyscript.d.#{Process.pid}" - @tempfile = "#{temp}/tar2rubyscript.f.#{Process.pid}" - - @@tempspace = self - - @newdir = @tempdir - end - - def extract - Dir.mkdir(@tempdir) if not FileTest.exists?(@tempdir) - - newlocation do - - # Create the temp environment. - - File.open(@tempfile, "wb") {|f| f.write @archive} - File.open(@tempfile, "rb") {|f| Reader.new(f).extract} - - # Eventually look for a subdirectory. - - entries = Dir.entries(".") - entries.delete(".") - entries.delete("..") - - if entries.length == 1 - entry = entries.shift.dup - if FileTest.directory?(entry) - @newdir = "#{@tempdir}/#{entry}" - end - end - end - - # Remember all File objects. - - @ioobjects = [] - ObjectSpace::each_object(File) do |obj| - @ioobjects << obj - end - - at_exit do - - # Close all File objects, opened in init.rb . - - ObjectSpace::each_object(File) do |obj| - obj.close if (not obj.closed? and not @ioobjects.include?(obj)) - end - - # Remove the temp environment. - - Dir.chdir(@olddir) - - recursivedelete(@tempfile) - recursivedelete(@tempdir) - end - end - - def recursivedelete(entry) - if FileTest.file?(entry) - File.delete(entry) - end - - if FileTest.directory?(entry) - pdir = Dir.pwd - - Dir.chdir(entry) - Dir.new(".").each do |e| - recursivedelete(e) if not [".", ".."].include?(e) - end - Dir.chdir(pdir) - - Dir.rmdir(entry) - end - end - - def oldlocation(file="") - if block_given? - pdir = Dir.pwd - - Dir.chdir(@olddir) - res = yield - Dir.chdir(pdir) - else - res = File.expand_path(file, @olddir) if not file.nil? - end - - res - end - - def newlocation(file="") - if block_given? - pdir = Dir.pwd - - Dir.chdir(@newdir) - res = yield - Dir.chdir(pdir) - else - res = File.expand_path(file, @newdir) if not file.nil? - end - - res - end - - def self.oldlocation(file="") - if block_given? - @@tempspace.oldlocation { yield } - else - @@tempspace.oldlocation(file) - end - end - - def self.newlocation(file="") - if block_given? - @@tempspace.newlocation { yield } - else - @@tempspace.newlocation(file) - end - end -end - -class Extract - def initialize - @archive = File.new($0, "rb").read.gsub(/\r/, "").split(/\n\n/)[-1].split("\n").collect{|s| s[2..-1]}.join("\n").unpack("m").shift - temp = ENV["TEMP"] - temp = "/tmp" if temp.nil? - @tempfile = "#{temp}/tar2rubyscript.f.#{Process.pid}" - end - - def extract - begin - File.open(@tempfile, "wb") {|f| f.write @archive} - File.open(@tempfile, "rb") {|f| Reader.new(f).extract} - ensure - File.delete(@tempfile) - end - end -end - -class MakeTar - def initialize - @archive = File.new($0, "rb").read.gsub(/\r/, "").split(/\n\n/)[-1].split("\n").collect{|s| s[2..-1]}.join("\n").unpack("m").shift - @tarfile = $0.gsub(/\.rbw?$/, "") + ".tar" - end - - def extract - File.open(@tarfile, "wb") {|f| f.write @archive} - end -end - -def oldlocation(file="") - if block_given? - TempSpace.oldlocation { yield } - else - TempSpace.oldlocation(file) - end -end - -def newlocation(file="") - if block_given? - TempSpace.newlocation { yield } - else - TempSpace.newlocation(file) - end -end - -if JustExtract - Extract.new.extract -else - if ToTar - MakeTar.new.extract - else - TempSpace.new.extract - - $0 = "./init.rb" - - newlocation do - load "init.rb" - end - end -end Binary files rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/eee.exe and rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/eee.exe differ Binary files rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/eeew.exe and rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/eeew.exe differ Binary files rubyscript2exe-0.1.18.tar.gz/rubyscript2exe/tar.exe and rubyscript2exe-0.1.19.tar.gz/rubyscript2exe/tar.exe differ