updated on Thu Jan 26 00:18:00 UTC 2012
[aur-mirror.git] / raggle / ruby-1.9.patch
blob7c4b053607fc276d167249164f28d706c954717e
1 --- raggle.backup 2010-10-25 08:08:07.626468032 -0400
2 +++ raggle 2010-10-25 08:18:56.812190806 -0400
3 @@ -457,16 +457,16 @@
4 HTML_ENTITY_LUT[m]
5 else
6 case m
7 - when 'amp': '&'
8 - when 'nbsp' ' '
9 - when /^quot$/ni: '"'
10 - when /^lt$/ni: '<'
11 - when /^gt$/ni: '>'
12 - when /^copy/: '(c)'
13 - when /^trade/: '(tm)'
14 - when /^#8212$/n: ","
15 - when /^#8217$/n: "'"
16 - when /^#8218$/n: ","
17 + when 'amp' then '&'
18 + when 'nbsp' then ' '
19 + when /^quot$/ni then '"'
20 + when /^lt$/ni then '<'
21 + when /^gt$/ni then '>'
22 + when /^copy/ then '(c)'
23 + when /^trade/ then '(tm)'
24 + when /^#8212$/n then ","
25 + when /^#8217$/n then "'"
26 + when /^#8218$/n then ","
27 when /^#(\d+)$/n
28 r = $1.to_i # Integer() interprets leading zeros as octal
29 if !r.between?(0, 255) && munge_uni
30 @@ -474,7 +474,7 @@
31 else
32 r.chr
33 end
34 - when /^#x([0-9a-f]+)$/ni
35 + when /^#x([0-9a-f]+)$/ni then
36 r = $1.hex
37 if !r.between?(0, 255) && munge_uni
38 UNICODE_LUT[r] ? UNICODE_LUT[r] : munge_str
39 @@ -915,7 +915,7 @@
40 Parser::each_token(@source) do |token, data, attributes|
41 #puts "C: #{@context[-1]} T: #{token} D: <#{data}> L: #{@lines.inspect}"
42 case token
43 - when :TEXT
44 + when :TEXT then
45 if @context[-1] == :in_pre
46 tmp = data.split("\n", -1)
47 if @lines[-1]
48 @@ -925,13 +925,13 @@
49 else
50 reflow_text(data)
51 end
52 - when :START_TAG
53 + when :START_TAG then
54 @current_attributes = attributes
55 tag = TAG_SET[data]
56 next unless tag
57 context_enter(@context, tag)
58 call_actions(tag, :start)
59 - when :END_TAG
60 + when :END_TAG then
61 tag = TAG_SET[data]
62 next unless tag
63 context_exit(@context, tag)
64 @@ -1146,7 +1146,8 @@
65 max_items = outline.attributes['max_items'] || nil
66 priority = outline.attributes['priority'].to_i || $config['default_feed_priority']
67 # the following properties take effect unless overridden on CLI
68 - if outline.attributes['refresh']: opml_refresh = outline.attributes['refresh'].to_i
69 + if outline.attributes['refresh']
70 + opml_refresh = outline.attributes['refresh'].to_i
71 else opml_refresh = nil; end # fixes clobberation
72 frefresh = refresh || opml_refresh || $config['default_feed_refresh']
73 fsave_items = save_items || outline.attributes['save_items'] || false
74 @@ -1185,7 +1186,8 @@
75 raise if $wins
76 die "Parsing #{file_name} failed: #{parse_err.message}" unless $wins
77 rescue => err
78 - if $wins: Interfaces::NcursesInterface::set_status($config['msg_bad_uri'])
79 + if $wins
80 + Interfaces::NcursesInterface::set_status($config['msg_bad_uri'])
81 else die err.message; end
82 end
83 end
84 @@ -1222,7 +1224,8 @@
85 raise "Couldn't open output file \"#{file_name}\"."
86 end
87 rescue => err
88 - if $wins: Interfaces::NcursesInterface::set_status($config['msg_bad_uri'])
89 + if $wins
90 + Interfaces::NcursesInterface::set_status($config['msg_bad_uri'])
91 else die err.message; end
92 end
93 end
94 @@ -2010,53 +2013,53 @@
95 begin
96 gopts.each do |opt, arg|
97 case opt
98 - when '--add'
99 + when '--add' then
100 ret['mode'] = 'add'
101 ret['url'] = arg if arg && arg.size > 0
102 - when '--edit'
103 + when '--edit' then
104 ret['mode'] = 'edit'
105 ret['id'] = arg.to_i
106 - when'--delete'
107 + when'--delete' then
108 ret['mode'] = 'delete'
109 ret['id'] = arg.to_i
110 - when '--invalidate'
111 + when '--invalidate' then
112 ret['mode'] = 'invalidate'
113 ret['id'] = arg.to_i
114 - when '--update'
115 + when '--update' then
116 ret['mode'] = 'update'
117 ret['id'] = (arg && (arg != 'all')) ? arg.to_i : 'all'
118 - when '--config': $config['config_path'] = arg
119 - when '--force': ret['force'] = true
120 - when '--list': ret['mode'] = 'list'
121 - when '--title': ret['title'] = arg
122 - when '--url': ret['url'] = arg
123 - when '--refresh': ret['refresh'] = arg.to_i
124 - when '--version'
125 + when '--config' then $config['config_path'] = arg
126 + when '--force' then ret['force'] = true
127 + when '--list' then ret['mode'] = 'list'
128 + when '--title' then ret['title'] = arg
129 + when '--url' then ret['url'] = arg
130 + when '--refresh' then ret['refresh'] = arg.to_i
131 + when '--version' then
132 puts "Raggle v#$VERSION"
133 exit(0)
134 - when '--priority': ret['priority'] = arg.to_i
135 - when '--purge': ret['mode'] = 'purge'
136 - when '--sort'
137 + when '--priority' then ret['priority'] = arg.to_i
138 + when '--purge' then ret['mode'] = 'purge'
139 + when '--sort' then
140 ret['mode'] = 'sort'
141 - when '--lock-title': ret['lock_title?'] = true
142 - when '--unlock-title': ret['lock_title?'] = false
143 - when '--save-items': ret['save_items?'] = true
144 - when '--max'
145 + when '--lock-title' then ret['lock_title?'] = true
146 + when '--unlock-title' then ret['lock_title?'] = false
147 + when '--save-items' then ret['save_items?'] = true
148 + when '--max' then
149 ret['max_items'] = arg.to_i
150 ret['save_items?'] = true if ret['max_items'] > 0
151 - when '--unsave-items': ret['save_items?'] = false
152 - when '--verbose': $config['verbose'] = true
153 - when '--import-opml'
154 + when '--unsave-items' then ret['save_items?'] = false
155 + when '--verbose' then $config['verbose'] = true
156 + when '--import-opml' then
157 ret['mode'] = 'import_opml'
158 ret['opml_file'] = arg
159 - when '--export-opml'
160 + when '--export-opml' then
161 ret['mode'] = 'export_opml'
162 ret['opml_file'] = arg
163 - when '--diag': $config['diag'] = true
164 - when '--default-config'
165 + when '--diag' then $config['diag'] = true
166 + when '--default-config' then
167 ret['mode'] = 'default_config'
168 - when '--ascii': ret['ascii'] = true
169 - when '--server'
170 + when '--ascii' then ret['ascii'] = true
171 + when '--server' then
172 if $HAVE_LIB['webrick']
173 $config['run_http_server'] = true
174 $config['http_server']['port'] = arg.to_i \
175 @@ -2064,16 +2067,16 @@
176 else
177 die 'Missing WEBrick, can\'t run HTTP Server.'
179 - when '--drb-server'
180 + when '--drb-server' then
181 if $HAVE_LIB['drb']
182 $config['run_drb_server'] = true
183 else
184 die "Missing DRb, can't run DRb Server."
186 - when '--find'
187 + when '--find' then
188 ret['mode'] = 'find_feeds'
189 ret['find_str'] = arg
190 - when '--help'
191 + when '--help' then
192 CLI::print_usage
195 @@ -2153,30 +2156,30 @@
197 def CLI::handle_mode(opts)
198 case opts['mode']
199 - when 'list'
200 + when 'list' then
201 CLI::list_feeds
202 exit(0)
203 - when 'add'
204 + when 'add' then
205 added = Engine::add_feed opts
206 Engine::save_feed_list if added
207 exit(0)
208 - when 'delete'
209 + when 'delete' then
210 Engine::delete_feed opts['id']
211 Engine::save_feed_list
212 exit(0)
213 - when 'invalidate'
214 + when 'invalidate' then
215 Engine::invalidate_feed opts['id']
216 Engine::save_feed_list
217 exit(0)
218 - when 'edit'
219 + when 'edit' then
220 Engine::edit_feed opts['id'], opts
221 Engine::save_feed_list
222 exit(0)
223 - when 'sort'
224 + when 'sort' then
225 Engine::sort_feeds
226 Engine::save_feed_list
227 exit(0)
228 - when 'update'
229 + when 'update' then
230 # start grab log
231 Engine.start_grab_log
233 @@ -2193,21 +2196,21 @@
234 Engine::save_feed_list
236 exit(0)
237 - when 'purge'
238 + when 'purge' then
239 Engine::purge_feed_cache
240 exit(0)
241 - when 'import_opml'
242 + when 'import_opml' then
243 OPML::import opts['opml_file'], opts['refresh'], opts['lock_title?'], opts['save_items?'],
244 opts['force']
245 Engine::save_feed_list
246 exit(0)
247 - when 'export_opml'
248 + when 'export_opml' then
249 OPML::export opts['opml_file']
250 exit(0)
251 - when 'find_feeds'
252 + when 'find_feeds' then
253 CLI::find_feeds(opts['find_str'])
254 exit(0)
255 - when 'default_config'
256 + when 'default_config' then
257 CLI::default_config
258 exit(0)
260 @@ -2333,10 +2336,10 @@
262 def Key::close_window
263 case $a_win
264 - when NcursesInterface::get_win_id('find'): $wins[$a_win].close(true)
265 - when NcursesInterface::get_win_id('cat'): $wins[$a_win].close(true)
266 - when NcursesInterface::get_win_id('keys'): $wins[$a_win].close(true)
267 - when NcursesInterface::get_win_id('edit'): $wins[$a_win].close(true)
268 + when NcursesInterface::get_win_id('find') then $wins[$a_win].close(true)
269 + when NcursesInterface::get_win_id('cat') then $wins[$a_win].close(true)
270 + when NcursesInterface::get_win_id('keys') then $wins[$a_win].close(true)
271 + when NcursesInterface::get_win_id('edit') then $wins[$a_win].close(true)
275 @@ -3404,16 +3407,19 @@
278 case feedopt # create options hash to pass to engine
279 - when 'save_items?'
280 - if str =~ /true/i: newopts = {feedopt => true}
281 + when 'save_items?' then
282 + if str =~ /true/i
283 + newopts = {feedopt => true}
284 else newopts = {feedopt => false}; end
285 - when 'priority', 'refresh'
286 + when 'priority', 'refresh' then
287 newopts = {feedopt => str.to_i}
288 - when 'max_items'
289 - if str =~ /none|nil/i: newopts = {feedopt => nil}
290 + when 'max_items' then
291 + if str =~ /none|nil/i
292 + newopts = {feedopt => nil}
293 else newopts = {feedopt => str.to_i}; end
294 - when 'category'
295 - if str =~ /\bnone\b|\bnil\b/i: newopts = {feedopt => nil}
296 + when 'category' then
297 + if str =~ /\bnone\b|\bnil\b/i
298 + newopts = {feedopt => nil}
299 else newopts = {feedopt => str}; end
300 else newopts = {feedopt => str}
302 @@ -3575,7 +3581,7 @@
303 item_content = item_content.gsub(/href\s*=\s*["']([^'"]+?)['"]/m) {
304 m = $1.dup
305 new_url = case m
306 - when (/^(\w+):\/\//): m
307 + when (/^(\w+):\/\//) then m
308 else
309 # attempt to merge URI with host_uri. if that fails,
310 # log a warning, then fall back to the unmodified string
311 @@ -3599,7 +3605,7 @@
312 # fix host-relative item URL
313 item_url = feed['items'][id]['url'].dup
314 item_url = case item_url
315 - when (/(\w+):\/\//): item_url
316 + when (/(\w+):\/\//) then item_url
317 else [host_uri, item_url].join('/')
320 @@ -3665,8 +3671,8 @@
321 # get browser command
322 cmd = $config['browser_cmd'].map { |cmd_part|
323 case cmd_part
324 - when /%s/: cmd_part % url.escape
325 - when '${browser}': $config['browser']
326 + when /%s/ then cmd_part % url.escape
327 + when '${browser}' then $config['browser']
328 else cmd_part
331 @@ -3833,7 +3839,8 @@
332 # if it's not nil, then add it to our list
333 added = false
334 if url && url.length > 0
335 - if title: added = Engine::add_feed({ 'url' => url, 'title' => title })
336 + if title
337 + added = Engine::add_feed({ 'url' => url, 'title' => title })
338 else added = Engine::add_feed({ 'url' => url }); end
339 NcursesInterface::populate_feed_win
340 else
341 @@ -3996,7 +4003,7 @@
344 case bmb[:type]
345 - when :csv_file
346 + when :csv_file then
347 # expand bookmark file path
348 path = Engine::expand_str(bmb[:path])
350 @@ -4020,11 +4027,11 @@
351 status = $config['msg_bm_file_err'] % [path, err.to_s]
352 NcursesInterface::set_status(status)
354 - when :exec
355 + when :exec then
356 fork {
357 system(bmb[:path], title, url, tags, ext)
359 - when :db
360 + when :db then
361 # build query
362 cols, args = [], []
363 { :title => title,
364 @@ -4043,7 +4050,7 @@
366 # database-specific connection stuff
367 case bmb[:dbtype]
368 - when :mysql
369 + when :mysql then
370 unless $HAVE_LIB['mysql']
371 raise $config['msg_bm_db_missing'] % 'Mysql'
373 @@ -4052,7 +4059,7 @@
374 db = Mysql::connect(bmb[:host], bmb[:user], bmb[:pass])
375 db.select_db(bmb[:dbname])
376 quote_meth = Mysql::method(:escape_string)
377 - when :sqlite
378 + when :sqlite then
379 unless $HAVE_LIB['sqlite']
380 raise $config['msg_bm_db_missing'] % 'SQLite'
382 @@ -4112,13 +4119,13 @@
383 old_key = key
384 key = key.gsub(/^KEY_/, '')
385 case key
386 - when 'DC': key = 'Delete'
387 - when ' ': key = 'Space'
388 - when 'NPAGE': key = 'Page Down'
389 - when 'PPAGE': key = 'Page Up'
390 - when '\f': key = 'Control-L'
391 - when ' ': key = 'Tab'
392 - when /^\d$/: key = '1-9'
393 + when 'DC' then key = 'Delete'
394 + when ' ' then key = 'Space'
395 + when 'NPAGE' then key = 'Page Down'
396 + when 'PPAGE' then key = 'Page Up'
397 + when '\f' then key = 'Control-L'
398 + when ' ' then key = 'Tab'
399 + when /^\d$/ then key = '1-9'
401 unless key == old_key # remove cruft if key info updated
402 keys[key] = keys[old_key]
403 @@ -4251,9 +4258,9 @@
404 $wins = []
405 $config['theme']['window_order'].each { |i|
406 case i
407 - when /feed/: cl = NcursesInterface::ListWindow
408 - when /item/: cl = NcursesInterface::ListWindow
409 - when /desc/: cl = NcursesInterface::TextWindow
410 + when /feed/ then cl = NcursesInterface::ListWindow
411 + when /item/ then cl = NcursesInterface::ListWindow
412 + when /desc/ then cl = NcursesInterface::TextWindow
413 else
414 raise "Unknown window #{i}"
416 @@ -4285,7 +4292,7 @@
417 if r && r.size > 0
418 c = Ncurses::getch
419 case c
420 - when Ncurses::KEY_MOUSE
421 + when Ncurses::KEY_MOUSE then
422 mev = Ncurses::MEVENT.new
423 Ncurses.getmouse(mev)
425 @@ -4388,27 +4395,27 @@
426 cat = $1 if req.query_string =~ /category=([^&]+)/
428 case mode
429 - when 'sort'
430 + when 'sort' then
431 Engine::sort_feeds
432 - when 'invalidate_all'
433 + when 'invalidate_all' then
434 Engine::invalidate_feed(-1)
435 $feed_thread.run
436 - when 'add'
437 + when 'add' then
438 url = $1 if req.query_string =~ /url=(.*)$/
439 added = Engine::add_feed({ 'url' => url })
440 $feed_thread.run if added and $config['update_after_add']
441 - when 'delete'
442 + when 'delete' then
443 if req.query_string =~ /id=(\d+)/
444 id = $1.to_i
445 Engine::delete_feed(id)
447 - when 'invalidate'
448 + when 'invalidate' then
449 if req.query_string =~ /id=(\d+)/
450 id = $1.to_i
451 Engine::invalidate_feed(id)
452 $feed_thread.run
454 - when 'save_feed_list'
455 + when 'save_feed_list' then
456 Engine::save_feed_list