boston-ruby 0.0.8 → 0.0.9

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/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
- Put `alias bostonrb=boston-ruby` in your `~/.bash_profile` if you want to save a few
22
- keystrokes.
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,7 +3,7 @@ require 'htmlentities'
3
3
 
4
4
  module BostonRuby
5
5
 
6
- VERSION = '0.0.8'
6
+ VERSION = '0.0.9'
7
7
 
8
8
  MAX_WIDTH = 90
9
9
  CODER = HTMLEntities.new
@@ -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').reverse.each {|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: DateTime.parse(entry.at('updated/text()').to_s),
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]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boston-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: