diff -ur rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/eee.pas rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/eee.pas --- rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/eee.pas 2005-01-13 23:07:30.000000000 +0100 +++ rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/eee.pas 2005-01-19 00:10:18.000000000 +0100 @@ -6,7 +6,7 @@ uses - SysUtils, Dos, GZio; + SysUtils, Dos, GZio, StrUtils; const @@ -90,7 +90,7 @@ {$IFDEF WIN32} chdir(dir); {$ELSE} // Foutje indien bovenliggende dirs niet benaderbaar zijn. - if copy(dir, 1, 1) <> ´/´ then begin + if not (AnsiStartsStr(´/´, dir)) then begin dir := currentdir + ´/´ + dir; end; @@ -115,7 +115,11 @@ getdir2(0, dir); chdir2(path); - findfirst(´*.*´, anyfile or directory, sr); + {$IFDEF WIN32} + findfirst(´*.*´, anyfile or directory, sr); + {$ELSE} + findfirst(´*´, anyfile or directory, sr); + {$ENDIF} while(doserror = 0) do begin assign(f, sr.name); // Foutje in 1.9.2 ??? getfattr(f, attr); // Foutje in 1.9.2 ??? @@ -334,7 +338,11 @@ getdir2(0, dir); chdir2(entry); - findfirst(´*.*´, anyfile or directory, sr); + {$IFDEF WIN32} + findfirst(´*.*´, anyfile or directory, sr); + {$ELSE} + findfirst(´*´, anyfile or directory, sr); + {$ENDIF} while(doserror = 0) do begin assign(f, sr.name); // Foutje in 1.9.2 ??? getfattr(f, attr); // Foutje in 1.9.2 ??? @@ -414,10 +422,10 @@ t.who := me; s := slash; - i := pos(s, t.exename); + i := posex(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); + t.exename := AnsiMidStr(t.exename, i+length(s), length(t.exename)-(i+length(s))+1); + i := posex(s, t.exename); end; zfile := gzopen(workfile, ´w´); @@ -425,9 +433,9 @@ 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); + if (not (s = ´´) and not (AnsiStartsStr(´#´, s))) then begin + klasse := AnsiMidStr(s, 1, 1); + tekst1 := AnsiMidStr(s, 3, length(s)-2); case klasse[1] of ´f´: pakin_f(zfile, klasse, tekst1, tekst1, t); @@ -519,14 +527,14 @@ {$ENDIF} {$IFDEF WIN32} - i := pos(´ ´, tekst); + i := posex(´ ´, 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); + c := AnsiMidStr(tekst, 1, i-1); + p := AnsiMidStr(tekst, i+1, length(tekst)-i); end; {$ELSE} i := 0; @@ -568,14 +576,14 @@ {$ENDIF} {$IFDEF WIN32} - i := pos(´ ´, tekst); + i := posex(´ ´, 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); + c := AnsiMidStr(tekst, 1, i-1); + p := AnsiMidStr(tekst, i+1, length(tekst)-i); end; {$ELSE} c := getenv(´SHELL´); @@ -614,40 +622,11 @@ klasse := h.klasse; tekst2 := h.tekst; - 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; - - s := ´%tempdir1%´; - i := pos(s, tekst2); - while (i > 0) do begin - tekst2 := copy(tekst2, 1, i-1) + workdir1 + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); - i := pos(s, tekst2); - end; - - s := ´%tempdir2%´; - i := pos(s, tekst2); - while (i > 0) do begin - tekst2 := copy(tekst2, 1, i-1) + workdir2 + copy(tekst2, i+length(s), length(tekst2)-(i+length(s))+1); - i := pos(s, tekst2); - end; - - 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; - - 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; + tekst2 := AnsiReplaceStr(tekst2, ´%parms%´, parms); + tekst2 := AnsiReplaceStr(tekst2, ´%quotedparms%´, quotedparms); + tekst2 := AnsiReplaceStr(tekst2, ´%tempdir%´, workdir); + tekst2 := AnsiReplaceStr(tekst2, ´%tempdir1%´, workdir1); + tekst2 := AnsiReplaceStr(tekst2, ´%tempdir2%´, workdir2); case klasse[1] of ´f´: pakuit_f(zfile, outfile, tekst2, h); @@ -796,28 +775,13 @@ mkdir(workdir); until (ioresult = 0); {$I+} - - workdir := tempdir + slash + workdir; - workfile := workdir + slash + ´eee.gz´; - - workdir1 := workdir; - workdir2 := workdir; - - s := ´\´; - i := pos(s, workdir1); - while (i > 0) do begin - workdir1 := copy(workdir1, 1, i-1) + ´/´ + copy(workdir1, i+length(s), length(workdir1)-(i+length(s))+1); - i := pos(s, workdir1); - end; - - s := ´/´; - i := pos(s, workdir2); - while (i > 0) do begin - workdir2 := copy(workdir2, 1, i-1) + ´\´ + copy(workdir2, i+length(s), length(workdir2)-(i+length(s))+1); - i := pos(s, workdir2); - end; chdir2(dir); + workdir := tempdir + slash + workdir; + workfile := workdir + slash + ´eee.gz´; + workdir1 := AnsiReplaceStr(workdir, ´\´, ´/´); + workdir2 := AnsiReplaceStr(workdir, ´/´, ´\´); + filemode := 0; assign(infile, paramstr(0)); @@ -826,7 +790,7 @@ blockread(infile, t, sizeof(t)); close(infile); - if (pos(´eeew´, lowercase(t.exename)) > 0) then begin + if (posex(´eeew´, lowercase(t.exename)) > 0) then begin list := false; end; diff -ur rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/ev/ftools.rb rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/ev/ftools.rb --- rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/ev/ftools.rb 2005-01-13 23:07:30.000000000 +0100 +++ rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/ev/ftools.rb 2005-01-19 00:10:18.000000000 +0100 @@ -28,6 +28,8 @@ end def self.rm_rf(entry) + File.chmod(0755, entry) + if File.ftype(entry) == "directory" pdir = Dir.pwd diff -ur rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb --- rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb 2005-01-13 23:07:30.000000000 +0100 +++ rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb 2005-01-19 00:10:18.000000000 +0100 @@ -7,6 +7,8 @@ class Dir def self.rm_rf(entry) + File.chmod(0755, entry) + if File.ftype(entry) == "directory" pdir = Dir.pwd @@ -16,9 +18,17 @@ end Dir.chdir(pdir) - Dir.delete(entry) + begin + Dir.delete(entry) + rescue => e + $stderr.puts e.message + end else - File.delete(entry) + begin + File.delete(entry) + rescue => e + $stderr.puts e.message + end end end end diff -ur rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/init.rb rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/init.rb --- rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/init.rb 2005-01-11 22:53:53.000000000 +0100 +++ rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/init.rb 2005-01-18 23:38:21.000000000 +0100 @@ -1,6 +1,6 @@ $: << File.dirname(File.expand_path(__FILE__)) -required = $".collect{|a| "-r " + a} +required = $".collect{|a| "-r ´#{a}´"} require "ev/oldandnewlocation" require "ev/dependencies" @@ -30,8 +30,10 @@ Config::CONFIG["target_os"] or "" end -RUBY = ARGV.include?("--rubyscript2exe-ruby") -RUBYW = ARGV.include?("--rubyscript2exe-rubyw") +RUBY = ARGV.include?("--rubyscript2exe-ruby") +RUBYW = ARGV.include?("--rubyscript2exe-rubyw") +VERBOSE = ARGV.include?("--rubyscript2exe-verbose") +QUIET = (ARGV.include?("--rubyscript2exe-quiet") and not VERBOSE) ARGV.delete_if{|arg| arg =~ /^--rubyscript2exe-/} @@ -65,15 +67,24 @@ script = "#{script}.rb" unless script =~ /\.rbw?$/ app = File.basename(script.gsub(/\.rbw?$/, "")) -$stderr.puts "Tracing #{app}..." +$stderr.puts "Tracing #{app}..." unless QUIET -libs = $:.collect{|a| "-I " + a} +libs = $:.collect{|a| "-I ´#{a}´"} +loadscript = tmplocation("require2lib2rubyscript2exe.rb") +verbose = (VERBOSE ? "--require2lib-verbose" : "") +quiet = (QUIET ? "--require2lib-quiet" : "") +argv = ARGV.collect{|a| "´#{a}´"} + +ENV["REQUIRE2LIB_LIBDIR"] = libdir2 +ENV["REQUIRE2LIB_LOADSCRIPT"] = loadscript oldlocation do - system(backslashes("#{bindir1}/ruby") + " #{required.join(" ")} #{libs.join(" ")} -r ´#{newlocation("require2lib.rb")}´ ´#{script}´ ´#{bindir2}´ ´#{libdir2}´ --require2lib-quiet" + " " + ARGV.collect{|a| "´" + a + "´"}.join(" ")) + system(backslashes("#{bindir1}/ruby") + " #{required.join(" ")} #{libs.join(" ")} -r ´#{newlocation("require2lib.rb")}´ ´#{script}´ #{verbose} #{quiet} #{argv.join(" ")}") end -$stderr.puts "Copying files..." +load(loadscript) + +$stderr.puts "Copying files..." unless QUIET Dir.mkdir(bindir2) unless File.directory?(bindir2) Dir.mkdir(libdir2) unless File.directory?(libdir2) @@ -86,6 +97,21 @@ rubywexe = "#{bindir1}/rubyw.exe" end +if defined?(RUBYSCRIPT2EXE_DLLS) + tocopy = [RUBYSCRIPT2EXE_DLLS].flatten +else + tocopy = [] +end + +tocopy.each do |s1| + s1 = oldlocation(s1) + file = File.basename(s1) + s2 = File.expand_path(file, bindir2) + + $stderr.puts "Copying #{s1} ..." if VERBOSE + File.copy(s1, s2) unless File.file?(s2) +end + if linux? tocopy = ldds(rubyexe) tocopy << rubyexe if File.file?(rubyexe) @@ -99,16 +125,16 @@ file = File.basename(s1) s2 = File.expand_path(file, bindir2) - #$stderr.puts "Copying #{s1} ..." - File.copy(s1, s2) unless File.file?(s2) + $stderr.puts "Copying #{s1} ..." if VERBOSE + File.copy(s1, s2) unless File.file?(s2) end begin s1 = oldlocation(script) s2 = File.expand_path("app.rb", appdir2) - #$stderr.puts "Copying #{s1} ..." - File.copy(s1, s2) unless File.file?(s2) + $stderr.puts "Copying #{s1} ..." if VERBOSE + File.copy(s1, s2) unless File.file?(s2) end if linux? @@ -121,8 +147,8 @@ file = File.basename(s1) s2 = File.expand_path(file, bindir2) - #$stderr.puts "Copying #{s1} ..." - File.copy(s1, s2) unless File.file?(s2) + $stderr.puts "Copying #{s1} ..." if VERBOSE + File.copy(s1, s2) unless File.file?(s2) end eeeexe = "eee.exe" @@ -132,7 +158,7 @@ appexe = "#{app}.bin" if linux? appico = "#{app}.ico" -$stderr.puts "Creating #{appexe} ..." +$stderr.puts "Creating #{appexe} ..." unless QUIET if linux? File.open(tmplocation("eee.sh"), "w") do |f| @@ -148,12 +174,19 @@ end File.open(tmplocation("eee.rb"), "w") do |f| - f.puts "lib = File.expand_path(File.dirname(__FILE__)) + ´/lib´" + f.puts "lib = File.expand_path(File.dirname(__FILE__)) + ´/lib´" f.puts "lib.sub!(/^.:/, ´/cygdrive/%s´ % $&[0..0].downcase) if lib =~ /^.:/" if cygwin? f.puts "$:.clear" f.puts "$: << lib" end +File.open(tmplocation("bootstrap.rb"), "w") do |f| + f.puts "load($0 = ARGV.shift)" +end + +File.open(tmplocation("empty.rb"), "w") do |f| +end + File.open(tmplocation("app.eee"), "w") do |f| rubyexe = "ruby.exe" rubyexe = "rubyw.exe" if rubyw @@ -163,13 +196,15 @@ f.puts "r lib" f.puts "f eee.sh" if linux? f.puts "f eee.rb" + f.puts "f bootstrap.rb" + f.puts "f empty.rb" f.puts "r app" if linux? - f.puts "c source %tempdir%/eee.sh %tempdir% %tempdir%/bin/#{rubyexe} -r %tempdir%/eee.rb %tempdir%/app/app.rb %quotedparms%" + f.puts "c source %tempdir%/eee.sh %tempdir% %tempdir%/bin/#{rubyexe} -r %tempdir%/eee.rb -r %tempdir1%/bootstrap.rb -T1 %tempdir1%/empty.rb %tempdir%/app/app.rb %quotedparms%" elsif cygwin? - f.puts "c %tempdir%\\bin\\#{rubyexe} -r %tempdir1%/eee.rb %tempdir1%/app/app.rb %quotedparms%" + f.puts "c %tempdir%\\bin\\#{rubyexe} -r %tempdir1%/eee.rb -r %tempdir1%/bootstrap.rb -T1 %tempdir1%/empty.rb %tempdir1%/app/app.rb %quotedparms%" else - f.puts "c %tempdir%\\bin\\#{rubyexe} -r %tempdir%\\eee.rb %tempdir%\\app\\app.rb %quotedparms%" + f.puts "c %tempdir%\\bin\\#{rubyexe} -r %tempdir%\\eee.rb -r %tempdir%\\bootstrap.rb -T1 %tempdir%\\empty.rb %tempdir%\\app\\app.rb %quotedparms%" end end diff -ur rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/require2lib.rb rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/require2lib.rb --- rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/require2lib.rb 2005-01-13 23:07:30.000000000 +0100 +++ rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/require2lib.rb 2005-01-19 00:10:18.000000000 +0100 @@ -25,8 +25,8 @@ ORGDIR = Dir.pwd THISFILE = File.expand_path(__FILE__) - BINDIR = File.expand_path(ARGV.shift) - LIBDIR = File.expand_path(ARGV.shift) + LIBDIR = File.expand_path((ENV["REQUIRE2LIB_LIBDIR"] or ".")) + LOADSCRIPT = File.expand_path((ENV["REQUIRE2LIB_LOADSCRIPT"] or ".")) RUBYLIBDIR = Config::CONFIG["rubylibdir"] SITELIBDIR = Config::CONFIG["sitelibdir"] @@ -37,7 +37,7 @@ end def self.gatherlibs - $stderr.puts "Gathering files..." + $stderr.puts "Gathering files..." unless QUIET File.makedirs(LIBDIR) @@ -145,7 +145,7 @@ if (not JUSTRUBYLIB and not JUSTSITELIB) or (JUSTRUBYLIB and fromfile.include?(RUBYLIBDIR)) or (JUSTSITELIB and fromfile.include?(SITELIBDIR)) - $stderr.puts "Found #{fromfile} ." if VERBOSE + $stderr.puts "Found #{fromfile} ." if VERBOSE File.makedirs(File.dirname(tofile)) unless File.directory?(File.dirname(tofile)) File.copy(fromfile, tofile) @@ -161,27 +161,17 @@ end end - #$stderr.puts "Can´t find #{req} ." unless req =~ /^ev\// - #$stderr.puts "Can´t find #{req} ." unless req =~ /^(\w:)?[\/\\]/ + #$stderr.puts "Can´t find #{req} ." unless req =~ /^ev\// or QUIET + #$stderr.puts "Can´t find #{req} ." unless req =~ /^(\w:)?[\/\\]/ or QUIET end end end $stderr.puts "Not all required files are pure Ruby." unless pureruby or QUIET - if defined?(RUBYSCRIPT2EXE_DLLS) - [RUBYSCRIPT2EXE_DLLS].flatten.each do |dll| - fromfile = File.expand_path(dll, ORGDIR) - tofile = File.expand_path(File.basename(dll), BINDIR) - - if File.file?(fromfile) - unless fromfile == tofile - $stderr.puts "Found #{fromfile} ." if VERBOSE - - File.makedirs(File.dirname(tofile)) unless File.directory?(File.dirname(tofile)) - File.copy(fromfile, tofile) - end - end + unless LOADSCRIPT == ORGDIR + File.open(LOADSCRIPT, "w") do |f| + f.puts "RUBYSCRIPT2EXE_DLLS = #{RUBYSCRIPT2EXE_DLLS.inspect}" if defined?(RUBYSCRIPT2EXE_DLLS) end end end Binary files rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/eee.bin and rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/eee.bin differ Binary files rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/eee.exe and rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/eee.exe differ Binary files rubyscript2exe-0.3.1.tar.gz/rubyscript2exe/eeew.exe and rubyscript2exe-0.3.2.tar.gz/rubyscript2exe/eeew.exe differ