bwkfanboy 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,14 +1,5 @@
1
1
  = About
2
2
 
3
- (<b>If you cannot install the gem via normal <tt>gem install
4
- bwkfanboy</tt> command</b> then go to
5
- https://rubygems.org/gems/bwkfanboy and click 'Download' link, save the
6
- file and run:
7
-
8
- # gem install -l /where/is/your/bwkfanboy-x.y.z.gem
9
-
10
- This problem arises with rubygems 1.5.0.)
11
-
12
3
  bwkfanboy is a HTML to Atom feed converter that you can use to watch
13
4
  sites that do not provide its own feed.
14
5
 
@@ -16,21 +7,42 @@ The converter is not a magick tool: you'll need to write a plugin (in
16
7
  Ruby) for each site you want to watch. bwkfanboy provides guidelines and
17
8
  general assistance.
18
9
 
19
- (Plugins included with bwkfanboy are usually updated more frequently
20
- than the whole gem on rubygems.org, so grab the source before
21
- struggling).
22
-
23
10
  Plugins from version 1.1.4 are *incompatible* with the 0.1.x
24
11
  series. Please reread in doc/plugin.rdoc the example of the skeleton
25
12
  plugin.
26
13
 
14
+ = Included Plugins
15
+
16
+ NAME VER DESCRIPTION
17
+
18
+ bwk 2 Brian Kernighan's articles from Daily Princetonian
19
+ freebsd-ports-update 3 News from FreeBSD ports
20
+ quora 11 Last n answers (per-user) from Quora; requires nodejs 0.3.7+
21
+ econlib 1 Latest articles from econlib.org
22
+
23
+
24
+ = Installation
25
+
26
+ The easiest way is to type:
27
+
28
+ # gem install bwkfanboy
29
+
30
+ Beware that plugins above are usually updated more frequently than the
31
+ whole gem on rubygems.org, so grab the source before struggling with a
32
+ particular plugin.
33
+
34
+ If the setup with <tt>gem install ...</tt> fails, go to
35
+ https://rubygems.org/gems/bwkfanboy and click 'Download' link, save the
36
+ file and run:
37
+
38
+ # gem install -l /where/is/your/bwkfanboy-x.y.z.gem
39
+
40
+ If even this doesn't help, drop me a email.
41
+
27
42
  = Architecture
28
43
 
29
44
  == Plugins
30
45
 
31
- bwkfanboy comes with several plugins. One of them, for example, parses a
32
- search page of dailyprincetonian.com looking for bwk's articles.
33
-
34
46
  The plugin is a Ruby class +Page+ that inherits Bwkfanboy::Parse parent,
35
47
  overriding 1 method.
36
48
 
@@ -105,4 +117,27 @@ There are 2 method to get an Atom feed via HTTP:
105
117
  directory. Read doc/bwkfanboy_server.rdoc to know how to operate it.
106
118
 
107
119
  = License
108
- :include: doc/LICENSE
120
+
121
+ (The MIT License)
122
+
123
+ Copyright (c) 2010 Alexander Gromnitsky.
124
+
125
+ Permission is hereby granted, free of charge, to any person obtaining
126
+ a copy of this software and associated documentation files (the
127
+ 'Software'), to deal in the Software without restriction, including
128
+ without limitation the rights to use, copy, modify, merge, publish,
129
+ distribute, sublicense, and/or sell copies of the Software, and to
130
+ permit persons to whom the Software is furnished to do so, subject to
131
+ the following conditions:
132
+
133
+ The above copyright notice and this permission notice shall be
134
+ included in all copies or substantial portions of the Software.
135
+
136
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
137
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
138
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
139
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
140
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
141
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
142
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
143
+
data/Rakefile CHANGED
@@ -5,8 +5,10 @@ require 'rake/gempackagetask'
5
5
  require 'rake/clean'
6
6
  require 'rake/rdoctask'
7
7
  require 'rake/testtask'
8
+ require 'json'
8
9
 
9
10
  require_relative 'test/rake_git'
11
+ require_relative 'doc/rakefile'
10
12
 
11
13
  spec = Gem::Specification.new {|i|
12
14
  i.name = "bwkfanboy"
@@ -22,31 +24,37 @@ spec = Gem::Specification.new {|i|
22
24
 
23
25
  i.executables = FileList['bin/*'].gsub(/^bin\//, '')
24
26
  i.default_executable = i.name
25
-
27
+
26
28
  i.test_files = FileList['test/test_*.rb']
27
-
29
+
28
30
  i.rdoc_options << '-m' << 'doc/README.rdoc' << '-x' << 'plugins'
29
- i.extra_rdoc_files = FileList['doc/*']
30
-
31
+ i.extra_rdoc_files = FileList['doc/*.rdoc']
32
+
31
33
  i.add_dependency('open4', '>= 1.0.1')
32
- i.add_dependency('activesupport', '>= 3.0.3')
34
+ i.add_dependency('activesupport', '>= 3.0.5')
33
35
  i.add_dependency('nokogiri', '>= 1.4.4')
34
- i.add_dependency('jsonschema', '>= 2.0.0')
36
+ i.add_dependency('jsonschema', '>= 2.0.1')
35
37
 
36
38
  i.add_development_dependency('git', '>= 1.2.5')
37
39
  }
38
40
 
39
41
  Rake::GemPackageTask.new(spec).define
40
42
 
41
- task default: [:repackage]
43
+ task gen_mydocs: ['mydocs:default'] do
44
+ spec.extra_rdoc_files.concat(MyDocs::RDOC_RELATIVE)
45
+ end
46
+
47
+ task default: [:gen_mydocs, :repackage]
48
+ task doc: [:gen_mydocs, :rdoc]
49
+ task clobber: ['mydocs:clean']
42
50
 
43
- Rake::RDocTask.new('doc') do |i|
44
- i.main = 'doc/README.rdoc'
51
+ Rake::RDocTask.new do |i|
45
52
  i.rdoc_files = FileList['doc/*', 'lib/**/*.rb']
46
53
  i.rdoc_files.exclude("lib/**/plugins")
54
+ i.main = 'doc/README.rdoc'
47
55
  end
48
56
 
49
57
  Rake::TestTask.new do |i|
50
- i.test_files = FileList['test/test_*.rb']
58
+ i.test_files = FileList['test/test_*.rb']
51
59
  i.libs << '.'
52
60
  end
data/doc/NEWS.rdoc CHANGED
@@ -1,3 +1,13 @@
1
+ === 1.3.1
2
+
3
+ Thu Mar 17 17:19:52 EET 2011
4
+
5
+ - Updated quora plugin.
6
+
7
+ - Updated 1 test for jsonschema 2.0.1.
8
+
9
+ - Updated the list of dependencies.
10
+
1
11
  === 1.3.0
2
12
 
3
13
  Thu Feb 10 11:17:57 EET 2011
data/doc/README.erb ADDED
@@ -0,0 +1,116 @@
1
+ = About
2
+
3
+ bwkfanboy is a HTML to Atom feed converter that you can use to watch
4
+ sites that do not provide its own feed.
5
+
6
+ The converter is not a magick tool: you'll need to write a plugin (in
7
+ Ruby) for each site you want to watch. bwkfanboy provides guidelines and
8
+ general assistance.
9
+
10
+ Plugins from version 1.1.4 are *incompatible* with the 0.1.x
11
+ series. Please reread in doc/plugin.rdoc the example of the skeleton
12
+ plugin.
13
+
14
+ = Included Plugins
15
+
16
+ <% MyDocs.plugins.each { |i| %> <%= i %>
17
+ <% } %>
18
+
19
+ = Installation
20
+
21
+ The easiest way is to type:
22
+
23
+ # gem install bwkfanboy
24
+
25
+ Beware that plugins above are usually updated more frequently than the
26
+ whole gem on rubygems.org, so grab the source before struggling with a
27
+ particular plugin.
28
+
29
+ If the setup with <tt>gem install ...</tt> fails, go to
30
+ https://rubygems.org/gems/bwkfanboy and click 'Download' link, save the
31
+ file and run:
32
+
33
+ # gem install -l /where/is/your/bwkfanboy-x.y.z.gem
34
+
35
+ If even this doesn't help, drop me a email.
36
+
37
+ = Architecture
38
+
39
+ == Plugins
40
+
41
+ The plugin is a Ruby class +Page+ that inherits Bwkfanboy::Parse parent,
42
+ overriding 1 method.
43
+
44
+ Plugins can be in system
45
+
46
+ `gem env gemdir`/gems/bwkfanboy-x.y.z/lib/bwkfanboy/plugins
47
+
48
+ or user's home
49
+
50
+ ~/.bwkfanboy/plugins
51
+
52
+ directories.
53
+
54
+ == Pipeline
55
+
56
+ The program consists of 4 parts:
57
+
58
+ 0. *bwkfanboy* script that takes 1 parameter: the name of a file in
59
+ plugins directories (without the .rb suffix). So, for example to get
60
+ an atom feed from dailyprincetonian.com you type:
61
+
62
+ % bwkfanboy bwk
63
+
64
+ and it will load
65
+ <tt>/usr/local/lib/ruby/gems/1.9/gems/bwkfanboy-0.0.1/lib/bwkfanboy/plugins/bwk.rb</tt>
66
+ file on my FreeBSD machine, fetch and parse html from
67
+ dailyprincetonian.com and generate the required feed, dumping it to
68
+ stdout.
69
+
70
+ The script is just a convinient wrapper for 3 separate utils.
71
+
72
+ 1. *bwkfanboy_fetch*
73
+
74
+ It reads 1 line from stdin for the URL to fetch from. The result will
75
+ be dumped to stdout.
76
+
77
+ 2. *bwkfanboy_parse*
78
+
79
+ It takes 1 parameter: <em>a full path</em> to a plugin file.
80
+
81
+ This util reads stdin expecting it to be a xhtml, parses it and dumps
82
+ the result to stdout in JSON-formatted object.
83
+
84
+ 3. *bwkfanboy_generate*
85
+
86
+ Reads stdin expecting it to be a proper JSON-formatted object.
87
+
88
+ The result will be an Atom feed dumped to stdout in UTF-8.
89
+
90
+ So, without the wrapper all this together looks like:
91
+
92
+ % echo http://example.org | bwkfanboy_fetch |
93
+ bwkfanboy_parse /path/to/my/plugin.rb | bwkfanboy_generate
94
+
95
+ == Log
96
+
97
+ All utils write to <tt>/tmp/bwkfanboy/USER/log/general.log</tt> file if
98
+ permissions allows it.
99
+
100
+ == HTTP
101
+
102
+ There are 2 method to get an Atom feed via HTTP:
103
+
104
+ 1. <tt>web/bwkfanboy.cgi</tt> (from the program tarball), which you may
105
+ copy to your Apache cgi directory and run it. This prohibits you from
106
+ using HOME directory for your own plugins. Also the cgi script
107
+ requires some manual editing (setting 1 variable in it) before even
108
+ you can start utilizing it.
109
+
110
+ 2. Small *bwkfanboy_server* HTTP server. It can run from any user and
111
+ thus is able to inherit env variables for discovering your HOME
112
+ directory. Read doc/bwkfanboy_server.rdoc to know how to operate it.
113
+
114
+ = License
115
+
116
+ <%= File.read(MyDocs::PATH + 'LICENSE') %>
data/doc/README.rdoc CHANGED
@@ -1,14 +1,5 @@
1
1
  = About
2
2
 
3
- (<b>If you cannot install the gem via normal <tt>gem install
4
- bwkfanboy</tt> command</b> then go to
5
- https://rubygems.org/gems/bwkfanboy and click 'Download' link, save the
6
- file and run:
7
-
8
- # gem install -l /where/is/your/bwkfanboy-x.y.z.gem
9
-
10
- This problem arises with rubygems 1.5.0.)
11
-
12
3
  bwkfanboy is a HTML to Atom feed converter that you can use to watch
13
4
  sites that do not provide its own feed.
14
5
 
@@ -16,21 +7,42 @@ The converter is not a magick tool: you'll need to write a plugin (in
16
7
  Ruby) for each site you want to watch. bwkfanboy provides guidelines and
17
8
  general assistance.
18
9
 
19
- (Plugins included with bwkfanboy are usually updated more frequently
20
- than the whole gem on rubygems.org, so grab the source before
21
- struggling).
22
-
23
10
  Plugins from version 1.1.4 are *incompatible* with the 0.1.x
24
11
  series. Please reread in doc/plugin.rdoc the example of the skeleton
25
12
  plugin.
26
13
 
14
+ = Included Plugins
15
+
16
+ NAME VER DESCRIPTION
17
+
18
+ bwk 2 Brian Kernighan's articles from Daily Princetonian
19
+ freebsd-ports-update 3 News from FreeBSD ports
20
+ quora 11 Last n answers (per-user) from Quora; requires nodejs 0.3.7+
21
+ econlib 1 Latest articles from econlib.org
22
+
23
+
24
+ = Installation
25
+
26
+ The easiest way is to type:
27
+
28
+ # gem install bwkfanboy
29
+
30
+ Beware that plugins above are usually updated more frequently than the
31
+ whole gem on rubygems.org, so grab the source before struggling with a
32
+ particular plugin.
33
+
34
+ If the setup with <tt>gem install ...</tt> fails, go to
35
+ https://rubygems.org/gems/bwkfanboy and click 'Download' link, save the
36
+ file and run:
37
+
38
+ # gem install -l /where/is/your/bwkfanboy-x.y.z.gem
39
+
40
+ If even this doesn't help, drop me a email.
41
+
27
42
  = Architecture
28
43
 
29
44
  == Plugins
30
45
 
31
- bwkfanboy comes with several plugins. One of them, for example, parses a
32
- search page of dailyprincetonian.com looking for bwk's articles.
33
-
34
46
  The plugin is a Ruby class +Page+ that inherits Bwkfanboy::Parse parent,
35
47
  overriding 1 method.
36
48
 
@@ -105,4 +117,27 @@ There are 2 method to get an Atom feed via HTTP:
105
117
  directory. Read doc/bwkfanboy_server.rdoc to know how to operate it.
106
118
 
107
119
  = License
108
- :include: doc/LICENSE
120
+
121
+ (The MIT License)
122
+
123
+ Copyright (c) 2010 Alexander Gromnitsky.
124
+
125
+ Permission is hereby granted, free of charge, to any person obtaining
126
+ a copy of this software and associated documentation files (the
127
+ 'Software'), to deal in the Software without restriction, including
128
+ without limitation the rights to use, copy, modify, merge, publish,
129
+ distribute, sublicense, and/or sell copies of the Software, and to
130
+ permit persons to whom the Software is furnished to do so, subject to
131
+ the following conditions:
132
+
133
+ The above copyright notice and this permission notice shall be
134
+ included in all copies or substantial portions of the Software.
135
+
136
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
137
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
138
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
139
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
140
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
141
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
142
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
143
+
data/doc/rakefile.rb ADDED
@@ -0,0 +1,59 @@
1
+ # -*-ruby-*-
2
+
3
+ require 'erb'
4
+ require 'json'
5
+ require 'pathname'
6
+
7
+ module MyDocs
8
+ PATH = Pathname.new File.dirname(__FILE__)
9
+
10
+ # our targets
11
+ RDOC = FileList["#{PATH}/*.erb"].sub(/\.erb$/, '.rdoc')
12
+ RDOC_RELATIVE = RDOC.pathmap '%-1d/%f'
13
+
14
+ BWK = PATH.parent + 'bin/bwkfanboy'
15
+ PLUGINS_DIR = PATH.parent + 'lib/bwkfanboy/plugins'
16
+ PLUGINS = Dir["#{PLUGINS_DIR}/*.rb"].map {|i| i.pathmap '%{\.rb$}f' }
17
+
18
+ # Return a list of plugins with description for each plugin.
19
+ # This is used in .erb files.
20
+ def self.plugins
21
+ plugin_name_max = 20
22
+
23
+ r = [format("%-#{plugin_name_max}s %s %s\n", 'NAME', 'VER', 'DESCRIPTION')]
24
+ PLUGINS.each {|i|
25
+ pr = `#{BWK} -i #{i} q w e r t y`.split("\n")
26
+ ver = pr[0].split(':')[1..-1].join.strip
27
+ desc = pr[2].split(':')[1..-1].join.strip
28
+ r << format("%-#{plugin_name_max}s %3s %s", i, ver, desc)
29
+ }
30
+ r
31
+ end
32
+ end
33
+
34
+ namespace 'mydocs' do
35
+ rule '.rdoc' => ['.erb'] do |i|
36
+ File.open(i.name, 'w+') {|fp|
37
+ puts i.source.pathmap('%-1d/%f') + ' > ' + i.name.pathmap('%-1d/%f')
38
+ fp.puts ERB.new(File.read(i.source)).result(binding)
39
+ }
40
+ end
41
+
42
+ desc "Generate all"
43
+ task :default => MyDocs::RDOC
44
+
45
+ desc "Clean all crap"
46
+ task :clean do
47
+ rm(MyDocs::RDOC, verbose: true, force: true)
48
+ end
49
+
50
+ desc "Print a list of plugins"
51
+ task :plugins do
52
+ MyDocs.plugins.each {|i| puts i}
53
+ end
54
+
55
+ desc "Print all staff that _can_ be generated"
56
+ task :print_gen do
57
+ puts MyDocs::RDOC.to_a.to_json
58
+ end
59
+ end
@@ -1,6 +1,6 @@
1
1
  module Bwkfanboy
2
2
  module Meta
3
3
  NAME = 'bwkfanboy'
4
- VERSION = '1.3.0'
4
+ VERSION = '1.3.1'
5
5
  end
6
6
  end
@@ -5,7 +5,7 @@ class Page < Bwkfanboy::Parse
5
5
  URI = '/usr/ports/UPDATING'
6
6
  URI_DEBUG = URI
7
7
  ENC = 'ASCII'
8
- VERSION = 2
8
+ VERSION = 3
9
9
  COPYRIGHT = "See bwkfanboy's LICENSE file"
10
10
  TITLE = "News from FreeBSD ports"
11
11
  CONTENT_TYPE = 'text'
@@ -28,7 +28,7 @@ class Page < Bwkfanboy::Parse
28
28
  re_u = /^(\d{8}):$/
29
29
  re_t1 = /^ {2}AFFECTS:\s+(.+)$/
30
30
  re_t2 = /^\s+(.+)$/
31
- re_a = /^ {2}AUTHOR:\s+(.+)$/
31
+ re_a = /^ {2}AUTHORS?:\s+(.+)$/
32
32
 
33
33
  ready = false
34
34
  mode = nil
@@ -91,6 +91,8 @@ function prepare4eval(body) {
91
91
  "function QTextImageEnlarger(args) { return arr(arguments) }\n" +
92
92
  "function NavigatorResults(args) { return arr(arguments) }\n" +
93
93
  "function RateAnswerApproveButton(args) { return arr(arguments) }\n" +
94
+ "function AnswerVoterNamesExpandable(args) { return arr(arguments) }\n" +
95
+ "function PrefetchManager(args) { return arr(arguments) }\n" +
94
96
  '';
95
97
  var tail = "\n_components;\n";
96
98
 
@@ -15,7 +15,7 @@ class Page < Bwkfanboy::Parse
15
15
  URI = 'http://www.quora.com/#{opt[0]}/answers'
16
16
  URI_DEBUG = '/home/alex/lib/software/alex/bwkfanboy/test/semis/quora.html'
17
17
  ENC = 'UTF-8'
18
- VERSION = 10
18
+ VERSION = 11
19
19
  COPYRIGHT = "See bwkfanboy's LICENSE file"
20
20
  TITLE = "Last n answers (per-user) from Quora; requires nodejs 0.3.7+"
21
21
  CONTENT_TYPE = 'html'