t 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +10 -11
  2. data/lib/t/stream.rb +12 -0
  3. data/lib/t/version.rb +1 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -46,17 +46,17 @@ The output of which will be structured like this:
46
46
  gem
47
47
  thG9EfWoADtIr6NjbL9ON (active)
48
48
 
49
- **Note**: One account (specifically, the last one you authorized) is marked as
50
- active. To change the active account use the `set` subcommand, passing either
51
- just the username, if it's unambiguous, or the username and consumer key pair.
52
- Something like this:
49
+ **Note**: One of your authorized accounts (specifically, the last one
50
+ authorized) will be set as active. To change the active account, use the `set`
51
+ subcommand, passing either just the username, if it's unambiguous, or the
52
+ username and consumer key pair, like this:
53
53
 
54
54
  t set active sferik UDfNTpOz5ZDG4a6w7dIWj
55
55
 
56
56
  Account information is stored in a YAML-formatted file located at `~/.trc`.
57
57
  **Note**: Anyone with access to this file can masquerade as you on Twitter, so
58
58
  it's important to keep it secure, just as you would treat your SSH private key.
59
- For this reason, the file is hidden and has the permission bits set to 0600.
59
+ For this reason, the file is hidden and has the permission bits set to `0600`.
60
60
 
61
61
  ## Usage Examples
62
62
  Typing `t help` will list all the available commands. You can type `t help
@@ -86,8 +86,7 @@ obviously can't contain any apostrophes.)
86
86
 
87
87
  **Note**: If the first user does not follow the second, `t` will exit with a
88
88
  non-zero exit code. This allows you to execute commands conditionally, for
89
- example, only attempt to send a user a direct message if he are already
90
- follows you:
89
+ example, send a user a direct message only if he already follows you:
91
90
 
92
91
  t does_follow @ev && t dm @ev "What's up, bro?"
93
92
 
@@ -103,7 +102,7 @@ follows you:
103
102
  ### List all your lists, in long format
104
103
  t lists -l
105
104
 
106
- ### List all your friends, ordered by number of followers
105
+ ### List all your friends, in long format, ordered by number of followers
107
106
  t friends -lf
108
107
 
109
108
  ### List all your leaders (people you follow who don't follow you back)
@@ -112,7 +111,7 @@ follows you:
112
111
  ### Unfollow everyone you follow who doesn't follow you back
113
112
  t leaders | xargs t unfollow
114
113
 
115
- ### Follow roulette: randomly follow someone who follows you (who you don't already follow)
114
+ ### Twitter roulette: randomly follow someone who follows you (who you don't already follow)
116
115
  t disciples | shuf | head -1 | xargs t follow
117
116
 
118
117
  ### Favorite the last 10 tweets that mention you
@@ -121,8 +120,8 @@ follows you:
121
120
  ### Output the last 200 tweets in your timeline to a CSV file
122
121
  t timeline -n 200 --csv > timeline.csv
123
122
 
124
- ### Start streaming a real-time sample of all Tweets (Control-C to stop)
125
- t stream all
123
+ ### Start streaming your timeline (Control-C to stop)
124
+ t stream timeline
126
125
 
127
126
  ### Count the number of employees who work for Twitter
128
127
  t list members twitter team | wc -l
data/lib/t/stream.rb CHANGED
@@ -1,5 +1,7 @@
1
+ require 't/cli'
1
2
  require 't/printable'
2
3
  require 't/rcfile'
4
+ require 't/search'
3
5
  require 'thor'
4
6
  require 'tweetstream'
5
7
 
@@ -39,6 +41,11 @@ module T
39
41
  desc "search KEYWORD [KEYWORD...]", "Stream Tweets that contain specified keywords, joined with logical ORs (Control-C to stop)"
40
42
  def search(keyword, *keywords)
41
43
  keywords.unshift(keyword)
44
+ client.on_inited do
45
+ search= T::Search.new
46
+ search.options = search.options.merge(:reverse => true)
47
+ search.all(keywords.join(' OR '))
48
+ end
42
49
  client.on_timeline_status do |status|
43
50
  print_status(status)
44
51
  end
@@ -51,6 +58,11 @@ module T
51
58
 
52
59
  desc "timeline", "Stream your timeline (Control-C to stop)"
53
60
  def timeline
61
+ client.on_inited do
62
+ cli = T::CLI.new
63
+ cli.options = cli.options.merge(:reverse => true)
64
+ cli.timeline
65
+ end
54
66
  client.on_timeline_status do |status|
55
67
  print_status(status)
56
68
  end
data/lib/t/version.rb CHANGED
@@ -13,7 +13,7 @@ module T
13
13
 
14
14
  # @return [Integer]
15
15
  def self.patch
16
- 0
16
+ 1
17
17
  end
18
18
 
19
19
  # @return [String, NilClass]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000 Z
12
+ date: 2012-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack