rwdtorrent 0.04 → 0.05

Sign up to get free protection for your applications and to get access to all the features.
data/ev/tree.rb CHANGED
@@ -88,7 +88,7 @@ class TreeObject
88
88
  def inspect
89
89
  parent, children = @parent, @children
90
90
 
91
- @parent, @children = parent.id, children.collect{|obj| obj.id}
91
+ @parent, @children = parent.object_id, children.collect{|obj| obj.object_id}
92
92
 
93
93
  res = " " * (level-1) + "#{self.class}(#{@subtype}) #{super}"
94
94
 
@@ -96,6 +96,34 @@ class TreeObject
96
96
 
97
97
  res
98
98
  end
99
+
100
+ def previous(klass=[], skip=[])
101
+ klass = [klass].flatten
102
+ skip = [skip].flatten
103
+
104
+ po = @parent
105
+ return nil if po.nil?
106
+
107
+ ch = po.children
108
+ return nil if ch.nil?
109
+
110
+ n = ch.index(self)
111
+ return nil if n.nil?
112
+
113
+ res = nil
114
+ if klass.nil?
115
+ n -= 1
116
+ res = ch[n]
117
+ else
118
+ begin
119
+ n -= 1
120
+ res = ch[n]
121
+ end while (klass.empty? or klass.collect{|k| ch[n-1].kind_of?(k)}.sort.uniq == [true]) \
122
+ and (skip.empty? or skip.collect{|k| ch[n-1].kind_of?(k)}.sort.uniq == [false])
123
+ end
124
+
125
+ res
126
+ end
99
127
  end
100
128
 
101
129
  class Tree
@@ -138,7 +166,7 @@ class Tree
138
166
  end
139
167
 
140
168
  def self.location(url, form=Hash.new)
141
- s = HTTPClient.get(url, form)
169
+ s = HTTPClient.get(url, {}, form)
142
170
  s = "" if s.nil?
143
171
  new(s)
144
172
  end
@@ -155,7 +183,7 @@ class Tree
155
183
 
156
184
  tree = nil
157
185
 
158
- Dir.mkdirrec(dir)
186
+ File.mkpath(dir)
159
187
 
160
188
  if File.file?(file)
161
189
  @@mutex.synchronize do
@@ -227,7 +255,7 @@ class Tree
227
255
  end
228
256
 
229
257
  def markclosed
230
- ([self].concat @objects).each do |obj|
258
+ ([self] + @objects).each do |obj|
231
259
  obj.children.each_index do |i|
232
260
  co1 = obj.children[i]
233
261
  co2 = obj.children[i+1]
@@ -238,7 +266,7 @@ class Tree
238
266
  end
239
267
 
240
268
  def deletedummies
241
- ([self].concat @objects).each do |obj|
269
+ ([self] + @objects).each do |obj|
242
270
  obj.children.delete_if do |obj2|
243
271
  obj2.upordown == Dummy
244
272
  end
data/ev/xml.rb CHANGED
@@ -1,4 +1,101 @@
1
1
  require "ev/sgml"
2
2
 
3
+ class SGMLObject
4
+ def to_x(closetags=true)
5
+ res = ""
6
+
7
+ parsetree("prechildren_to_x", "postchildren_to_x", res, closetags)
8
+
9
+ res
10
+ end
11
+ end
12
+
13
+ class Text < SGMLObject
14
+ def prechildren_to_x(res, closetags)
15
+ res << @text.strip unless @text.strip.empty?
16
+ end
17
+ end
18
+
19
+ class Comment < SGMLObject
20
+ def prechildren_to_x(res, closetags)
21
+ res << "\n" if not previous([], [Text]).kind_of?(Comment)
22
+ lines = @text.gsub(/(<!--|-->)/, "").lf.split(/\n/)
23
+ if lines.length == 1
24
+ res << " "*(@level-1) + "<!-- " + lines[0].strip + " -->" + "\n"
25
+ else
26
+ res << " "*(@level-1) + "<!--" + "\n"
27
+ res << lines.collect{|s| " "*(@level-1) + s.strip}.delete_if{|s| s.compress.empty?}.join("\n")
28
+ res << "\n"
29
+ res << " "*(@level-1) + "-->" + "\n"
30
+ res << "\n"
31
+ end
32
+ end
33
+ end
34
+
35
+ class Special < SGMLObject
36
+ def prechildren_to_x(res, closetags)
37
+ res << " "*(@level-1) + @text.compress + "\n"
38
+ end
39
+ end
40
+
41
+ class Instruction < SGMLObject
42
+ def prechildren_to_x(res, closetags)
43
+ res << " "*(@level-1) + @text.compress + "\n"
44
+ end
45
+ end
46
+
47
+ class OpenTag < Tag
48
+ def prechildren_to_x(res, closetags)
49
+ a = [@subtype]
50
+
51
+ args = @args.dup
52
+ args.delete("id")
53
+ args.delete("name")
54
+ args = args.sort
55
+ args.unshift(["id", @args["id"]]) if @args.include?("id")
56
+ args.unshift(["name", @args["name"]]) if @args.include?("name")
57
+
58
+ args.each do |k, v|
59
+ if not v.include?("'")
60
+ a << "#{k}='#{v}'"
61
+ else
62
+ if not v.include?('"')
63
+ a << "#{k}=\"#{v}\""
64
+ else
65
+ a << "#{k}='#{v.gsub(/\'/, '"')}'"
66
+ end
67
+ end
68
+ end
69
+
70
+ if @children.length == 0 or (@children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.compress.empty?)
71
+ res << " "*(@level-1) + "<#{a.join(" ")}/>" + "\n"
72
+ else
73
+ if @children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.lf.split(/\n/).length == 1
74
+ res << " "*(@level-1) + "<#{a.join(" ")}>"
75
+ else
76
+ res << " "*(@level-1) + "<#{a.join(" ")}>" + "\n"
77
+ end
78
+ end
79
+ end
80
+
81
+ def postchildren_to_x(res, closetags)
82
+ if closetags
83
+ unless @children.length == 0 or (@children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.compress.empty?)
84
+ res << "\n" if @children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.lf.split(/\n/).length > 1
85
+ res << " "*(@level-1) unless @children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.lf.split(/\n/).length == 1
86
+ res << "</#{@subtype}>"
87
+ res << "\n"
88
+ end
89
+ end
90
+ end
91
+ end
92
+
3
93
  class XML < SGML
94
+ def to_x(closetags=true)
95
+ res = ""
96
+
97
+ parsetree("prechildren_to_x", "postchildren_to_x", res, closetags)
98
+
99
+ res
100
+ end
4
101
  end
@@ -131,7 +131,8 @@ end
131
131
 
132
132
  class MetaInfo
133
133
  def initialize(dict=nil)
134
- raise TypeError, "argument must be a Hash (maybe see MetaInfo.from_location)" unless dict.is_a? Hash
134
+ # raise TypeError, "argument must be a Hash (maybe see MetaInfo.from_location)" unless dict.is_a? Hash
135
+
135
136
  @s = TypedStruct.new do |s|
136
137
  s.field :info => MetaInfoInfo, :announce => URI::HTTP,
137
138
  :announce_list => Array, :creation_date => Time,
@@ -1,4 +1,4 @@
1
1
  $rwdguivar=
2
2
  "<application>
3
- <window name=\"main\" title=\"Tinker - RubyWebDialogs\">
3
+ <window name=\"main\" title=\"RwdTinker - RubyWebDialogs\">
4
4
  <tabs>"
@@ -1,6 +1,6 @@
1
1
  $rwdguivar=
2
2
  "
3
- <tab name=\"selectiontab\" caption=#{Message[:selection_panel]}>
3
+ <tab name=\"selectiontab\" caption=\"Menu Panel\">
4
4
 
5
5
  <table>
6
6
  <row> <p align=\"right\">Open a new location </row>
@@ -16,21 +16,7 @@ $rwdguivar=
16
16
 
17
17
  </horizontal>
18
18
  <table>
19
- <row> <p align=\"right\" >FileName:</p> <text size=70 name=\"a_configurationfilename\"/> </row>
20
- <row> <p align=\"right\">1:</p> <text size=70 name=\"a_configline1\"/> </row>
21
- <row> <p align=\"right\">2:</p> <text size=70 name=\"a_configline2\"/> </row>
22
- <row> <p align=\"right\">3:</p> <text size=70 name=\"a_configline3\"/> </row>
23
- <row> <p align=\"right\">4:</p> <text size=70 name=\"a_configline4\"/> </row>
24
- <row> <p align=\"right\">5:</p> <text size=70 name=\"a_configline5\"/> </row>
25
- <row> <p align=\"right\">6:</p> <text size=70 name=\"a_configline6\"/> </row>
26
- <row> <p align=\"right\">7:</p> <text size=70 name=\"a_configline7\"/> </row>
27
- <row> <p align=\"right\">8:</p> <text size=70 name=\"a_configline8\"/> </row>
28
- <row> <p align=\"right\">9:</p> <text size=70 name=\"a_configline9\"/> </row>
29
- <row> <p align=\"right\">10:</p> <text size=70 name=\"a_configline10\"/> </row>
30
- <row> <p align=\"right\">11:</p> <text size=70 name=\"a_configline11\"/> </row>
31
- <row> <p align=\"right\">12:</p> <text size=70 name=\"a_configline12\"/> </row>
32
- <row> <p align=\"right\">13:</p> <text size=70 name=\"a_configline13\"/> </row>
33
- <row> <p align=\"right\">14:</p> <text size=70 name=\"a_configline14\"/> </row>
19
+ <textarea name=\"a_configurationfile\"/>
34
20
 
35
21
 
36
22
  </table>
@@ -227,6 +227,10 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
227
227
  Thanks, Steven Gibson
228
228
 
229
229
  == Changelog
230
+ Version 1.66
231
+ Fixed directory layout
232
+ increased size of config edit screen
233
+
230
234
  Version 1.65
231
235
  Changed documents listing screen - now using hash
232
236
  Changed helpabout screen - now using hash
@@ -132,6 +132,11 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
132
132
  Thanks, Steven Gibson
133
133
 
134
134
  == Changelog
135
+ Version 0.05
136
+ updated to rwdtinker 1.66
137
+ changed SAFE level to 0 - don't put online
138
+ updated to Webdialog 0.2.0 4-2005 version
139
+
135
140
  Version 0.04
136
141
  now only using rubytorrent to read metafile data
137
142
  changed config file screen
data/rwdconfig.dist CHANGED
@@ -1,4 +1,4 @@
1
- ##VERSION:1.65
1
+ ##VERSION:1.66
2
2
  # rwdtinker core configuration file
3
3
  ##NAME: ConfigLocation:0
4
4
  ConfigLocation=""
data/tests/makedist.rb CHANGED
@@ -57,4 +57,5 @@ ListingCommand = "ls -1 -s -h #{DistroTitle}*"
57
57
 
58
58
  puts `#{ListingCommand}`
59
59
 
60
- print "Build finished\n"
60
+ print "Build finished\n"
61
+ print "for debian remeber to change config file: RwdTorrentRoot and $torrentfile location"