tw 0.3.9 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -1
- data/Gemfile +0 -1
- data/History.txt +6 -0
- data/README.md +6 -0
- data/lib/tw/app/cmds.rb +26 -0
- data/lib/tw/app/main.rb +6 -0
- data/lib/tw/app/render.rb +18 -9
- data/lib/tw/client/request.rb +15 -0
- data/lib/tw/version.rb +1 -1
- data/test/test_t_co.rb +1 -1
- data/test/test_tw.rb +1 -1
- data/tw.gemspec +5 -1
- metadata +63 -35
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 91269b65fc68a85c17b8431e4b11bc382df0ff96
|
4
|
+
data.tar.gz: 6cc0d2bd18c92a98b282ea90a9c7ad6ef4022e1d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67b726754a2bf6becce0294a50093c7f30a1a81d1c1020ef514f71127ce2437fd96bb9dbabef587102db5e5324368bb5cac7e7975314b4d389f57f63d6920efb
|
7
|
+
data.tar.gz: efe1f310620e8553f7eba7b5344fea25ec579cf109064a89530bb7162f35dd6029068a5e15558d3153d4fef27a25fa16676492640f603bf5d4e0fd97111ab0dd
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/History.txt
CHANGED
data/README.md
CHANGED
data/lib/tw/app/cmds.rb
CHANGED
@@ -71,6 +71,32 @@ module Tw::App
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
+
cmd :favorite do |v, opts|
|
75
|
+
if opts.has_param? :favorite
|
76
|
+
id = opts[:favorite]
|
77
|
+
auth
|
78
|
+
client.show_status id
|
79
|
+
puts 'Fav this?'
|
80
|
+
puts '[Y/n]'
|
81
|
+
on_exit if STDIN.gets.strip =~ /^n/i
|
82
|
+
puts "success!" if client.favorite id
|
83
|
+
end
|
84
|
+
on_exit
|
85
|
+
end
|
86
|
+
|
87
|
+
cmd :retweet do |v, opts|
|
88
|
+
if opts.has_param? :retweet
|
89
|
+
id = opts[:retweet]
|
90
|
+
auth
|
91
|
+
client.show_status id
|
92
|
+
puts 'RT this?'
|
93
|
+
puts '[Y/n]'
|
94
|
+
on_exit if STDIN.gets.strip =~ /^n/i
|
95
|
+
puts "success!" if client.retweet id
|
96
|
+
end
|
97
|
+
on_exit
|
98
|
+
end
|
99
|
+
|
74
100
|
cmd :pipe do |v, opts|
|
75
101
|
auth
|
76
102
|
while line = STDIN.gets do
|
data/lib/tw/app/main.rb
CHANGED
@@ -49,8 +49,11 @@ module Tw::App
|
|
49
49
|
arg :timeline, 'show timeline', :alias => :tl
|
50
50
|
arg :dm, 'show direct messages'
|
51
51
|
arg 'dm:to', 'create direct message'
|
52
|
+
arg :favorite, 'favorite tweet', :alias => :fav
|
53
|
+
arg :retweet, 'retweet', :alias => :rt
|
52
54
|
arg :search, 'search public timeline', :alias => :s
|
53
55
|
arg :stream, 'show user stream', :alias => :st
|
56
|
+
arg :status_id, 'show status_id', :alias => :id
|
54
57
|
arg :pipe, 'pipe tweet'
|
55
58
|
arg :format, 'output format', :default => 'text'
|
56
59
|
arg :silent, 'silent mode'
|
@@ -88,10 +91,13 @@ module Tw::App
|
|
88
91
|
STDERR.puts " tw --dm:to=username \"hello!\""
|
89
92
|
STDERR.puts " tw --format=json"
|
90
93
|
STDERR.puts ' tw --format="@#{user} #{text} - http://twitter.com/#{user}/#{id}"'
|
94
|
+
STDERR.puts "fav tw --fav=334739319170428929"
|
95
|
+
STDERR.puts "rt tw --rt=334739319170428929"
|
91
96
|
on_exit
|
92
97
|
end
|
93
98
|
|
94
99
|
Render.silent = @parser[:silent]
|
100
|
+
Render.show_status_id = @parser[:status_id]
|
95
101
|
Tw::Conf.conf_file = @parser[:conf]
|
96
102
|
|
97
103
|
regist_cmds
|
data/lib/tw/app/render.rb
CHANGED
@@ -9,6 +9,14 @@ module Tw::App
|
|
9
9
|
@@silent ||= false
|
10
10
|
end
|
11
11
|
|
12
|
+
def self.show_status_id=(bool)
|
13
|
+
@@show_status_id = bool ? true : false
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.show_status_id
|
17
|
+
@@show_status_id ||= false
|
18
|
+
end
|
19
|
+
|
12
20
|
def self.puts(s)
|
13
21
|
STDOUT.puts s unless silent
|
14
22
|
end
|
@@ -27,15 +35,16 @@ module Tw::App
|
|
27
35
|
a.id <=> b.id
|
28
36
|
}.each{|m|
|
29
37
|
STDOUT.puts case format
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
when 'text'
|
39
|
+
user = m.user.kind_of?(Hash) ? "@#{m.user[:from]} > @#{m.user[:to]}" : "@#{m.user}"
|
40
|
+
line = "#{m.time.strftime '[%m/%d %a] (%H:%M:%S)'} #{user} : #{CGI.unescapeHTML m.text}"
|
41
|
+
line += " <#{m.id}>" if show_status_id
|
42
|
+
line.colorize(/@[a-zA-Z0-9_]+/)
|
43
|
+
when 'json'
|
44
|
+
m.to_json
|
45
|
+
else
|
46
|
+
m.format format
|
47
|
+
end
|
39
48
|
}
|
40
49
|
end
|
41
50
|
end
|
data/lib/tw/client/request.rb
CHANGED
@@ -77,5 +77,20 @@ module Tw
|
|
77
77
|
puts res.created_at
|
78
78
|
end
|
79
79
|
|
80
|
+
def show_status(status_id)
|
81
|
+
res = Twitter.status(status_id)
|
82
|
+
puts res.text
|
83
|
+
puts "http://twitter.com/#{res.user.screen_name}/status/#{res.id}"
|
84
|
+
puts res.created_at
|
85
|
+
end
|
86
|
+
|
87
|
+
def favorite(status_id)
|
88
|
+
Twitter.favorite status_id
|
89
|
+
end
|
90
|
+
|
91
|
+
def retweet(status_id)
|
92
|
+
Twitter.retweet status_id
|
93
|
+
end
|
94
|
+
|
80
95
|
end
|
81
96
|
end
|
data/lib/tw/version.rb
CHANGED
data/test/test_t_co.rb
CHANGED
data/test/test_tw.rb
CHANGED
data/tw.gemspec
CHANGED
@@ -20,6 +20,10 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_dependency 'userstream', '>= 1.2.0'
|
21
21
|
gem.add_dependency 'json', '>= 1.7.0'
|
22
22
|
gem.add_dependency 'rainbow', '>= 1.1.4'
|
23
|
-
gem.add_dependency 'args_parser', '>= 0.1.
|
23
|
+
gem.add_dependency 'args_parser', '>= 0.1.4'
|
24
24
|
gem.add_dependency 'parallel', '>= 0.6.0'
|
25
|
+
|
26
|
+
gem.add_development_dependency 'rake'
|
27
|
+
gem.add_development_dependency 'bundler', '~> 1.3'
|
28
|
+
gem.add_development_dependency 'minitest'
|
25
29
|
end
|
metadata
CHANGED
@@ -1,112 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Sho Hashimoto
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-15 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: twitter
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 4.4.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 4.4.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: userstream
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 1.2.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 1.2.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: json
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: 1.7.0
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: 1.7.0
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rainbow
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: 1.1.4
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: 1.1.4
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: args_parser
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.1.
|
75
|
+
version: 0.1.4
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.1.
|
82
|
+
version: 0.1.4
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: parallel
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: 0.6.0
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: 0.6.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: bundler
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.3'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.3'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: minitest
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
110
139
|
description: CUI Twitter Client.
|
111
140
|
email:
|
112
141
|
- hashimoto@shokai.org
|
@@ -146,27 +175,26 @@ files:
|
|
146
175
|
- tw.gemspec
|
147
176
|
homepage: http://shokai.github.com/tw
|
148
177
|
licenses: []
|
178
|
+
metadata: {}
|
149
179
|
post_install_message:
|
150
180
|
rdoc_options: []
|
151
181
|
require_paths:
|
152
182
|
- lib
|
153
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
184
|
requirements:
|
156
|
-
- -
|
185
|
+
- - '>='
|
157
186
|
- !ruby/object:Gem::Version
|
158
187
|
version: '0'
|
159
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
-
none: false
|
161
189
|
requirements:
|
162
|
-
- -
|
190
|
+
- - '>='
|
163
191
|
- !ruby/object:Gem::Version
|
164
192
|
version: '0'
|
165
193
|
requirements: []
|
166
194
|
rubyforge_project:
|
167
|
-
rubygems_version:
|
195
|
+
rubygems_version: 2.0.3
|
168
196
|
signing_key:
|
169
|
-
specification_version:
|
197
|
+
specification_version: 4
|
170
198
|
summary: CUI Twitter Client.
|
171
199
|
test_files:
|
172
200
|
- test/test_helper.rb
|