twail 0.1.6 → 0.1.7
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/lib/twail.rb +20 -16
- data/twail.gemspec +1 -1
- metadata +3 -3
data/lib/twail.rb
CHANGED
|
@@ -96,24 +96,28 @@ if ARGV.first =~ /^s/ # search
|
|
|
96
96
|
text_width = (total_width - 44)
|
|
97
97
|
|
|
98
98
|
while query
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
data/twail.gemspec
CHANGED
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.
|
|
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: &
|
|
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: *
|
|
24
|
+
version_requirements: *70179478155120
|
|
25
25
|
description: tail your Twitter timelines, or search Twitter
|
|
26
26
|
email:
|
|
27
27
|
- dhchoi@gmail.com
|