bwkfanboy 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/bwkfanboy +0 -1
- data/doc/NEWS.rdoc +6 -0
- data/lib/bwkfanboy/plugins/quora.js +1 -0
- data/lib/bwkfanboy/plugins/quora.rb +1 -1
- data/lib/bwkfanboy/utils.rb +5 -1
- data/test/semis/Rakefile +35 -0
- data/test/semis/bwk.html +35 -40
- data/test/semis/links.txt +3 -0
- data/test/semis/quora.html +11 -12
- data/test/test_fetch.rb +1 -1
- data/test/test_parse.rb +1 -1
- data/test/test_server.rb +2 -2
- metadata +5 -3
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ require 'rake/testtask'
|
|
9
9
|
spec = Gem::Specification.new() {|i|
|
10
10
|
i.name = "bwkfanboy"
|
11
11
|
i.summary = 'A converter from HTML to Atom feed that you can use to watch sites that do not provide its own feed.'
|
12
|
-
i.version = '0.1.
|
12
|
+
i.version = '0.1.3'
|
13
13
|
i.author = 'Alexander Gromnitsky'
|
14
14
|
i.email = 'alexander.gromnitsky@gmail.com'
|
15
15
|
i.homepage = 'http://github.com/gromnitsky/bwkfanboy'
|
data/bin/bwkfanboy
CHANGED
@@ -88,7 +88,6 @@ o.on('-i', 'Show some info about the plugin') { |i| $conf[:mode] = 'info' }
|
|
88
88
|
o.on('-l', 'List all plugins') { |i| $conf[:mode] = 'list' }
|
89
89
|
o.on('-p', 'List all plugins paths') { |i| $conf[:mode] = 'path' }
|
90
90
|
o.on('-D', '(ignore this) Use URI_DEBUG const instead URI in plugins') { |i| $conf[:mode] = 'debug' }
|
91
|
-
o.on('-V', 'Show version & exit.') { |i| $conf[:mode] = 'version' }
|
92
91
|
Bwkfanboy::Utils.cl_parse(ARGV, $conf[:banner], o) # run cl parser
|
93
92
|
|
94
93
|
plugin = Plugin.new(ARGV[0])
|
data/doc/NEWS.rdoc
CHANGED
@@ -85,6 +85,7 @@ function prepare4eval(body) {
|
|
85
85
|
"function UserSig(args) { return arr(arguments) }\n" +
|
86
86
|
"function HeaderLogo(args) { return arr(arguments) }\n" +
|
87
87
|
"function NavElement(args) { return arr(arguments) }\n" +
|
88
|
+
"function UserFollowLink(args) { return arr(arguments) }\n" +
|
88
89
|
'';
|
89
90
|
var tail = "\n_components;\n";
|
90
91
|
|
@@ -17,7 +17,7 @@ class Page < Bwkfanboy::Parse
|
|
17
17
|
URI = 'http://www.quora.com/#{opt[0]}/answers'
|
18
18
|
URI_DEBUG = '/home/alex/lib/software/alex/bwkfanboy/test/semis/quora.html'
|
19
19
|
ENC = 'UTF-8'
|
20
|
-
VERSION =
|
20
|
+
VERSION = 4
|
21
21
|
COPYRIGHT = "See bwkfanboy's LICENSE file"
|
22
22
|
TITLE = "Last n answers (per-user) from Quora; requires nodejs"
|
23
23
|
CONTENT_TYPE = 'html'
|
data/lib/bwkfanboy/utils.rb
CHANGED
@@ -7,7 +7,7 @@ require 'active_support/core_ext/module/attribute_accessors'
|
|
7
7
|
module Bwkfanboy
|
8
8
|
module Meta
|
9
9
|
NAME = 'bwkfanboy'
|
10
|
-
VERSION = '0.1.
|
10
|
+
VERSION = '0.1.3'
|
11
11
|
USER_AGENT = "#{NAME}/#{VERSION} (#{RUBY_PLATFORM}; N; #{Encoding.default_external.name}; #{RUBY_ENGINE}; rv:#{RUBY_VERSION}.#{RUBY_PATCHLEVEL})"
|
12
12
|
PLUGIN_CLASS = 'Page'
|
13
13
|
DIR_TMP = "/tmp/#{Meta::NAME}/#{ENV['USER']}"
|
@@ -113,6 +113,10 @@ module Bwkfanboy
|
|
113
113
|
o = OptionParser.new
|
114
114
|
o.banner = banner
|
115
115
|
o.on('-v', 'Be more verbose.') { |i| Bwkfanboy::Utils.cfg[:verbose] += 1 }
|
116
|
+
o.on('-V', 'Show version & exit.') { |i|
|
117
|
+
puts Bwkfanboy::Meta::VERSION
|
118
|
+
exit 0
|
119
|
+
}
|
116
120
|
return o if ! simple
|
117
121
|
end
|
118
122
|
|
data/test/semis/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*-ruby-*-
|
2
|
+
|
3
|
+
require 'open-uri'
|
4
|
+
|
5
|
+
LINKS = 'links.txt'
|
6
|
+
|
7
|
+
desc "fetch pages found in #{LINKS} file; (filter with 't=page')"
|
8
|
+
task :default do
|
9
|
+
if ENV['t'] =~ /^\s*$/ || !ENV.key?('t') then ENV['t'] = '.*' end
|
10
|
+
|
11
|
+
stng = false
|
12
|
+
File.open(LINKS) { |fp|
|
13
|
+
n = 0
|
14
|
+
while line = fp.gets
|
15
|
+
n += 1
|
16
|
+
next if (line =~ /^\s*#/ || line =~ /^\s*$/)
|
17
|
+
a = line.split
|
18
|
+
fail "invalid line #{n}" if a.length != 2
|
19
|
+
next if (a[0] !~ Regexp::new(ENV['t']))
|
20
|
+
|
21
|
+
rm(a[0], force: true)
|
22
|
+
printf "fetching '#{a[1]}'... "
|
23
|
+
open(a[1]) {|remote|
|
24
|
+
open(a[0], 'w+') {|out| out.puts remote.read }
|
25
|
+
stng = true
|
26
|
+
}
|
27
|
+
puts 'OK'
|
28
|
+
end
|
29
|
+
}
|
30
|
+
|
31
|
+
if !stng
|
32
|
+
STDERR.puts 'No matching fetch targets found.'
|
33
|
+
exit 1
|
34
|
+
end
|
35
|
+
end
|
data/test/semis/bwk.html
CHANGED
@@ -30,8 +30,11 @@
|
|
30
30
|
<link href="http://www.dailyprincetonian.com:8080/css/global/ie6_fixes.css" type="text/css" rel="stylesheet">
|
31
31
|
<![endif]-->
|
32
32
|
|
33
|
-
|
33
|
+
-<script type="text/javascript" src="http://www.dailyprincetonian.com:8080/js/mootools/mootools.v1.11.stripped.js"></script>
|
34
34
|
<script type="text/javascript" src="http://www.dailyprincetonian.com:8080/js/ExternalLinks.js"></script>
|
35
|
+
<script type="text/javascript" src="http://www.dailyprincetonian.com:8080/js/BlogHeader.js"></script>
|
36
|
+
<script type="text/javascript" src="http://www.dailyprincetonian.com:8080/js/SlideshowPreview.js"></script>
|
37
|
+
|
35
38
|
|
36
39
|
<script type="text/javascript" src="http://www.dailyprincetonian.com:8080/js/TopArticles.js"></script>
|
37
40
|
|
@@ -84,7 +87,7 @@
|
|
84
87
|
|
85
88
|
</div>
|
86
89
|
<div>
|
87
|
-
|
90
|
+
Thursday, October 28, 2010
|
88
91
|
</div>
|
89
92
|
</div>
|
90
93
|
<div id="site_search">
|
@@ -119,16 +122,15 @@
|
|
119
122
|
</div>
|
120
123
|
|
121
124
|
<div id="bottom_subheader">
|
122
|
-
<div id="weather">
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
</embed>
|
125
|
+
<div id="weather" style="overflow: hidden; height: 90px; display: block; position: relative;">
|
126
|
+
<div id="blog_header_top" style="margin-top: 5px; height: 20px;"><img src="http://www.dailyprincetonian.com:8080/img/global/header/blogs_top.png"></div>
|
127
|
+
<div id="blog_header_content" style="position: relative; width: 750px; margin-bottom: 2px; height: 50px;">
|
128
|
+
<a href="http://blogs.dailyprincetonian.com/" target="_blank"><img src="http://www.dailyprincetonian.com:8080/img/global/header/blog_header_prox.png" style="float:left;"></a>
|
129
|
+
<a href="http://blogs.dailyprincetonian.com/" target="_blank"><img src="http://www.dailyprincetonian.com:8080/img/global/header/blog_header_prox.png" style="float:right;"></a>
|
130
|
+
<a href="http://dpstreet.blogspot.com/" target="_blank"><img src="http://www.dailyprincetonian.com:8080/img/global/header/blog_header_intersections.png" style="float:right;"></a>
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
132
134
|
<div id="underweather">
|
133
135
|
|
134
136
|
<a href="/feeds/"><img src="http://www.dailyprincetonian.com:8080/rss.png" alt="RSS Feeds" height="10px" width="10px"/>RSS</a>
|
@@ -136,8 +138,7 @@
|
|
136
138
|
<a href="http://twitter.com/princetonian" target="_blank"><img src="http://www.dailyprincetonian.com:8080/img/global/twitter.png" alt="Follow on Twitter" height="10px" width="10px" />Twitter</a>
|
137
139
|
<a href="/subscriptions/"><img src="http://www.dailyprincetonian.com:8080/favicon.png" alt="Subscribe to the E-Prince" height="10px" width="10px" />E-Prince</a>
|
138
140
|
|
139
|
-
</div>
|
140
|
-
</div>
|
141
|
+
</div></div>
|
141
142
|
|
142
143
|
|
143
144
|
<div id="subheader_content" class="ad">
|
@@ -168,7 +169,23 @@
|
|
168
169
|
</div>
|
169
170
|
<div id="content_body">
|
170
171
|
|
171
|
-
<p>Search returned
|
172
|
+
<p>Search returned 30 articles. </p>
|
173
|
+
|
174
|
+
|
175
|
+
<div class="article_item">
|
176
|
+
<h2><a href="/2010/10/25/26695/">We’re number one!</a> (2010-10-25) </h2>
|
177
|
+
<div class="authors">By <span class="authors_people"><a href="http://www.dailyprincetonian.com/accounts/profile/1891/">Brian Kernighan GS '69</a></span></div>
|
178
|
+
<div class="summary">Every August, US News & World Report publishes a popular issue that ranks U.S. colleges and universities. If memory serves, Princeton has been ranked first in “national universities” for the past 10 or 11 years, with two exceptions. Several years ago we slipped to second place for a year, clearly ...</div>
|
179
|
+
</div>
|
180
|
+
<br>
|
181
|
+
|
182
|
+
|
183
|
+
<div class="article_item">
|
184
|
+
<h2><a href="/2010/09/27/26339/">Call me Ned</a> (2010-09-27) </h2>
|
185
|
+
<div class="authors">By <span class="authors_people"><a href="http://www.dailyprincetonian.com/accounts/profile/1891/">Brian Kernighan GS '69</a></span></div>
|
186
|
+
<div class="summary">The term “Luddite,” often aimed today at people who complain about new technology, comes from the (perhaps fictional) Ned Ludd. Ludd was said to have destroyed textile machinery to protest its negative effect on his livelihood and way of life during the early days of the industrial revolution in England. ...</div>
|
187
|
+
</div>
|
188
|
+
<br>
|
172
189
|
|
173
190
|
|
174
191
|
<div class="article_item">
|
@@ -234,22 +251,6 @@
|
|
234
251
|
</div>
|
235
252
|
<br>
|
236
253
|
|
237
|
-
|
238
|
-
<div class="article_item">
|
239
|
-
<h2><a href="/2009/03/23/23097/">Gladly learn, and gladly teach</a> (2009-03-23) </h2>
|
240
|
-
<div class="authors">By <span class="authors_people"><a href="http://www.dailyprincetonian.com/accounts/profile/441/">Brian Kernighan</a></span></div>
|
241
|
-
<div class="summary">More than a dozen years ago, I taught for one semester at Harvard. A good friend was taking her sabbatical and asked me to take over her course. This was well before I came to Princeton, and, though I had done occasional adjunct teaching, I had never spent real time ...</div>
|
242
|
-
</div>
|
243
|
-
<br>
|
244
|
-
|
245
|
-
|
246
|
-
<div class="article_item">
|
247
|
-
<h2><a href="/2009/02/16/22750/">Washington crossings</a> (2009-02-16) </h2>
|
248
|
-
<div class="authors">By <span class="authors_people"><a href="http://www.dailyprincetonian.com/accounts/profile/1891/">Brian Kernighan GS '69</a></span></div>
|
249
|
-
<div class="summary">Editor's note appended There are only two groups who routinely ignore the traffic lights on Washington Road: drivers and pedestrians.Almost every day I cross Washington Road several times. In the early morning when there’s hardly anyone around, drivers rocket by at 50 or 60 miles per hour and feel completely ...</div>
|
250
|
-
</div>
|
251
|
-
<br>
|
252
|
-
|
253
254
|
|
254
255
|
<br>
|
255
256
|
|
@@ -333,23 +334,17 @@ Page 1 of 3
|
|
333
334
|
|
334
335
|
<div id="footer">
|
335
336
|
<ul>
|
336
|
-
<li
|
337
|
-
<li><a href="/section/news/">News</a></li>
|
338
|
-
<li><a href="/section/sports/">Sports</a></li>
|
339
|
-
<li><a href="/section/opinion/">Opinion</a></li>
|
340
|
-
<li><a href="/section/street/">Street</a></li>
|
337
|
+
<li><a href="/join/">Join Our Team</a></li>
|
341
338
|
<li><a class="rss_link" href="/feeds/">RSS</a></li>
|
342
339
|
<li><a href="/archives/">Archives</a></li>
|
343
|
-
<li><a href="http://blogs.dailyprincetonian.com/">The Prox</a></li>
|
344
340
|
<li><a href="http://dailyprincetonian.printroom.com/">Photo Store</a></li>
|
345
|
-
<li
|
341
|
+
<li><a href="/faq/">FAQ</a></li>
|
342
|
+
<li class="last"><a href="http://open.dailyprincetonian.com/public/permissions_form.pdf">Reprints & Permissions</a></li>
|
346
343
|
</ul>
|
347
344
|
<ul>
|
348
345
|
<li class="first"><a href="/advertising/">Advertise</a></li>
|
349
346
|
<li><a href="/subscriptions/">Subscriptions & Back Orders</a></li>
|
350
347
|
<li><a href="/accounts/staff/">Staff & Contributors</a></li>
|
351
|
-
<li><a href="/join/">Join Our Team</a></li>
|
352
|
-
<li><a href="http://prince.personforce.com/prince.php">Job Board</a></li>
|
353
348
|
<li class="last"><a href="/feedback/">Contact Us</a></li>
|
354
349
|
</ul>
|
355
350
|
</div>
|