PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/raggle/ruby-1.9.patch

https://bitbucket.org/kaendfinger/aur-mirror
Patch | 458 lines | 448 code | 10 blank | 0 comment | 0 complexity | 5423eadaa7699d48314cb753ff9f9aea MD5 | raw file
Possible License(s): LGPL-2.0, Unlicense, AGPL-1.0, BitTorrent-1.0, EPL-1.0, GPL-3.0, BSD-3-Clause, GPL-2.0, MIT, CC-BY-SA-3.0, BSD-2-Clause, MPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, JSON, AGPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0, LGPL-2.1, ISC, CC-BY-3.0, WTFPL, 0BSD, CC0-1.0, LGPL-3.0, Cube, Apache-2.0
  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.'
  178. end
  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."
  185. end
  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
  193. end
  194. end
  195. @@ -2153,30 +2156,30 @@
  196. #
  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
  232. @@ -2193,21 +2196,21 @@
  233. Engine::save_feed_list
  234. exit(0)
  235. - when 'purge'
  236. + when 'purge' then
  237. Engine::purge_feed_cache
  238. exit(0)
  239. - when 'import_opml'
  240. + when 'import_opml' then
  241. OPML::import opts['opml_file'], opts['refresh'], opts['lock_title?'], opts['save_items?'],
  242. opts['force']
  243. Engine::save_feed_list
  244. exit(0)
  245. - when 'export_opml'
  246. + when 'export_opml' then
  247. OPML::export opts['opml_file']
  248. exit(0)
  249. - when 'find_feeds'
  250. + when 'find_feeds' then
  251. CLI::find_feeds(opts['find_str'])
  252. exit(0)
  253. - when 'default_config'
  254. + when 'default_config' then
  255. CLI::default_config
  256. exit(0)
  257. end
  258. @@ -2333,10 +2336,10 @@
  259. #
  260. def Key::close_window
  261. case $a_win
  262. - when NcursesInterface::get_win_id('find'): $wins[$a_win].close(true)
  263. - when NcursesInterface::get_win_id('cat'): $wins[$a_win].close(true)
  264. - when NcursesInterface::get_win_id('keys'): $wins[$a_win].close(true)
  265. - when NcursesInterface::get_win_id('edit'): $wins[$a_win].close(true)
  266. + when NcursesInterface::get_win_id('find') then $wins[$a_win].close(true)
  267. + when NcursesInterface::get_win_id('cat') then $wins[$a_win].close(true)
  268. + when NcursesInterface::get_win_id('keys') then $wins[$a_win].close(true)
  269. + when NcursesInterface::get_win_id('edit') then $wins[$a_win].close(true)
  270. end
  271. end
  272. @@ -3404,16 +3407,19 @@
  273. end
  274. case feedopt # create options hash to pass to engine
  275. - when 'save_items?'
  276. - if str =~ /true/i: newopts = {feedopt => true}
  277. + when 'save_items?' then
  278. + if str =~ /true/i
  279. + newopts = {feedopt => true}
  280. else newopts = {feedopt => false}; end
  281. - when 'priority', 'refresh'
  282. + when 'priority', 'refresh' then
  283. newopts = {feedopt => str.to_i}
  284. - when 'max_items'
  285. - if str =~ /none|nil/i: newopts = {feedopt => nil}
  286. + when 'max_items' then
  287. + if str =~ /none|nil/i
  288. + newopts = {feedopt => nil}
  289. else newopts = {feedopt => str.to_i}; end
  290. - when 'category'
  291. - if str =~ /\bnone\b|\bnil\b/i: newopts = {feedopt => nil}
  292. + when 'category' then
  293. + if str =~ /\bnone\b|\bnil\b/i
  294. + newopts = {feedopt => nil}
  295. else newopts = {feedopt => str}; end
  296. else newopts = {feedopt => str}
  297. end
  298. @@ -3575,7 +3581,7 @@
  299. item_content = item_content.gsub(/href\s*=\s*["']([^'"]+?)['"]/m) {
  300. m = $1.dup
  301. new_url = case m
  302. - when (/^(\w+):\/\//): m
  303. + when (/^(\w+):\/\//) then m
  304. else
  305. # attempt to merge URI with host_uri. if that fails,
  306. # log a warning, then fall back to the unmodified string
  307. @@ -3599,7 +3605,7 @@
  308. # fix host-relative item URL
  309. item_url = feed['items'][id]['url'].dup
  310. item_url = case item_url
  311. - when (/(\w+):\/\//): item_url
  312. + when (/(\w+):\/\//) then item_url
  313. else [host_uri, item_url].join('/')
  314. end
  315. end
  316. @@ -3665,8 +3671,8 @@
  317. # get browser command
  318. cmd = $config['browser_cmd'].map { |cmd_part|
  319. case cmd_part
  320. - when /%s/: cmd_part % url.escape
  321. - when '${browser}': $config['browser']
  322. + when /%s/ then cmd_part % url.escape
  323. + when '${browser}' then $config['browser']
  324. else cmd_part
  325. end
  326. }
  327. @@ -3833,7 +3839,8 @@
  328. # if it's not nil, then add it to our list
  329. added = false
  330. if url && url.length > 0
  331. - if title: added = Engine::add_feed({ 'url' => url, 'title' => title })
  332. + if title
  333. + added = Engine::add_feed({ 'url' => url, 'title' => title })
  334. else added = Engine::add_feed({ 'url' => url }); end
  335. NcursesInterface::populate_feed_win
  336. else
  337. @@ -3996,7 +4003,7 @@
  338. end
  339. case bmb[:type]
  340. - when :csv_file
  341. + when :csv_file then
  342. # expand bookmark file path
  343. path = Engine::expand_str(bmb[:path])
  344. @@ -4020,11 +4027,11 @@
  345. status = $config['msg_bm_file_err'] % [path, err.to_s]
  346. NcursesInterface::set_status(status)
  347. end
  348. - when :exec
  349. + when :exec then
  350. fork {
  351. system(bmb[:path], title, url, tags, ext)
  352. }
  353. - when :db
  354. + when :db then
  355. # build query
  356. cols, args = [], []
  357. { :title => title,
  358. @@ -4043,7 +4050,7 @@
  359. # database-specific connection stuff
  360. case bmb[:dbtype]
  361. - when :mysql
  362. + when :mysql then
  363. unless $HAVE_LIB['mysql']
  364. raise $config['msg_bm_db_missing'] % 'Mysql'
  365. end
  366. @@ -4052,7 +4059,7 @@
  367. db = Mysql::connect(bmb[:host], bmb[:user], bmb[:pass])
  368. db.select_db(bmb[:dbname])
  369. quote_meth = Mysql::method(:escape_string)
  370. - when :sqlite
  371. + when :sqlite then
  372. unless $HAVE_LIB['sqlite']
  373. raise $config['msg_bm_db_missing'] % 'SQLite'
  374. end
  375. @@ -4112,13 +4119,13 @@
  376. old_key = key
  377. key = key.gsub(/^KEY_/, '')
  378. case key
  379. - when 'DC': key = 'Delete'
  380. - when ' ': key = 'Space'
  381. - when 'NPAGE': key = 'Page Down'
  382. - when 'PPAGE': key = 'Page Up'
  383. - when ' ': key = 'Control-L'
  384. - when ' ': key = 'Tab'
  385. - when /^\d$/: key = '1-9'
  386. + when 'DC' then key = 'Delete'
  387. + when ' ' then key = 'Space'
  388. + when 'NPAGE' then key = 'Page Down'
  389. + when 'PPAGE' then key = 'Page Up'
  390. + when ' ' then key = 'Control-L'
  391. + when ' ' then key = 'Tab'
  392. + when /^\d$/ then key = '1-9'
  393. end
  394. unless key == old_key # remove cruft if key info updated
  395. keys[key] = keys[old_key]
  396. @@ -4251,9 +4258,9 @@
  397. $wins = []
  398. $config['theme']['window_order'].each { |i|
  399. case i
  400. - when /feed/: cl = NcursesInterface::ListWindow
  401. - when /item/: cl = NcursesInterface::ListWindow
  402. - when /desc/: cl = NcursesInterface::TextWindow
  403. + when /feed/ then cl = NcursesInterface::ListWindow
  404. + when /item/ then cl = NcursesInterface::ListWindow
  405. + when /desc/ then cl = NcursesInterface::TextWindow
  406. else
  407. raise "Unknown window #{i}"
  408. end
  409. @@ -4285,7 +4292,7 @@
  410. if r && r.size > 0
  411. c = Ncurses::getch
  412. case c
  413. - when Ncurses::KEY_MOUSE
  414. + when Ncurses::KEY_MOUSE then
  415. mev = Ncurses::MEVENT.new
  416. Ncurses.getmouse(mev)
  417. @@ -4388,27 +4395,27 @@
  418. cat = $1 if req.query_string =~ /category=([^&]+)/
  419. case mode
  420. - when 'sort'
  421. + when 'sort' then
  422. Engine::sort_feeds
  423. - when 'invalidate_all'
  424. + when 'invalidate_all' then
  425. Engine::invalidate_feed(-1)
  426. $feed_thread.run
  427. - when 'add'
  428. + when 'add' then
  429. url = $1 if req.query_string =~ /url=(.*)$/
  430. added = Engine::add_feed({ 'url' => url })
  431. $feed_thread.run if added and $config['update_after_add']
  432. - when 'delete'
  433. + when 'delete' then
  434. if req.query_string =~ /id=(\d+)/
  435. id = $1.to_i
  436. Engine::delete_feed(id)
  437. end
  438. - when 'invalidate'
  439. + when 'invalidate' then
  440. if req.query_string =~ /id=(\d+)/
  441. id = $1.to_i
  442. Engine::invalidate_feed(id)
  443. $feed_thread.run
  444. end
  445. - when 'save_feed_list'
  446. + when 'save_feed_list' then
  447. Engine::save_feed_list
  448. end