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.
- data/.gitignore +4 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +51 -0
- data/Procfile +1 -0
- data/README.rdoc +40 -77
- data/Rakefile +13 -48
- data/bin/bwkfanboy +47 -166
- data/bin/bwkfanboy_generate +7 -19
- data/bin/bwkfanboy_parse +21 -17
- data/bwkfanboy.gemspec +40 -0
- data/config.ru +3 -0
- data/doc/NEWS.rdoc +21 -79
- data/doc/plugin.rdoc +63 -79
- data/etc/bwkfanboy.yaml +2 -0
- data/etc/sinatra.rb +34 -0
- data/lib/bwkfanboy/cliconfig.rb +141 -0
- data/lib/bwkfanboy/cliutils.rb +114 -0
- data/lib/bwkfanboy/fetch.rb +22 -24
- data/lib/bwkfanboy/generator.rb +78 -0
- data/lib/bwkfanboy/home.rb +53 -0
- data/lib/bwkfanboy/meta.rb +5 -2
- data/lib/bwkfanboy/plugin.rb +247 -0
- data/lib/bwkfanboy/plugin_skeleton.erb +19 -23
- data/lib/bwkfanboy/server.rb +73 -0
- data/lib/bwkfanboy/utils.rb +39 -129
- data/plugins/bwk.rb +25 -0
- data/plugins/econlib.rb +22 -0
- data/plugins/freebsd-ports-update.rb +73 -0
- data/plugins/inc.rb +29 -0
- data/plugins/test.rb +29 -0
- data/public/.gitattributes +1 -0
- data/public/favicon.ico +0 -0
- data/public/jquery-1.7.2.min.js +0 -0
- data/public/list.js +111 -0
- data/public/loading.gif +0 -0
- data/public/style.css +54 -0
- data/shotgun.rb +20 -0
- data/test/example/.gitattributes +1 -0
- data/test/example/.gitignore +1 -0
- data/test/example/02/plugins/bwk.html +0 -0
- data/test/{plugins → example/02/plugins}/empty.rb +0 -0
- data/test/example/02/plugins/garbage.rb +1 -0
- data/test/example/02/plugins/inc.html +0 -0
- data/test/helper.rb +30 -27
- data/test/helper_cliutils.rb +34 -0
- data/test/test_cli.rb +86 -0
- data/test/test_fetch.rb +49 -18
- data/test/test_generate.rb +43 -16
- data/test/test_home.rb +33 -0
- data/test/test_plugin.rb +141 -0
- data/test/test_server.rb +21 -32
- data/views/list.haml +38 -0
- metadata +223 -110
- data/bin/bwkfanboy_fetch +0 -13
- data/bin/bwkfanboy_server +0 -126
- data/doc/README.erb +0 -114
- data/doc/README.rdoc +0 -141
- data/doc/TODO +0 -7
- data/doc/bwkfanboy_fetch.rdoc +0 -4
- data/doc/bwkfanboy_generate.rdoc +0 -7
- data/doc/bwkfanboy_parse.rdoc +0 -7
- data/doc/bwkfanboy_server.rdoc +0 -35
- data/doc/rakefile.rb +0 -59
- data/lib/bwkfanboy/generate.rb +0 -63
- data/lib/bwkfanboy/parser.rb +0 -156
- data/lib/bwkfanboy/plugins/bwk.rb +0 -33
- data/lib/bwkfanboy/plugins/econlib.rb +0 -34
- data/lib/bwkfanboy/plugins/freebsd-ports-update.rb +0 -76
- data/lib/bwkfanboy/plugins/inc.rb +0 -37
- data/lib/bwkfanboy/schema.js +0 -39
- data/test/popen4.sh +0 -4
- data/test/rake_git.rb +0 -36
- data/test/semis/Rakefile +0 -35
- data/test/semis/bwk.html +0 -393
- data/test/semis/bwk.json +0 -82
- data/test/semis/econlib.html +0 -21
- data/test/semis/inc.html +0 -1067
- data/test/semis/links.txt +0 -4
- data/test/test_parse.rb +0 -27
- data/test/xml-clean.sh +0 -8
- data/web/bwkfanboy.cgi +0 -36
data/test/semis/links.txt
DELETED
data/test/test_parse.rb
DELETED
@@ -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
|
data/test/xml-clean.sh
DELETED
data/web/bwkfanboy.cgi
DELETED
@@ -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
|