rwdfoldeditor 0.01
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.txt +462 -0
- data/bin/rwdfoldeditor +19 -0
- data/code/01rwdcore/01rwdcore.rb +29 -0
- data/code/01rwdcore/02helptexthashbegin.rb +4 -0
- data/code/01rwdcore/03helptexthash.rb +23 -0
- data/code/01rwdcore/04helptextend.rb +6 -0
- data/code/01rwdcore/jumplinkcommand.rb +26 -0
- data/code/01rwdcore/openhelpwindow.rb +31 -0
- data/code/01rwdcore/returntomain.rb +10 -0
- data/code/01rwdcore/rundocuments.rb +10 -0
- data/code/01rwdcore/runeditconfiguration.rb +10 -0
- data/code/01rwdcore/runhelpabout.rb +10 -0
- data/code/01rwdcore/runopentinkerdocument.rb +7 -0
- data/code/01rwdcore/rwdtinkerversion.rb +22 -0
- data/code/01rwdcore/rwdwindowreturn.rb +9 -0
- data/code/01rwdcore/selectiontab.rb +9 -0
- data/code/01rwdcore/setuphelpaboutoptions.rb +13 -0
- data/code/01rwdcore/setuptinkerdocuments.rb +6 -0
- data/code/01rwdcore/test_cases.rb +109 -0
- data/code/01rwdcore/test_harness.rb +13 -0
- data/code/01rwdcore/uploadreturns.rb +62 -0
- data/code/dd0viewphoto/dd0viewphoto.rb +3 -0
- data/code/superant.com.foldeditor/0uninstallapplet.rb +10 -0
- data/code/superant.com.foldeditor/changehypernotename.rb +21 -0
- data/code/superant.com.foldeditor/chooselinkfile.rb +6 -0
- data/code/superant.com.foldeditor/choosenotefile.rb +6 -0
- data/code/superant.com.foldeditor/createnewnotehtml.rb +31 -0
- data/code/superant.com.foldeditor/helptexthashrwdhypernote.rb +38 -0
- data/code/superant.com.foldeditor/hyperlinkcreatelinkfile.rb +19 -0
- data/code/superant.com.foldeditor/listfoldeditorfiles.rb +7 -0
- data/code/superant.com.foldeditor/loadfolddocument.rb +21 -0
- data/code/superant.com.foldeditor/loadrwdfoldeditlinkfile.rb +19 -0
- data/code/superant.com.foldeditor/openhelpwindowrwdhyernote.rb +30 -0
- data/code/superant.com.foldeditor/runrwdapplet.rb +10 -0
- data/code/superant.com.foldeditor/rwddisplayfoldlinks.rb +33 -0
- data/code/superant.com.foldeditor/rwdtinkerversion.rb +10 -0
- data/code/superant.com.foldeditor/savefoldlinkfile.rb +20 -0
- data/code/superant.com.foldeditor/savehtmlhypernoterecord.rb +20 -0
- data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +19 -0
- data/code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb +61 -0
- data/code/superant.com.rwdtinkerbackwindow/initiateapplets.rb +240 -0
- data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +34 -0
- data/code/superant.com.rwdtinkerbackwindow/installremotegem.rb +20 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemdirs.rb +12 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +53 -0
- data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +12 -0
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +27 -0
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +22 -0
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationvariables.rb +14 -0
- data/code/superant.com.rwdtinkerbackwindow/network.rb +87 -0
- data/code/superant.com.rwdtinkerbackwindow/openappletname.rb +19 -0
- data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +38 -0
- data/code/superant.com.rwdtinkerbackwindow/remotegemlist.rb +24 -0
- data/code/superant.com.rwdtinkerbackwindow/removeapplet.rb +46 -0
- data/code/superant.com.rwdtinkerbackwindow/removeappletvariables.rb +52 -0
- data/code/superant.com.rwdtinkerbackwindow/runremoteinstall.rb +11 -0
- data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +15 -0
- data/code/superant.com.rwdtinkerbackwindow/rwdtinkerwin2version.rb +13 -0
- data/code/superant.com.rwdtinkerbackwindow/saveconfigurationrecord.rb +19 -0
- data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +22 -0
- data/code/superant.com.rwdtinkerbackwindow/viewgemappletcontents.rb +24 -0
- data/code/zz0applicationend/zz0end.rb +4 -0
- data/configuration/language.dist +8 -0
- data/configuration/rwdapplicationidentity.dist +3 -0
- data/configuration/rwdtinker.dist +18 -0
- data/configuration/rwdwfoldeditor-0.01.dist +12 -0
- data/configuration/tinkerwin2variables.dist +17 -0
- data/gui/00coreguibegin/applicationguitop.rwd +4 -0
- data/gui/frontwindow0/cc0openphoto.rwd +22 -0
- data/gui/frontwindowselections/00selectiontabbegin.rwd +11 -0
- data/gui/frontwindowselections/jumplinkcommands.rwd +15 -0
- data/gui/frontwindowselections/wwselectionend.rwd +3 -0
- data/gui/frontwindowtdocuments/00documentbegin.rwd +6 -0
- data/gui/frontwindowtdocuments/tinkerdocuments.rwd +14 -0
- data/gui/frontwindowtdocuments/zzdocumentend.rwd +8 -0
- data/gui/helpaboutbegin/zzzrwdlasttab.rwd +6 -0
- data/gui/helpaboutbegin/zzzzhelpscreenstart.rwd +3 -0
- data/gui/helpaboutbegin/zzzzzzhelpabouttab.rwd +15 -0
- data/gui/helpaboutzend/helpscreenend.rwd +3 -0
- data/gui/helpaboutzend/zhelpscreenstart2.rwd +3 -0
- data/gui/helpaboutzend/zzzzhelpabout2.rwd +15 -0
- data/gui/helpaboutzend/zzzzhelpscreen2end.rwd +3 -0
- data/gui/tinkerbackwindows/superant.com.foldeditor/10appletbegin.rwd +4 -0
- data/gui/tinkerbackwindows/superant.com.foldeditor/10aviewnote.rwd +42 -0
- data/gui/tinkerbackwindows/superant.com.foldeditor/15htmlview.rwd +46 -0
- data/gui/tinkerbackwindows/superant.com.foldeditor/56viewfold.rwd +43 -0
- data/gui/tinkerbackwindows/superant.com.foldeditor/81jumplinkcommands.rwd +17 -0
- data/gui/tinkerbackwindows/superant.com.foldeditor/9end.rwd +6 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/1appname.rwd +5 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/40rwdlistzips.rwd +41 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/45installremotezip.rwd +44 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/50rwdlistapplets.rwd +44 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd +30 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +29 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/81jumplinkcommands.rwd +17 -0
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/9backend.rwd +6 -0
- data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/1appname.rwd +31 -0
- data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/9end.rwd +4 -0
- data/gui/tinkerbackwindows/superant.com.versionwindow/1appname.rwd +19 -0
- data/gui/tinkerbackwindows/superant.com.versionwindow/helpaboutwindow.rwd +17 -0
- data/gui/zzcoreguiend/yy9rwdend.rwd +4 -0
- data/init.rb +277 -0
- data/installed/rwdwfoldeditor-0.01.inf +13 -0
- data/installed/temp.rb +1 -0
- data/lang/en/rwdcore/languagefile.rb +58 -0
- data/lang/es/rwdcore/languagefile-es.rb +62 -0
- data/lang/fr/rwdcore/languagefile.rb +64 -0
- data/lang/jp/rwdcore/languagefile.rb +72 -0
- data/lang/nl/rwdcore/languagefile.rb +75 -0
- data/lib/rconftool.rb +380 -0
- data/lib/rwd/browser.rb +123 -0
- data/lib/rwd/ftools.rb +174 -0
- data/lib/rwd/mime.rb +328 -0
- data/lib/rwd/net.rb +866 -0
- data/lib/rwd/ruby.rb +889 -0
- data/lib/rwd/rwd.rb +1942 -0
- data/lib/rwd/sgml.rb +236 -0
- data/lib/rwd/thread.rb +63 -0
- data/lib/rwd/tree.rb +371 -0
- data/lib/rwd/xml.rb +101 -0
- data/lib/zip/ioextras.rb +114 -0
- data/lib/zip/stdrubyext.rb +111 -0
- data/lib/zip/tempfile_bugfixed.rb +195 -0
- data/lib/zip/zip.rb +1378 -0
- data/lib/zip/zipfilesystem.rb +558 -0
- data/lib/zip/ziprequire.rb +61 -0
- data/rwd_files/HowTo_FoldEditor.txt +105 -0
- data/rwd_files/HowTo_Tinker.txt +471 -0
- data/rwd_files/HowTo_TinkerWin2.txt +202 -0
- data/rwd_files/Readme.txt +57 -0
- data/rwd_files/RubyWebDialogs.html +6 -0
- data/rwd_files/default.fld +9 -0
- data/rwd_files/favicon.ico +0 -0
- data/rwd_files/rdoc-style.css +175 -0
- data/rwd_files/rwdapplications.html +54 -0
- data/rwd_files/rwdhypernote-0.13.fld +202 -0
- data/rwd_files/tinker.png +0 -0
- data/rwdconfig.dist +21 -0
- data/rwdfoldeditor.rb +1 -0
- data/tests/RubyGauge.rb +179 -0
- data/tests/checkdepends.sh +4 -0
- data/tests/cleancnf.sh +6 -0
- data/tests/makedist-rwdwfoldeditor.rb +56 -0
- data/tests/makedist.rb +66 -0
- data/tests/rdep.rb +354 -0
- data/tests/totranslate.lang +93 -0
- data/zips/rwdwaddresses-1.05.zip +0 -0
- data/zips/rwdwcalc-0.61.zip +0 -0
- data/zips/rwdwfoldeditor-0.01.zip +0 -0
- data/zips/rwdwgutenberg-0.09.zip +0 -0
- data/zips/rwdwschedule-1.04.zip +0 -0
- data/zips/rwdwshell-1.04.zip +0 -0
- data/zips/temp.rb +1 -0
- data/zips/wrubyslippers-1.06.zip +0 -0
- metadata +212 -0
@@ -0,0 +1,558 @@
|
|
1
|
+
require 'zip/zip'
|
2
|
+
|
3
|
+
module Zip
|
4
|
+
module ZipFileSystem
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
mappedZip = ZipFileNameMapper.new(self)
|
8
|
+
@zipFsDir = ZipFsDir.new(mappedZip)
|
9
|
+
@zipFsFile = ZipFsFile.new(mappedZip)
|
10
|
+
@zipFsDir.file = @zipFsFile
|
11
|
+
@zipFsFile.dir = @zipFsDir
|
12
|
+
end
|
13
|
+
|
14
|
+
def dir
|
15
|
+
@zipFsDir
|
16
|
+
end
|
17
|
+
|
18
|
+
def file
|
19
|
+
@zipFsFile
|
20
|
+
end
|
21
|
+
|
22
|
+
class ZipFsFile
|
23
|
+
|
24
|
+
attr_writer :dir
|
25
|
+
# protected :dir
|
26
|
+
|
27
|
+
class ZipFsStat
|
28
|
+
def initialize(zipFsFile, entryName)
|
29
|
+
@zipFsFile = zipFsFile
|
30
|
+
@entryName = entryName
|
31
|
+
end
|
32
|
+
|
33
|
+
def forward_invoke(msg)
|
34
|
+
@zipFsFile.send(msg, @entryName)
|
35
|
+
end
|
36
|
+
|
37
|
+
def kind_of?(t)
|
38
|
+
super || t == ::File::Stat
|
39
|
+
end
|
40
|
+
|
41
|
+
forward_message :forward_invoke, :file?, :directory?, :pipe?, :chardev?
|
42
|
+
forward_message :forward_invoke, :symlink?, :socket?, :blockdev?
|
43
|
+
forward_message :forward_invoke, :readable?, :readable_real?
|
44
|
+
forward_message :forward_invoke, :writable?, :writable_real?
|
45
|
+
forward_message :forward_invoke, :executable?, :executable_real?
|
46
|
+
forward_message :forward_invoke, :sticky?, :owned?, :grpowned?
|
47
|
+
forward_message :forward_invoke, :setuid?, :setgid?
|
48
|
+
forward_message :forward_invoke, :zero?
|
49
|
+
forward_message :forward_invoke, :size, :size?
|
50
|
+
forward_message :forward_invoke, :mtime, :atime, :ctime
|
51
|
+
|
52
|
+
def blocks; nil; end
|
53
|
+
|
54
|
+
def get_entry
|
55
|
+
@zipFsFile.__send__(:get_entry, @entryName)
|
56
|
+
end
|
57
|
+
private :get_entry
|
58
|
+
|
59
|
+
def gid
|
60
|
+
e = get_entry
|
61
|
+
if e.extra.member? "IUnix"
|
62
|
+
e.extra["IUnix"].gid || 0
|
63
|
+
else
|
64
|
+
0
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def uid
|
69
|
+
e = get_entry
|
70
|
+
if e.extra.member? "IUnix"
|
71
|
+
e.extra["IUnix"].uid || 0
|
72
|
+
else
|
73
|
+
0
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def ino; 0; end
|
78
|
+
|
79
|
+
def dev; 0; end
|
80
|
+
|
81
|
+
def rdev; 0; end
|
82
|
+
|
83
|
+
def rdev_major; 0; end
|
84
|
+
|
85
|
+
def rdev_minor; 0; end
|
86
|
+
|
87
|
+
def ftype
|
88
|
+
if file?
|
89
|
+
return "file"
|
90
|
+
elsif directory?
|
91
|
+
return "directory"
|
92
|
+
else
|
93
|
+
raise StandardError, "Unknown file type"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def nlink; 1; end
|
98
|
+
|
99
|
+
def blksize; nil; end
|
100
|
+
|
101
|
+
def mode
|
102
|
+
e = get_entry
|
103
|
+
if e.fstype == 3
|
104
|
+
e.externalFileAttributes >> 16
|
105
|
+
else
|
106
|
+
33206 # 33206 is equivalent to -rw-rw-rw-
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def initialize(mappedZip)
|
112
|
+
@mappedZip = mappedZip
|
113
|
+
end
|
114
|
+
|
115
|
+
def get_entry(fileName)
|
116
|
+
if ! exists?(fileName)
|
117
|
+
raise Errno::ENOENT, "No such file or directory - #{fileName}"
|
118
|
+
end
|
119
|
+
@mappedZip.find_entry(fileName)
|
120
|
+
end
|
121
|
+
private :get_entry
|
122
|
+
|
123
|
+
def unix_mode_cmp(fileName, mode)
|
124
|
+
begin
|
125
|
+
e = get_entry(fileName)
|
126
|
+
e.fstype == 3 && ((e.externalFileAttributes >> 16) & mode ) != 0
|
127
|
+
rescue Errno::ENOENT
|
128
|
+
false
|
129
|
+
end
|
130
|
+
end
|
131
|
+
private :unix_mode_cmp
|
132
|
+
|
133
|
+
def exists?(fileName)
|
134
|
+
expand_path(fileName) == "/" || @mappedZip.find_entry(fileName) != nil
|
135
|
+
end
|
136
|
+
alias :exist? :exists?
|
137
|
+
|
138
|
+
# Permissions not implemented, so if the file exists it is accessible
|
139
|
+
alias owned? exists?
|
140
|
+
alias grpowned? exists?
|
141
|
+
|
142
|
+
def readable?(fileName)
|
143
|
+
unix_mode_cmp(fileName, 0444)
|
144
|
+
end
|
145
|
+
alias readable_real? readable?
|
146
|
+
|
147
|
+
def writable?(fileName)
|
148
|
+
unix_mode_cmp(fileName, 0222)
|
149
|
+
end
|
150
|
+
alias writable_real? writable?
|
151
|
+
|
152
|
+
def executable?(fileName)
|
153
|
+
unix_mode_cmp(fileName, 0111)
|
154
|
+
end
|
155
|
+
alias executable_real? executable?
|
156
|
+
|
157
|
+
def setuid?(fileName)
|
158
|
+
unix_mode_cmp(fileName, 04000)
|
159
|
+
end
|
160
|
+
|
161
|
+
def setgid?(fileName)
|
162
|
+
unix_mode_cmp(fileName, 02000)
|
163
|
+
end
|
164
|
+
|
165
|
+
def sticky?(fileName)
|
166
|
+
unix_mode_cmp(fileName, 01000)
|
167
|
+
end
|
168
|
+
|
169
|
+
def umask(*args)
|
170
|
+
::File.umask(*args)
|
171
|
+
end
|
172
|
+
|
173
|
+
def truncate(fileName, len)
|
174
|
+
raise StandardError, "truncate not supported"
|
175
|
+
end
|
176
|
+
|
177
|
+
def directory?(fileName)
|
178
|
+
entry = @mappedZip.find_entry(fileName)
|
179
|
+
expand_path(fileName) == "/" || (entry != nil && entry.directory?)
|
180
|
+
end
|
181
|
+
|
182
|
+
def open(fileName, openMode = "r", &block)
|
183
|
+
case openMode
|
184
|
+
when "r"
|
185
|
+
@mappedZip.get_input_stream(fileName, &block)
|
186
|
+
when "w"
|
187
|
+
@mappedZip.get_output_stream(fileName, &block)
|
188
|
+
else
|
189
|
+
raise StandardError, "openmode '#{openMode} not supported" unless openMode == "r"
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
def new(fileName, openMode = "r")
|
194
|
+
open(fileName, openMode)
|
195
|
+
end
|
196
|
+
|
197
|
+
def size(fileName)
|
198
|
+
@mappedZip.get_entry(fileName).size
|
199
|
+
end
|
200
|
+
|
201
|
+
# nil for not found and nil for directories
|
202
|
+
def size?(fileName)
|
203
|
+
entry = @mappedZip.find_entry(fileName)
|
204
|
+
return (entry == nil || entry.directory?) ? nil : entry.size
|
205
|
+
end
|
206
|
+
|
207
|
+
def chown(ownerInt, groupInt, *filenames)
|
208
|
+
filenames.each { |fileName|
|
209
|
+
e = get_entry(fileName)
|
210
|
+
unless e.extra.member?("IUnix")
|
211
|
+
e.extra.create("IUnix")
|
212
|
+
end
|
213
|
+
e.extra["IUnix"].uid = ownerInt
|
214
|
+
e.extra["IUnix"].gid = groupInt
|
215
|
+
}
|
216
|
+
filenames.size
|
217
|
+
end
|
218
|
+
|
219
|
+
def chmod (modeInt, *filenames)
|
220
|
+
filenames.each { |fileName|
|
221
|
+
e = get_entry(fileName)
|
222
|
+
e.fstype = 3 # force convertion filesystem type to unix
|
223
|
+
e.externalFileAttributes = modeInt << 16
|
224
|
+
}
|
225
|
+
filenames.size
|
226
|
+
end
|
227
|
+
|
228
|
+
def zero?(fileName)
|
229
|
+
sz = size(fileName)
|
230
|
+
sz == nil || sz == 0
|
231
|
+
rescue Errno::ENOENT
|
232
|
+
false
|
233
|
+
end
|
234
|
+
|
235
|
+
def file?(fileName)
|
236
|
+
entry = @mappedZip.find_entry(fileName)
|
237
|
+
entry != nil && entry.file?
|
238
|
+
end
|
239
|
+
|
240
|
+
def dirname(fileName)
|
241
|
+
::File.dirname(fileName)
|
242
|
+
end
|
243
|
+
|
244
|
+
def basename(fileName)
|
245
|
+
::File.basename(fileName)
|
246
|
+
end
|
247
|
+
|
248
|
+
def split(fileName)
|
249
|
+
::File.split(fileName)
|
250
|
+
end
|
251
|
+
|
252
|
+
def join(*fragments)
|
253
|
+
::File.join(*fragments)
|
254
|
+
end
|
255
|
+
|
256
|
+
def utime(modifiedTime, *fileNames)
|
257
|
+
fileNames.each { |fileName|
|
258
|
+
get_entry(fileName).time = modifiedTime
|
259
|
+
}
|
260
|
+
end
|
261
|
+
|
262
|
+
def mtime(fileName)
|
263
|
+
@mappedZip.get_entry(fileName).mtime
|
264
|
+
end
|
265
|
+
|
266
|
+
def atime(fileName)
|
267
|
+
e = get_entry(fileName)
|
268
|
+
if e.extra.member? "UniversalTime"
|
269
|
+
e.extra["UniversalTime"].atime
|
270
|
+
else
|
271
|
+
nil
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
def ctime(fileName)
|
276
|
+
e = get_entry(fileName)
|
277
|
+
if e.extra.member? "UniversalTime"
|
278
|
+
e.extra["UniversalTime"].ctime
|
279
|
+
else
|
280
|
+
nil
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
def pipe?(filename)
|
285
|
+
false
|
286
|
+
end
|
287
|
+
|
288
|
+
def blockdev?(filename)
|
289
|
+
false
|
290
|
+
end
|
291
|
+
|
292
|
+
def chardev?(filename)
|
293
|
+
false
|
294
|
+
end
|
295
|
+
|
296
|
+
def symlink?(fileName)
|
297
|
+
false
|
298
|
+
end
|
299
|
+
|
300
|
+
def socket?(fileName)
|
301
|
+
false
|
302
|
+
end
|
303
|
+
|
304
|
+
def ftype(fileName)
|
305
|
+
@mappedZip.get_entry(fileName).directory? ? "directory" : "file"
|
306
|
+
end
|
307
|
+
|
308
|
+
def readlink(fileName)
|
309
|
+
raise NotImplementedError, "The readlink() function is not implemented"
|
310
|
+
end
|
311
|
+
|
312
|
+
def symlink(fileName, symlinkName)
|
313
|
+
raise NotImplementedError, "The symlink() function is not implemented"
|
314
|
+
end
|
315
|
+
|
316
|
+
def link(fileName, symlinkName)
|
317
|
+
raise NotImplementedError, "The link() function is not implemented"
|
318
|
+
end
|
319
|
+
|
320
|
+
def pipe
|
321
|
+
raise NotImplementedError, "The pipe() function is not implemented"
|
322
|
+
end
|
323
|
+
|
324
|
+
def stat(fileName)
|
325
|
+
if ! exists?(fileName)
|
326
|
+
raise Errno::ENOENT, fileName
|
327
|
+
end
|
328
|
+
ZipFsStat.new(self, fileName)
|
329
|
+
end
|
330
|
+
|
331
|
+
alias lstat stat
|
332
|
+
|
333
|
+
def readlines(fileName)
|
334
|
+
open(fileName) { |is| is.readlines }
|
335
|
+
end
|
336
|
+
|
337
|
+
def read(fileName)
|
338
|
+
@mappedZip.read(fileName)
|
339
|
+
end
|
340
|
+
|
341
|
+
def popen(*args, &aProc)
|
342
|
+
File.popen(*args, &aProc)
|
343
|
+
end
|
344
|
+
|
345
|
+
def foreach(fileName, aSep = $/, &aProc)
|
346
|
+
open(fileName) { |is| is.each_line(aSep, &aProc) }
|
347
|
+
end
|
348
|
+
|
349
|
+
def delete(*args)
|
350
|
+
args.each {
|
351
|
+
|fileName|
|
352
|
+
if directory?(fileName)
|
353
|
+
raise Errno::EISDIR, "Is a directory - \"#{fileName}\""
|
354
|
+
end
|
355
|
+
@mappedZip.remove(fileName)
|
356
|
+
}
|
357
|
+
end
|
358
|
+
|
359
|
+
def rename(fileToRename, newName)
|
360
|
+
@mappedZip.rename(fileToRename, newName) { true }
|
361
|
+
end
|
362
|
+
|
363
|
+
alias :unlink :delete
|
364
|
+
|
365
|
+
def expand_path(aPath)
|
366
|
+
@mappedZip.expand_path(aPath)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
class ZipFsDir
|
371
|
+
|
372
|
+
def initialize(mappedZip)
|
373
|
+
@mappedZip = mappedZip
|
374
|
+
end
|
375
|
+
|
376
|
+
attr_writer :file
|
377
|
+
|
378
|
+
def new(aDirectoryName)
|
379
|
+
ZipFsDirIterator.new(entries(aDirectoryName))
|
380
|
+
end
|
381
|
+
|
382
|
+
def open(aDirectoryName)
|
383
|
+
dirIt = new(aDirectoryName)
|
384
|
+
if block_given?
|
385
|
+
begin
|
386
|
+
yield(dirIt)
|
387
|
+
return nil
|
388
|
+
ensure
|
389
|
+
dirIt.close
|
390
|
+
end
|
391
|
+
end
|
392
|
+
dirIt
|
393
|
+
end
|
394
|
+
|
395
|
+
def pwd; @mappedZip.pwd; end
|
396
|
+
alias getwd pwd
|
397
|
+
|
398
|
+
def chdir(aDirectoryName)
|
399
|
+
unless @file.stat(aDirectoryName).directory?
|
400
|
+
raise Errno::EINVAL, "Invalid argument - #{aDirectoryName}"
|
401
|
+
end
|
402
|
+
@mappedZip.pwd = @file.expand_path(aDirectoryName)
|
403
|
+
end
|
404
|
+
|
405
|
+
def entries(aDirectoryName)
|
406
|
+
entries = []
|
407
|
+
foreach(aDirectoryName) { |e| entries << e }
|
408
|
+
entries
|
409
|
+
end
|
410
|
+
|
411
|
+
def foreach(aDirectoryName)
|
412
|
+
unless @file.stat(aDirectoryName).directory?
|
413
|
+
raise Errno::ENOTDIR, aDirectoryName
|
414
|
+
end
|
415
|
+
path = @file.expand_path(aDirectoryName).ensure_end("/")
|
416
|
+
|
417
|
+
subDirEntriesRegex = Regexp.new("^#{path}([^/]+)$")
|
418
|
+
@mappedZip.each {
|
419
|
+
|fileName|
|
420
|
+
match = subDirEntriesRegex.match(fileName)
|
421
|
+
yield(match[1]) unless match == nil
|
422
|
+
}
|
423
|
+
end
|
424
|
+
|
425
|
+
def delete(entryName)
|
426
|
+
unless @file.stat(entryName).directory?
|
427
|
+
raise Errno::EINVAL, "Invalid argument - #{entryName}"
|
428
|
+
end
|
429
|
+
@mappedZip.remove(entryName)
|
430
|
+
end
|
431
|
+
alias rmdir delete
|
432
|
+
alias unlink delete
|
433
|
+
|
434
|
+
def mkdir(entryName, permissionInt = 0)
|
435
|
+
@mappedZip.mkdir(entryName, permissionInt)
|
436
|
+
end
|
437
|
+
|
438
|
+
def chroot(*args)
|
439
|
+
raise NotImplementedError, "The chroot() function is not implemented"
|
440
|
+
end
|
441
|
+
|
442
|
+
end
|
443
|
+
|
444
|
+
class ZipFsDirIterator
|
445
|
+
include Enumerable
|
446
|
+
|
447
|
+
def initialize(arrayOfFileNames)
|
448
|
+
@fileNames = arrayOfFileNames
|
449
|
+
@index = 0
|
450
|
+
end
|
451
|
+
|
452
|
+
def close
|
453
|
+
@fileNames = nil
|
454
|
+
end
|
455
|
+
|
456
|
+
def each(&aProc)
|
457
|
+
raise IOError, "closed directory" if @fileNames == nil
|
458
|
+
@fileNames.each(&aProc)
|
459
|
+
end
|
460
|
+
|
461
|
+
def read
|
462
|
+
raise IOError, "closed directory" if @fileNames == nil
|
463
|
+
@fileNames[(@index+=1)-1]
|
464
|
+
end
|
465
|
+
|
466
|
+
def rewind
|
467
|
+
raise IOError, "closed directory" if @fileNames == nil
|
468
|
+
@index = 0
|
469
|
+
end
|
470
|
+
|
471
|
+
def seek(anIntegerPosition)
|
472
|
+
raise IOError, "closed directory" if @fileNames == nil
|
473
|
+
@index = anIntegerPosition
|
474
|
+
end
|
475
|
+
|
476
|
+
def tell
|
477
|
+
raise IOError, "closed directory" if @fileNames == nil
|
478
|
+
@index
|
479
|
+
end
|
480
|
+
end
|
481
|
+
|
482
|
+
# All access to ZipFile from ZipFsFile and ZipFsDir goes through a
|
483
|
+
# ZipFileNameMapper, which has one responsibility: ensure
|
484
|
+
class ZipFileNameMapper
|
485
|
+
include Enumerable
|
486
|
+
|
487
|
+
def initialize(zipFile)
|
488
|
+
@zipFile = zipFile
|
489
|
+
@pwd = "/"
|
490
|
+
end
|
491
|
+
|
492
|
+
attr_accessor :pwd
|
493
|
+
|
494
|
+
def find_entry(fileName)
|
495
|
+
@zipFile.find_entry(expand_to_entry(fileName))
|
496
|
+
end
|
497
|
+
|
498
|
+
def get_entry(fileName)
|
499
|
+
@zipFile.get_entry(expand_to_entry(fileName))
|
500
|
+
end
|
501
|
+
|
502
|
+
def get_input_stream(fileName, &aProc)
|
503
|
+
@zipFile.get_input_stream(expand_to_entry(fileName), &aProc)
|
504
|
+
end
|
505
|
+
|
506
|
+
def get_output_stream(fileName, &aProc)
|
507
|
+
@zipFile.get_output_stream(expand_to_entry(fileName), &aProc)
|
508
|
+
end
|
509
|
+
|
510
|
+
def read(fileName)
|
511
|
+
@zipFile.read(expand_to_entry(fileName))
|
512
|
+
end
|
513
|
+
|
514
|
+
def remove(fileName)
|
515
|
+
@zipFile.remove(expand_to_entry(fileName))
|
516
|
+
end
|
517
|
+
|
518
|
+
def rename(fileName, newName, &continueOnExistsProc)
|
519
|
+
@zipFile.rename(expand_to_entry(fileName), expand_to_entry(newName),
|
520
|
+
&continueOnExistsProc)
|
521
|
+
end
|
522
|
+
|
523
|
+
def mkdir(fileName, permissionInt = 0)
|
524
|
+
@zipFile.mkdir(expand_to_entry(fileName), permissionInt)
|
525
|
+
end
|
526
|
+
|
527
|
+
# Turns entries into strings and adds leading /
|
528
|
+
# and removes trailing slash on directories
|
529
|
+
def each
|
530
|
+
@zipFile.each {
|
531
|
+
|e|
|
532
|
+
yield("/"+e.to_s.chomp("/"))
|
533
|
+
}
|
534
|
+
end
|
535
|
+
|
536
|
+
def expand_path(aPath)
|
537
|
+
expanded = aPath.starts_with("/") ? aPath : @pwd.ensure_end("/") + aPath
|
538
|
+
expanded.gsub!(/\/\.(\/|$)/, "")
|
539
|
+
expanded.gsub!(/[^\/]+\/\.\.(\/|$)/, "")
|
540
|
+
expanded.empty? ? "/" : expanded
|
541
|
+
end
|
542
|
+
|
543
|
+
private
|
544
|
+
|
545
|
+
def expand_to_entry(aPath)
|
546
|
+
expand_path(aPath).lchop
|
547
|
+
end
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
class ZipFile
|
552
|
+
include ZipFileSystem
|
553
|
+
end
|
554
|
+
end
|
555
|
+
|
556
|
+
# Copyright (C) 2002, 2003 Thomas Sondergaard
|
557
|
+
# rubyzip is free software; you can redistribute it and/or
|
558
|
+
# modify it under the terms of the ruby license.
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'zip/zip'
|
2
|
+
|
3
|
+
class ZipList
|
4
|
+
def initialize(zipFileList)
|
5
|
+
@zipFileList = zipFileList
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_input_stream(entry, &aProc)
|
9
|
+
@zipFileList.each {
|
10
|
+
|zfName|
|
11
|
+
Zip::ZipFile.open(zfName) {
|
12
|
+
|zf|
|
13
|
+
begin
|
14
|
+
return zf.get_input_stream(entry, &aProc)
|
15
|
+
rescue Errno::ENOENT
|
16
|
+
end
|
17
|
+
}
|
18
|
+
}
|
19
|
+
raise Errno::ENOENT,
|
20
|
+
"No matching entry found in zip files '#{@zipFileList.join(', ')}' "+
|
21
|
+
" for '#{entry}'"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
module Kernel
|
27
|
+
alias :oldRequire :require
|
28
|
+
|
29
|
+
def require(moduleName)
|
30
|
+
zip_require(moduleName) || oldRequire(moduleName)
|
31
|
+
end
|
32
|
+
|
33
|
+
def zip_require(moduleName)
|
34
|
+
return false if already_loaded?(moduleName)
|
35
|
+
get_resource(ensure_rb_extension(moduleName)) {
|
36
|
+
|zis|
|
37
|
+
eval(zis.read); $" << moduleName
|
38
|
+
}
|
39
|
+
return true
|
40
|
+
rescue Errno::ENOENT => ex
|
41
|
+
return false
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_resource(resourceName, &aProc)
|
45
|
+
zl = ZipList.new($:.grep(/\.zip$/))
|
46
|
+
zl.get_input_stream(resourceName, &aProc)
|
47
|
+
end
|
48
|
+
|
49
|
+
def already_loaded?(moduleName)
|
50
|
+
moduleRE = Regexp.new("^"+moduleName+"(\.rb|\.so|\.dll|\.o)?$")
|
51
|
+
$".detect { |e| e =~ moduleRE } != nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def ensure_rb_extension(aString)
|
55
|
+
aString.sub(/(\.rb)?$/i, ".rb")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Copyright (C) 2002 Thomas Sondergaard
|
60
|
+
# rubyzip is free software; you can redistribute it and/or
|
61
|
+
# modify it under the terms of the ruby license.
|
@@ -0,0 +1,105 @@
|
|
1
|
+
= rwdfoldeditor - for rwdtinker and RubyWebDialogs
|
2
|
+
|
3
|
+
rwdfoldeditor is a little book editor
|
4
|
+
|
5
|
+
The GUI interface used is RubyWebDialogs
|
6
|
+
|
7
|
+
RubyWebDialogs is a platform independent graphical user interface for Ruby applications. It generates HTML and serves it with an internal HTTP server, so you can use your favorite web browser as the front end for your Ruby application. All this means, that it can be used on almost every platform, like Ruby itself. http://www.erikveen.dds.nl/rubywebdialogs/
|
8
|
+
|
9
|
+
== Quick Start
|
10
|
+
Start the program by typing
|
11
|
+
ruby init.rb
|
12
|
+
|
13
|
+
Then point your web browser to:
|
14
|
+
http://localhost:7705/
|
15
|
+
|
16
|
+
To exit, press the x inside the browser window.
|
17
|
+
|
18
|
+
== Design - rwdfoldeditor
|
19
|
+
|
20
|
+
This program is a book notes editor
|
21
|
+
text notes can saved all over the computer
|
22
|
+
|
23
|
+
Notes are tracked in a fold file
|
24
|
+
|
25
|
+
One use is to bundle all the files in a software project in one view.
|
26
|
+
|
27
|
+
|
28
|
+
== Tabs
|
29
|
+
|
30
|
+
There are tabs to enter notes and links and edit configurations
|
31
|
+
|
32
|
+
View/Edit Note - to create a note or edit and existing note
|
33
|
+
|
34
|
+
View/Edit Links - to edit links
|
35
|
+
|
36
|
+
Note Utilities - to rename or delete notes
|
37
|
+
|
38
|
+
Edit Configuration - to change the configuration of rwdhypernote
|
39
|
+
|
40
|
+
|
41
|
+
== Using over a Network
|
42
|
+
|
43
|
+
To serve the application over your local LAN,change the last line in the
|
44
|
+
init.rb file to something like:
|
45
|
+
RwdTinker.file(RWDFile).serve(8080, "-r" ? ".rwduids" : nil)
|
46
|
+
Then you should be able to login at: http://yourhostname:8080
|
47
|
+
|
48
|
+
You have to authorize yourself. The .rwuids example is a string with
|
49
|
+
the name of the authorization file, relative to the home directory
|
50
|
+
of the user that started the service. This file has to be in the form of:
|
51
|
+
|
52
|
+
user1 = password
|
53
|
+
user2 = pass phrase
|
54
|
+
|
55
|
+
Thus the file .rwduids might contain:
|
56
|
+
|
57
|
+
erik = secret
|
58
|
+
|
59
|
+
== Requirements:
|
60
|
+
RubyWebDialogs - I am using 0.0.12
|
61
|
+
Ruby I am using version 1.8.2
|
62
|
+
|
63
|
+
|
64
|
+
I have tested this under Linux-Debian kernel 2.6.9
|
65
|
+
|
66
|
+
==Making Applets
|
67
|
+
|
68
|
+
What is required in a applet for the rwdtinker framework
|
69
|
+
|
70
|
+
1. config file
|
71
|
+
2. code files - under in a unique directory under code
|
72
|
+
3. gui files - begin with window name in unique directory(s) under gui/tinkerbackwindow
|
73
|
+
4. install file ending with .inf under install directory - code directories are listed in here for live startup
|
74
|
+
5. uninstall program file in code directory - to uninstall the global variables
|
75
|
+
6. the install file, config file and uninstall method have the same name
|
76
|
+
|
77
|
+
Then zip it up and it should be ready to go.
|
78
|
+
|
79
|
+
== PROBLEMS:
|
80
|
+
|
81
|
+
Closing the browser doesn't terminate the application. You have to use the application's close-button And terminating the application doesn't terminate the application when running in network mode. You just log out.
|
82
|
+
|
83
|
+
Don't use the back-button of the browser! Strange and unpredictable things may and will happen!
|
84
|
+
|
85
|
+
|
86
|
+
== contacts
|
87
|
+
For more information see:
|
88
|
+
http://rwdapplications.rubyforge.org/wiki/wiki.pl
|
89
|
+
|
90
|
+
|
91
|
+
For more information about RubyWebDialogs see:
|
92
|
+
http://www.erikveen.dds.nl/rubywebdialogs/index.html
|
93
|
+
|
94
|
+
|
95
|
+
Steven Gibson
|
96
|
+
steven@superant.com
|
97
|
+
|
98
|
+
== Changelog
|
99
|
+
|
100
|
+
version 0.01
|
101
|
+
First Release
|
102
|
+
select file in a fold link file
|
103
|
+
create new text files
|
104
|
+
edit fold link files
|
105
|
+
|