twail 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/twail.rb +20 -16
  2. data/twail.gemspec +1 -1
  3. metadata +3 -3
@@ -96,24 +96,28 @@ if ARGV.first =~ /^s/ # search
96
96
  text_width = (total_width - 44)
97
97
 
98
98
  while query
99
- url = "http://search.twitter.com/search.json#{query}"
100
- json = `curl -s '#{url}'`
101
- res = JSON.parse(json)
102
- res['results'].each do |x|
103
- time = Time.parse(x['created_at']).localtime
104
- text = x['text'].gsub(/\n/, ' ')
105
- text += " #{x['id']}" if options[:tweet_ids]
106
- textlines = options[:wrap] ? text.wrap(text_width).split(/\n/) : [text]
107
- puts "%s | %s | %s" % [time.to_s.gsub(/\s\S+$/,''), x['from_user'].rjust(18), textlines.shift]
108
- textlines.each do |line|
109
- puts("%s | %s" % [''.rjust(40), line])
99
+ begin
100
+ url = "http://search.twitter.com/search.json#{query}"
101
+ json = `curl -s '#{url}'`
102
+ res = JSON.parse(json)
103
+ res['results'].each do |x|
104
+ time = Time.parse(x['created_at']).localtime
105
+ text = x['text'].gsub(/\n/, ' ')
106
+ text += " #{x['id']}" if options[:tweet_ids]
107
+ textlines = options[:wrap] ? text.wrap(text_width).split(/\n/) : [text]
108
+ puts "%s | %s | %s" % [time.to_s.gsub(/\s\S+$/,''), x['from_user'].rjust(18), textlines.shift]
109
+ textlines.each do |line|
110
+ puts("%s | %s" % [''.rjust(40), line])
111
+ end
110
112
  end
111
- end
112
- query = res['next_page']
113
- if max_pages
114
- if query.nil? || query[/page=(\d+)/, 1].to_i > max_pages.to_i
115
- exit
113
+ query = res['next_page']
114
+ if max_pages
115
+ if query.nil? || query[/page=(\d+)/, 1].to_i > max_pages.to_i
116
+ exit
117
+ end
116
118
  end
119
+ rescue Errno::EPIPE
120
+ exit
117
121
  end
118
122
  end
119
123
  exit
@@ -2,7 +2,7 @@
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "twail"
5
- s.version = '0.1.6'
5
+ s.version = '0.1.7'
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.required_ruby_version = '>= 1.9.0'
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twurl
16
- requirement: &70173350282360 !ruby/object:Gem::Requirement
16
+ requirement: &70179478155120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.6.3
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70173350282360
24
+ version_requirements: *70179478155120
25
25
  description: tail your Twitter timelines, or search Twitter
26
26
  email:
27
27
  - dhchoi@gmail.com