rwdshell 0.97 → 0.98
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.
- data/Readme.txt +6 -0
- data/code/01rwdcore/01rwdcore.rb +4 -2
- data/code/01rwdcore/test_cases.rb +126 -0
- data/code/01rwdcore/test_harness.rb +15 -0
- data/code/01rwdcore/uploadreturns.rb +62 -0
- data/code/superant.com.rwdtinkerbackwindow/diagnostictab.rb +14 -10
- data/configuration/language.dist +1 -1
- data/configuration/rwdapplicationidentity.dist +2 -2
- data/configuration/rwdshell.dist +2 -2
- data/configuration/rwdtinker.dist +2 -2
- data/configuration/tinkerwin2variables.dist +1 -1
- data/extras/zip/ioextras.rb +114 -0
- data/extras/zip/stdrubyext.rb +111 -0
- data/extras/zip/tempfile_bugfixed.rb +195 -0
- data/extras/zip/zip.rb +1377 -0
- data/extras/zip/zipfilesystem.rb +558 -0
- data/extras/zip/ziprequire.rb +61 -0
- data/gui/helpaboutinstalled/superant.com.tinkerhelpabout/3copyright.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.rwdshellbackwindow/46editscriptrecord.rwd +5 -5
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +12 -16
- data/init.rb +3 -0
- data/rwd_files/HowTo_Shell.txt +4 -0
- data/rwd_files/HowTo_Tinker.txt +14 -0
- data/rwdconfig.dist +6 -2
- data/tests/makedist.rb +16 -1
- metadata +12 -17
- data/extras/cmdline_parse +0 -47
- data/extras/config_file +0 -69
- data/extras/errorMsg +0 -19
- data/extras/makePlaylist +0 -34
- data/extras/mp3controld +0 -289
- data/extras/playlist +0 -186
- data/extras/showHelp +0 -18
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/1appname.rwd +0 -4
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/3copyright.rwd +0 -3
- data/gui/helpaboutinstalled/superant.com.rwdwin2helpabout/5version.rwd +0 -10
- data/installed/rwdtinkerwin2-0.5.inf +0 -8
@@ -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.
|
@@ -1,9 +1,9 @@
|
|
1
1
|
$rwdguivar=
|
2
2
|
"
|
3
|
-
<tab name=\"
|
3
|
+
<tab name=\"editrubyrecordfile\" caption=\"Edit Script\">
|
4
4
|
<table>
|
5
5
|
<row> <p> </row>
|
6
|
-
<row> <p align=\"right\">
|
6
|
+
<row> <p align=\"right\">you can create a new record here or edit one</row>
|
7
7
|
<row> <p> </row>
|
8
8
|
<horizontal>
|
9
9
|
<button caption=\"Fill Record\" action=\"loadrubyscriptrecord\"/>
|
@@ -13,16 +13,16 @@ $rwdguivar=
|
|
13
13
|
</horizontal>
|
14
14
|
<horizontal>
|
15
15
|
<row> <p align=\"right\">FileName:</p>
|
16
|
-
<text name=\"
|
16
|
+
<text name=\"a_rubyscriptfilename\"/>
|
17
17
|
</horizontal>
|
18
18
|
<table>
|
19
|
-
<textarea name=\"
|
19
|
+
<textarea name=\"a_rubyscriptrecord\"/> </row>
|
20
20
|
|
21
21
|
|
22
22
|
</table>
|
23
23
|
|
24
24
|
<p>
|
25
|
-
<p>%
|
25
|
+
<p>%newrubyresult%</p>
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -2,30 +2,26 @@ $rwdguivar=
|
|
2
2
|
"
|
3
3
|
<tab name=\"diagnostictab\" caption=\"Diagnostic Tab\">
|
4
4
|
<horizontal>
|
5
|
-
<button caption=\"View
|
5
|
+
<button caption=\"View Platform Information\" action=\"runviewplatform\"/>
|
6
6
|
|
7
7
|
|
8
|
-
</horizontal>
|
9
|
-
<p>%rubyversion%</p>
|
10
|
-
|
11
|
-
|
12
|
-
<table>
|
13
|
-
<row> <p> </row>
|
14
|
-
|
15
|
-
</table>
|
16
|
-
|
17
|
-
<horizontal>
|
18
|
-
<button caption=\"view platform\" action=\"runviewplatform\"/>
|
19
|
-
|
20
8
|
</horizontal>
|
21
9
|
|
22
10
|
<p>%platformdisplay%</p>
|
23
11
|
<horizontal>
|
24
|
-
|
12
|
+
|
25
13
|
|
26
14
|
</horizontal>
|
27
|
-
|
28
|
-
|
15
|
+
<horizontal>
|
16
|
+
<button caption=\"upload this page of information to the Program Author\" action=\"uploadreturnsfile\"/>
|
17
|
+
</horizontal>
|
18
|
+
<horizontal>
|
19
|
+
<p align=\"right\">Email:(optional)</p> <text size=50 name=\"a_emailupload\"/>
|
20
|
+
|
21
|
+
</horizontal>
|
22
|
+
<p align=\"center\">Comment/Suggestion/Feature Request or Bug Report:(optional)</p> <textarea name=\"a_commentupload\"/>
|
23
|
+
|
24
|
+
<p>%returnsftpdisplay%</p>
|
29
25
|
|
30
26
|
</tab>"
|
31
27
|
|
data/init.rb
CHANGED
@@ -65,6 +65,9 @@ MAINconfignew = "rwdconfig.cnf"
|
|
65
65
|
MAINconfigdist = "rwdconfig.dist"
|
66
66
|
Rconftool::install(MAINconfigdist,MAINconfignew)
|
67
67
|
|
68
|
+
#load main config file
|
69
|
+
load 'rwdconfig.cnf'
|
70
|
+
|
68
71
|
Dir.chdir("configuration") #changes the current working directory
|
69
72
|
|
70
73
|
fileList = Dir.new(".").entries.sort.reverse.delete_if { |x| ! (x =~ /dist$/) } #creates an Array separated with \n
|