diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/CHANGELOG rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/CHANGELOG --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/CHANGELOG 2006-08-06 19:32:36.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/CHANGELOG 2007-04-15 21:04:06.000000000 +0200 @@ -1,12 +1,30 @@ ---------------------------------------------------------------- +0.5.2 - 15.04.2007 + +* Fixed a bug when using the gem as library. + +* Fixed a bug concerning RUBYSCRIPT2EXE.userdir(file) (as well + as RUBYSCRIPT2EXE.appdir(file)) and full pathnames. + +* Replaced %TEMP% by %HOME%/eee, or %USERPROFILE%/eee, or + %TEMP%/eee, or c:/eee (on Windows). Replaced /tmp by + $HOME/.eee, or /tmp/.eee (on Linux/Darwin). This is to avoid + "Insecure world writable dir". + +* Introduced RUBYSCRIPT2EXE.exedir and + RUBYSCRIPT2EXE.executable. + +---------------------------------------------------------------- + 0.5.1 - 06.08.2006 * Fixed a bug when using the big rubyscript2exe.rb (the RBA) as library. -* Fixed a bug in RUBYSCRIPT2EXE.appdir. Added - RUBYSCRIPT2EXE.userdir. +* Fixed a bug in RUBYSCRIPT2EXE.appdir. + +* Added RUBYSCRIPT2EXE.userdir. * Added RUBYSCRIPT2EXE.rubyw=. diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/eee.pas rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/eee.pas --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/eee.pas 2006-08-06 19:33:04.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/eee.pas 2007-04-15 21:31:50.000000000 +0200 @@ -1079,11 +1079,31 @@ appname := t.appname; end; - temp := getshortpathname(getenv('TEMP')); + temp := getshortpathname(getenv('HOME')); if (temp = '') then begin - temp := '/tmp' + temp := getshortpathname(getenv('USERPROFILE')); + if (temp = '') then begin + temp := getshortpathname(getenv('TEMP')); + if (temp = '') then begin + {$IFDEF WIN32} + temp := 'c:'; + {$ELSE} + temp := '/tmp'; + {$ENDIF} + end; + end; end; + {$IFDEF WIN32} + temp := temp + slash + 'eee'; + {$ELSE} + temp := temp + slash + '.eee'; + {$ENDIF} + + {$I-} + mkdir(temp); if (ioresult <> 0) then; + {$I+} + getdir2(0, orgdir); chdir2(temp, false); {$I-} diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/ev/dependencies.rb rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/ev/dependencies.rb --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/ev/dependencies.rb 2006-08-06 19:33:04.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/ev/dependencies.rb 2007-04-15 21:31:49.000000000 +0200 @@ -12,7 +12,7 @@ paden << File.dirname(file) - windir1 = (ENV["WINDIR"] || "").gsub(/\\/, "/").downcase + windir1 = (ENV["SYSTEMROOT"] || ENV["WINDIR"] || "").gsub(/\\/, "/").downcase drive = windir1.scan(/^(.):/).shift.shift windir2 = windir1.sub(/^#{drive}:/, "/cygdrive/#{drive.downcase}") @@ -72,6 +72,8 @@ libs = `ldd #{tempfile}`.split(/\r*\n/).collect{|line| line.split(/\s+/)[3]} if linux? libs = `otool -L #{tempfile}`.split(/\r*\n/)[1..-1].collect{|line| line.split(/\s+/)[1]} if darwin? + libs ||= [] + libs.compact.each do |lib| if File.file?(lib) and not res.include?(lib) todo << lib diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/ev/ftools.rb rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/ev/ftools.rb --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/ev/ftools.rb 2006-08-06 19:33:04.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/ev/ftools.rb 2007-04-15 21:31:50.000000000 +0200 @@ -62,6 +62,7 @@ def self.find(entry=nil, mask=nil) entry = "." if entry.nil? + entry = entry.to_s entry = entry.gsub(/[\/\\]*$/, "") unless entry.nil? @@ -95,58 +96,57 @@ res.sort end -end -class File - def self.rollbackup(file, mode=nil) - backupfile = file + ".RB.BACKUP" - controlfile = file + ".RB.CONTROL" - res = nil + def self.home(*args, &block) + dir = nil - File.touch(file) unless File.file?(file) + dir ||= ENV["HOME"] + dir ||= ENV["USERPROFILE"] + dir ||= "c:/" - # Rollback + handle_home_and_temp(dir, *args, &block) + end - if File.file?(backupfile) and File.file?(controlfile) - $stderr.puts "Restoring #{file}..." + def self.temp(*args, &block) + dir = nil - File.copy(backupfile, file) # Rollback from phase 3 - end + dir ||= ENV["TMPDIR"] + dir ||= ENV["TMP"] + dir ||= ENV["TEMP"] + dir ||= "/tmp" - # Reset + handle_home_and_temp(dir, *args, &block) + end - 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 + private - # Backup + def self.handle_home_and_temp(dir, *args, &block) + file = File.join(*args) + file = file.gsub(/\\/, "/") + file = file.gsub(/\/+/, "/") + file = file.gsub(/^\/+/, "") + file = file.gsub(/\/+$/, "") + + dir = dir.gsub(/\\/, "/") + dir = dir.gsub(/\/+/, "/") + dir = dir.gsub(/\/+$/, "") + dir = File.expand_path(file, dir) - File.copy(file, backupfile) # Enter phase 2 - File.touch(controlfile) # Enter phase 3 + res = dir - # The real thing + if block + pdir = Dir.pwd - if block_given? - if mode.nil? - res = yield - else - File.open(file, mode) do |f| - res = yield(f) - end - end + Dir.chdir(dir) # Ruby 1.6 doesn't handle Dir.chdir(&block). + res = block.call(res) + Dir.chdir(pdir) end - # Cleanup - - File.delete(backupfile) # Enter phase 4 - File.delete(controlfile) # Enter phase 5 - - # Return, like File.open - - res = File.open(file, (mode or "r")) unless block_given? - res end +end +class File def self.touch(file) if File.exists?(file) File.utime(Time.now, File.mtime(file), file) diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb 2006-08-06 19:33:04.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/ev/oldandnewlocation.rb 2007-04-15 21:31:49.000000000 +0200 @@ -1,3 +1,5 @@ +require "rubyscript2exe" + temp = File.expand_path((ENV["TMPDIR"] or ENV["TMP"] or ENV["TEMP"] or "/tmp").gsub(/\\/, "/")) dir = "#{temp}/oldandnewlocation.#{Process.pid}" @@ -40,7 +42,7 @@ oldlocation rescue NameError def oldlocation(file="") - dir = ENV["OLDDIR"] + dir = (ENV["OLDDIR"] || RUBYSCRIPT2EXE.userdir) rescue "." res = nil if block_given? @@ -61,7 +63,7 @@ newlocation rescue NameError def newlocation(file="") - dir = ENV["NEWDIR"] + dir = (ENV["NEWDIR"] || RUBYSCRIPT2EXE.appdir) rescue "." res = nil if block_given? @@ -82,7 +84,7 @@ applocation rescue NameError def applocation(file="") - dir = ENV["APPDIR"] + dir = (ENV["APPDIR"] || RUBYSCRIPT2EXE.appdir) rescue "." res = nil if block_given? diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/init.rb rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/init.rb --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/init.rb 2006-08-06 18:40:35.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/init.rb 2007-04-10 20:06:14.000000000 +0200 @@ -1,12 +1,6 @@ -$: << File.dirname(File.expand_path(__FILE__)) - -$".delete "rubyscript2exe.rb" - -if defined?(oldlocation) - oldlocation do - require "rubyscript2exe" - end -else +begin + load File.join(File.dirname(__FILE__), "rubyscript2exe.rb") +rescue LoadError require "rubyscript2exe" end @@ -75,9 +69,27 @@ usagescript = "rubyscript2exe.rb" if defined?(TAR2RUBYSCRIPT) $stderr.puts <<-EOF - Usage: ruby #{usagescript} application.rb[w] [--rubyscript2exe-rubyw|--rubyscript2exe-ruby] [--rubyscript2exe-nostrip] + Usage: ruby #{usagescript} application.rb[w] [parameters] or - ruby #{usagescript} application[/] [--rubyscript2exe-rubyw|--rubyscript2exe-ruby] [--rubyscript2exe-nostrip] + ruby #{usagescript} application[/] [parameters] + + Where parameter is on of the following: + + --rubyscript2exe-rubyw Avoid the popping up of a DOS box. (It's + annoying in the test period... No puts and + p anymore... Only use it for distributing + your application. See Logging.) + --rubyscript2exe-ruby Force the popping up of a DOS box (default). + --rubyscript2exe-nostrip Avoid stripping. The binaries (ruby and + *.so) on Linux and Darwin are stripped by + default to reduce the size of the resulting + executable. + --rubyscript2exe-strace Start the embedded application with strace + (Linux only, for debugging only). + --rubyscript2exe-tk (experimental) Embed not only the Ruby + bindings for TK, but TK itself as well. + --rubyscript2exe-verbose Verbose mode. + --rubyscript2exe-quiet Quiet mode. On Linux and Darwin, there's no difference between ruby and rubyw. @@ -143,7 +155,7 @@ rubyw = false rubyw = true if script =~ /\.rbw$/ -rubyw = true if RUBYSCRIPT2EXE::RUBYW +rubyw = true if RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:rubyw] rubyw = false if RUBY rubyw = true if RUBYW @@ -156,9 +168,9 @@ $stderr.puts "Copying files..." unless QUIET -copyto([RUBYSCRIPT2EXE::DLLS].flatten.collect{|s| oldlocation(s)}, bindir2) -copyto([RUBYSCRIPT2EXE::BIN].flatten.collect{|s| oldlocation(s)}, bindir2) -copyto([RUBYSCRIPT2EXE::LIB].flatten.collect{|s| oldlocation(s)}, libdir2) +copyto([RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:dlls]].flatten.collect{|s| oldlocation(s)}, bindir2) +copyto([RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:bin]].flatten.collect{|s| oldlocation(s)}, bindir2) +copyto([RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:lib]].flatten.collect{|s| oldlocation(s)}, libdir2) copyto(rubyexe, bindir2) if (linux? or darwin?) and File.file?(rubyexe) copyto(ldds(rubyexe), bindir2) if (linux? or darwin?) @@ -173,7 +185,7 @@ copyto(Dir.find(libdir2, /\.(so|o|dll)$/i).collect{|file| ldds(file)}, bindir2) if linux? or darwin? copyto(Dir.find(libdir2, /\.(so|o|dll)$/i).collect{|file| dlls(file)}, bindir2) if windows? or cygwin? -if TK or RUBYSCRIPT2EXE::TK +if TK or RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:tk] if File.file?("#{libdir2}/tk.rb") $stderr.puts "Copying TCL/TK..." unless QUIET @@ -187,7 +199,7 @@ end end -if not NOSTRIP and RUBYSCRIPT2EXE::STRIP and (linux? or darwin?) +if not NOSTRIP and RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:strip] and (linux? or darwin?) $stderr.puts "Stripping..." unless QUIET system("cd #{bindir2} ; strip --strip-all * 2> /dev/null") @@ -264,9 +276,9 @@ f.puts " ARGV.concat(RUBYSCRIPT2EXE::PARMSLIST.split(/\000/))" f.puts "end" - f.puts "# Set the RubyGems environment" + if RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:rubygems] + f.puts "# Set the RubyGems environment" - if RUBYSCRIPT2EXE::RUBYGEMS f.puts "ENV.keys.each do |key|" f.puts " ENV.delete(key) if key =~ /^gem_/i" f.puts "end" @@ -295,9 +307,11 @@ # ??? nog iets met app/bin? if linux? - f.puts "c PATH=%tempdir%/bin:$PATH ; export LD_LIBRARY_PATH=%tempdir%/bin:$LD_LIBRARY_PATH ; chmod +x %tempdir%/bin/* ; #{strace} %tempdir%/bin/#{rubyexe} -r %tempdir%/bootstrap.rb -T1 %tempdir%/empty.rb %tempdir%/app/#{apprb}" + f.puts "t chmod +x %tempdir%/bin/*" + f.puts "c export PATH=%tempdir%/bin:$PATH ; export LD_LIBRARY_PATH=%tempdir%/bin:$LD_LIBRARY_PATH ; #{strace} %tempdir%/bin/#{rubyexe} -r %tempdir%/bootstrap.rb -T1 %tempdir%/empty.rb %tempdir%/app/#{apprb}" elsif darwin? - f.puts "c PATH=%tempdir%/bin:$PATH ; export DYLD_LIBRARY_PATH=%tempdir%/bin:$DYLD_LIBRARY_PATH ; chmod +x %tempdir%/bin/* ; %tempdir%/bin/#{rubyexe} -r %tempdir%/bootstrap.rb -T1 %tempdir%/empty.rb %tempdir%/app/#{apprb}" + f.puts "t chmod +x %tempdir%/bin/*" + f.puts "c export PATH=%tempdir%/bin:$PATH ; export DYLD_LIBRARY_PATH=%tempdir%/bin:$DYLD_LIBRARY_PATH ; %tempdir%/bin/#{rubyexe} -r %tempdir%/bootstrap.rb -T1 %tempdir%/empty.rb %tempdir%/app/#{apprb}" elsif cygwin? f.puts "c %tempdir%\\bin\\#{rubyexe} -r %tempdir1%/bootstrap.rb -T1 %tempdir1%/empty.rb %tempdir1%/app/#{apprb}" else @@ -328,7 +342,7 @@ tmplocation do ENV["EEE_EXE"] = eeeexe ENV["EEE_DIR"] = Dir.pwd - ENV["EEE_TEMPDIR"] = RUBYSCRIPT2EXE::TEMPDIR if RUBYSCRIPT2EXE::TEMPDIR + ENV["EEE_TEMPDIR"] = RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:tempdir] if RUBYSCRIPT2EXE::REQUIRE2LIB_FROM_APP[:tempdir] eeebin1 = newlocation("eee.exe") eeebin1 = newlocation("eee_linux") if linux? diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/require2lib.rb rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/require2lib.rb --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/require2lib.rb 2006-08-06 19:33:04.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/require2lib.rb 2007-04-15 21:31:50.000000000 +0200 @@ -1,5 +1,6 @@ require "ev/ftools" require "rbconfig" +require "rubyscript2exe" exit if __FILE__ == $0 @@ -127,11 +128,15 @@ unless LOADSCRIPT == ORGDIR File.open(LOADSCRIPT, "w") do |f| f.puts "module RUBYSCRIPT2EXE" + f.puts " REQUIRE2LIB_FROM_APP={}" + RUBYSCRIPT2EXE.class_variables.each do |const| const = const[2..-1] - f.puts " #{const.upcase}=#{RUBYSCRIPT2EXE.send(const).inspect}" + + f.puts " REQUIRE2LIB_FROM_APP[:#{const}]=#{RUBYSCRIPT2EXE.send(const).inspect}" end - f.puts " RUBYGEMS=#{rubygems.inspect}" + + f.puts " REQUIRE2LIB_FROM_APP[:rubygems]=#{rubygems.inspect}" f.puts "end" end end @@ -139,10 +144,10 @@ end module Kernel - alias :old_load :load + alias :require2lib_load :load def load(filename, wrap=false) REQUIRE2LIB::LOADED << filename unless REQUIRE2LIB::LOADED.include?(filename) - old_load(filename, wrap) + require2lib_load(filename, wrap) end end diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/rubyscript2exe.rb rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/rubyscript2exe.rb --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/rubyscript2exe.rb 2006-08-06 19:33:04.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/rubyscript2exe.rb 2007-04-15 21:31:50.000000000 +0200 @@ -31,19 +31,26 @@ def self.strip=(b) ; @@strip = b ; end def self.appdir(file=nil, &block) - dir = File.dirname(File.expand_path($0, USERDIR)) - dir = File.expand_path(File.join(TEMPDIR, "app")) if is_compiled? and defined?(TEMPDIR) - - _use_given_dir(dir, file, &block) + if is_compiled? and defined?(TEMPDIR) + use_given_dir(File.expand_path(File.join(TEMPDIR, "app")), file, &block) + else + use_given_dir(File.dirname(File.expand_path($0, USERDIR)), file, &block) + end end def self.userdir(file=nil, &block) - dir = USERDIR + use_given_dir(USERDIR, file, &block) + end - _use_given_dir(USERDIR, file, &block) + def self.exedir(file=nil, &block) + if is_compiled? and defined?(APPEXE) + use_given_dir(File.dirname(APPEXE), file, &block) + else + use_given_dir(File.dirname(File.expand_path($0)), file, &block) + end end - def self._use_given_dir(dir, file, &block) + def self.use_given_dir(dir, *file, &block) if block pdir = Dir.pwd @@ -51,13 +58,15 @@ res = block[] Dir.chdir(pdir) else - res = File.join(*([dir, file].compact)) + file = file.compact + res = File.expand_path(File.join(*file), dir) end res end + class << self - private :_use_given_dir + private :use_given_dir end def self.is_compiling? @@ -68,6 +77,14 @@ defined?(COMPILED) end + def self.executable + if is_compiled? and defined?(APPEXE) + APPEXE + else + File.expand_path($0) + end + end + verbose = $VERBOSE $VERBOSE = nil s = ENV["PATH"].dup diff -ur rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/VERSION rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/VERSION --- rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/VERSION 2006-08-06 19:33:04.000000000 +0200 +++ rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/VERSION 2007-04-15 21:31:49.000000000 +0200 @@ -1 +1 @@ -0.5.1 +0.5.2 Binary files rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/eee.exe and rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/eee.exe differ Binary files rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/eee_linux and rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/eee_linux differ Binary files rubyscript2exe-0.5.1.tar.gz/rubyscript2exe/eeew.exe and rubyscript2exe-0.5.2.tar.gz/rubyscript2exe/eeew.exe differ