public
Fork of rubys/mars
Description: Yet Another Planet Refactoring
Homepage: http://intertwingly.net/blog/2007/12/19/Yet-Another-Planet-Refactoring
Clone URL: git://github.com/technomancy/mars.git
Search Repo:
a bit more comments
technomancy (author)
Fri Jun 27 09:15:35 -0700 2008
commit  ba8c737efc5e9123458d085dae8701e32560b971
tree    290b08bb24e8cf523950cd50e966034832c98c6a
parent  0a586b503fd189482796420ada7b11fe3f3e7194
...
1
2
3
4
5
...
1
 
2
3
4
0
@@ -1,4 +1,3 @@
0
 test/test.log
0
-test/cache/*
0
 test/output/*
0
 TAGS
0
\ No newline at end of file
0
...
13
14
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
17
18
...
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
0
@@ -13,6 +13,19 @@ the latest html5lib package contains a bug that's only fixed in 0.10.1
0
   $ svn checkout http://html5lib.googlecode.com/svn/trunk/ html5lib
0
   $ cd html5lib/ruby && rake install_gem
0
 
0
+TODO: make this gem available somewhere. (Ideally rubyforge, but whatever.)
0
+
0
+In addition, Mars needs a *working* XML parser (REXML version 3.1.6
0
+won't do). The easiest thing to do is probably to install the ruby
0
+bindings to libxml2. On debian-based systems:
0
+
0
+ $ sudo apt-get install libxml2-dev && sudo gem install libxml-ruby
0
+
0
+But you can also get a more recent REXML if you don't have a compiler:
0
+
0
+ $ svn co http://www.germane-software.com/repos/rexml/trunk/ rexml
0
+ $ export RUBYLIB="/path/rexml/src"
0
+
0
 == Usage
0
 
0
   $ planet $CONFIG_FILE
...
13
14
15
16
17
 
18
19
20
 
 
 
21
22
23
...
13
14
15
 
 
16
17
18
19
20
21
22
23
24
25
0
@@ -13,11 +13,13 @@ Hoe.new('mars', Planet::VERSION) do |p|
0
 
0
   p.extra_deps << ['addressable']
0
   p.extra_deps << ['idn']
0
- p.extra_deps << ['rfeedparser']
0
- p.extra_deps << ['libxml-ruby']
0
+ # p.extra_deps << ['rfeedparser']
0
   p.extra_deps << ['html5lib', '>=0.10.1']
0
   # p.add_development_dependency 'test-spec'
0
   p.extra_deps << ['test-spec']
0
+
0
+ # TODO: one-of-many dependency between libxml, expat, and rexml
0
+ # p.extra_deps << ['libxml-ruby']
0
 end
0
 
0
 task :spec do
...
5
6
7
 
8
9
10
...
5
6
7
8
9
10
11
0
@@ -5,6 +5,7 @@ module Planet
0
     module_function
0
     
0
     def process(template, feed)
0
+ # TODO: decouple from REXML structure. rfeedparser makes this easy.
0
       @sources = []
0
       ::ERB.new(File.read(template)).result(binding)
0
     end
...
3
4
5
 
6
7
8
...
3
4
5
6
7
8
9
0
@@ -3,6 +3,7 @@ require 'planet/log'
0
 
0
 module Planet
0
   # Old INI-style configuration preserved for backward-compatibility
0
+ # Probably broken; it's not tested at all.
0
   def self.ini_config(filename)
0
     @@config = ConfigParser.new
0
     @@config.read(filename)
...
1
2
3
 
 
4
5
6
...
38
39
40
41
42
 
43
44
45
...
1
2
3
4
5
6
7
8
...
40
41
42
 
 
43
44
45
46
0
@@ -1,6 +1,8 @@
0
 require 'rexml/document'
0
 require 'html5/liberalxmlparser'
0
 
0
+# TODO: switch to using rfeedparser
0
+
0
 module Planet
0
   module XmlParser
0
     begin
0
@@ -38,8 +40,7 @@ module Planet
0
         # being used.
0
         raise e unless @@parser == :expat or e.is_a? StandardError
0
         
0
- # If everything is being bozo'd, enable this to see why.
0
- # print "PARSE ERROR: #{$!}\n #{$!.backtrace.join("\n ")}\n"
0
+ print "PARSE ERROR: #{$!}\n #{$!.backtrace.join("\n ")}\n" if $DEBUG
0
 
0
         # last ditch attempt: use a liberal XML parser
0
         parser = HTML5::XMLParser.new
...
253
254
255
256
 
257
258
 
259
260
261
...
253
254
255
 
256
257
 
258
259
260
261
0
@@ -253,9 +253,9 @@ header:
0
   content-type:
0
   - application/atom+xml; charset=utf-8
0
   date:
0
- - Thu, 26 Jun 2008 16:03:11 GMT
0
+ - Fri, 27 Jun 2008 02:44:38 GMT
0
   x-runtime:
0
- - "1.52803"
0
+ - "0.68077"
0
   server:
0
   - nginx/0.6.26
0
   content-length:
...
1
2
3
 
 
 
 
 
 
 
4
5
6
...
161
162
163
164
165
166
167
168
 
169
170
171
...
175
176
177
178
 
179
180
181
...
185
186
187
188
 
189
190
 
191
192
193
194
 
195
196
197
...
1
2
 
3
4
5
6
7
8
9
10
11
12
...
167
168
169
 
 
 
 
 
170
171
172
173
...
177
178
179
 
180
181
182
183
...
187
188
189
 
190
191
 
192
193
194
195
 
196
197
198
199
0
@@ -1,6 +1,12 @@
0
 --- !ruby/object:Net::HTTPOK
0
 body: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\
0
- <feed xmlns=\"http://www.w3.org/2005/Atom\"\n xmlns:thr=\"http://purl.org/syndication/thread/1.0\">\n <link rel=\"self\" href=\"http://intertwingly.net/blog/index.atom\"/>\n <id>http://intertwingly.net/blog/index.atom</id>\n <icon>../favicon.ico</icon>\n\n <title>Sam Ruby</title>\n <subtitle>It\xE2\x80\x99s just data</subtitle>\n <author>\n <name>Sam Ruby</name>\n <email>rubys@intertwingly.net</email>\n <uri>/blog/</uri>\n </author>\n <updated>2008-06-26T13:36:48-04:00</updated>\n <link href=\"/blog/\"/>\n <link rel=\"license\" href=\"http://creativecommons.org/licenses/BSD/\"/>\n\n <entry>\n <id>tag:intertwingly.net,2004:2861</id>\n <link href=\"/blog/2008/06/24/Minimalist-Markup\"/>\n <link rel=\"replies\" href=\"2861.atom\" thr:count=\"26\" thr:updated=\"2008-06-26T13:36:33-04:00\"/>\n <title>Minimalist Markup</title>\n <summary type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p>While <a href=\"http://tomayko.com/writings/administrative-debris\">Ryan</a>, <a href=\"http://www.b-list.org/weblog/2008/jun/15/minimal/\">James</a>, and <a href=\"http://diveintomark.org/archives/2008/06/21/minimalism\">Mark</a> have been pursing a minimalist design from a presentation perspective, I\xE2\x80\x99ve been quietly pursuing a minimalist design from a markup perspective.</p>\n\
0
+ <feed xmlns=\"http://www.w3.org/2005/Atom\"\n xmlns:thr=\"http://purl.org/syndication/thread/1.0\">\n <link rel=\"self\" href=\"http://intertwingly.net/blog/index.atom\"/>\n <id>http://intertwingly.net/blog/index.atom</id>\n <icon>../favicon.ico</icon>\n\n <title>Sam Ruby</title>\n <subtitle>It\xE2\x80\x99s just data</subtitle>\n <author>\n <name>Sam Ruby</name>\n <email>rubys@intertwingly.net</email>\n <uri>/blog/</uri>\n </author>\n <updated>2008-06-27T10:49:16-04:00</updated>\n <link href=\"/blog/\"/>\n <link rel=\"license\" href=\"http://creativecommons.org/licenses/BSD/\"/>\n\n <entry>\n <id>tag:intertwingly.net,2004:2862</id>\n <link href=\"/blog/2008/06/26/Unable-to-Complete-the-Call-as-Dialed\"/>\n <link rel=\"replies\" href=\"2862.atom\" thr:count=\"5\" thr:updated=\"2008-06-27T08:49:13-04:00\"/>\n <title>Unable to Complete the Call as Dialed</title>\n <summary type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p><a href=\"http://www.theregister.co.uk/2008/06/26/icann_approves_customized_top_level_domains/\">Tim Bray</a>: <em>I\xE2\x80\x99m not sure whether this <a href=\"http://www.theregister.co.uk/2008/06/26/icann_approves_customized_top_level_domains/\">free-TLD</a> idea is a good or bad thing in the big picture</em></p>\n\
0
+ <p>Consider the fun that will occur when existing software is presented with email addresses that contain non-latin characters.</p></div></summary>\n <content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"130\" height=\"77\" viewBox=\"0 0 130 77\">\n <path d=\"M2,12l8-6h11v11l-6,8zM62,12l8-6h11v11l-6,8zM2,62l8-6h11v11l-6,8zM62,62l8-6h11v11l-6,8z\" fill=\"#fe898b\"/>\n <path d=\"M2,12h13v13h-13zM62,12h13v13h-13zM2,62h13v13h-13zM62,62h13v13h-13z\" fill=\"#cb0612\"/>\n\n <path d=\"M23,12l8-6h29v11l-5,7h-4v9l-6,7zM59,68l-5,6l-30-11l6-7h3v-8l6-5h11v14h9z\" fill=\"#52a9ff\"/>\n <path d=\"M23,12h32v12h-10v16h-12v-16h-10zM54,74h-30v-11h9v-15h12v15h9z\" fill=\"#5c64b5\"/>\n\n <path d=\"M84,12l8-6c18-4,38,19,34,27l-5,6zM84,63c18,4,38,5,42-21h-12l-5,6c-2,14,-18,10-20,10z\" fill=\"#87f7a2\"/>\n <path d=\"M84,12c20-5,41,15,37,27h-12c0-12-8-15-25-15zM84,75c20,3,41-15,37-27h-12c0,12-8,15-25,15z\" fill=\"#18bf73\"/>\n\
0
+ </svg>\n\
0
+ <p><a href=\"http://www.theregister.co.uk/2008/06/26/icann_approves_customized_top_level_domains/\"><cite>Tim Bray</cite></a>: <em>I\xE2\x80\x99m not sure whether this <a href=\"http://www.theregister.co.uk/2008/06/26/icann_approves_customized_top_level_domains/\">free-TLD</a> idea is a good or bad thing in the big picture</em></p>\n\
0
+ <p>When I was a young\xE2\x80\x99un, <a href=\"http://en.wikipedia.org/wiki/North_American_Numbering_Plan#History\">telephone area codes in North America</a> had a zero or a one a the middle digit, and none of the exchanges in such area codes had such.\xC2\xA0 This enabled telephone switching equipment to detect whether the number you were dialing was a local or long distance number without requiring a one to be dialed first.\xC2\xA0 Eventually, phone numbers became scarce, and this was ditched.</p>\n\
0
+ <p>This meant that the <abbr title=\"Private Branch eXchange\">PBX</abbr> equipment in a number of locations were unable to make calls to these new numbers, and had to be replaced.</p>\n\
0
+ <p>The modern equivalent of this may be <a href=\"http://www.regular-expressions.info/email.html\">email addresses</a>.\xC2\xA0 Consider the fun that will occur when existing software is presented with email addresses that contain non-latin characters.</p></div></content>\n <updated>2008-06-26T20:42:00-04:00</updated>\n </entry>\n\n <entry>\n <id>tag:intertwingly.net,2004:2861</id>\n <link href=\"/blog/2008/06/24/Minimalist-Markup\"/>\n <link rel=\"replies\" href=\"2861.atom\" thr:count=\"27\" thr:updated=\"2008-06-26T15:43:51-04:00\"/>\n <title>Minimalist Markup</title>\n <summary type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><p>While <a href=\"http://tomayko.com/writings/administrative-debris\">Ryan</a>, <a href=\"http://www.b-list.org/weblog/2008/jun/15/minimal/\">James</a>, and <a href=\"http://diveintomark.org/archives/2008/06/21/minimalism\">Mark</a> have been pursing a minimalist design from a presentation perspective, I\xE2\x80\x99ve been quietly pursuing a minimalist design from a markup perspective.</p>\n\
0
   <p>My <a href=\"http://rails.intertwingly.net/blog/\">front page</a> (under development) will be <a href=\"http://html5.validator.nu/?doc=http%3A%2F%2Frails.intertwingly.net%2Fblog%2F\">valid HTML5</a> and yet have absolutely no <code>div</code> or <code>span</code> elements, no inline <code>style</code> or <code>class</code> attributes, and no <code>table</code> or <code>img</code> elements used purely for layout purposes.</p></div></summary>\n <content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100\" height=\"100\" viewBox=\"0 0 100 100\">\n <path d=\"M38,38c0-12,24-15,23-2c0,9-16,13-16,23v7h11v-4c0-9,17-12,17-27c-2-22-45-22-45,3zM45,70h11v11h-11z\" fill=\"#371\"/>\n <circle cx=\"50\" cy=\"50\" r=\"45\" fill=\"none\" stroke=\"#371\" stroke-width=\"10\"/>\n\
0
   </svg>\n\
0
   <p>While <a href=\"http://tomayko.com/writings/administrative-debris\">Ryan</a>, <a href=\"http://www.b-list.org/weblog/2008/jun/15/minimal/\">James</a>, and <a href=\"http://diveintomark.org/archives/2008/06/21/minimalism\">Mark</a> have been pursing a minimalist design from a presentation perspective, I\xE2\x80\x99ve been quietly pursuing a minimalist design from a markup perspective.\xC2\xA0 I\xE2\x80\x99m not sure when it changed, but Firefox 3.0, Safari 3.1.1, and Opera 9.5 now all support units of <em>em</em> in SVG dimensions.</p>\n\
0
@@ -161,11 +167,7 @@ body: "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\
0
   <path d=\"M44,13c-42,39,-46,60-12,54c1-1,1,0,1,5c0,7,0,9,4,9c5,0,4-1,4-9c0,-4-1-8,0-9c2-9,0-11-7-7c-14,8,-26,4,2-21l14-14c8,-8,0,-15-7-7\" fill=\"#838\"/>\n\
0
   <circle r=\"7\" fill=\"#838\" cx='38' cy='93'/>\n\
0
   </svg>\n\
0
- <a href=\"http://www.crunchboard.com/opening/detailjob.php?jid=4125\"><cite>Henry Work</cite></a>: <em>TechCrunch seeks two Rails programmers to join the company as interns this summer.</em></div></content>\n <updated>2008-05-02T21:35:43-04:00</updated>\n </entry>\n\n <entry>\n <id>tag:intertwingly.net,2004:2842</id>\n <link href=\"/blog/2008/05/01/License-Free-Spec\"/>\n <link rel=\"replies\" href=\"2842.atom\" thr:count=\"2\" thr:updated=\"2008-05-03T06:54:34-04:00\"/>\n <title>License-Free Spec</title>\n <content type=\"xhtml\"><div xmlns=\"http://www.w3.org/1999/xhtml\"><svg xmlns='http://www.w3.org/2000/svg' width=\"105\" height=\"93\" viewBox=\"0 0 105 93\">\n\
0
- <path d='M66,0h39v93zM38,0h-38v93zM52,35l25,58h-16l-8-18h-18z' fill='#ED1C24'/>\n\
0
- </svg>\n\
0
- <p><a href=\"http://blogs.adobe.com/penguin.swf/2008/04/licensefree_spec.html\"><cite>Mike Melanson</cite></a>: <em>the previous restriction that anyone who looks at the spec technically isn\xE2\x80\x99t allowed to create an independent SWF decoder (if documentation EULAs are to be believed) was a point of contention among many open source types.</em></p>\n\
0
- <p>I would agree that the ability to create a license-free, independent open source implementation is an important aspect of an open standard.</p></div></content>\n <updated>2008-05-01T11:05:22-04:00</updated>\n </entry>\n\n\
0
+ <a href=\"http://www.crunchboard.com/opening/detailjob.php?jid=4125\"><cite>Henry Work</cite></a>: <em>TechCrunch seeks two Rails programmers to join the company as interns this summer.</em></div></content>\n <updated>2008-05-02T21:35:43-04:00</updated>\n </entry>\n\n\
0
   </feed>\n\n"
0
 body_exist: true
0
 code: "200"
0
@@ -175,7 +177,7 @@ header:
0
   vary:
0
   - Accept-Encoding,User-Agent
0
   last-modified:
0
- - Thu, 26 Jun 2008 17:36:48 GMT
0
+ - Fri, 27 Jun 2008 14:49:16 GMT
0
   connection:
0
   - close
0
   content-location:
0
@@ -185,13 +187,13 @@ header:
0
   x-pingback:
0
   - http://intertwingly.net/blog/pingback
0
   etag:
0
- - "\"620899-d342-3cd84c00\""
0
+ - "\"6200b9-da8a-38a5300\""
0
   date:
0
- - Thu, 26 Jun 2008 17:57:40 GMT
0
+ - Fri, 27 Jun 2008 16:08:49 GMT
0
   server:
0
   - Apache
0
   content-length:
0
- - "16709"
0
+ - "17265"
0
   accept-ranges:
0
   - bytes
0
 http_version: "1.1"
...
494
495
496
497
 
498
499
500
...
494
495
496
 
497
498
499
500
0
@@ -494,7 +494,7 @@ header:
0
   etag:
0
   - "\"448fb-126c9-4862b67d\""
0
   date:
0
- - Thu, 26 Jun 2008 16:03:09 GMT
0
+ - Fri, 27 Jun 2008 02:44:35 GMT
0
   server:
0
   - Apache/1.3.37 (Unix) mod_throttle/3.1.2 DAV/1.0.3 mod_fastcgi/2.4.2 mod_gzip/1.3.26.1a PHP/4.4.8 mod_ssl/2.8.22 OpenSSL/0.9.7e
0
   content-length:
...
1
2
3
 
4
5
6
...
1
2
3
4
5
6
7
0
@@ -1,6 +1,7 @@
0
 <!DOCTYPE html>
0
 <html xmlns="http://www.w3.org/1999/xhtml">
0
   <head>
0
+ <!-- TODO: include good sample CSS and images -->
0
     <link rel="stylesheet" href="default.css" type="text/css"/>
0
     <title><%= Planet.config['name'] %></title>
0
     <meta name="robots" content="noindex,nofollow"/>
...
10
11
12
13
14
15
16
...
10
11
12
 
13
14
15
0
@@ -10,7 +10,6 @@ require 'planet'
0
 # For tests, never fetch and always consider things not-modified.
0
 class Net::HTTP
0
   def start; Net::HTTPNotModified.new('1.0', '304', 'Not Modified') end
0
- def code; '304' end
0
 end
0
 
0
 module Planet

Comments

    No one has commented yet.