t 0.2.0 → 0.2.1
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/t/cli.rb +6 -6
- data/lib/t/cli/follow.rb +4 -5
- data/lib/t/cli/follow/all.rb +7 -9
- data/lib/t/cli/list.rb +1 -1
- data/lib/t/cli/list/remove.rb +2 -2
- data/lib/t/cli/list/remove/all.rb +5 -4
- data/lib/t/cli/unfollow.rb +4 -5
- data/lib/t/cli/unfollow/all.rb +33 -7
- data/lib/t/core_ext/enumerable.rb +13 -0
- data/lib/t/version.rb +1 -1
- data/spec/cli/follow/all_spec.rb +2 -3
- data/spec/cli/follow_spec.rb +1 -26
- data/spec/cli/unfollow/all_spec.rb +72 -3
- data/spec/cli/unfollow_spec.rb +1 -26
- metadata +32 -31
data/lib/t/cli.rb
CHANGED
@@ -88,7 +88,7 @@ module T
|
|
88
88
|
desc "direct_messages", "Returns the 20 most recent Direct Messages sent to you."
|
89
89
|
def direct_messages
|
90
90
|
run_pager
|
91
|
-
client.direct_messages(:include_entities => false).
|
91
|
+
client.direct_messages(:include_entities => false).each do |direct_message|
|
92
92
|
say "#{direct_message.sender.screen_name.rjust(20)}: #{direct_message.text} (#{time_ago_in_words(direct_message.created_at)} ago)"
|
93
93
|
end
|
94
94
|
end
|
@@ -132,7 +132,7 @@ module T
|
|
132
132
|
timeline = client.favorites(hash)
|
133
133
|
timeline.reverse! if options['reverse']
|
134
134
|
run_pager
|
135
|
-
timeline.
|
135
|
+
timeline.each do |status|
|
136
136
|
say "#{status.user.screen_name.rjust(20)}: #{status.text} (#{time_ago_in_words(status.created_at)} ago)"
|
137
137
|
end
|
138
138
|
end
|
@@ -158,7 +158,7 @@ module T
|
|
158
158
|
timeline = client.mentions(hash)
|
159
159
|
timeline.reverse! if options['reverse']
|
160
160
|
run_pager
|
161
|
-
timeline.
|
161
|
+
timeline.each do |status|
|
162
162
|
say "#{status.user.screen_name.rjust(20)}: #{status.text} (#{time_ago_in_words(status.created_at)} ago)"
|
163
163
|
end
|
164
164
|
end
|
@@ -215,7 +215,7 @@ module T
|
|
215
215
|
timeline = client.search(query, hash)
|
216
216
|
timeline.reverse! if options['reverse']
|
217
217
|
run_pager
|
218
|
-
timeline.
|
218
|
+
timeline.each do |status|
|
219
219
|
say "#{status.from_user.rjust(20)}: #{status.text} (#{time_ago_in_words(status.created_at)} ago)"
|
220
220
|
end
|
221
221
|
end
|
@@ -223,7 +223,7 @@ module T
|
|
223
223
|
desc "sent_messages", "Returns the 20 most recent Direct Messages sent to you."
|
224
224
|
def sent_messages
|
225
225
|
run_pager
|
226
|
-
client.direct_messages_sent(:include_entities => false).
|
226
|
+
client.direct_messages_sent(:include_entities => false).each do |direct_message|
|
227
227
|
say "#{direct_message.recipient.screen_name.rjust(20)}: #{direct_message.text} (#{time_ago_in_words(direct_message.created_at)} ago)"
|
228
228
|
end
|
229
229
|
end
|
@@ -275,7 +275,7 @@ module T
|
|
275
275
|
timeline = client.home_timeline(hash)
|
276
276
|
timeline.reverse! if options['reverse']
|
277
277
|
run_pager
|
278
|
-
timeline.
|
278
|
+
timeline.each do |status|
|
279
279
|
say "#{status.user.screen_name.rjust(20)}: #{status.text} (#{time_ago_in_words(status.created_at)} ago)"
|
280
280
|
end
|
281
281
|
end
|
data/lib/t/cli/follow.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 't/core_ext/enumerable'
|
1
2
|
require 't/core_ext/string'
|
2
3
|
require 't/rcfile'
|
3
4
|
require 'thor'
|
@@ -19,13 +20,11 @@ module T
|
|
19
20
|
desc "users SCREEN_NAME [SCREEN_NAME...]", "Allows you to start following users."
|
20
21
|
def users(screen_name, *screen_names)
|
21
22
|
screen_names.unshift(screen_name)
|
22
|
-
|
23
|
+
screen_names.threaded_map do |screen_name|
|
23
24
|
screen_name = screen_name.strip_at
|
24
|
-
|
25
|
-
say "@#{@rcfile.default_profile[0]} is now following @#{user.screen_name}."
|
26
|
-
user
|
25
|
+
client.follow(screen_name, :include_entities => false)
|
27
26
|
end
|
28
|
-
number =
|
27
|
+
number = screen_names.length
|
29
28
|
say "@#{@rcfile.default_profile[0]} is now following #{number} more #{number == 1 ? 'user' : 'users'}."
|
30
29
|
say
|
31
30
|
say "Run `#{$0} unfollow users #{screen_names.join(' ')}` to stop."
|
data/lib/t/cli/follow/all.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 't/core_ext/enumerable'
|
1
2
|
require 't/rcfile'
|
2
3
|
require 'thor'
|
3
4
|
require 'twitter'
|
@@ -34,16 +35,14 @@ module T
|
|
34
35
|
end
|
35
36
|
follow_ids = (follower_ids - friend_ids)
|
36
37
|
number = follow_ids.length
|
37
|
-
return say "@#{@rcfile.default_profile[0]} is already following all
|
38
|
+
return say "@#{@rcfile.default_profile[0]} is already following all followers." if number.zero?
|
38
39
|
return unless yes? "Are you sure you want to follow #{number} #{number == 1 ? 'user' : 'users'}?"
|
39
|
-
screen_names = follow_ids.
|
40
|
-
|
41
|
-
say "@#{@rcfile.default_profile[0]} is now following @#{user.screen_name}."
|
42
|
-
user.screen_name
|
40
|
+
screen_names = follow_ids.threaded_map do |follow_id|
|
41
|
+
client.follow(follow_id, :include_entities => false)
|
43
42
|
end
|
44
43
|
say "@#{@rcfile.default_profile[0]} is now following #{number} more #{number == 1 ? 'user' : 'users'}."
|
45
44
|
say
|
46
|
-
say "Run `#{$0} unfollow
|
45
|
+
say "Run `#{$0} unfollow all followers` to stop."
|
47
46
|
end
|
48
47
|
|
49
48
|
desc "listed LIST_NAME", "Follow all members of a list."
|
@@ -58,9 +57,8 @@ module T
|
|
58
57
|
number = list_member_collection.length
|
59
58
|
return say "@#{@rcfile.default_profile[0]} is already following all list members." if number.zero?
|
60
59
|
return unless yes? "Are you sure you want to follow #{number} #{number == 1 ? 'user' : 'users'}?"
|
61
|
-
list_member_collection.
|
62
|
-
|
63
|
-
say "@#{@rcfile.default_profile[0]} is now following @#{user.screen_name}."
|
60
|
+
list_member_collection.threaded_map do |list_member|
|
61
|
+
client.follow(list_member.id, :include_entities => false)
|
64
62
|
end
|
65
63
|
say "@#{@rcfile.default_profile[0]} is now following #{number} more #{number == 1 ? 'user' : 'users'}."
|
66
64
|
say
|
data/lib/t/cli/list.rb
CHANGED
@@ -36,7 +36,7 @@ module T
|
|
36
36
|
timeline = client.list_timeline(list_name, hash)
|
37
37
|
timeline.reverse! if options['reverse']
|
38
38
|
run_pager
|
39
|
-
timeline.
|
39
|
+
timeline.each do |status|
|
40
40
|
say "#{status.user.screen_name.rjust(20)}: #{status.text} (#{time_ago_in_words(status.created_at)} ago)"
|
41
41
|
end
|
42
42
|
end
|
data/lib/t/cli/list/remove.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 't/core_ext/enumerable'
|
1
2
|
require 't/core_ext/string'
|
2
3
|
require 't/rcfile'
|
3
4
|
require 'thor'
|
@@ -20,10 +21,9 @@ module T
|
|
20
21
|
desc "users LIST_NAME SCREEN_NAME [SCREEN_NAME...]", "Remove users from a list."
|
21
22
|
def users(list_name, screen_name, *screen_names)
|
22
23
|
screen_names.unshift(screen_name)
|
23
|
-
screen_names.
|
24
|
+
screen_names.threaded_map do |screen_name|
|
24
25
|
screen_name = screen_name.strip_at
|
25
26
|
client.list_remove_member(list_name, screen_name)
|
26
|
-
say "@#{@rcfile.default_profile[0]} removed @#{screen_name} from the list \"#{list_name}\"."
|
27
27
|
end
|
28
28
|
number = screen_names.length
|
29
29
|
say "@#{@rcfile.default_profile[0]} removed #{number} #{number == 1 ? 'user' : 'users'} from the list \"#{list_name}\"."
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 't/core_ext/enumerable'
|
1
2
|
require 't/rcfile'
|
2
3
|
require 'thor'
|
3
4
|
require 'twitter'
|
@@ -40,7 +41,7 @@ module T
|
|
40
41
|
else
|
41
42
|
return unless yes? "Are you sure you want to remove #{number} #{number == 1 ? 'friend' : 'friends'} from the list \"#{list_name}\"?"
|
42
43
|
end
|
43
|
-
list_member_ids_to_remove.
|
44
|
+
list_member_ids_to_remove.threaded_map do |list_member_id|
|
44
45
|
client.list_remove_member(list_name, list_member_id)
|
45
46
|
end
|
46
47
|
say "@#{@rcfile.default_profile[0]} removed #{number} #{number == 1 ? 'friend' : 'friends'} from the list \"#{list_name}\"."
|
@@ -71,7 +72,7 @@ module T
|
|
71
72
|
else
|
72
73
|
return unless yes? "Are you sure you want to remove #{number} #{number == 1 ? 'follower' : 'followers'} from the list \"#{list_name}\"?"
|
73
74
|
end
|
74
|
-
list_member_ids_to_remove.
|
75
|
+
list_member_ids_to_remove.threaded_map do |list_member_id|
|
75
76
|
client.list_remove_member(list_name, list_member_id)
|
76
77
|
end
|
77
78
|
say "@#{@rcfile.default_profile[0]} removed #{number} #{number == 1 ? 'follower' : 'followers'} from the list \"#{list_name}\"."
|
@@ -102,7 +103,7 @@ module T
|
|
102
103
|
else
|
103
104
|
return unless yes? "Are you sure you want to remove #{number} #{number == 1 ? 'member' : 'members'} from the list \"#{to_list_name}\"?"
|
104
105
|
end
|
105
|
-
list_member_ids_to_remove.
|
106
|
+
list_member_ids_to_remove.threaded_map do |list_member_id|
|
106
107
|
client.list_remove_member(to_list_name, list_member_id)
|
107
108
|
end
|
108
109
|
say "@#{@rcfile.default_profile[0]} removed #{number} #{number == 1 ? 'member' : 'members'} from the list \"#{to_list_name}\"."
|
@@ -122,7 +123,7 @@ module T
|
|
122
123
|
number = list_member_ids.length
|
123
124
|
return say "The list \"#{list_name}\" doesn't have any members." if number.zero?
|
124
125
|
return unless yes? "Are you sure you want to remove #{number} #{number == 1 ? 'member' : 'members'} from the list \"#{list_name}\"?"
|
125
|
-
list_member_ids.
|
126
|
+
list_member_ids.threaded_map do |list_member_id|
|
126
127
|
client.list_remove_member(list_name, list_member_id)
|
127
128
|
end
|
128
129
|
say "@#{@rcfile.default_profile[0]} removed #{number} #{number == 1 ? 'member' : 'members'} from the list \"#{list_name}\"."
|
data/lib/t/cli/unfollow.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 't/core_ext/enumerable'
|
1
2
|
require 't/core_ext/string'
|
2
3
|
require 't/rcfile'
|
3
4
|
require 'thor'
|
@@ -19,13 +20,11 @@ module T
|
|
19
20
|
desc "users SCREEN_NAME [SCREEN_NAME...]", "Allows you to stop following users."
|
20
21
|
def users(screen_name, *screen_names)
|
21
22
|
screen_names.unshift(screen_name)
|
22
|
-
|
23
|
+
screen_names.threaded_map do |screen_name|
|
23
24
|
screen_name = screen_name.strip_at
|
24
|
-
|
25
|
-
say "@#{@rcfile.default_profile[0]} is no longer following @#{user.screen_name}."
|
26
|
-
user
|
25
|
+
client.unfollow(screen_name, :include_entities => false)
|
27
26
|
end
|
28
|
-
number =
|
27
|
+
number = screen_names.length
|
29
28
|
say "@#{@rcfile.default_profile[0]} is no longer following #{number} #{number == 1 ? 'user' : 'users'}."
|
30
29
|
say
|
31
30
|
say "Run `#{$0} follow users #{screen_names.join(' ')}` to follow again."
|
data/lib/t/cli/unfollow/all.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 't/core_ext/enumerable'
|
1
2
|
require 't/rcfile'
|
2
3
|
require 'thor'
|
3
4
|
require 'twitter'
|
@@ -28,15 +29,42 @@ module T
|
|
28
29
|
number = list_member_collection.length
|
29
30
|
return say "@#{@rcfile.default_profile[0]} is already not following any list members." if number.zero?
|
30
31
|
return unless yes? "Are you sure you want to unfollow #{number} #{number == 1 ? 'user' : 'users'}?"
|
31
|
-
list_member_collection.
|
32
|
-
|
33
|
-
say "@#{@rcfile.default_profile[0]} is no longer following @#{user.screen_name}."
|
32
|
+
list_member_collection.threaded_map do |list_member|
|
33
|
+
client.unfollow(list_member.id, :include_entities => false)
|
34
34
|
end
|
35
35
|
say "@#{@rcfile.default_profile[0]} is no longer following #{number} #{number == 1 ? 'user' : 'users'}."
|
36
36
|
say
|
37
37
|
say "Run `#{$0} follow all listed #{list_name}` to follow again."
|
38
38
|
end
|
39
39
|
|
40
|
+
desc "followers", "Unfollow all followers."
|
41
|
+
def followers
|
42
|
+
follower_ids = []
|
43
|
+
cursor = -1
|
44
|
+
until cursor == 0
|
45
|
+
followers = client.follower_ids(:cursor => cursor)
|
46
|
+
follower_ids += followers.ids
|
47
|
+
cursor = followers.next_cursor
|
48
|
+
end
|
49
|
+
friend_ids = []
|
50
|
+
cursor = -1
|
51
|
+
until cursor == 0
|
52
|
+
friends = client.friend_ids(:cursor => cursor)
|
53
|
+
friend_ids += friends.ids
|
54
|
+
cursor = friends.next_cursor
|
55
|
+
end
|
56
|
+
follow_ids = (follower_ids - friend_ids)
|
57
|
+
number = follow_ids.length
|
58
|
+
return say "@#{@rcfile.default_profile[0]} is already not following any followers." if number.zero?
|
59
|
+
return unless yes? "Are you sure you want to unfollow #{number} #{number == 1 ? 'user' : 'users'}?"
|
60
|
+
screen_names = follow_ids.threaded_map do |follow_id|
|
61
|
+
client.unfollow(follow_id, :include_entities => false)
|
62
|
+
end
|
63
|
+
say "@#{@rcfile.default_profile[0]} is no longer following #{number} #{number == 1 ? 'user' : 'users'}."
|
64
|
+
say
|
65
|
+
say "Run `#{$0} follow all followers` to stop."
|
66
|
+
end
|
67
|
+
|
40
68
|
desc "nonfollowers", "Unfollow all non-followers."
|
41
69
|
def nonfollowers
|
42
70
|
friend_ids = []
|
@@ -57,9 +85,8 @@ module T
|
|
57
85
|
number = unfollow_ids.length
|
58
86
|
return say "@#{@rcfile.default_profile[0]} is already not following any non-followers." if number.zero?
|
59
87
|
return unless yes? "Are you sure you want to unfollow #{number} #{number == 1 ? 'user' : 'users'}?"
|
60
|
-
screen_names = unfollow_ids.
|
88
|
+
screen_names = unfollow_ids.threaded_map do |unfollow_id|
|
61
89
|
user = client.unfollow(unfollow_id, :include_entities => false)
|
62
|
-
say "@#{@rcfile.default_profile[0]} is no longer following @#{user.screen_name}."
|
63
90
|
user.screen_name
|
64
91
|
end
|
65
92
|
say "@#{@rcfile.default_profile[0]} is no longer following #{number} #{number == 1 ? 'user' : 'users'}."
|
@@ -79,9 +106,8 @@ module T
|
|
79
106
|
number = friend_ids.length
|
80
107
|
return say "@#{@rcfile.default_profile[0]} is already not following anyone." if number.zero?
|
81
108
|
return unless yes? "Are you sure you want to unfollow #{number} #{number == 1 ? 'user' : 'users'}?"
|
82
|
-
screen_names = friend_ids.
|
109
|
+
screen_names = friend_ids.threaded_map do |friend_id|
|
83
110
|
user = client.unfollow(friend_id, :include_entities => false)
|
84
|
-
say "@#{@rcfile.default_profile[0]} is no longer following @#{user.screen_name}."
|
85
111
|
user.screen_name
|
86
112
|
end
|
87
113
|
say "@#{@rcfile.default_profile[0]} is no longer following #{number} #{number == 1 ? 'user' : 'users'}."
|
data/lib/t/version.rb
CHANGED
data/spec/cli/follow/all_spec.rb
CHANGED
@@ -40,7 +40,7 @@ describe T::CLI::Follow::All do
|
|
40
40
|
end
|
41
41
|
it "should have the correct output" do
|
42
42
|
@t.follow("all", "followers")
|
43
|
-
$stdout.string.chomp.should == "@testcli is already following all
|
43
|
+
$stdout.string.chomp.should == "@testcli is already following all followers."
|
44
44
|
end
|
45
45
|
end
|
46
46
|
context "one user" do
|
@@ -74,7 +74,7 @@ describe T::CLI::Follow::All do
|
|
74
74
|
$stdout.should_receive(:print).with("Are you sure you want to follow 1 user? ")
|
75
75
|
$stdin.should_receive(:gets).and_return("yes")
|
76
76
|
@t.follow("all", "followers")
|
77
|
-
$stdout.string.should =~ /^@testcli is now following
|
77
|
+
$stdout.string.should =~ /^@testcli is now following 1 more user\.$/
|
78
78
|
end
|
79
79
|
end
|
80
80
|
context "no" do
|
@@ -141,7 +141,6 @@ describe T::CLI::Follow::All do
|
|
141
141
|
$stdout.should_receive(:print).with("Are you sure you want to follow 1 user? ")
|
142
142
|
$stdin.should_receive(:gets).and_return("yes")
|
143
143
|
@t.follow("all", "listed", "presidents")
|
144
|
-
$stdout.string.should =~ /^@testcli is now following @sferik\.$/
|
145
144
|
$stdout.string.should =~ /^@testcli is now following 1 more user\.$/
|
146
145
|
end
|
147
146
|
end
|
data/spec/cli/follow_spec.rb
CHANGED
@@ -41,32 +41,7 @@ describe T::CLI::Follow do
|
|
41
41
|
end
|
42
42
|
it "should have the correct output" do
|
43
43
|
@t.follow("users", "sferik")
|
44
|
-
$stdout.string.should =~ /^@testcli is now following
|
45
|
-
end
|
46
|
-
end
|
47
|
-
context "two users" do
|
48
|
-
before do
|
49
|
-
stub_post("/1/friendships/create.json").
|
50
|
-
with(:body => {:screen_name => "sferik", :include_entities => "false"}).
|
51
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
52
|
-
stub_post("/1/friendships/create.json").
|
53
|
-
with(:body => {:screen_name => "gem", :include_entities => "false"}).
|
54
|
-
to_return(:body => fixture("gem.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
55
|
-
end
|
56
|
-
it "should request the correct resource" do
|
57
|
-
@t.follow("users", "sferik", "gem")
|
58
|
-
a_post("/1/friendships/create.json").
|
59
|
-
with(:body => {:screen_name => "sferik", :include_entities => "false"}).
|
60
|
-
should have_been_made
|
61
|
-
a_post("/1/friendships/create.json").
|
62
|
-
with(:body => {:screen_name => "gem", :include_entities => "false"}).
|
63
|
-
should have_been_made
|
64
|
-
end
|
65
|
-
it "should have the correct output" do
|
66
|
-
@t.follow("users", "sferik", "gem")
|
67
|
-
$stdout.string.should =~ /^@testcli is now following @sferik\.$/
|
68
|
-
$stdout.string.should =~ /^@testcli is now following @gem\.$/
|
69
|
-
$stdout.string.should =~ /^@testcli is now following 2 more users\.$/
|
44
|
+
$stdout.string.should =~ /^@testcli is now following 1 more user\.$/
|
70
45
|
end
|
71
46
|
end
|
72
47
|
end
|
@@ -69,7 +69,6 @@ describe T::CLI::Unfollow::All do
|
|
69
69
|
$stdout.should_receive(:print).with("Are you sure you want to unfollow 1 user? ")
|
70
70
|
$stdin.should_receive(:gets).and_return("yes")
|
71
71
|
@t.unfollow("all", "listed", "presidents")
|
72
|
-
$stdout.string.should =~ /^@testcli is no longer following @sferik\.$/
|
73
72
|
$stdout.string.should =~ /^@testcli is no longer following 1 user\.$/
|
74
73
|
end
|
75
74
|
end
|
@@ -84,6 +83,78 @@ describe T::CLI::Unfollow::All do
|
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
86
|
+
describe "#followers" do
|
87
|
+
before do
|
88
|
+
@t.options = @t.options.merge(:profile => fixture_path + "/.trc")
|
89
|
+
end
|
90
|
+
context "no users" do
|
91
|
+
before do
|
92
|
+
stub_get("/1/followers/ids.json").
|
93
|
+
with(:query => {:cursor => "-1"}).
|
94
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
95
|
+
stub_get("/1/friends/ids.json").
|
96
|
+
with(:query => {:cursor => "-1"}).
|
97
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
98
|
+
end
|
99
|
+
it "should request the correct resource" do
|
100
|
+
@t.unfollow("all", "followers")
|
101
|
+
a_get("/1/followers/ids.json").
|
102
|
+
with(:query => {:cursor => "-1"}).
|
103
|
+
should have_been_made
|
104
|
+
a_get("/1/friends/ids.json").
|
105
|
+
with(:query => {:cursor => "-1"}).
|
106
|
+
should have_been_made
|
107
|
+
end
|
108
|
+
it "should have the correct output" do
|
109
|
+
@t.unfollow("all", "followers")
|
110
|
+
$stdout.string.chomp.should == "@testcli is already not following any followers."
|
111
|
+
end
|
112
|
+
end
|
113
|
+
context "one user" do
|
114
|
+
before do
|
115
|
+
stub_get("/1/followers/ids.json").
|
116
|
+
with(:query => {:cursor => "-1"}).
|
117
|
+
to_return(:body => fixture("friends_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
118
|
+
stub_get("/1/friends/ids.json").
|
119
|
+
with(:query => {:cursor => "-1"}).
|
120
|
+
to_return(:body => fixture("followers_ids.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
121
|
+
stub_delete("/1/friendships/destroy.json").
|
122
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
123
|
+
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
124
|
+
end
|
125
|
+
it "should request the correct resource" do
|
126
|
+
$stdout.should_receive(:print).with("Are you sure you want to unfollow 1 user? ")
|
127
|
+
$stdin.should_receive(:gets).and_return("yes")
|
128
|
+
@t.unfollow("all", "followers")
|
129
|
+
a_get("/1/followers/ids.json").
|
130
|
+
with(:query => {:cursor => "-1"}).
|
131
|
+
should have_been_made
|
132
|
+
a_get("/1/friends/ids.json").
|
133
|
+
with(:query => {:cursor => "-1"}).
|
134
|
+
should have_been_made
|
135
|
+
a_delete("/1/friendships/destroy.json").
|
136
|
+
with(:query => {:user_id => "7505382", :include_entities => "false"}).
|
137
|
+
should have_been_made
|
138
|
+
end
|
139
|
+
context "yes" do
|
140
|
+
it "should have the correct output" do
|
141
|
+
$stdout.should_receive(:print).with("Are you sure you want to unfollow 1 user? ")
|
142
|
+
$stdin.should_receive(:gets).and_return("yes")
|
143
|
+
@t.unfollow("all", "followers")
|
144
|
+
$stdout.string.should =~ /^@testcli is no longer following 1 user\.$/
|
145
|
+
end
|
146
|
+
end
|
147
|
+
context "no" do
|
148
|
+
it "should have the correct output" do
|
149
|
+
$stdout.should_receive(:print).with("Are you sure you want to unfollow 1 user? ")
|
150
|
+
$stdin.should_receive(:gets).and_return("no")
|
151
|
+
@t.unfollow("all", "followers")
|
152
|
+
$stdout.string.chomp.should == ""
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
87
158
|
describe "#nonfollowers" do
|
88
159
|
before do
|
89
160
|
@t.options = @t.options.merge(:profile => fixture_path + "/.trc")
|
@@ -143,7 +214,6 @@ describe T::CLI::Unfollow::All do
|
|
143
214
|
$stdout.should_receive(:print).with("Are you sure you want to unfollow 1 user? ")
|
144
215
|
$stdin.should_receive(:gets).and_return("yes")
|
145
216
|
@t.unfollow("all", "nonfollowers")
|
146
|
-
$stdout.string.should =~ /^@testcli is no longer following @sferik\.$/
|
147
217
|
$stdout.string.should =~ /^@testcli is no longer following 1 user\.$/
|
148
218
|
end
|
149
219
|
end
|
@@ -205,7 +275,6 @@ describe T::CLI::Unfollow::All do
|
|
205
275
|
$stdout.should_receive(:print).with("Are you sure you want to unfollow 1 user? ")
|
206
276
|
$stdin.should_receive(:gets).and_return("yes")
|
207
277
|
@t.unfollow("all", "users")
|
208
|
-
$stdout.string.should =~ /^@testcli is no longer following @sferik\.$/
|
209
278
|
$stdout.string.should =~ /^@testcli is no longer following 1 user\.$/
|
210
279
|
end
|
211
280
|
end
|
data/spec/cli/unfollow_spec.rb
CHANGED
@@ -41,32 +41,7 @@ describe T::CLI::Unfollow do
|
|
41
41
|
end
|
42
42
|
it "should have the correct output" do
|
43
43
|
@t.unfollow("users", "sferik")
|
44
|
-
$stdout.string.should =~ /^@testcli is no longer following
|
45
|
-
end
|
46
|
-
end
|
47
|
-
context "two users" do
|
48
|
-
before do
|
49
|
-
stub_delete("/1/friendships/destroy.json").
|
50
|
-
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
|
51
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
52
|
-
stub_delete("/1/friendships/destroy.json").
|
53
|
-
with(:query => {:screen_name => "gem", :include_entities => "false"}).
|
54
|
-
to_return(:body => fixture("gem.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
55
|
-
end
|
56
|
-
it "should request the correct resource" do
|
57
|
-
@t.unfollow("users", "sferik", "gem")
|
58
|
-
a_delete("/1/friendships/destroy.json").
|
59
|
-
with(:query => {:screen_name => "sferik", :include_entities => "false"}).
|
60
|
-
should have_been_made
|
61
|
-
a_delete("/1/friendships/destroy.json").
|
62
|
-
with(:query => {:screen_name => "gem", :include_entities => "false"}).
|
63
|
-
should have_been_made
|
64
|
-
end
|
65
|
-
it "should have the correct output" do
|
66
|
-
@t.unfollow("users", "sferik", "gem")
|
67
|
-
$stdout.string.should =~ /^@testcli is no longer following @sferik\.$/
|
68
|
-
$stdout.string.should =~ /^@testcli is no longer following @gem\.$/
|
69
|
-
$stdout.string.should =~ /^@testcli is no longer following 2 users\.$/
|
44
|
+
$stdout.string.should =~ /^@testcli is no longer following 1 user\.$/
|
70
45
|
end
|
71
46
|
end
|
72
47
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-26 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
16
|
-
requirement: &
|
16
|
+
requirement: &70204403301640 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -24,10 +24,10 @@ dependencies:
|
|
24
24
|
version: '4'
|
25
25
|
type: :runtime
|
26
26
|
prerelease: false
|
27
|
-
version_requirements: *
|
27
|
+
version_requirements: *70204403301640
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: activesupport
|
30
|
-
requirement: &
|
30
|
+
requirement: &70204403297120 !ruby/object:Gem::Requirement
|
31
31
|
none: false
|
32
32
|
requirements:
|
33
33
|
- - ! '>='
|
@@ -38,10 +38,10 @@ dependencies:
|
|
38
38
|
version: '4'
|
39
39
|
type: :runtime
|
40
40
|
prerelease: false
|
41
|
-
version_requirements: *
|
41
|
+
version_requirements: *70204403297120
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: launchy
|
44
|
-
requirement: &
|
44
|
+
requirement: &70204403293700 !ruby/object:Gem::Requirement
|
45
45
|
none: false
|
46
46
|
requirements:
|
47
47
|
- - ~>
|
@@ -49,10 +49,10 @@ dependencies:
|
|
49
49
|
version: '2.0'
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
|
-
version_requirements: *
|
52
|
+
version_requirements: *70204403293700
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: geokit
|
55
|
-
requirement: &
|
55
|
+
requirement: &70204403292200 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
58
|
- - ~>
|
@@ -60,10 +60,10 @@ dependencies:
|
|
60
60
|
version: '1.6'
|
61
61
|
type: :runtime
|
62
62
|
prerelease: false
|
63
|
-
version_requirements: *
|
63
|
+
version_requirements: *70204403292200
|
64
64
|
- !ruby/object:Gem::Dependency
|
65
65
|
name: oauth
|
66
|
-
requirement: &
|
66
|
+
requirement: &70204403290620 !ruby/object:Gem::Requirement
|
67
67
|
none: false
|
68
68
|
requirements:
|
69
69
|
- - ~>
|
@@ -71,10 +71,10 @@ dependencies:
|
|
71
71
|
version: '0.4'
|
72
72
|
type: :runtime
|
73
73
|
prerelease: false
|
74
|
-
version_requirements: *
|
74
|
+
version_requirements: *70204403290620
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: thor
|
77
|
-
requirement: &
|
77
|
+
requirement: &70204403289260 !ruby/object:Gem::Requirement
|
78
78
|
none: false
|
79
79
|
requirements:
|
80
80
|
- - ~>
|
@@ -82,10 +82,10 @@ dependencies:
|
|
82
82
|
version: 0.15.0.rc2
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
|
-
version_requirements: *
|
85
|
+
version_requirements: *70204403289260
|
86
86
|
- !ruby/object:Gem::Dependency
|
87
87
|
name: twitter
|
88
|
-
requirement: &
|
88
|
+
requirement: &70204403288000 !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
@@ -96,10 +96,10 @@ dependencies:
|
|
96
96
|
version: '3'
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
|
-
version_requirements: *
|
99
|
+
version_requirements: *70204403288000
|
100
100
|
- !ruby/object:Gem::Dependency
|
101
101
|
name: yajl-ruby
|
102
|
-
requirement: &
|
102
|
+
requirement: &70204403286200 !ruby/object:Gem::Requirement
|
103
103
|
none: false
|
104
104
|
requirements:
|
105
105
|
- - ~>
|
@@ -107,10 +107,10 @@ dependencies:
|
|
107
107
|
version: '1.1'
|
108
108
|
type: :runtime
|
109
109
|
prerelease: false
|
110
|
-
version_requirements: *
|
110
|
+
version_requirements: *70204403286200
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
|
-
requirement: &
|
113
|
+
requirement: &70204403285460 !ruby/object:Gem::Requirement
|
114
114
|
none: false
|
115
115
|
requirements:
|
116
116
|
- - ! '>='
|
@@ -118,10 +118,10 @@ dependencies:
|
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
|
-
version_requirements: *
|
121
|
+
version_requirements: *70204403285460
|
122
122
|
- !ruby/object:Gem::Dependency
|
123
123
|
name: rake
|
124
|
-
requirement: &
|
124
|
+
requirement: &70204403284560 !ruby/object:Gem::Requirement
|
125
125
|
none: false
|
126
126
|
requirements:
|
127
127
|
- - ! '>='
|
@@ -129,10 +129,10 @@ dependencies:
|
|
129
129
|
version: '0'
|
130
130
|
type: :development
|
131
131
|
prerelease: false
|
132
|
-
version_requirements: *
|
132
|
+
version_requirements: *70204403284560
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: rspec
|
135
|
-
requirement: &
|
135
|
+
requirement: &70204403283960 !ruby/object:Gem::Requirement
|
136
136
|
none: false
|
137
137
|
requirements:
|
138
138
|
- - ! '>='
|
@@ -140,10 +140,10 @@ dependencies:
|
|
140
140
|
version: '0'
|
141
141
|
type: :development
|
142
142
|
prerelease: false
|
143
|
-
version_requirements: *
|
143
|
+
version_requirements: *70204403283960
|
144
144
|
- !ruby/object:Gem::Dependency
|
145
145
|
name: simplecov
|
146
|
-
requirement: &
|
146
|
+
requirement: &70204403283260 !ruby/object:Gem::Requirement
|
147
147
|
none: false
|
148
148
|
requirements:
|
149
149
|
- - ! '>='
|
@@ -151,10 +151,10 @@ dependencies:
|
|
151
151
|
version: '0'
|
152
152
|
type: :development
|
153
153
|
prerelease: false
|
154
|
-
version_requirements: *
|
154
|
+
version_requirements: *70204403283260
|
155
155
|
- !ruby/object:Gem::Dependency
|
156
156
|
name: timecop
|
157
|
-
requirement: &
|
157
|
+
requirement: &70204403282080 !ruby/object:Gem::Requirement
|
158
158
|
none: false
|
159
159
|
requirements:
|
160
160
|
- - ! '>='
|
@@ -162,10 +162,10 @@ dependencies:
|
|
162
162
|
version: '0'
|
163
163
|
type: :development
|
164
164
|
prerelease: false
|
165
|
-
version_requirements: *
|
165
|
+
version_requirements: *70204403282080
|
166
166
|
- !ruby/object:Gem::Dependency
|
167
167
|
name: webmock
|
168
|
-
requirement: &
|
168
|
+
requirement: &70204403281420 !ruby/object:Gem::Requirement
|
169
169
|
none: false
|
170
170
|
requirements:
|
171
171
|
- - ! '>='
|
@@ -173,7 +173,7 @@ dependencies:
|
|
173
173
|
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
|
-
version_requirements: *
|
176
|
+
version_requirements: *70204403281420
|
177
177
|
description: A command-line interface for Twitter.
|
178
178
|
email: sferik@gmail.com
|
179
179
|
executables:
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- lib/t/cli/set.rb
|
203
203
|
- lib/t/cli/unfollow.rb
|
204
204
|
- lib/t/cli/unfollow/all.rb
|
205
|
+
- lib/t/core_ext/enumerable.rb
|
205
206
|
- lib/t/core_ext/string.rb
|
206
207
|
- lib/t/rcfile.rb
|
207
208
|
- lib/t/version.rb
|
@@ -263,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
264
|
version: 1.3.6
|
264
265
|
requirements: []
|
265
266
|
rubyforge_project:
|
266
|
-
rubygems_version: 1.8.
|
267
|
+
rubygems_version: 1.8.13
|
267
268
|
signing_key:
|
268
269
|
specification_version: 3
|
269
270
|
summary: CLI for Twitter
|