rwdhypernote 0.03

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. data/Notes/changes.lnk +1 -0
  2. data/Notes/changes.txt +1 -0
  3. data/Notes/hypernote/hypernote01.txt +1 -0
  4. data/Notes/hypernote/hypernote02.txt +1 -0
  5. data/Notes/hypernote/newnote3.txt +2 -0
  6. data/Notes/rwdtinker/RwdtinkerProgrammingQuickStart.lnk +1 -0
  7. data/Notes/rwdtinker/RwdtinkerProgrammingQuickStart.txt +11 -0
  8. data/Notes/rwdtinker/newnote.txt +1 -0
  9. data/Notes/rwdtinker/rwdtinker01.txt +9 -0
  10. data/Notes/rwdtinker/testnote2.txt +1 -0
  11. data/Readme.txt +97 -0
  12. data/bin/rwdhypernote +19 -0
  13. data/code/01rwdcore/01rwdcore.rb +20 -0
  14. data/code/01rwdcore/02helptexthashbegin.rb +4 -0
  15. data/code/01rwdcore/03helptexthash.rb +31 -0
  16. data/code/01rwdcore/04helptextend.rb +6 -0
  17. data/code/01rwdcore/openhelpwindow.rb +31 -0
  18. data/code/01rwdcore/returntomain.rb +10 -0
  19. data/code/01rwdcore/rwdtinkerversion.rb +15 -0
  20. data/code/01rwdcore/rwdwindowreturn.rb +11 -0
  21. data/code/superant.com.hypernote/archiveevent.rb +14 -0
  22. data/code/superant.com.hypernote/changehypernotename.rb +21 -0
  23. data/code/superant.com.hypernote/clearhypernotescreendisplay.rb +8 -0
  24. data/code/superant.com.hypernote/clearlinkscreendisplay.rb +8 -0
  25. data/code/superant.com.hypernote/copyfilename.rb +10 -0
  26. data/code/superant.com.hypernote/createnewnote.rb +14 -0
  27. data/code/superant.com.hypernote/deletehypernoterecord.rb +20 -0
  28. data/code/superant.com.hypernote/helptexthashrwdhypernote.rb +60 -0
  29. data/code/superant.com.hypernote/hyperlinkcreatelinkfile.rb +19 -0
  30. data/code/superant.com.hypernote/listhypernotelinks.rb +52 -0
  31. data/code/superant.com.hypernote/listhypernotes.rb +55 -0
  32. data/code/superant.com.hypernote/listlinknotes.rb +33 -0
  33. data/code/superant.com.hypernote/loadconfigurationrecord.rb +34 -0
  34. data/code/superant.com.hypernote/loadconfigurationvariables.rb +13 -0
  35. data/code/superant.com.hypernote/loadlinksrecord.rb +21 -0
  36. data/code/superant.com.hypernote/loadnoterecord.rb +24 -0
  37. data/code/superant.com.hypernote/openhelpwindowrwdhyernote.rb +23 -0
  38. data/code/superant.com.hypernote/returntomain.rb +10 -0
  39. data/code/superant.com.hypernote/rwdhypernotehelpabout.rb +14 -0
  40. data/code/superant.com.hypernote/saveconfigurationrecord.rb +18 -0
  41. data/code/superant.com.hypernote/savehypernoterecord.rb +20 -0
  42. data/code/superant.com.hypernote/savelinkrecord.rb +23 -0
  43. data/code/superant.com.hypernote/viewrwdschedulesconfiguration.rb +21 -0
  44. data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +99 -0
  45. data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +21 -0
  46. data/code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb +58 -0
  47. data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +22 -0
  48. data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +20 -0
  49. data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +19 -0
  50. data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +12 -0
  51. data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +54 -0
  52. data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +11 -0
  53. data/code/superant.com.rwdtinkerbackwindow/listzips.rb +31 -0
  54. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +32 -0
  55. data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +13 -0
  56. data/code/superant.com.rwdtinkerbackwindow/network.rb +87 -0
  57. data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +18 -0
  58. data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +42 -0
  59. data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +24 -0
  60. data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +28 -0
  61. data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +12 -0
  62. data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +14 -0
  63. data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +18 -0
  64. data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -0
  65. data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +21 -0
  66. data/code/zz0applicationend/zz0end.rb +4 -0
  67. data/configuration/language.cnf +5 -0
  68. data/configuration/rwdapplicationidentity.cnf +3 -0
  69. data/configuration/rwdhypernote.cnf +9 -0
  70. data/configuration/rwdhypernoteversion.cnf +3 -0
  71. data/configuration/rwdtinker.cnf +16 -0
  72. data/configuration/rwdtinkerversion.cnf +2 -0
  73. data/configuration/tinkerwin2variables.cnf +12 -0
  74. data/configuration/tinkerwin2version.cnf +3 -0
  75. data/ev/browser.rb +109 -0
  76. data/ev/ftools.rb +170 -0
  77. data/ev/net.rb +750 -0
  78. data/ev/ruby.rb +819 -0
  79. data/ev/rwd.rb +1849 -0
  80. data/ev/sgml.rb +236 -0
  81. data/ev/thread.rb +63 -0
  82. data/ev/tree.rb +343 -0
  83. data/ev/xml.rb +4 -0
  84. data/extras/zip/ioextras.rb +114 -0
  85. data/extras/zip/stdrubyext.rb +111 -0
  86. data/extras/zip/tempfile_bugfixed.rb +195 -0
  87. data/extras/zip/zip.rb +1376 -0
  88. data/extras/zip/zipfilesystem.rb +558 -0
  89. data/extras/zip/ziprequire.rb +61 -0
  90. data/gui/00coreguibegin/applicationguitop.rwd +4 -0
  91. data/gui/frontwindow0/superant.com.hypernote/10viewnote.rwd +32 -0
  92. data/gui/frontwindow0/superant.com.hypernote/20editlinks.rwd +34 -0
  93. data/gui/frontwindow0/superant.com.hypernote/30noteutilities.rwd +27 -0
  94. data/gui/frontwindowselectionbegin/selectiontabbegin/selectiontabbegin.rwd +16 -0
  95. data/gui/frontwindowselections/superant.com.rwdtinkerwin2selectiontab/rwdwin2selectiontab.rwd +12 -0
  96. data/gui/frontwindowselectionzend/viewselectionzend/viewselectionend.rwd +3 -0
  97. data/gui/frontwindowtdocumentbegin/superant.com.documentsbegin/tt0documentbegin.rwd +6 -0
  98. data/gui/frontwindowtdocuments/superant.com.documents/uu5documents.rwd +15 -0
  99. data/gui/frontwindowtdocuments/superant.com.rwdhypernotedocument/rwdhypernotedocument.rwd +5 -0
  100. data/gui/frontwindowtdocuments/superant.com.tinkerwin2documents/uu5documents.rwd +6 -0
  101. data/gui/frontwindowtdocumentzend/superant.com.documentsend/ww0documentend.rwd +12 -0
  102. data/gui/frontwindowz1end/frontwindowend/xx0rwdfirsttab.rwd +6 -0
  103. data/gui/helpaboutbegin/superant.com.helpaboutbegin/ya0helpscreenstart.rwd +3 -0
  104. data/gui/helpaboutinstalled/superant.com.rwdhypernotehelpabout/1versionname.rwd +6 -0
  105. data/gui/helpaboutinstalled/superant.com.rwdhypernotehelpabout/5version.rwd +9 -0
  106. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +4 -0
  107. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +3 -0
  108. data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +10 -0
  109. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/1appname.rwd +4 -0
  110. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +3 -0
  111. data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/5version.rwd +10 -0
  112. data/gui/helpaboutzend/superant.com.helpaboutend/helpscreenend.rwd +3 -0
  113. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/1appname.rwd +5 -0
  114. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/40rwdlistzips.rwd +42 -0
  115. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/45installremotezip.rwd +44 -0
  116. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/50rwdlistapplets.rwd +44 -0
  117. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd +38 -0
  118. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +33 -0
  119. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/75rwdcontrol.rwd +33 -0
  120. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/80tab1.rwd +11 -0
  121. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/9backend.rwd +6 -0
  122. data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/1appname.rwd +31 -0
  123. data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/9end.rwd +4 -0
  124. data/gui/tinkerbackwindows/superant.com.versionwindow/1appname.rwd +19 -0
  125. data/gui/zzcoreguiend/tinkerapplicationguiend/yy9rwdend.rwd +4 -0
  126. data/init.rb +269 -0
  127. data/lang/alanguagehashbegin.rb +4 -0
  128. data/lang/en/rwdcore/languagefile.rb +16 -0
  129. data/lang/es/rwdcore/languagefile-es.rb +14 -0
  130. data/lang/jp/rwdcore/languagefile.rb +9 -0
  131. data/lang/languagehash.rb +4 -0
  132. data/lang/nl/rwdcore/languagefile.rb +19 -0
  133. data/lang/templangfile.rb +16 -0
  134. data/lang/vlanguagehashend.rb +6 -0
  135. data/lang/wlocallangstart.rb +5 -0
  136. data/lang/xlocallangfile.rb +16 -0
  137. data/lang/zlocallangend.rb +2 -0
  138. data/lib/temp.rb +1 -0
  139. data/rwd_files/HowTo_HyperNote.txt +97 -0
  140. data/rwd_files/HowTo_Tinker.txt +375 -0
  141. data/rwd_files/HowTo_TinkerWin2.txt +202 -0
  142. data/rwd_files/Readme.txt +57 -0
  143. data/rwd_files/favicon.ico +0 -0
  144. data/rwd_files/rdoc-style.css +175 -0
  145. data/rwd_files/rwdapplications.html +54 -0
  146. data/rwd_files/rwdindex.html +6 -0
  147. data/rwd_files/tinker.png +0 -0
  148. data/zips/rwdahelloworld-0.5.zip +0 -0
  149. metadata +202 -0
@@ -0,0 +1,24 @@
1
+ # This tinker method is to retrieve the list of rwdzip applets available to install from the remote repository
2
+
3
+ def superantcomremotegemlist
4
+ gemcommandoption = "search --remote "
5
+ gemfilename = "rwdzip"
6
+ commandtext = "gem search --remote rwdzip"
7
+ commandtemp = $xpcommand + commandtext
8
+ begin # exception trapped block
9
+
10
+ tempremotegemappletsresult = `#{commandtemp} 2>&1`
11
+ @superantcomremotegemappletsfullresult = tempremotegemappletsresult
12
+ fileList = tempremotegemappletsresult.split(/\n/).delete_if { |x| ! (x =~ /\Arwdzip/) }
13
+
14
+ @superantcomremotegemappletsresult = fileList.rwd_method("superantcomremotegemappletdirsname")
15
+ rescue SystemCallError, StandardError
16
+ @superantcomremotegemappletsresult = "system call error: " + $!
17
+ end # exception rescue
18
+ end
19
+
20
+ def superantcomremotegemappletdirsname(inffile)
21
+ applet = inffile
22
+ @superantcominstallremoteappletinput = applet
23
+
24
+ end
@@ -0,0 +1,28 @@
1
+ def removeapplet
2
+ require 'fileutils'
3
+ nametext = "%s" % [@a_removeapplet]
4
+
5
+ begin # exception trapped block
6
+ fileName = "installed/" + nametext + ".inf"
7
+ count = 0
8
+ fd = File.open(fileName,"r")
9
+
10
+
11
+ fd.each { |oneline|
12
+ if count == 1
13
+ commandline = "rm -r " + oneline
14
+ system( commandline+' > temp.output' )
15
+ end
16
+ count = 1
17
+ }
18
+ fd.close
19
+ commandline = "rm " + fileName
20
+
21
+ system(commandline)
22
+ @removeapplettext = "applet files removed! - restart rwd to finish uninstalling"
23
+
24
+ rescue
25
+ @removeapplettext = "\n" + "error"
26
+ end # exception rescue
27
+
28
+ end
@@ -0,0 +1,12 @@
1
+ # Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
2
+ # This application is a framework for writing programs from RubyWebDialogs
3
+ # http://www.erikveen.dds.nl/rubywebdialogs/index.html
4
+ # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
+
6
+ # call the rwdtinker helpwindow
7
+
8
+ def runrwdtinkerbackwindow
9
+ @rwd_window = "tinkerbackwindow"
10
+ @rwd_tab = "rwdzipslister"
11
+ end
12
+
@@ -0,0 +1,14 @@
1
+ # Application RwdTinker orginally (c) 2004 Steven Gibson under GPL.
2
+ # This application is a framework for writing programs from RubyWebDialogs
3
+ # http://www.erikveen.dds.nl/rubywebdialogs/index.html
4
+ # For more information about RwdTinker see http://www.rubyforge.net/projects/rwdapplications
5
+
6
+ # return the version constant defined in the config file
7
+ def runrwdtinkerwin2version
8
+ @rwd_window = "applicationversion"
9
+ @versionappnamedisplay = "RwdTinkerWin2"
10
+ @versioncopyrightdisplay = "(c) 2004 Steven Gibson "
11
+ @versionnumberdisplay = "Version " + RwdTinkerWin2Version
12
+
13
+ end
14
+
@@ -0,0 +1,18 @@
1
+ # this method saves the configuration record
2
+ def saveconfigurationrecord
3
+ require 'fileutils'
4
+ if @a_configurationfilename
5
+ newname = "%s" % [@a_configurationfilename] # grab the filename to create
6
+ newdata =@a_configline1.to_s + "\n" + @a_configline2.to_s + "\n" + @a_configline3.to_s + "\n" + @a_configline4.to_s + "\n" + @a_configline5.to_s + "\n" + @a_configline6.to_s + "\n" + @a_configline7.to_s + "\n" + @a_configline8.to_s + "\n"
7
+
8
+ begin # exception trapped block
9
+ fileName = File.join( ConfigurationDir, newname )
10
+ fd = File.open(fileName,"w")
11
+ fd.print(newdata) # save the record info to the file
12
+ fd.close
13
+ @newconfigurationresult=newdata # show the record info in the browser
14
+ rescue SystemCallError, StandardError
15
+ $stderr.print "system call error: " + $!
16
+ end # exception rescue
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ def viewappletcontents
2
+ require 'fileutils'
3
+ require 'extras/zip/zip'
4
+ nametext = "%s" % [@a_installapplet]
5
+
6
+ begin # exception trapped block
7
+ fullname = nametext + ".zip"
8
+ fileName = File.join($zipslocation,fullname)
9
+ tempfilecontents = " "
10
+ zf = Zip::ZipFile.new(fileName)
11
+ zf.sort.each {
12
+ |entry|
13
+ tempfilecontents = tempfilecontents + entry.to_s + "\n"
14
+ }
15
+ @appletcontentstext = tempfilecontents
16
+
17
+ rescue
18
+ @installapplettext = "unzip error - error opening applet"
19
+ end # exception rescue
20
+
21
+ end
@@ -0,0 +1,21 @@
1
+ def viewgemappletcontents
2
+ require 'fileutils'
3
+ require 'extras/zip/zip'
4
+ nametext = "%s" % [@a_installapplet]
5
+
6
+ begin # exception trapped block
7
+ fullname = nametext + ".zip"
8
+
9
+ tempfilecontents = " "
10
+ zf = Zip::ZipFile.new(fullname)
11
+ zf.sort.each {
12
+ |entry|
13
+ tempfilecontents = tempfilecontents + entry.to_s + "\n"
14
+ }
15
+ @appletcontentstext = tempfilecontents
16
+
17
+ rescue
18
+ @installapplettext = "unzip error - error opening applet"
19
+ end # exception rescue
20
+
21
+ end
@@ -0,0 +1,4 @@
1
+
2
+
3
+ end # end of rwdtinker class
4
+
@@ -0,0 +1,5 @@
1
+
2
+ #$lang = "jp"
3
+ $lang= "en"
4
+ #$lang= "nl"
5
+ #$lang= "es"
@@ -0,0 +1,3 @@
1
+
2
+ $rwdapplicationidentity = "rwdtinker main application"
3
+
@@ -0,0 +1,9 @@
1
+
2
+ $rwdhypernote_directory = "Notes"
3
+ $notesarray = ["Notes/changes.txt"]
4
+ $noteslinksarray = ["Notes/changes.lnk"]
5
+ $rwdschedule_ftpsite = "ftp.mysite.com"
6
+ $rwdschedule_ftplogin = "mylogin"
7
+ $rwdschedule_ftppassword = "mypassword"
8
+ $rwdschedule_ftpdirectory = "/incoming/rwdschedules/"
9
+ $rwdschedule_updatedirectory = "updates"
@@ -0,0 +1,3 @@
1
+
2
+ RwdHyperNoteVersion = "0.03"
3
+
@@ -0,0 +1,16 @@
1
+
2
+ ConfigurationDir = "configuration" # for use in program - init.rb has this value without using this constant
3
+ CodeName = "rwdtinker"
4
+ CodeNameFile = CodeName + ".rb"
5
+ LangNameFile = "rwdlanguage.rb"
6
+ RWDFile = "rwdtinker.rwd"
7
+ LangDir = "lang"
8
+ TempLangHashFile = LangDir + "/" + "templangfile.rb"
9
+ LocalLangHashFile = LangDir + "/" + "xlocallangfile.rb"
10
+ CodeDir = "code"
11
+ GuiDir = "gui"
12
+ $help_topic = "general_help"
13
+ $helptopicsarray = [ "general_help","network_help"]
14
+ $prevouswindow ="main"
15
+ $rwdcontrolports =["13713","13714","13715","13716","13717","13718"]
16
+ $port = 7705
@@ -0,0 +1,2 @@
1
+
2
+ RwdTinkerVersion = "1.54"
@@ -0,0 +1,12 @@
1
+
2
+ TinkerWin2ConfigurationFileName = "tinkerwin2variables.cnf" # this file name - do not change
3
+ $zipslocation = "zips" # location of applets to add
4
+ $zipsarray = [""] ; $zipsarraylocal = [""]
5
+ $xpcommand = " " # Linux machines
6
+ # $xpcommand = "cmd /C " # XP machines with cmd shell
7
+ $gemdirectory_withgemfiles = "/usr/lib/ruby/gems/1.8/gems"
8
+ # $gemdirectory_withgemfiles = "c:\\ruby\\lib\\ruby\\gems\\1.8\\gems" # XP machine
9
+ # $geminstalled_directory = "/ruby/lib/ruby/gems/1.8/gems" # XP machine
10
+ $geminstalled_directory = "/usr/lib/ruby/gems/1.8/gems" # Debian Linux
11
+
12
+
@@ -0,0 +1,3 @@
1
+
2
+ RwdTinkerWin2Version = "0.8"
3
+
data/ev/browser.rb ADDED
@@ -0,0 +1,109 @@
1
+ require "ev/ruby"
2
+ require "ev/net"
3
+
4
+ begin
5
+ require "win32ole"
6
+ require "win32/registry"
7
+ rescue LoadError
8
+ $".push "win32ole.so"
9
+ $".push "win32/registry.rb"
10
+ end
11
+
12
+ def windowsbrowser
13
+ $stderr.puts "Looking for default browser..."
14
+
15
+ filetype = "htmlfile"
16
+ application = nil
17
+
18
+ begin
19
+ Win32::Registry::HKEY_CLASSES_ROOT.open('.html') do |reg|
20
+ filetype = reg[""]
21
+ end
22
+
23
+ Win32::Registry::HKEY_CLASSES_ROOT.open(filetype + '\shell\open\command') do |reg|
24
+ application = reg[""]
25
+ end
26
+ rescue NameError
27
+ $stderr.puts "Only available for Windows."
28
+ end
29
+
30
+ application
31
+ end
32
+
33
+ def linuxbrowser
34
+ application = ""
35
+
36
+ application = `which galeon 2> /dev/null`.chomp if application.empty?
37
+ application = `which mozilla 2> /dev/null`.chomp if application.empty?
38
+ application = `which firefox 2> /dev/null`.chomp if application.empty?
39
+ application = `which opera 2> /dev/null`.chomp if application.empty?
40
+ application = `which konqueror 2> /dev/null`.chomp if application.empty?
41
+ application = `which htmlview 2> /dev/null`.chomp if application.empty?
42
+ application = nil if application.empty?
43
+
44
+ application
45
+ end
46
+
47
+ def defaultbrowser
48
+ res = nil
49
+ res = windowsbrowser if windows?
50
+ res = linuxbrowser if linux?
51
+ res
52
+ end
53
+
54
+ def showinbrowser(html, browser=defaultbrowser)
55
+ port, io = TCPServer.freeport(7701, 7709)
56
+
57
+ unless browser.nil?
58
+ Thread.new do
59
+ begin
60
+ #command = "1234 \"http://localhost:#{port}\"" if linux?
61
+ #command = "L:/prog/MozillaFirefox/firefox.exe \"http://localhost:#{port}\"" if cygwin?
62
+ #command = Win32::Registry::HKEY_CLASSES_ROOT.open('htmlfile\shell\open\command')[0] + " \"http://localhost:#{port}/\"" if windows?
63
+
64
+ command = "#{browser} \"http://localhost:#{port}\""
65
+
66
+ Thread.pass
67
+
68
+ system(command)
69
+ rescue
70
+ end
71
+ end
72
+ end
73
+
74
+ HTTPServer.serve([port, io]) do |req, resp|
75
+ resp << html
76
+
77
+ resp.stop
78
+ end
79
+ end
80
+
81
+ def tab2html(tab)
82
+ res = ""
83
+
84
+ tab = tab.to_html(false)
85
+
86
+ res << "<html>\n"
87
+ res << "<body>\n"
88
+ res << "<table align='center' border='1' cellspacing='0' cellpadding='3'>\n"
89
+ res << "<tbody>\n"
90
+
91
+ tab.split(/\r*\n/).each do |line|
92
+ res << "<tr>\n"
93
+
94
+ line.split(/\t/, -1).each do |veld|
95
+ veld = "&nbsp;" if veld.compress.empty?
96
+
97
+ res << "<td>%s</td>\n" % veld
98
+ end
99
+
100
+ res << "</tr>\n"
101
+ end
102
+
103
+ res << "</tbody>\n"
104
+ res << "</table>\n"
105
+ res << "</body>\n"
106
+ res << "</html>\n"
107
+
108
+ res
109
+ end
data/ev/ftools.rb ADDED
@@ -0,0 +1,170 @@
1
+ require "ftools"
2
+
3
+ class Dir
4
+ def self.mkdirrec(dir)
5
+ pdir = File.dirname(dir)
6
+
7
+ if not pdir.empty? and not File.directory?(pdir)
8
+ Dir.mkdirrec(pdir)
9
+ end
10
+
11
+ Dir.mkdir(dir) rescue nil
12
+ end
13
+
14
+ def self.copy(from, to)
15
+ if File.directory?(from)
16
+ pdir = Dir.pwd
17
+ todir = File.expand_path(to)
18
+
19
+ mkdirrec(todir)
20
+
21
+ Dir.chdir(from)
22
+ Dir.new(".").each do |e|
23
+ Dir.copy(e, todir+"/"+e) if not [".", ".."].include?(e)
24
+ end
25
+ Dir.chdir(pdir)
26
+ else
27
+ todir = File.dirname(File.expand_path(to))
28
+
29
+ mkdirrec(todir)
30
+
31
+ File.copy(from, to)
32
+ end
33
+ end
34
+
35
+ def self.move(from, to)
36
+ Dir.copy(from, to)
37
+ Dir.rm_rf(from)
38
+ end
39
+
40
+ def self.rm_rf(entry)
41
+ if File.ftype(entry) == "directory"
42
+ pdir = Dir.pwd
43
+
44
+ Dir.chdir(entry)
45
+ Dir.new(".").each do |e|
46
+ Dir.rm_rf(e) if not [".", ".."].include?(e)
47
+ end
48
+ Dir.chdir(pdir)
49
+
50
+ Dir.delete(entry)
51
+ else
52
+ File.delete(entry)
53
+ end
54
+ end
55
+
56
+ def self.find(entry=nil, mask=nil)
57
+ entry = "." if entry.nil?
58
+
59
+ entry = entry.gsub!(/[\/\\]*$/, "") unless entry.nil?
60
+
61
+ mask = /^#{mask}$/i if mask.kind_of?(String)
62
+
63
+ res = []
64
+
65
+ if File.directory?(entry)
66
+ pdir = Dir.pwd
67
+
68
+ res += ["%s/" % entry] if mask.nil? or entry =~ mask
69
+
70
+ begin
71
+ Dir.chdir(entry)
72
+
73
+ begin
74
+ Dir.new(".").each do |e|
75
+ res += Dir.find(e, mask).collect{|e| entry+"/"+e} unless [".", ".."].include?(e)
76
+ end
77
+ ensure
78
+ Dir.chdir(pdir)
79
+ end
80
+ rescue Errno::EACCES => error
81
+ puts error
82
+ end
83
+ else
84
+ res += [entry] if mask.nil? or entry =~ mask
85
+ end
86
+
87
+ res
88
+ end
89
+ end
90
+
91
+ class File
92
+ def self.rollbackup(file, mode=nil)
93
+ backupfile = file + ".RB.BACKUP"
94
+ controlfile = file + ".RB.CONTROL"
95
+ res = nil
96
+
97
+ File.touch(file) unless File.file?(file)
98
+
99
+ # Rollback
100
+
101
+ if File.file?(backupfile) and File.file?(controlfile)
102
+ $stdout.puts "Restoring #{file}..."
103
+
104
+ File.copy(backupfile, file) # Rollback from phase 3
105
+ end
106
+
107
+ # Reset
108
+
109
+ File.delete(backupfile) if File.file?(backupfile) # Reset from phase 2 or 3
110
+ File.delete(controlfile) if File.file?(controlfile) # Reset from phase 3 or 4
111
+
112
+ # Backup
113
+
114
+ File.copy(file, backupfile) # Enter phase 2
115
+ File.touch(controlfile) # Enter phase 3
116
+
117
+ # The real thing
118
+
119
+ if block_given?
120
+ if mode.nil?
121
+ res = yield
122
+ else
123
+ File.open(file, mode) do |f|
124
+ res = yield(f)
125
+ end
126
+ end
127
+ end
128
+
129
+ # Cleanup
130
+
131
+ File.delete(backupfile) # Enter phase 4
132
+ File.delete(controlfile) # Enter phase 5
133
+
134
+ # Return, like File.open
135
+
136
+ res = File.open(file, (mode or "r")) unless block_given?
137
+
138
+ res
139
+ end
140
+
141
+ def self.touch(file)
142
+ File.open(file, "a"){|f|}
143
+ end
144
+
145
+ def self.which(file)
146
+ res = nil
147
+
148
+ if windows?
149
+ file = file.gsub(/\.exe$/i, "") + ".exe"
150
+ sep = ";"
151
+ else
152
+ sep = ":"
153
+ end
154
+
155
+ catch :stop do
156
+ ENV["PATH"].split(/#{sep}/).reverse.each do |d|
157
+ if File.directory?(d)
158
+ Dir.new(d).each do |e|
159
+ if e.downcase == file.downcase
160
+ res = File.expand_path(e, d)
161
+ throw :stop
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
167
+
168
+ res
169
+ end
170
+ end