bwkfanboy 1.4.1 → 2.0.0

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.
Files changed (81) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +7 -0
  3. data/Gemfile.lock +51 -0
  4. data/Procfile +1 -0
  5. data/README.rdoc +40 -77
  6. data/Rakefile +13 -48
  7. data/bin/bwkfanboy +47 -166
  8. data/bin/bwkfanboy_generate +7 -19
  9. data/bin/bwkfanboy_parse +21 -17
  10. data/bwkfanboy.gemspec +40 -0
  11. data/config.ru +3 -0
  12. data/doc/NEWS.rdoc +21 -79
  13. data/doc/plugin.rdoc +63 -79
  14. data/etc/bwkfanboy.yaml +2 -0
  15. data/etc/sinatra.rb +34 -0
  16. data/lib/bwkfanboy/cliconfig.rb +141 -0
  17. data/lib/bwkfanboy/cliutils.rb +114 -0
  18. data/lib/bwkfanboy/fetch.rb +22 -24
  19. data/lib/bwkfanboy/generator.rb +78 -0
  20. data/lib/bwkfanboy/home.rb +53 -0
  21. data/lib/bwkfanboy/meta.rb +5 -2
  22. data/lib/bwkfanboy/plugin.rb +247 -0
  23. data/lib/bwkfanboy/plugin_skeleton.erb +19 -23
  24. data/lib/bwkfanboy/server.rb +73 -0
  25. data/lib/bwkfanboy/utils.rb +39 -129
  26. data/plugins/bwk.rb +25 -0
  27. data/plugins/econlib.rb +22 -0
  28. data/plugins/freebsd-ports-update.rb +73 -0
  29. data/plugins/inc.rb +29 -0
  30. data/plugins/test.rb +29 -0
  31. data/public/.gitattributes +1 -0
  32. data/public/favicon.ico +0 -0
  33. data/public/jquery-1.7.2.min.js +0 -0
  34. data/public/list.js +111 -0
  35. data/public/loading.gif +0 -0
  36. data/public/style.css +54 -0
  37. data/shotgun.rb +20 -0
  38. data/test/example/.gitattributes +1 -0
  39. data/test/example/.gitignore +1 -0
  40. data/test/example/02/plugins/bwk.html +0 -0
  41. data/test/{plugins → example/02/plugins}/empty.rb +0 -0
  42. data/test/example/02/plugins/garbage.rb +1 -0
  43. data/test/example/02/plugins/inc.html +0 -0
  44. data/test/helper.rb +30 -27
  45. data/test/helper_cliutils.rb +34 -0
  46. data/test/test_cli.rb +86 -0
  47. data/test/test_fetch.rb +49 -18
  48. data/test/test_generate.rb +43 -16
  49. data/test/test_home.rb +33 -0
  50. data/test/test_plugin.rb +141 -0
  51. data/test/test_server.rb +21 -32
  52. data/views/list.haml +38 -0
  53. metadata +223 -110
  54. data/bin/bwkfanboy_fetch +0 -13
  55. data/bin/bwkfanboy_server +0 -126
  56. data/doc/README.erb +0 -114
  57. data/doc/README.rdoc +0 -141
  58. data/doc/TODO +0 -7
  59. data/doc/bwkfanboy_fetch.rdoc +0 -4
  60. data/doc/bwkfanboy_generate.rdoc +0 -7
  61. data/doc/bwkfanboy_parse.rdoc +0 -7
  62. data/doc/bwkfanboy_server.rdoc +0 -35
  63. data/doc/rakefile.rb +0 -59
  64. data/lib/bwkfanboy/generate.rb +0 -63
  65. data/lib/bwkfanboy/parser.rb +0 -156
  66. data/lib/bwkfanboy/plugins/bwk.rb +0 -33
  67. data/lib/bwkfanboy/plugins/econlib.rb +0 -34
  68. data/lib/bwkfanboy/plugins/freebsd-ports-update.rb +0 -76
  69. data/lib/bwkfanboy/plugins/inc.rb +0 -37
  70. data/lib/bwkfanboy/schema.js +0 -39
  71. data/test/popen4.sh +0 -4
  72. data/test/rake_git.rb +0 -36
  73. data/test/semis/Rakefile +0 -35
  74. data/test/semis/bwk.html +0 -393
  75. data/test/semis/bwk.json +0 -82
  76. data/test/semis/econlib.html +0 -21
  77. data/test/semis/inc.html +0 -1067
  78. data/test/semis/links.txt +0 -4
  79. data/test/test_parse.rb +0 -27
  80. data/test/xml-clean.sh +0 -8
  81. data/web/bwkfanboy.cgi +0 -36
@@ -1,4 +0,0 @@
1
- # output_file URL
2
- inc.html http://www.inc.com/author/jason-fried
3
- bwk.html http://www.dailyprincetonian.com/advanced_search/?author=Brian+Kernighan
4
- econlib.html http://www.econlib.org/cgi-bin/searcharticles.pl?sortby=DD&query=ha*
@@ -1,27 +0,0 @@
1
- require_relative 'helper'
2
-
3
- class TestParse < MiniTest::Unit::TestCase
4
- CMD = cmd('bwkfanboy_parse')
5
- LIBDIR = '../lib/bwkfanboy'
6
-
7
- def test_no_plugin
8
- r = Utils.cmd_run("#{CMD} ''")
9
- assert_equal(1, r[0])
10
- assert_match(/cannot load plugin/, r[1])
11
- end
12
-
13
- def test_empty_plugin
14
- cmd CMD
15
- r = Utils.cmd_run("#{CMD} #{Dir.pwd}/plugins/empty.rb")
16
- assert_equal(1, r[0])
17
- assert_match(/plugin .+ has errors: class Page isn't defined/, r[1])
18
- end
19
-
20
- def test_plugin_parse
21
- cmd CMD
22
- r = Utils.cmd_run("#{CMD} #{Dir.pwd}/#{LIBDIR}/plugins/bwk.rb < semis/bwk.html")
23
- assert_equal(0, r[0])
24
- # bin/bwkfanboy_parse `pwd`/lib/bwkfanboy/plugins/bwk.rb < test/semis/bwk.html | md5
25
- assert_equal('a433a4a27bafb060a41aa85a40808056', Digest::MD5.hexdigest(r[2]))
26
- end
27
- end
@@ -1,8 +0,0 @@
1
- #!/bin/sh
2
-
3
- tidy=/usr/local/bin/tidy
4
- iconv=/usr/local/bin/iconv
5
-
6
- $tidy -q -raw -asxml -f /dev/null --force-output 1 \
7
- --quote-nbsp 0 -bare -clean \
8
- | $iconv -c -f KOI8-RU -t UTF-8
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # -*-ruby-*-
3
-
4
- require 'cgi'
5
- require_relative '../lib/bwkfanboy/parser'
6
-
7
- # set this!
8
- CONVERTER = '/home/alex/lib/software/alex/bwkfanboy/bin/bwkfanboy'
9
-
10
- def errx(t)
11
- print "Content-Type: text/plain\r\n\r\n"
12
- print "#{Bwkfanboy::Meta::NAME}.cgi error: #{t}"
13
- exit 0
14
- end
15
-
16
- cgi = CGI.new
17
- if cgi.has_key?('p') then
18
- errx("invalid plugin name: #{cgi['p']}") if cgi['p'] !~ Bwkfanboy::Meta::PLUGIN_NAME
19
- else
20
- errx("parametr 'p' required")
21
- end
22
-
23
- if cgi.has_key?('o')
24
- errx("'o' is too harsh") if cgi['o'] !~ Bwkfanboy::Meta::PLUGIN_OPTS
25
- end
26
-
27
- cmd = "#{CONVERTER} '#{cgi['p']}' #{cgi['o']}"
28
- r = Bwkfanboy::Utils.cmd_run(cmd)
29
- errx("\n\n#{r[1]}") if r[0] != 0
30
- xml = r[2]
31
-
32
- print "Content-Type: application/atom+xml; charset=UTF-8\r\n"
33
- print "Content-Length: #{xml.length}\r\n"
34
- print "Content-Disposition: inline; filename=\"#{Bwkfanboy::Meta::NAME}-#{cgi['p']}.xml\"\r\n\r\n"
35
-
36
- puts xml