t 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,7 +23,7 @@ or send direct messages via the CLI.
23
23
  Once you have registered your application, you'll be given a consumer key and
24
24
  secret, which you can use to authorize your Twitter account.
25
25
 
26
- t authorize --consumer-key YOUR_CONSUMER_KEY --consumer-secret YOUR_CONSUMER_SECRET
26
+ t authorize -c YOUR_CONSUMER_KEY -s YOUR_CONSUMER_SECRET
27
27
 
28
28
  This will open a new browser window where you can authenticate to Twitter and
29
29
  then enter the returned PIN back into the terminal. Assuming that works,
@@ -43,7 +43,7 @@ Notice that one account is marked as the default. To change the default use the
43
43
  `set` subcommand, passing either just the username, if it's unambiguous, or the
44
44
  username and consumer key pair, like so:
45
45
 
46
- t set default sferik thG9EfWoADtIr6NjbL9ON
46
+ t set default sferik UDfNTpOz5ZDG4a6w7dIWj
47
47
 
48
48
  Account information is stored in the YAML-formatted file `~/.trc`.
49
49
 
@@ -56,11 +56,15 @@ type `t help TASK` to get help for a specific command.
56
56
  ### <a name="update"></a>Update your status
57
57
  t update "I'm tweeting from the command line. Isn't that special?"
58
58
 
59
+ Note: If your tweet includes characters such as `@` or `!`, make sure to wrap
60
+ it in single quotes instead of double quotes, so those characters are not
61
+ interpreted by your shell.
62
+
59
63
  ### <a name="stats"></a>Retrieve stats about users
60
- t users -l sferik gem
64
+ t users -l @sferik @gem
61
65
 
62
66
  ### <a name="follow"></a>Follow users
63
- t follow sferik gem
67
+ t follow @sferik @gem
64
68
 
65
69
  ### <a name="friends"></a>List your friends (ordered by number of followers)
66
70
  t friends -lf
@@ -78,19 +82,19 @@ type `t help TASK` to get help for a specific command.
78
82
  t list create presidents
79
83
 
80
84
  ### <a name="list-add"></a>Add users to a list
81
- t list add presidents BarackObama Jasonfinn
85
+ t list add presidents @BarackObama @Jasonfinn
82
86
 
83
87
  ### <a name="following"></a>Create a list that contains today's date in the name
84
- date "+following-%Y-%m-%d" | xargs t list create
88
+ t list create following-`date "+%Y-%m-%d"`
85
89
 
86
90
  ### Add everyone you're following to a list
87
91
  t followings | xargs t list add following-`date "+%Y-%m-%d"`
88
92
 
89
- ### <a name="members"></a>Display members of a list
90
- t members following-`date "+%Y-%m-%d"`
93
+ ### <a name="list-members"></a>Display members of a list
94
+ t list members following-`date "+%Y-%m-%d"`
91
95
 
92
96
  ### Count the number of Twitter employees
93
- t members twitter team | wc -l
97
+ t list members twitter team | wc -l
94
98
 
95
99
  ### <a name="search-all"></a>Search Twitter for the 20 most recent Tweets that match a specified query
96
100
  t search all "query"
@@ -108,7 +112,29 @@ type `t help TASK` to get help for a specific command.
108
112
  t search timeline "query"
109
113
 
110
114
  ### <a name="search-user"></a>Search Tweets in a user's timeline that match a specified query
111
- t search user sferik "query"
115
+ t search user @sferik "query"
116
+
117
+ ## <a name="terminology"></a>Relationship Terminology
118
+
119
+ There is some ambiguity in the terminology used to describe relationships on
120
+ Twitter. For example, some people use the term "friends" to mean the set of
121
+ everyone you follow, while we use it to mean just the subset of people who
122
+ follow you back (i.e., friendship is bidirectional). Here is the full table of
123
+ terminology used throughout `t`:
124
+
125
+ ___________________________________________________
126
+ | | |
127
+ | YOU FOLLOW THEM | YOU DON'T FOLLOW THEM |
128
+ _________________________|_________________________|_________________________|_________________________
129
+ | | | | |
130
+ | THEY FOLLOW YOU | friends | disciples | followers |
131
+ |_________________________|_________________________|_________________________|_________________________|
132
+ | | |
133
+ | THEY DON'T FOLLOW YOU | leaders |
134
+ |_________________________|_________________________|
135
+ | |
136
+ | followings |
137
+ |_________________________|
112
138
 
113
139
  ## <a name="history"></a>History
114
140
  ![History](http://twitter.rubyforge.org/images/terminal_output.png "History")
data/lib/t/cli.rb CHANGED
@@ -98,6 +98,7 @@ module T
98
98
  desc "block SCREEN_NAME [SCREEN_NAME...]", "Block users."
99
99
  def block(screen_name, *screen_names)
100
100
  screen_names.unshift(screen_name)
101
+ screen_names.map!(&:strip_ats)
101
102
  screen_names.threaded_each do |screen_name|
102
103
  screen_name.strip_ats
103
104
  retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
@@ -161,6 +162,32 @@ module T
161
162
  end
162
163
  map %w(sent_messages sms) => :direct_messages_sent
163
164
 
165
+ desc "disciples", "Returns the list of people who follow you but you don't follow back."
166
+ method_option :created, :aliases => "-c", :type => :boolean, :default => false, :desc => "Sort by the time when Twitter acount was created."
167
+ method_option :favorites, :aliases => "-v", :type => :boolean, :default => false, :desc => "Sort by number of favorites."
168
+ method_option :followers, :aliases => "-f", :type => :boolean, :default => false, :desc => "Sort by number of followers."
169
+ method_option :friends, :aliases => "-d", :type => :boolean, :default => false, :desc => "Sort by number of friends."
170
+ method_option :listed, :aliases => "-i", :type => :boolean, :default => false, :desc => "Sort by number of list memberships."
171
+ method_option :long, :aliases => "-l", :type => :boolean, :default => false, :desc => "List in long format."
172
+ method_option :reverse, :aliases => "-r", :type => :boolean, :default => false, :desc => "Reverse the order of the sort."
173
+ method_option :tweets, :aliases => "-t", :type => :boolean, :default => false, :desc => "Sort by number of Tweets."
174
+ method_option :unsorted, :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
175
+ def disciples
176
+ follower_ids = collect_with_cursor do |cursor|
177
+ client.follower_ids(:cursor => cursor)
178
+ end
179
+ following_ids = collect_with_cursor do |cursor|
180
+ client.friend_ids(:cursor => cursor)
181
+ end
182
+ disciple_ids = (follower_ids - following_ids)
183
+ users = disciple_ids.in_groups_of(MAX_USERS_PER_REQUEST, false).threaded_map do |disciple_id_group|
184
+ retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
185
+ client.users(disciple_id_group, :include_entities => false)
186
+ end
187
+ end.flatten
188
+ print_user_list(users)
189
+ end
190
+
164
191
  desc "dm SCREEN_NAME MESSAGE", "Sends that person a Direct Message."
165
192
  def dm(screen_name, message)
166
193
  screen_name = screen_name.strip_ats
@@ -200,6 +227,7 @@ module T
200
227
  desc "follow SCREEN_NAME [SCREEN_NAME...]", "Allows you to start following users."
201
228
  def follow(screen_name, *screen_names)
202
229
  screen_names.unshift(screen_name)
230
+ screen_names.map!(&:strip_ats)
203
231
  screen_names.threaded_each do |screen_name|
204
232
  retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
205
233
  client.follow(screen_name, :include_entities => false)
@@ -329,7 +357,7 @@ module T
329
357
  method_option :location, :aliases => "-l", :type => :boolean, :default => false
330
358
  def reply(status_id, message)
331
359
  status_id = status_id.strip_commas
332
- status = client.status(status_id, :include_entities => false, :include_my_retweet => false, :trim_user => true)
360
+ status = client.status(status_id, :include_entities => false, :include_my_retweet => false)
333
361
  opts = {:in_reply_to_status_id => status.id, :include_entities => false, :trim_user => true}
334
362
  opts.merge!(:lat => location.lat, :long => location.lng) if options['location']
335
363
  reply = client.update("@#{status.user.screen_name} #{message}", opts)
@@ -341,6 +369,7 @@ module T
341
369
  desc "report_spam SCREEN_NAME [SCREEN_NAME...]", "Report users for spam."
342
370
  def report_spam(screen_name, *screen_names)
343
371
  screen_names.unshift(screen_name)
372
+ screen_names.map!(&:strip_ats)
344
373
  screen_names.threaded_each do |screen_name|
345
374
  screen_name.strip_ats
346
375
  retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
@@ -441,6 +470,7 @@ module T
441
470
  desc "unfollow SCREEN_NAME [SCREEN_NAME...]", "Allows you to stop following users."
442
471
  def unfollow(screen_name, *screen_names)
443
472
  screen_names.unshift(screen_name)
473
+ screen_names.map!(&:strip_ats)
444
474
  screen_names.threaded_each do |screen_name|
445
475
  retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
446
476
  client.unfollow(screen_name, :include_entities => false)
@@ -476,6 +506,7 @@ module T
476
506
  method_option :unsorted, :aliases => "-u", :type => :boolean, :default => false, :desc => "Output is not sorted."
477
507
  def users(screen_name, *screen_names)
478
508
  screen_names.unshift(screen_name)
509
+ screen_names.map!(&:strip_ats)
479
510
  users = client.users(screen_names, :include_entities => false)
480
511
  print_user_list(users)
481
512
  end
data/lib/t/delete.rb CHANGED
@@ -17,6 +17,7 @@ module T
17
17
  desc "block SCREEN_NAME [SCREEN_NAME...]", "Unblock users."
18
18
  def block(screen_name, *screen_names)
19
19
  screen_names.unshift(screen_name)
20
+ screen_names.map!(&:strip_ats)
20
21
  screen_names.threaded_each do |screen_name|
21
22
  screen_name.strip_ats
22
23
  retryable(:tries => 3, :on => Twitter::Error::ServerError, :sleep => 0) do
@@ -49,7 +50,7 @@ module T
49
50
  status_ids.each do |status_id|
50
51
  unless options['force']
51
52
  status = client.status(status_id, :include_entities => false, :include_my_retweet => false, :trim_user => true)
52
- return unless yes? "Are you sure you want to delete the favorite of @#{status.user.screen_name}'s status: \"#{status.text}\"? [y/N]"
53
+ return unless yes? "Are you sure you want to remove @#{status.user.screen_name}'s status: \"#{status.text}\" from your favorites? [y/N]"
53
54
  end
54
55
  status = client.unfavorite(status_id, :include_entities => false)
55
56
  say "@#{@rcfile.default_profile[0]} unfavorited @#{status.user.screen_name}'s status: \"#{status.text}\""
data/lib/t/list.rb CHANGED
@@ -65,6 +65,7 @@ module T
65
65
  def members(*args)
66
66
  list = args.pop
67
67
  owner = args.pop || @rcfile.default_profile[0]
68
+ owner = owner.strip_ats
68
69
  users = collect_with_cursor do |cursor|
69
70
  client.list_members(owner, list, :cursor => cursor, :include_entities => false, :skip_status => true)
70
71
  end
@@ -100,6 +101,7 @@ module T
100
101
  def timeline(*args)
101
102
  list = args.pop
102
103
  owner = args.pop || @rcfile.default_profile[0]
104
+ owner = owner.strip_ats
103
105
  per_page = options['number'] || DEFAULT_NUM_RESULTS
104
106
  statuses = client.list_timeline(owner, list, :include_entities => false, :per_page => per_page)
105
107
  print_status_list(statuses)
data/lib/t/printable.rb CHANGED
@@ -67,10 +67,10 @@ module T
67
67
  print_table(array)
68
68
  else
69
69
  if STDOUT.tty?
70
- print_in_columns(users.map(&:screen_name))
70
+ print_in_columns(users.map{|user| "@#{user.screen_name}"})
71
71
  else
72
72
  users.each do |user|
73
- say user.screen_name
73
+ say "@#{user.screen_name}"
74
74
  end
75
75
  end
76
76
  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
- 2
16
+ 3
17
17
  end
18
18
 
19
19
  # @return [String, NilClass]
data/spec/cli_spec.rb CHANGED
@@ -254,6 +254,112 @@ ID Posted at Screen name Text
254
254
  end
255
255
  end
256
256
 
257
+ describe "#disciples" do
258
+ before do
259
+ stub_get("/1/followers/ids.json").
260
+ with(:query => {:cursor => "-1"}).
261
+ to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
262
+ stub_get("/1/friends/ids.json").
263
+ with(:query => {:cursor => "-1"}).
264
+ to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
265
+ stub_get("/1/users/lookup.json").
266
+ with(:query => {:user_id => "213747670,428004849", :include_entities => "false"}).
267
+ to_return(:body => fixture("users.json"), :headers => {:content_type => "application/json; charset=utf-8"})
268
+ end
269
+ it "should request the correct resource" do
270
+ @cli.disciples
271
+ a_get("/1/followers/ids.json").
272
+ with(:query => {:cursor => "-1"}).
273
+ should have_been_made
274
+ a_get("/1/friends/ids.json").
275
+ with(:query => {:cursor => "-1"}).
276
+ should have_been_made
277
+ a_get("/1/users/lookup.json").
278
+ with(:query => {:user_id => "213747670,428004849", :include_entities => "false"}).
279
+ should have_been_made
280
+ end
281
+ it "should have the correct output" do
282
+ @cli.disciples
283
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
284
+ end
285
+ context "--created" do
286
+ before do
287
+ @cli.options = @cli.options.merge(:created => true)
288
+ end
289
+ it "should sort by the time when Twitter acount was created" do
290
+ @cli.disciples
291
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
292
+ end
293
+ end
294
+ context "--favorites" do
295
+ before do
296
+ @cli.options = @cli.options.merge(:favorites => true)
297
+ end
298
+ it "should sort by number of favorites" do
299
+ @cli.disciples
300
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
301
+ end
302
+ end
303
+ context "--followers" do
304
+ before do
305
+ @cli.options = @cli.options.merge(:followers => true)
306
+ end
307
+ it "should sort by number of followers" do
308
+ @cli.disciples
309
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
310
+ end
311
+ end
312
+ context "--friends" do
313
+ before do
314
+ @cli.options = @cli.options.merge(:friends => true)
315
+ end
316
+ it "should sort by number of friends" do
317
+ @cli.disciples
318
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
319
+ end
320
+ end
321
+ context "--listed" do
322
+ before do
323
+ @cli.options = @cli.options.merge(:listed => true)
324
+ end
325
+ it "should sort by number of list memberships" do
326
+ @cli.disciples
327
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
328
+ end
329
+ end
330
+ context "--long" do
331
+ before do
332
+ @cli.options = @cli.options.merge(:long => true)
333
+ end
334
+ it "should list in long format" do
335
+ @cli.disciples
336
+ $stdout.string.should == <<-eos
337
+ ID Since Tweets Favorites Listed Following Followers Screen name Name
338
+ 14,100,886 Mar 8 2008 3,913 32 185 1,871 2,767 @pengwynn Wynn Netherland
339
+ 7,505,382 Jul 16 2007 2,962 727 29 88 898 @sferik Erik Michaels-Ober
340
+ eos
341
+ end
342
+ end
343
+ context "--reverse" do
344
+ before do
345
+ @cli.options = @cli.options.merge(:reverse => true)
346
+ end
347
+ it "should reverse the order of the sort" do
348
+ @cli.disciples
349
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
350
+ end
351
+ end
352
+ context "--tweets" do
353
+ before do
354
+ @cli.options = @cli.options.merge(:tweets => true)
355
+ end
356
+ it "should sort by number of Tweets" do
357
+ @cli.disciples
358
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
359
+ end
360
+ end
361
+ end
362
+
257
363
  describe "#dm" do
258
364
  before do
259
365
  @cli.options = @cli.options.merge(:profile => fixture_path + "/.trc")
@@ -459,7 +565,7 @@ ID Posted at Screen name Text
459
565
  end
460
566
  it "should have the correct output" do
461
567
  @cli.followings
462
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
568
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
463
569
  end
464
570
  context "--created" do
465
571
  before do
@@ -467,7 +573,7 @@ ID Posted at Screen name Text
467
573
  end
468
574
  it "should sort by the time when Twitter acount was created" do
469
575
  @cli.followings
470
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
576
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
471
577
  end
472
578
  end
473
579
  context "--favorites" do
@@ -476,7 +582,7 @@ ID Posted at Screen name Text
476
582
  end
477
583
  it "should sort by number of favorites" do
478
584
  @cli.followings
479
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
585
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
480
586
  end
481
587
  end
482
588
  context "--followers" do
@@ -485,7 +591,7 @@ ID Posted at Screen name Text
485
591
  end
486
592
  it "should sort by number of followers" do
487
593
  @cli.followings
488
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
594
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
489
595
  end
490
596
  end
491
597
  context "--friends" do
@@ -494,7 +600,7 @@ ID Posted at Screen name Text
494
600
  end
495
601
  it "should sort by number of friends" do
496
602
  @cli.followings
497
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
603
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
498
604
  end
499
605
  end
500
606
  context "--listed" do
@@ -503,7 +609,7 @@ ID Posted at Screen name Text
503
609
  end
504
610
  it "should sort by number of list memberships" do
505
611
  @cli.followings
506
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
612
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
507
613
  end
508
614
  end
509
615
  context "--long" do
@@ -525,7 +631,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
525
631
  end
526
632
  it "should reverse the order of the sort" do
527
633
  @cli.followings
528
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
634
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
529
635
  end
530
636
  end
531
637
  context "--tweets" do
@@ -534,7 +640,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
534
640
  end
535
641
  it "should sort by number of Tweets" do
536
642
  @cli.followings
537
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
643
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
538
644
  end
539
645
  end
540
646
  end
@@ -559,7 +665,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
559
665
  end
560
666
  it "should have the correct output" do
561
667
  @cli.followers
562
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
668
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
563
669
  end
564
670
  context "--created" do
565
671
  before do
@@ -567,7 +673,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
567
673
  end
568
674
  it "should sort by the time when Twitter acount was created" do
569
675
  @cli.followers
570
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
676
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
571
677
  end
572
678
  end
573
679
  context "--favorites" do
@@ -576,7 +682,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
576
682
  end
577
683
  it "should sort by number of favorites" do
578
684
  @cli.followers
579
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
685
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
580
686
  end
581
687
  end
582
688
  context "--followers" do
@@ -585,7 +691,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
585
691
  end
586
692
  it "should sort by number of followers" do
587
693
  @cli.followers
588
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
694
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
589
695
  end
590
696
  end
591
697
  context "--friends" do
@@ -594,7 +700,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
594
700
  end
595
701
  it "should sort by number of friends" do
596
702
  @cli.followers
597
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
703
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
598
704
  end
599
705
  end
600
706
  context "--listed" do
@@ -603,7 +709,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
603
709
  end
604
710
  it "should sort by number of list memberships" do
605
711
  @cli.followers
606
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
712
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
607
713
  end
608
714
  end
609
715
  context "--long" do
@@ -625,7 +731,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
625
731
  end
626
732
  it "should reverse the order of the sort" do
627
733
  @cli.followers
628
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
734
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
629
735
  end
630
736
  end
631
737
  context "--tweets" do
@@ -634,7 +740,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
634
740
  end
635
741
  it "should sort by number of Tweets" do
636
742
  @cli.followers
637
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
743
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
638
744
  end
639
745
  end
640
746
  end
@@ -665,7 +771,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
665
771
  end
666
772
  it "should have the correct output" do
667
773
  @cli.friends
668
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
774
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
669
775
  end
670
776
  context "--created" do
671
777
  before do
@@ -673,7 +779,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
673
779
  end
674
780
  it "should sort by the time when Twitter acount was created" do
675
781
  @cli.friends
676
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
782
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
677
783
  end
678
784
  end
679
785
  context "--favorites" do
@@ -682,7 +788,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
682
788
  end
683
789
  it "should sort by number of favorites" do
684
790
  @cli.friends
685
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
791
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
686
792
  end
687
793
  end
688
794
  context "--followers" do
@@ -691,7 +797,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
691
797
  end
692
798
  it "should sort by number of followers" do
693
799
  @cli.friends
694
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
800
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
695
801
  end
696
802
  end
697
803
  context "--friends" do
@@ -700,7 +806,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
700
806
  end
701
807
  it "should sort by number of friends" do
702
808
  @cli.friends
703
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
809
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
704
810
  end
705
811
  end
706
812
  context "--listed" do
@@ -709,7 +815,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
709
815
  end
710
816
  it "should sort by number of list memberships" do
711
817
  @cli.friends
712
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
818
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
713
819
  end
714
820
  end
715
821
  context "--long" do
@@ -731,7 +837,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
731
837
  end
732
838
  it "should reverse the order of the sort" do
733
839
  @cli.friends
734
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
840
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
735
841
  end
736
842
  end
737
843
  context "--tweets" do
@@ -740,7 +846,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
740
846
  end
741
847
  it "should sort by number of Tweets" do
742
848
  @cli.friends
743
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
849
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
744
850
  end
745
851
  end
746
852
  end
@@ -771,7 +877,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
771
877
  end
772
878
  it "should have the correct output" do
773
879
  @cli.leaders
774
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
880
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
775
881
  end
776
882
  context "--created" do
777
883
  before do
@@ -779,7 +885,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
779
885
  end
780
886
  it "should sort by the time when Twitter acount was created" do
781
887
  @cli.leaders
782
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
888
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
783
889
  end
784
890
  end
785
891
  context "--favorites" do
@@ -788,7 +894,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
788
894
  end
789
895
  it "should sort by number of favorites" do
790
896
  @cli.leaders
791
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
897
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
792
898
  end
793
899
  end
794
900
  context "--followers" do
@@ -797,7 +903,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
797
903
  end
798
904
  it "should sort by number of followers" do
799
905
  @cli.leaders
800
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
906
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
801
907
  end
802
908
  end
803
909
  context "--friends" do
@@ -806,7 +912,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
806
912
  end
807
913
  it "should sort by number of friends" do
808
914
  @cli.leaders
809
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
915
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
810
916
  end
811
917
  end
812
918
  context "--listed" do
@@ -815,7 +921,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
815
921
  end
816
922
  it "should sort by number of list memberships" do
817
923
  @cli.leaders
818
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
924
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
819
925
  end
820
926
  end
821
927
  context "--long" do
@@ -837,7 +943,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
837
943
  end
838
944
  it "should reverse the order of the sort" do
839
945
  @cli.leaders
840
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
946
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
841
947
  end
842
948
  end
843
949
  context "--tweets" do
@@ -846,7 +952,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
846
952
  end
847
953
  it "should sort by number of Tweets" do
848
954
  @cli.leaders
849
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
955
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
850
956
  end
851
957
  end
852
958
  end
@@ -971,7 +1077,7 @@ ID Posted at Screen name Text
971
1077
  before do
972
1078
  @cli.options = @cli.options.merge(:profile => fixture_path + "/.trc", :location => true)
973
1079
  stub_get("/1/statuses/show/55709764298092545.json").
974
- with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
1080
+ with(:query => {:include_entities => "false", :include_my_retweet => "false"}).
975
1081
  to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
976
1082
  stub_post("/1/statuses/update.json").
977
1083
  with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :include_entities => "false", :trim_user => "true"}).
@@ -984,7 +1090,7 @@ ID Posted at Screen name Text
984
1090
  it "should request the correct resource" do
985
1091
  @cli.reply("55709764298092545", "Testing")
986
1092
  a_get("/1/statuses/show/55709764298092545.json").
987
- with(:query => {:include_entities => "false", :include_my_retweet => "false", :trim_user => "true"}).
1093
+ with(:query => {:include_entities => "false", :include_my_retweet => "false"}).
988
1094
  should have_been_made
989
1095
  a_post("/1/statuses/update.json").
990
1096
  with(:body => {:in_reply_to_status_id => "55709764298092545", :status => "@sferik Testing", :lat => "37.76969909668", :long => "-122.39330291748", :include_entities => "false", :trim_user => "true"}).
@@ -1217,7 +1323,7 @@ URL https://twitter.com/sferik/status/55709764298092545
1217
1323
  end
1218
1324
  it "should have the correct output" do
1219
1325
  @cli.suggest
1220
- $stdout.string.chomp.rstrip.should == "antpires jtrupiano maccman mlroach stuntmann82"
1326
+ $stdout.string.chomp.rstrip.should == "@antpires @jtrupiano @maccman @mlroach @stuntmann82"
1221
1327
  end
1222
1328
  context "--created" do
1223
1329
  before do
@@ -1225,7 +1331,7 @@ URL https://twitter.com/sferik/status/55709764298092545
1225
1331
  end
1226
1332
  it "should sort by the time when Twitter acount was created" do
1227
1333
  @cli.suggest
1228
- $stdout.string.chomp.rstrip.should == "maccman mlroach jtrupiano stuntmann82 antpires"
1334
+ $stdout.string.chomp.rstrip.should == "@maccman @mlroach @jtrupiano @stuntmann82 @antpires"
1229
1335
  end
1230
1336
  end
1231
1337
  context "--favorites" do
@@ -1234,7 +1340,7 @@ URL https://twitter.com/sferik/status/55709764298092545
1234
1340
  end
1235
1341
  it "should sort by number of favorites" do
1236
1342
  @cli.suggest
1237
- $stdout.string.chomp.rstrip.should == "stuntmann82 antpires maccman mlroach jtrupiano"
1343
+ $stdout.string.chomp.rstrip.should == "@stuntmann82 @antpires @maccman @mlroach @jtrupiano"
1238
1344
  end
1239
1345
  end
1240
1346
  context "--followers" do
@@ -1243,7 +1349,7 @@ URL https://twitter.com/sferik/status/55709764298092545
1243
1349
  end
1244
1350
  it "should sort by number of followers" do
1245
1351
  @cli.suggest
1246
- $stdout.string.chomp.rstrip.should == "stuntmann82 antpires mlroach jtrupiano maccman"
1352
+ $stdout.string.chomp.rstrip.should == "@stuntmann82 @antpires @mlroach @jtrupiano @maccman"
1247
1353
  end
1248
1354
  end
1249
1355
  context "--friends" do
@@ -1252,7 +1358,7 @@ URL https://twitter.com/sferik/status/55709764298092545
1252
1358
  end
1253
1359
  it "should sort by number of friends" do
1254
1360
  @cli.suggest
1255
- $stdout.string.chomp.rstrip.should == "stuntmann82 antpires mlroach jtrupiano maccman"
1361
+ $stdout.string.chomp.rstrip.should == "@stuntmann82 @antpires @mlroach @jtrupiano @maccman"
1256
1362
  end
1257
1363
  end
1258
1364
  context "--listed" do
@@ -1261,7 +1367,7 @@ URL https://twitter.com/sferik/status/55709764298092545
1261
1367
  end
1262
1368
  it "should sort by number of list memberships" do
1263
1369
  @cli.suggest
1264
- $stdout.string.chomp.rstrip.should == "stuntmann82 antpires mlroach jtrupiano maccman"
1370
+ $stdout.string.chomp.rstrip.should == "@stuntmann82 @antpires @mlroach @jtrupiano @maccman"
1265
1371
  end
1266
1372
  end
1267
1373
  context "--long" do
@@ -1300,7 +1406,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
1300
1406
  end
1301
1407
  it "should reverse the order of the sort" do
1302
1408
  @cli.suggest
1303
- $stdout.string.chomp.rstrip.should == "stuntmann82 mlroach maccman jtrupiano antpires"
1409
+ $stdout.string.chomp.rstrip.should == "@stuntmann82 @mlroach @maccman @jtrupiano @antpires"
1304
1410
  end
1305
1411
  end
1306
1412
  context "--tweets" do
@@ -1309,7 +1415,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
1309
1415
  end
1310
1416
  it "should sort by number of Tweets" do
1311
1417
  @cli.suggest
1312
- $stdout.string.chomp.rstrip.should == "stuntmann82 antpires jtrupiano maccman mlroach"
1418
+ $stdout.string.chomp.rstrip.should == "@stuntmann82 @antpires @jtrupiano @maccman @mlroach"
1313
1419
  end
1314
1420
  end
1315
1421
  end
@@ -1541,7 +1647,7 @@ ID Posted at Screen name Text
1541
1647
  end
1542
1648
  it "should have the correct output" do
1543
1649
  @cli.users("sferik", "pengwynn")
1544
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
1650
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
1545
1651
  end
1546
1652
  context "--created" do
1547
1653
  before do
@@ -1549,7 +1655,7 @@ ID Posted at Screen name Text
1549
1655
  end
1550
1656
  it "should sort by the time when Twitter acount was created" do
1551
1657
  @cli.users("sferik", "pengwynn")
1552
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
1658
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
1553
1659
  end
1554
1660
  end
1555
1661
  context "--favorites" do
@@ -1558,7 +1664,7 @@ ID Posted at Screen name Text
1558
1664
  end
1559
1665
  it "should sort by number of favorites" do
1560
1666
  @cli.users("sferik", "pengwynn")
1561
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
1667
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
1562
1668
  end
1563
1669
  end
1564
1670
  context "--followers" do
@@ -1567,7 +1673,7 @@ ID Posted at Screen name Text
1567
1673
  end
1568
1674
  it "should sort by number of followers" do
1569
1675
  @cli.users("sferik", "pengwynn")
1570
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
1676
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
1571
1677
  end
1572
1678
  end
1573
1679
  context "--friends" do
@@ -1576,7 +1682,7 @@ ID Posted at Screen name Text
1576
1682
  end
1577
1683
  it "should sort by number of friends" do
1578
1684
  @cli.users("sferik", "pengwynn")
1579
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
1685
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
1580
1686
  end
1581
1687
  end
1582
1688
  context "--listed" do
@@ -1585,7 +1691,7 @@ ID Posted at Screen name Text
1585
1691
  end
1586
1692
  it "should sort by number of list memberships" do
1587
1693
  @cli.users("sferik", "pengwynn")
1588
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
1694
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
1589
1695
  end
1590
1696
  end
1591
1697
  context "--long" do
@@ -1607,7 +1713,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
1607
1713
  end
1608
1714
  it "should reverse the order of the sort" do
1609
1715
  @cli.users("sferik", "pengwynn")
1610
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
1716
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
1611
1717
  end
1612
1718
  end
1613
1719
  context "--tweets" do
@@ -1616,7 +1722,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
1616
1722
  end
1617
1723
  it "should sort by number of Tweets" do
1618
1724
  @cli.users("sferik", "pengwynn")
1619
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
1725
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
1620
1726
  end
1621
1727
  end
1622
1728
  end
data/spec/delete_spec.rb CHANGED
@@ -126,7 +126,7 @@ describe T::Delete do
126
126
  to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
127
127
  end
128
128
  it "should request the correct resource" do
129
- $stdout.should_receive(:print).with("Are you sure you want to delete the favorite of @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
129
+ $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
130
130
  $stdin.should_receive(:gets).and_return("yes")
131
131
  @delete.favorite("28439861609")
132
132
  a_get("/1/statuses/show/28439861609.json").
@@ -138,7 +138,7 @@ describe T::Delete do
138
138
  end
139
139
  context "yes" do
140
140
  it "should have the correct output" do
141
- $stdout.should_receive(:print).with("Are you sure you want to delete the favorite of @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
141
+ $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
142
142
  $stdin.should_receive(:gets).and_return("yes")
143
143
  @delete.favorite("28439861609")
144
144
  $stdout.string.should =~ /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
@@ -146,7 +146,7 @@ describe T::Delete do
146
146
  end
147
147
  context "no" do
148
148
  it "should have the correct output" do
149
- $stdout.should_receive(:print).with("Are you sure you want to delete the favorite of @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
149
+ $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
150
150
  $stdin.should_receive(:gets).and_return("no")
151
151
  @delete.favorite("28439861609")
152
152
  $stdout.string.chomp.should be_empty
data/spec/list_spec.rb CHANGED
@@ -89,15 +89,15 @@ describe T::List do
89
89
  end
90
90
  it "should have the correct output" do
91
91
  @list.members("presidents")
92
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
92
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
93
93
  end
94
94
  context "--created" do
95
95
  before do
96
96
  @list.options = @list.options.merge(:created => true)
97
97
  end
98
- it "should sort by the time when Twitter acount was created" do
98
+ it "should sort by the time wshen Twitter account was created" do
99
99
  @list.members("presidents")
100
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
100
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
101
101
  end
102
102
  end
103
103
  context "--favorites" do
@@ -106,7 +106,7 @@ describe T::List do
106
106
  end
107
107
  it "should sort by number of favorites" do
108
108
  @list.members("presidents")
109
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
109
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
110
110
  end
111
111
  end
112
112
  context "--followers" do
@@ -115,7 +115,7 @@ describe T::List do
115
115
  end
116
116
  it "should sort by number of followers" do
117
117
  @list.members("presidents")
118
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
118
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
119
119
  end
120
120
  end
121
121
  context "--friends" do
@@ -124,7 +124,7 @@ describe T::List do
124
124
  end
125
125
  it "should sort by number of friends" do
126
126
  @list.members("presidents")
127
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
127
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
128
128
  end
129
129
  end
130
130
  context "--listed" do
@@ -133,7 +133,7 @@ describe T::List do
133
133
  end
134
134
  it "should sort by number of list memberships" do
135
135
  @list.members("presidents")
136
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
136
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
137
137
  end
138
138
  end
139
139
  context "--long" do
@@ -155,7 +155,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
155
155
  end
156
156
  it "should reverse the order of the sort" do
157
157
  @list.members("presidents")
158
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
158
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
159
159
  end
160
160
  end
161
161
  context "--tweets" do
@@ -164,7 +164,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
164
164
  end
165
165
  it "should sort by number of Tweets" do
166
166
  @list.members("presidents")
167
- $stdout.string.chomp.rstrip.should == "sferik pengwynn"
167
+ $stdout.string.chomp.rstrip.should == "@sferik @pengwynn"
168
168
  end
169
169
  end
170
170
  context "with a screen name passed" do
@@ -181,7 +181,7 @@ ID Since Tweets Favorites Listed Following Followers Scree
181
181
  end
182
182
  it "should have the correct output" do
183
183
  @list.members("presidents")
184
- $stdout.string.chomp.rstrip.should == "pengwynn sferik"
184
+ $stdout.string.chomp.rstrip.should == "@pengwynn @sferik"
185
185
  end
186
186
  end
187
187
  end
data/t.gemspec ADDED
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+ require File.expand_path("../lib/t/version", __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.add_dependency 'actionpack', ['>= 2.3.11', '< 4']
6
+ gem.add_dependency 'activesupport', ['>= 2.3.11', '< 4']
7
+ gem.add_dependency 'launchy', '~> 2.0'
8
+ gem.add_dependency 'geokit', '~> 1.6'
9
+ gem.add_dependency 'highline', '~> 1.6'
10
+ gem.add_dependency 'json', '~> 1.6'
11
+ gem.add_dependency 'oauth', '~> 0.4'
12
+ gem.add_dependency 'retryable', '~> 1.2'
13
+ gem.add_dependency 'thor', '~> 0.15.0.rc2'
14
+ gem.add_dependency 'twitter', ['~> 2.2', '>= 2.2.3']
15
+ gem.add_development_dependency 'pry'
16
+ gem.add_development_dependency 'rake'
17
+ gem.add_development_dependency 'rspec'
18
+ gem.add_development_dependency 'simplecov'
19
+ gem.add_development_dependency 'timecop'
20
+ gem.add_development_dependency 'webmock'
21
+ gem.author = "Erik Michaels-Ober"
22
+ gem.bindir = 'bin'
23
+ gem.description = %q{A command-line power tool for Twitter.}
24
+ gem.email = 'sferik@gmail.com'
25
+ gem.executables = %w(t)
26
+ gem.files = %w(LICENSE.md README.md Rakefile t.gemspec)
27
+ gem.files += Dir.glob("lib/**/*.rb")
28
+ gem.files += Dir.glob("bin/**/*")
29
+ gem.files += Dir.glob("spec/**/*")
30
+ gem.homepage = 'http://github.com/sferik/t'
31
+ gem.name = 't'
32
+ gem.require_paths = ['lib']
33
+ gem.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if gem.respond_to? :required_rubygems_version=
34
+ gem.summary = %q{CLI for Twitter}
35
+ gem.test_files = Dir.glob("spec/**/*")
36
+ gem.version = T::Version.to_s
37
+ end
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.6.2
4
+ version: 0.6.3
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-04-24 00:00:00.000000000 Z
12
+ date: 2012-04-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -295,6 +295,7 @@ files:
295
295
  - LICENSE.md
296
296
  - README.md
297
297
  - Rakefile
298
+ - t.gemspec
298
299
  - bin/t
299
300
  - lib/t/cli.rb
300
301
  - lib/t/collectable.rb