t 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -1
- data/LICENSE.md +1 -1
- data/README.md +3 -2
- data/bin/t +1 -1
- data/lib/t.rb +2 -1
- data/lib/t/cli.rb +219 -215
- data/lib/t/collectable.rb +2 -2
- data/lib/t/delete.rb +28 -16
- data/lib/t/identicon.rb +49 -0
- data/lib/t/list.rb +21 -21
- data/lib/t/printable.rb +41 -3
- data/lib/t/rcfile.rb +10 -0
- data/lib/t/search.rb +49 -49
- data/lib/t/set.rb +10 -10
- data/lib/t/stream.rb +33 -33
- data/lib/t/utils.rb +1 -1
- data/lib/t/version.rb +1 -1
- data/t.gemspec +7 -8
- metadata +9 -9
data/lib/t/set.rb
CHANGED
@@ -22,50 +22,50 @@ module T
|
|
22
22
|
@rcfile.active_profile = {'username' => @rcfile[screen_name][consumer_key]['username'], 'consumer_key' => consumer_key}
|
23
23
|
say "Active account has been updated to #{@rcfile.active_profile[0]}."
|
24
24
|
end
|
25
|
-
map %w
|
25
|
+
map %w(account default) => :active
|
26
26
|
|
27
27
|
desc 'bio DESCRIPTION', 'Edits your Bio information on your Twitter profile.'
|
28
28
|
def bio(description)
|
29
|
-
client.update_profile(:
|
29
|
+
client.update_profile(description: description)
|
30
30
|
say "@#{@rcfile.active_profile[0]}'s bio has been updated."
|
31
31
|
end
|
32
32
|
|
33
33
|
desc 'language LANGUAGE_NAME', "Selects the language you'd like to receive notifications in."
|
34
34
|
def language(language_name)
|
35
|
-
client.settings(:
|
35
|
+
client.settings(lang: language_name)
|
36
36
|
say "@#{@rcfile.active_profile[0]}'s language has been updated."
|
37
37
|
end
|
38
38
|
|
39
39
|
desc 'location PLACE_NAME', 'Updates the location field in your profile.'
|
40
40
|
def location(place_name)
|
41
|
-
client.update_profile(:
|
41
|
+
client.update_profile(location: place_name)
|
42
42
|
say "@#{@rcfile.active_profile[0]}'s location has been updated."
|
43
43
|
end
|
44
44
|
|
45
45
|
desc 'name NAME', 'Sets the name field on your Twitter profile.'
|
46
46
|
def name(name)
|
47
|
-
client.update_profile(:
|
47
|
+
client.update_profile(name: name)
|
48
48
|
say "@#{@rcfile.active_profile[0]}'s name has been updated."
|
49
49
|
end
|
50
50
|
|
51
51
|
desc 'profile_background_image FILE', 'Sets the background image on your Twitter profile.'
|
52
|
-
method_option 'tile', :
|
52
|
+
method_option 'tile', aliases: '-t', type: :boolean, desc: 'Whether or not to tile the background image.'
|
53
53
|
def profile_background_image(file)
|
54
|
-
client.update_profile_background_image(File.new(File.expand_path(file)), :
|
54
|
+
client.update_profile_background_image(File.new(File.expand_path(file)), tile: options['tile'], skip_status: true)
|
55
55
|
say "@#{@rcfile.active_profile[0]}'s background image has been updated."
|
56
56
|
end
|
57
|
-
map %w
|
57
|
+
map %w(background background_image) => :profile_background_image
|
58
58
|
|
59
59
|
desc 'profile_image FILE', 'Sets the image on your Twitter profile.'
|
60
60
|
def profile_image(file)
|
61
61
|
client.update_profile_image(File.new(File.expand_path(file)))
|
62
62
|
say "@#{@rcfile.active_profile[0]}'s image has been updated."
|
63
63
|
end
|
64
|
-
map %w
|
64
|
+
map %w(avatar image) => :profile_image
|
65
65
|
|
66
66
|
desc 'website URI', 'Sets the website field on your profile.'
|
67
67
|
def website(uri)
|
68
|
-
client.update_profile(:
|
68
|
+
client.update_profile(url: uri)
|
69
69
|
say "@#{@rcfile.active_profile[0]}'s website has been updated."
|
70
70
|
end
|
71
71
|
end
|
data/lib/t/stream.rb
CHANGED
@@ -25,9 +25,9 @@ module T
|
|
25
25
|
end
|
26
26
|
|
27
27
|
desc 'all', 'Stream a random sample of all Tweets (Control-C to stop)'
|
28
|
-
method_option 'csv', :
|
29
|
-
method_option 'decode_uris', :
|
30
|
-
method_option 'long', :
|
28
|
+
method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
|
29
|
+
method_option 'decode_uris', aliases: '-d', type: :boolean, desc: 'Decodes t.co URLs into their original form.'
|
30
|
+
method_option 'long', aliases: '-l', type: :boolean, desc: 'Output in long format.'
|
31
31
|
def all
|
32
32
|
streaming_client.before_request do
|
33
33
|
if options['csv']
|
@@ -48,7 +48,7 @@ module T
|
|
48
48
|
array = build_long_tweet(tweet).each_with_index.collect do |element, index|
|
49
49
|
TWEET_HEADINGS_FORMATTING[index] % element
|
50
50
|
end
|
51
|
-
print_table([array], :
|
51
|
+
print_table([array], truncate: STDOUT.tty?)
|
52
52
|
else
|
53
53
|
print_message(tweet.user.screen_name, tweet.text)
|
54
54
|
end
|
@@ -56,23 +56,23 @@ module T
|
|
56
56
|
end
|
57
57
|
|
58
58
|
desc 'list [USER/]LIST', 'Stream a timeline for members of the specified list (Control-C to stop)'
|
59
|
-
method_option 'csv', :
|
60
|
-
method_option 'decode_uris', :
|
61
|
-
method_option 'id', :
|
62
|
-
method_option 'long', :
|
63
|
-
method_option 'reverse', :
|
59
|
+
method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
|
60
|
+
method_option 'decode_uris', aliases: '-d', type: :boolean, desc: 'Decodes t.co URLs into their original form.'
|
61
|
+
method_option 'id', aliases: '-i', type: :boolean, desc: 'Specify user via ID instead of screen name.'
|
62
|
+
method_option 'long', aliases: '-l', type: :boolean, desc: 'Output in long format.'
|
63
|
+
method_option 'reverse', aliases: '-r', type: :boolean, desc: 'Reverse the order of the sort.'
|
64
64
|
def list(user_list)
|
65
65
|
owner, list_name = extract_owner(user_list, options)
|
66
66
|
require 't/list'
|
67
67
|
streaming_client.before_request do
|
68
68
|
list = T::List.new
|
69
69
|
list.options = list.options.merge(options)
|
70
|
-
list.options = list.options.merge(:
|
71
|
-
list.options = list.options.merge(:
|
70
|
+
list.options = list.options.merge(reverse: true)
|
71
|
+
list.options = list.options.merge(format: TWEET_HEADINGS_FORMATTING)
|
72
72
|
list.timeline(user_list)
|
73
73
|
end
|
74
74
|
user_ids = client.list_members(owner, list_name).collect(&:id)
|
75
|
-
streaming_client.filter(:
|
75
|
+
streaming_client.filter(follow: user_ids.join(',')) do |tweet|
|
76
76
|
next unless tweet.is_a?(Twitter::Tweet)
|
77
77
|
if options['csv']
|
78
78
|
print_csv_tweet(tweet)
|
@@ -80,13 +80,13 @@ module T
|
|
80
80
|
array = build_long_tweet(tweet).each_with_index.collect do |element, index|
|
81
81
|
TWEET_HEADINGS_FORMATTING[index] % element
|
82
82
|
end
|
83
|
-
print_table([array], :
|
83
|
+
print_table([array], truncate: STDOUT.tty?)
|
84
84
|
else
|
85
85
|
print_message(tweet.user.screen_name, tweet.text)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
89
|
-
map %w
|
89
|
+
map %w(tl) => :timeline
|
90
90
|
|
91
91
|
desc 'matrix', 'Unfortunately, no one can be told what the Matrix is. You have to see it for yourself.'
|
92
92
|
def matrix
|
@@ -95,27 +95,27 @@ module T
|
|
95
95
|
cli = T::CLI.new
|
96
96
|
cli.matrix
|
97
97
|
end
|
98
|
-
streaming_client.sample(:
|
98
|
+
streaming_client.sample(language: 'ja') do |tweet|
|
99
99
|
next unless tweet.is_a?(Twitter::Tweet)
|
100
100
|
say(tweet.text.gsub(/[^\u3000\u3040-\u309f]/, '').reverse, [:bold, :green, :on_black], false)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
104
|
desc 'search KEYWORD [KEYWORD...]', 'Stream Tweets that contain specified keywords, joined with logical ORs (Control-C to stop)'
|
105
|
-
method_option 'csv', :
|
106
|
-
method_option 'decode_uris', :
|
107
|
-
method_option 'long', :
|
105
|
+
method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
|
106
|
+
method_option 'decode_uris', aliases: '-d', type: :boolean, desc: 'Decodes t.co URLs into their original form.'
|
107
|
+
method_option 'long', aliases: '-l', type: :boolean, desc: 'Output in long format.'
|
108
108
|
def search(keyword, *keywords)
|
109
109
|
keywords.unshift(keyword)
|
110
110
|
require 't/search'
|
111
111
|
streaming_client.before_request do
|
112
112
|
search = T::Search.new
|
113
113
|
search.options = search.options.merge(options)
|
114
|
-
search.options = search.options.merge(:
|
115
|
-
search.options = search.options.merge(:
|
114
|
+
search.options = search.options.merge(reverse: true)
|
115
|
+
search.options = search.options.merge(format: TWEET_HEADINGS_FORMATTING)
|
116
116
|
search.all(keywords.join(' OR '))
|
117
117
|
end
|
118
|
-
streaming_client.filter(:
|
118
|
+
streaming_client.filter(track: keywords.join(',')) do |tweet|
|
119
119
|
next unless tweet.is_a?(Twitter::Tweet)
|
120
120
|
if options['csv']
|
121
121
|
print_csv_tweet(tweet)
|
@@ -123,7 +123,7 @@ module T
|
|
123
123
|
array = build_long_tweet(tweet).each_with_index.collect do |element, index|
|
124
124
|
TWEET_HEADINGS_FORMATTING[index] % element
|
125
125
|
end
|
126
|
-
print_table([array], :
|
126
|
+
print_table([array], truncate: STDOUT.tty?)
|
127
127
|
else
|
128
128
|
print_message(tweet.user.screen_name, tweet.text)
|
129
129
|
end
|
@@ -131,16 +131,16 @@ module T
|
|
131
131
|
end
|
132
132
|
|
133
133
|
desc 'timeline', 'Stream your timeline (Control-C to stop)'
|
134
|
-
method_option 'csv', :
|
135
|
-
method_option 'decode_uris', :
|
136
|
-
method_option 'long', :
|
134
|
+
method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
|
135
|
+
method_option 'decode_uris', aliases: '-d', type: :boolean, desc: 'Decodes t.co URLs into their original form.'
|
136
|
+
method_option 'long', aliases: '-l', type: :boolean, desc: 'Output in long format.'
|
137
137
|
def timeline
|
138
138
|
require 't/cli'
|
139
139
|
streaming_client.before_request do
|
140
140
|
cli = T::CLI.new
|
141
141
|
cli.options = cli.options.merge(options)
|
142
|
-
cli.options = cli.options.merge(:
|
143
|
-
cli.options = cli.options.merge(:
|
142
|
+
cli.options = cli.options.merge(reverse: true)
|
143
|
+
cli.options = cli.options.merge(format: TWEET_HEADINGS_FORMATTING)
|
144
144
|
cli.timeline
|
145
145
|
end
|
146
146
|
streaming_client.user do |tweet|
|
@@ -151,7 +151,7 @@ module T
|
|
151
151
|
array = build_long_tweet(tweet).each_with_index.collect do |element, index|
|
152
152
|
TWEET_HEADINGS_FORMATTING[index] % element
|
153
153
|
end
|
154
|
-
print_table([array], :
|
154
|
+
print_table([array], truncate: STDOUT.tty?)
|
155
155
|
else
|
156
156
|
print_message(tweet.user.screen_name, tweet.text)
|
157
157
|
end
|
@@ -159,9 +159,9 @@ module T
|
|
159
159
|
end
|
160
160
|
|
161
161
|
desc 'users USER_ID [USER_ID...]', 'Stream Tweets either from or in reply to specified users (Control-C to stop)'
|
162
|
-
method_option 'csv', :
|
163
|
-
method_option 'decode_uris', :
|
164
|
-
method_option 'long', :
|
162
|
+
method_option 'csv', aliases: '-c', type: :boolean, desc: 'Output in CSV format.'
|
163
|
+
method_option 'decode_uris', aliases: '-d', type: :boolean, desc: 'Decodes t.co URLs into their original form.'
|
164
|
+
method_option 'long', aliases: '-l', type: :boolean, desc: 'Output in long format.'
|
165
165
|
def users(user_id, *user_ids)
|
166
166
|
user_ids.unshift(user_id)
|
167
167
|
user_ids.collect!(&:to_i)
|
@@ -176,7 +176,7 @@ module T
|
|
176
176
|
print_table([headings])
|
177
177
|
end
|
178
178
|
end
|
179
|
-
streaming_client.filter(:
|
179
|
+
streaming_client.filter(follow: user_ids.join(',')) do |tweet|
|
180
180
|
next unless tweet.is_a?(Twitter::Tweet)
|
181
181
|
if options['csv']
|
182
182
|
print_csv_tweet(tweet)
|
@@ -184,7 +184,7 @@ module T
|
|
184
184
|
array = build_long_tweet(tweet).each_with_index.collect do |element, index|
|
185
185
|
TWEET_HEADINGS_FORMATTING[index] % element
|
186
186
|
end
|
187
|
-
print_table([array], :
|
187
|
+
print_table([array], truncate: STDOUT.tty?)
|
188
188
|
else
|
189
189
|
print_message(tweet.user.screen_name, tweet.text)
|
190
190
|
end
|
data/lib/t/utils.rb
CHANGED
@@ -50,7 +50,7 @@ module T
|
|
50
50
|
def fetch_users(users, options)
|
51
51
|
format_users!(users, options)
|
52
52
|
require 'retryable'
|
53
|
-
users = retryable(:
|
53
|
+
users = Retryable.retryable(tries: 3, on: Twitter::Error, sleep: 0) do
|
54
54
|
yield users
|
55
55
|
end
|
56
56
|
[users, users.length]
|
data/lib/t/version.rb
CHANGED
data/t.gemspec
CHANGED
@@ -8,21 +8,20 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.add_dependency 'geokit', ['>= 1.8.3', '< 2']
|
9
9
|
spec.add_dependency 'htmlentities', '~> 4.3'
|
10
10
|
spec.add_dependency 'oauth', '~> 0.4.7'
|
11
|
-
spec.add_dependency 'retryable', '~>
|
11
|
+
spec.add_dependency 'retryable', '~> 2.0'
|
12
12
|
spec.add_dependency 'thor', ['>= 0.19.1', '< 2']
|
13
|
-
spec.add_dependency 'twitter', '~> 5.
|
13
|
+
spec.add_dependency 'twitter', '~> 5.13'
|
14
14
|
spec.add_development_dependency 'bundler', '~> 1.0'
|
15
15
|
spec.author = 'Erik Michaels-Ober'
|
16
|
-
spec.bindir = 'bin'
|
17
16
|
spec.description = 'A command-line power tool for Twitter.'
|
18
17
|
spec.email = 'sferik@gmail.com'
|
19
|
-
spec.executables =
|
20
|
-
spec.files = %w
|
18
|
+
spec.executables = Dir['bin/*'].map { |f| File.basename(f) }
|
19
|
+
spec.files = %w(CONTRIBUTING.md LICENSE.md README.md t.gemspec) + Dir['bin/*'] + Dir['lib/**/*.rb']
|
21
20
|
spec.homepage = 'http://sferik.github.com/t/'
|
22
|
-
spec.licenses = %w
|
21
|
+
spec.licenses = %w(MIT)
|
23
22
|
spec.name = 't'
|
24
|
-
spec.require_paths = %w
|
25
|
-
spec.required_ruby_version = '>= 1.9.
|
23
|
+
spec.require_paths = %w(lib)
|
24
|
+
spec.required_ruby_version = '>= 1.9.3'
|
26
25
|
spec.required_rubygems_version = '>= 1.3.5'
|
27
26
|
spec.summary = 'CLI for Twitter'
|
28
27
|
spec.version = T::Version
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Michaels-Ober
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
81
|
+
version: '2.0'
|
82
82
|
type: :runtime
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
88
|
+
version: '2.0'
|
89
89
|
- !ruby/object:Gem::Dependency
|
90
90
|
name: thor
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,14 +112,14 @@ dependencies:
|
|
112
112
|
requirements:
|
113
113
|
- - "~>"
|
114
114
|
- !ruby/object:Gem::Version
|
115
|
-
version: '5.
|
115
|
+
version: '5.13'
|
116
116
|
type: :runtime
|
117
117
|
prerelease: false
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - "~>"
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version: '5.
|
122
|
+
version: '5.13'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: bundler
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/t/core_ext/string.rb
|
153
153
|
- lib/t/delete.rb
|
154
154
|
- lib/t/editor.rb
|
155
|
+
- lib/t/identicon.rb
|
155
156
|
- lib/t/list.rb
|
156
157
|
- lib/t/printable.rb
|
157
158
|
- lib/t/rcfile.rb
|
@@ -174,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
175
|
requirements:
|
175
176
|
- - ">="
|
176
177
|
- !ruby/object:Gem::Version
|
177
|
-
version: 1.9.
|
178
|
+
version: 1.9.3
|
178
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
180
|
requirements:
|
180
181
|
- - ">="
|
@@ -182,9 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
183
|
version: 1.3.5
|
183
184
|
requirements: []
|
184
185
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
186
|
+
rubygems_version: 2.4.5
|
186
187
|
signing_key:
|
187
188
|
specification_version: 4
|
188
189
|
summary: CLI for Twitter
|
189
190
|
test_files: []
|
190
|
-
has_rdoc:
|