rwdgutenberg 0.12 → 0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/code/01rwdcore/01rwdcore.rb +6 -6
- data/code/01rwdcore/02helptexthashbegin.rb +14 -2
- data/code/01rwdcore/03helptexthash.rb +18 -20
- data/code/01rwdcore/jumplinkcommand.rb +14 -4
- data/code/01rwdcore/openhelpwindow.rb +7 -0
- data/code/01rwdcore/runhelpabout.rb +6 -1
- data/code/01rwdcore/runtab.rb +15 -0
- data/code/01rwdcore/selectiontab.rb +2 -0
- data/code/01rwdcore/setuphelpaboutoptions.rb +2 -0
- data/code/01rwdcore/setuptinkerdocuments.rb +1 -0
- data/code/01rwdcore/test_cases.rb +100 -51
- data/code/01rwdcore/test_harness.rb +8 -1
- data/code/01rwdcore/uploadreturns.rb +3 -0
- data/code/dd0viewphoto/dd0viewphoto.rb +2 -0
- data/code/superant.com.gutenberg/0uninstallapplet.rb +2 -0
- data/code/superant.com.gutenberg/changegutenbergname.rb +0 -0
- data/code/superant.com.gutenberg/clearbookscreendisplay.rb +0 -0
- data/code/superant.com.gutenberg/cleargutenbergfiles.rb +0 -0
- data/code/superant.com.gutenberg/cleargutrecordfiles.rb +0 -0
- data/code/superant.com.gutenberg/copyfilename.rb +0 -0
- data/code/superant.com.gutenberg/createnewnote.rb +1 -1
- data/code/superant.com.gutenberg/deletegutenbergrecord.rb +0 -0
- data/code/superant.com.gutenberg/gutenbergcreatefile.rb +0 -0
- data/code/superant.com.gutenberg/helptexthashload.rb +0 -0
- data/code/superant.com.gutenberg/listnamerecord.rb +0 -0
- data/code/superant.com.gutenberg/listtextfilesgutenberg.rb +0 -0
- data/code/superant.com.gutenberg/loadbookrecord.rb +0 -0
- data/code/superant.com.gutenberg/loadconfigurationrecord.rb +0 -0
- data/code/superant.com.gutenberg/loadconfigurationvariables.rb +0 -0
- data/code/superant.com.gutenberg/openhelpwindow.rb +41 -0
- data/code/superant.com.gutenberg/runbackwindow.rb +0 -0
- data/code/superant.com.gutenberg/rungutenbergwindow.rb +0 -0
- data/code/superant.com.gutenberg/rwdgutenbergbackward.rb +0 -0
- data/code/superant.com.gutenberg/rwdtinkerversion.rb +0 -0
- data/code/superant.com.gutenberg/saveconfigurationrecord.rb +0 -0
- data/code/superant.com.gutenberg/savegutenbergrecord.rb +0 -0
- data/code/superant.com.library/marcsearch.rb +30 -0
- data/code/superant.com.rwdtinkerbackwindow/changelocale.rb +84 -0
- data/code/superant.com.rwdtinkerbackwindow/initiateapplets.rb +30 -102
- data/code/superant.com.rwdtinkerbackwindow/installgemapplet.rb +2 -0
- data/code/superant.com.rwdtinkerbackwindow/listgemzips.rb +2 -0
- data/code/superant.com.rwdtinkerbackwindow/listinstalledfiles.rb +3 -1
- data/code/superant.com.rwdtinkerbackwindow/listzips.rb +4 -0
- data/code/superant.com.rwdtinkerbackwindow/loadconfigurationrecord.rb +3 -1
- data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +3 -1
- data/code/superant.com.rwdtinkerbackwindow/showlocaleoptions.rb +9 -0
- data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +1 -0
- data/code/superant.com.rwdtinkerbackwindow/viewlogfile.rb +8 -5
- data/code/zz0applicationend/zz0end.rb +2 -1
- data/configuration/rwdtinker.dist +3 -2
- data/configuration/rwdwgutenberg.dist +3 -3
- data/configuration/tinkerwin2variables.dist +4 -8
- data/gui/tinkerbackwindows/superant.com.backgutenberg/30booklistutilities.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.backgutenberg/40marctab.rwd +26 -0
- data/gui/tinkerbackwindows/superant.com.backgutenberg/67viewconfiguration.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/70rwddiagnostics.rwd +1 -1
- data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/80localechanger.rwd +17 -0
- data/init.rb +53 -156
- data/installed/rwdwgutenberg.inf +0 -1
- data/lang/en/rwdcore/en.po +197 -0
- data/lang/es/rwdcore/es.po +184 -0
- data/lang/fr/rwdcore/fr.po +169 -0
- data/lang/hi/rwdcore/hi.po +173 -0
- data/lang/ja/rwdcore/ja.po +171 -0
- data/lang/nl/rwdcore/nl.po +169 -0
- data/lib/marc.rb +38 -0
- data/lib/marc/constants.rb +14 -0
- data/lib/marc/controlfield.rb +47 -0
- data/lib/marc/datafield.rb +163 -0
- data/lib/marc/dublincore.rb +79 -0
- data/lib/marc/exception.rb +9 -0
- data/lib/marc/reader.rb +186 -0
- data/lib/marc/record.rb +147 -0
- data/lib/marc/subfield.rb +31 -0
- data/lib/marc/writer.rb +87 -0
- data/lib/marc/xmlreader.rb +103 -0
- data/lib/marc/xmlwriter.rb +155 -0
- data/lib/rwdtinker/rwdcodedir.rb +56 -0
- data/lib/rwdtinker/rwdguidir.rb +57 -0
- data/lib/rwdtinker/rwdlangdir.rb +60 -0
- data/lib/rwdtinker/rwdtinkertools.rb +2 -1
- data/lib/zip/ioextras.rb +43 -2
- data/lib/zip/stdrubyext.rb +5 -5
- data/lib/zip/tempfile_bugfixed.rb +2 -2
- data/lib/zip/zip.rb +618 -149
- data/lib/zip/zipfilesystem.rb +59 -8
- data/lib/zip/ziprequire.rb +32 -3
- data/lib/zmarc.rb +140 -0
- data/lib/zoom.so +0 -0
- data/rwd_files/HowTo_Gutenberg.txt +8 -1
- data/rwd_files/HowTo_Tinker.txt +29 -6
- data/rwd_files/Tinkerhelptexthash.txt +84 -0
- data/rwd_files/log/rwdtinker.log +0 -2080
- data/rwd_files/rwdapplications.html +23 -1
- data/rwd_files/rwdgutenberghelpfiles.txt +11 -4
- data/rwdconfig.dist +4 -2
- data/tests/makedist-rwdwgutenberg.rb +1 -1
- data/tests/makedist.rb +1 -1
- data/zips/rwdwfoldeditor-0.07.zip +0 -0
- data/zips/{rwdwgutenberg-0.12.zip → rwdwgutenberg-0.13.zip} +0 -0
- data/zips/rwdwhypernote-0.16.zip +0 -0
- data/zips/rwdwmovies-0.98.zip +0 -0
- data/zips/tinkerbellw-0.04.zip +0 -0
- data/zips/{wrubyslippers-1.07.zip → wrubyslippers-1.08.zip} +0 -0
- metadata +39 -14
- data/code/01rwdcore/04helptextend.rb +0 -6
- data/code/superant.com.gutenberg/openhelpwindowgutenberg.rb +0 -35
- data/code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb +0 -61
- data/lang/en/rwdcore/languagefile.rb +0 -59
- data/lang/es/rwdcore/languagefile-es.rb +0 -63
- data/lang/fr/rwdcore/languagefile.rb +0 -65
- data/lang/jp/rwdcore/languagefile.rb +0 -73
- data/lang/nl/rwdcore/languagefile.rb +0 -76
- data/rwdgutenberg.rb +0 -1
- data/zips/rwdwfoldeditor-0.05.zip +0 -0
data/lib/marc/writer.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
module MARC
|
2
|
+
|
3
|
+
# A class for writing MARC records as MARC21.
|
4
|
+
|
5
|
+
class Writer
|
6
|
+
|
7
|
+
# the constructor which you must pass a file path
|
8
|
+
# or an object that responds to a write message
|
9
|
+
|
10
|
+
def initialize(file)
|
11
|
+
if file.class == String
|
12
|
+
@fh = File.new(file,"w")
|
13
|
+
elsif file.respond_to?('write')
|
14
|
+
@fh = file
|
15
|
+
else
|
16
|
+
throw "must pass in file name or handle"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
# write a record to the file or handle
|
22
|
+
|
23
|
+
def write(record)
|
24
|
+
@fh.write(MARC::Writer.encode(record))
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# close underlying filehandle
|
29
|
+
|
30
|
+
def close
|
31
|
+
@fh.close
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
# a static method that accepts a MARC::Record object
|
36
|
+
# and returns the record encoded as MARC21 in transmission format
|
37
|
+
|
38
|
+
def self.encode(record)
|
39
|
+
directory = ''
|
40
|
+
fields = ''
|
41
|
+
offset = 0
|
42
|
+
for field in record.fields
|
43
|
+
|
44
|
+
# encode the field
|
45
|
+
field_data = ''
|
46
|
+
if field.class == MARC::DataField
|
47
|
+
field_data = field.indicator1 + field.indicator2
|
48
|
+
for s in field.subfields
|
49
|
+
field_data += SUBFIELD_INDICATOR + s.code + s.value
|
50
|
+
end
|
51
|
+
elsif field.class == MARC::ControlField
|
52
|
+
field_data = field.value
|
53
|
+
end
|
54
|
+
field_data += END_OF_FIELD
|
55
|
+
|
56
|
+
# calculate directory entry for the field
|
57
|
+
field_length = field_data.length()
|
58
|
+
directory += sprintf("%03s%04i%05i", field.tag, field_length,
|
59
|
+
offset)
|
60
|
+
|
61
|
+
# add field to data for other fields
|
62
|
+
fields += field_data
|
63
|
+
|
64
|
+
# update offset for next field
|
65
|
+
offset += field_length
|
66
|
+
end
|
67
|
+
|
68
|
+
# determine the base (leader + directory)
|
69
|
+
base = record.leader + directory + END_OF_FIELD
|
70
|
+
|
71
|
+
# determine complete record
|
72
|
+
marc = base + fields + END_OF_RECORD
|
73
|
+
|
74
|
+
# update leader with the byte offest to the end of the directory
|
75
|
+
marc[12..16] = sprintf("%05i", base.length())
|
76
|
+
|
77
|
+
# update the record length
|
78
|
+
marc[0..4] = sprintf("%05i", marc.length())
|
79
|
+
|
80
|
+
# store updated leader in the record that was passed in
|
81
|
+
record.leader = marc[0..LEADER_LENGTH-1]
|
82
|
+
|
83
|
+
# return encoded marc
|
84
|
+
return marc
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
require 'rexml/parsers/pullparser'
|
3
|
+
|
4
|
+
module MARC
|
5
|
+
|
6
|
+
class XMLReader
|
7
|
+
include Enumerable
|
8
|
+
|
9
|
+
# the constructor which you can pass either a filename:
|
10
|
+
#
|
11
|
+
# reader = MARC::XMLReader.new('/Users/edsu/marc.xml')
|
12
|
+
#
|
13
|
+
# or a File object,
|
14
|
+
#
|
15
|
+
# reader = Marc::XMLReader.new(File.new('/Users/edsu/marc.xml'))
|
16
|
+
#
|
17
|
+
# or really any object that responds to read(n)
|
18
|
+
#
|
19
|
+
# reader = MARC::XMLReader.new(StringIO.new(xml))
|
20
|
+
|
21
|
+
def initialize(file)
|
22
|
+
if file.class == String:
|
23
|
+
handle = File.new(file)
|
24
|
+
elsif file.respond_to?("read", 5)
|
25
|
+
handle = file
|
26
|
+
else
|
27
|
+
throw "must pass in path or File"
|
28
|
+
end
|
29
|
+
|
30
|
+
@parser = REXML::Parsers::PullParser.new(handle)
|
31
|
+
end
|
32
|
+
|
33
|
+
def each
|
34
|
+
while @parser.has_next?
|
35
|
+
event = @parser.pull
|
36
|
+
# if it's the start of a record element
|
37
|
+
if event.start_element? and strip_ns(event[0]) == 'record'
|
38
|
+
yield build_record
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def strip_ns(str)
|
46
|
+
return str.sub(/^.*:/, '')
|
47
|
+
end
|
48
|
+
|
49
|
+
# will accept parse events until a record has been built up
|
50
|
+
#
|
51
|
+
def build_record
|
52
|
+
record = MARC::Record.new
|
53
|
+
data_field = nil
|
54
|
+
control_field = nil
|
55
|
+
subfield = nil
|
56
|
+
text = ''
|
57
|
+
attrs = nil
|
58
|
+
|
59
|
+
while @parser.has_next?
|
60
|
+
event = @parser.pull
|
61
|
+
|
62
|
+
if event.text?
|
63
|
+
text += REXML::Text::unnormalize(event[0])
|
64
|
+
next
|
65
|
+
end
|
66
|
+
|
67
|
+
if event.start_element?
|
68
|
+
text = ''
|
69
|
+
attrs = event[1]
|
70
|
+
case strip_ns(event[0])
|
71
|
+
when 'controlfield'
|
72
|
+
text = ''
|
73
|
+
control_field = MARC::ControlField.new(attrs['tag'])
|
74
|
+
when 'datafield'
|
75
|
+
text = ''
|
76
|
+
data_field = MARC::DataField.new(attrs['tag'], attrs['ind1'],
|
77
|
+
attrs['ind2'])
|
78
|
+
when 'subfield'
|
79
|
+
text = ''
|
80
|
+
subfield = MARC::Subfield.new(attrs['code'])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if event.end_element?
|
85
|
+
case strip_ns(event[0])
|
86
|
+
when 'leader'
|
87
|
+
record.leader = text
|
88
|
+
when 'record'
|
89
|
+
return record
|
90
|
+
when 'controlfield'
|
91
|
+
control_field.value = text
|
92
|
+
record.append(control_field)
|
93
|
+
when 'datafield'
|
94
|
+
record.append(data_field)
|
95
|
+
when 'subfield'
|
96
|
+
subfield.value = text
|
97
|
+
data_field.append(subfield)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'rexml/document'
|
2
|
+
require 'rexml/text'
|
3
|
+
require 'rexml/formatters/default'
|
4
|
+
|
5
|
+
module MARC
|
6
|
+
|
7
|
+
# A class for writing MARC records as MARCXML.
|
8
|
+
# BIG CAVEAT! XMLWriter will *not* convert your MARC8 to UTF8
|
9
|
+
# bug the authors to do this if you need it
|
10
|
+
|
11
|
+
class XMLWriter
|
12
|
+
|
13
|
+
# the constructor which you must pass a file path
|
14
|
+
# or an object that responds to a write message
|
15
|
+
# the second argument is a hash of options, currently
|
16
|
+
# only supporting one option, stylesheet
|
17
|
+
#
|
18
|
+
# writer = XMLWriter.new 'marc.xml', :stylesheet => 'style.xsl'
|
19
|
+
# writer.write record
|
20
|
+
|
21
|
+
def initialize(file, opts={})
|
22
|
+
@writer = REXML::Formatters::Default.new
|
23
|
+
if file.class == String
|
24
|
+
@fh = File.new(file,"w")
|
25
|
+
elsif file.respond_to?('write')
|
26
|
+
@fh = file
|
27
|
+
else
|
28
|
+
throw "must pass in file name or handle"
|
29
|
+
end
|
30
|
+
|
31
|
+
@fh.write("<?xml version='1.0'?>\n")
|
32
|
+
if opts[:stylesheet]
|
33
|
+
@fh.write(
|
34
|
+
%Q{<?xml-stylesheet type="text/xsl" href="#{opts[:stylesheet]}"?>\n})
|
35
|
+
end
|
36
|
+
@fh.write("<collection xmlns='" + MARC_NS + "' " +
|
37
|
+
"xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' " +
|
38
|
+
"xsi:schemaLocation='" + MARC_NS + " " + MARC_XSD + "'>")
|
39
|
+
@fh.write("\n")
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# write a record to the file or handle
|
44
|
+
|
45
|
+
def write(record)
|
46
|
+
@writer.write(MARC::XMLWriter.encode(record), @fh)
|
47
|
+
@fh.write("\n")
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
# close underlying filehandle
|
52
|
+
|
53
|
+
def close
|
54
|
+
@fh.write("</collection>")
|
55
|
+
@fh.close
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
# a static method that accepts a MARC::Record object
|
60
|
+
# and returns a REXML::Document for the XML serialization.
|
61
|
+
|
62
|
+
def self.encode(record, opts={})
|
63
|
+
singleChar = Regexp.new('[\da-z ]{1}')
|
64
|
+
ctrlFieldTag = Regexp.new('00[1-9A-Za-z]{1}')
|
65
|
+
|
66
|
+
# Right now, this writer handles input from the strict and
|
67
|
+
# lenient MARC readers. Because it can get 'loose' MARC in, it
|
68
|
+
# attempts to do some cleanup on data values that are not valid
|
69
|
+
# MARCXML.
|
70
|
+
|
71
|
+
# TODO? Perhaps the 'loose MARC' checks should be split out
|
72
|
+
# into a tolerant MARCXMLWriter allowing the main one to skip
|
73
|
+
# this extra work.
|
74
|
+
|
75
|
+
# TODO: At the very least there should be some logging
|
76
|
+
# to record our attempts to account for less than perfect MARC.
|
77
|
+
|
78
|
+
e = REXML::Element.new('record')
|
79
|
+
e.add_namespace(MARC_NS) if opts[:include_namespace]
|
80
|
+
|
81
|
+
# MARCXML only allows alphanumerics or spaces in the leader
|
82
|
+
record.leader.gsub!(/[^\w|^\s]/, 'Z')
|
83
|
+
|
84
|
+
# MARCXML is particular about last four characters; ILSes aren't
|
85
|
+
if (record.leader[20..23] != "4500")
|
86
|
+
record.leader[20..23] = "4500"
|
87
|
+
end
|
88
|
+
|
89
|
+
# MARCXML doesn't like a space here so we need a filler character: Z
|
90
|
+
if (record.leader[6..6] == " ")
|
91
|
+
record.leader[6..6] = "Z"
|
92
|
+
end
|
93
|
+
|
94
|
+
leader = REXML::Element.new("leader")
|
95
|
+
leader.add_text(record.leader)
|
96
|
+
e.add_element(leader)
|
97
|
+
|
98
|
+
for field in record.fields
|
99
|
+
if field.class == MARC::DataField
|
100
|
+
datafield_elem = REXML::Element.new("datafield")
|
101
|
+
|
102
|
+
# If marc is leniently parsed, we may have some dirty data; using
|
103
|
+
# the 'z' ind1 value should help us locate these later to fix
|
104
|
+
if (field.indicator1.match(singleChar) == nil)
|
105
|
+
field.indicator1 = 'z'
|
106
|
+
end
|
107
|
+
|
108
|
+
# If marc is leniently parsed, we may have some dirty data; using
|
109
|
+
# the 'z' ind2 value should help us locate these later to fix
|
110
|
+
if (field.indicator2.match(singleChar) == nil)
|
111
|
+
field.indicator2 = 'z'
|
112
|
+
end
|
113
|
+
|
114
|
+
datafield_elem.add_attributes({
|
115
|
+
"tag"=>field.tag,
|
116
|
+
"ind1"=>field.indicator1,
|
117
|
+
"ind2"=>field.indicator2
|
118
|
+
})
|
119
|
+
|
120
|
+
for subfield in field.subfields
|
121
|
+
subfield_element = REXML::Element.new("subfield")
|
122
|
+
|
123
|
+
# If marc is leniently parsed, we may have some dirty data; using
|
124
|
+
# the blank subfield code should help us locate these later to fix
|
125
|
+
if (subfield.code.match(singleChar) == nil)
|
126
|
+
subfield.code = ' '
|
127
|
+
end
|
128
|
+
|
129
|
+
subfield_element.add_attribute("code", subfield.code)
|
130
|
+
text = subfield.value
|
131
|
+
subfield_element.add_text(text)
|
132
|
+
datafield_elem.add_element(subfield_element)
|
133
|
+
end
|
134
|
+
|
135
|
+
e.add_element datafield_elem
|
136
|
+
elsif field.class == MARC::ControlField
|
137
|
+
control_element = REXML::Element.new("controlfield")
|
138
|
+
|
139
|
+
# We need a marker for invalid tag values (we use 000)
|
140
|
+
unless field.tag.match(ctrlFieldTag)
|
141
|
+
field.tag = "00z"
|
142
|
+
end
|
143
|
+
|
144
|
+
control_element.add_attribute("tag", field.tag)
|
145
|
+
text = field.value
|
146
|
+
control_element.add_text(text)
|
147
|
+
e.add_element(control_element)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# return xml
|
152
|
+
return e
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# part of rwdtinker smalllinux@gmail.com
|
2
|
+
# copyleft gpl 2008 Steven Gibson
|
3
|
+
|
4
|
+
require 'lib/rwdtinker/rwdtinkertools'
|
5
|
+
|
6
|
+
tmpmodload = '
|
7
|
+
def RwdtinkerTools.findfilesp(d)
|
8
|
+
|
9
|
+
a = Array.new(Dir[d].entries.sort)
|
10
|
+
#loop through and get the files names
|
11
|
+
a.each do |x|
|
12
|
+
#adjust the filters to the files you want to see...
|
13
|
+
if(!test(?d,x))
|
14
|
+
# only rwd files
|
15
|
+
if x =~ /rb|rwd|txt/
|
16
|
+
fileA=File.open("#{x}","r") #opens the file thats in fileName as read only
|
17
|
+
@@tempdoc+=fileA.read #reads the file into the doc string
|
18
|
+
fileA.close
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def RwdtinkerTools.findprogramfiles(codedir, specificdir = "")
|
26
|
+
@@tempdoc = ""
|
27
|
+
#get a list of the files and subdirectories on the starting directory only
|
28
|
+
a = Array.new(Dir[codedir].entries.sort)
|
29
|
+
#loop through the list, ignore the files and add all new directories found
|
30
|
+
a.each do |x|
|
31
|
+
#if a directory...
|
32
|
+
if(test(?d,x))
|
33
|
+
# add to the original list of directories
|
34
|
+
@@root = x + "/**"
|
35
|
+
#adds the new ones to the array
|
36
|
+
b = Dir[@@root].entries.sort
|
37
|
+
b.each do |x|
|
38
|
+
if(test(?d,x))
|
39
|
+
a.push(x) #appends to the end of the array...
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
a.each do |x|
|
45
|
+
#if it is a file...
|
46
|
+
if(!test(?d,x))
|
47
|
+
a.delete(x)
|
48
|
+
else #it is a directory...
|
49
|
+
findfilesp(x + "/**")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
return @@tempdoc
|
53
|
+
end
|
54
|
+
'
|
55
|
+
|
56
|
+
RwdtinkerTools.module_eval(tmpmodload)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# part of rwdtinker smalllinux@gmail.com
|
2
|
+
# copyleft gpl 2008 Steven Gibson
|
3
|
+
|
4
|
+
require 'lib/rwdtinker/rwdtinkertools'
|
5
|
+
|
6
|
+
tmpmodload = '
|
7
|
+
def RwdtinkerTools.loadguifile(d)
|
8
|
+
|
9
|
+
a = Array.new(Dir[d].entries.sort)
|
10
|
+
#loop through and get the files names
|
11
|
+
a.each do |x|
|
12
|
+
#adjust the filters to the files you want to see...
|
13
|
+
if(!test(?d,x))
|
14
|
+
# only rwd files
|
15
|
+
if x =~ /rb|rwd|txt/
|
16
|
+
|
17
|
+
load x #opens the file thats in fileName and reads it
|
18
|
+
@@tempdoc += $rwdguivar # adds the file into the doc string
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def RwdtinkerTools.findguifiles(guidir)
|
25
|
+
@@tempdoc = ""
|
26
|
+
#get a list of the files and subdirectories on the starting directory only
|
27
|
+
a = Array.new(Dir[guidir].entries.sort)
|
28
|
+
#loop through the list, ignore the files and add all new directories found
|
29
|
+
a.each do |x|
|
30
|
+
#if a directory...
|
31
|
+
if(test(?d,x))
|
32
|
+
#use this new dir find to add to the original list of directories
|
33
|
+
@@root = x + "/**"
|
34
|
+
#adds the new ones to the array
|
35
|
+
b = Dir[@@root].entries.sort
|
36
|
+
b.each do |x|
|
37
|
+
if(test(?d,x))
|
38
|
+
a.push(x) #appends to the end of the array...
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
a.each do |x|
|
44
|
+
#if it is a file...
|
45
|
+
if(!test(?d,x))
|
46
|
+
a.delete(x)
|
47
|
+
|
48
|
+
else #it is a directory...
|
49
|
+
loadguifile(x + "/**")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
return @@tempdoc
|
53
|
+
|
54
|
+
end
|
55
|
+
'
|
56
|
+
|
57
|
+
RwdtinkerTools.module_eval(tmpmodload)
|