boston-ruby 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -2
- data/lib/boston-ruby.rb +1 -1
- data/lib/boston-ruby/mailing_list.rb +6 -3
- metadata +1 -1
data/README.md
CHANGED
@@ -17,9 +17,11 @@ line.
|
|
17
17
|
|
18
18
|
gem install boston-ruby
|
19
19
|
|
20
|
+
If you want to save a few keystrokes when you invoke the command, put something like
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
alias brb=boston-ruby
|
23
|
+
|
24
|
+
in your `~/.bash_profile` and use your alias.
|
23
25
|
|
24
26
|
## Sample output
|
25
27
|
|
data/lib/boston-ruby.rb
CHANGED
@@ -3,18 +3,21 @@
|
|
3
3
|
require 'nokogiri'
|
4
4
|
require 'date'
|
5
5
|
require 'boston-ruby'
|
6
|
+
require 'time'
|
6
7
|
|
7
8
|
xml = `curl -A "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008092416 Firefox/3.0.3" -s http://groups.google.com/group/boston-rubygroup/feed/atom_v1_0_msgs.xml?num=50`
|
8
9
|
doc = Nokogiri::XML.parse xml
|
9
10
|
|
10
11
|
threads = Hash.new
|
11
12
|
|
12
|
-
doc.search('entry').
|
13
|
+
doc.search('entry').each {|entry|
|
13
14
|
title = entry.at('title').inner_text
|
14
15
|
thread_link = entry.at('link')[:href].sub(/\/[^\/]*$/, '')
|
16
|
+
date_s = entry.at('updated/text()').to_s
|
17
|
+
updated = Time.parse(date_s).localtime
|
15
18
|
data = {
|
16
19
|
author: entry.at('author/name/text()').to_s,
|
17
|
-
updated:
|
20
|
+
updated: updated,
|
18
21
|
link_id: entry.at('link')[:href][/\/([^\/]*)\?/, 1],
|
19
22
|
summary: entry.at('summary').inner_text.gsub("<br>", " ").gsub(/\s{2,}/, ' ').strip,
|
20
23
|
}
|
@@ -27,7 +30,7 @@ doc.search('entry').reverse.each {|entry|
|
|
27
30
|
|
28
31
|
puts "(Most recently updated thread is last.)"
|
29
32
|
puts
|
30
|
-
threads.each do |uid, thread|
|
33
|
+
threads.to_a.reverse.each do |uid, thread|
|
31
34
|
puts thread[:title]
|
32
35
|
puts '-' * thread[:title].size
|
33
36
|
puts thread[:link]
|