tw 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -4,7 +4,7 @@ GEM
4
4
  RedCloth (4.2.9)
5
5
  RedCloth (4.2.9-java)
6
6
  activesupport (2.3.14)
7
- args_parser (0.1.0)
7
+ args_parser (0.1.2)
8
8
  faraday (0.8.4)
9
9
  multipart-post (~> 1.1)
10
10
  hashie (1.2.0)
@@ -21,14 +21,14 @@ GEM
21
21
  rubigen (>= 1.5.3)
22
22
  syntax (>= 1.0.0)
23
23
  oauth (0.4.7)
24
- parallel (0.5.18)
24
+ parallel (0.5.19)
25
25
  rainbow (1.1.4)
26
26
  rake (0.9.2.2)
27
27
  rubigen (1.5.8)
28
28
  activesupport (>= 2.3.5, < 3.2.0)
29
29
  simple_oauth (0.1.9)
30
30
  syntax (1.0.0)
31
- twitter (4.0.0)
31
+ twitter (4.1.0)
32
32
  faraday (~> 0.8)
33
33
  multi_json (~> 1.3)
34
34
  simple_oauth (~> 0.1.6)
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.3.1 2012-10-11
2
+
3
+ * pipe DM
4
+
1
5
  === 0.3.0 2012-10-10
2
6
 
3
7
  * silent mode option : --silent
data/README.rdoc CHANGED
@@ -55,7 +55,7 @@ Switch Accounts
55
55
  Format
56
56
 
57
57
  % tw --format=json
58
- % tw --stream --format="@#{user} #{text} - http://twitter.com/#{user}/#{id}"
58
+ % tw --stream --format="@#{user} #{text} - #{url}"
59
59
 
60
60
 
61
61
  == Make Twitter Bot
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ $hoe = Hoe.spec 'tw' do
18
18
  ['twitter', '>= 4.0.0', '< 5.0.0'],
19
19
  ['userstream', '>= 1.2.0', '< 1.3.0'],
20
20
  ['json', '>= 1.7.5', '< 1.8.0'],
21
- ['args_parser', '>= 0.1.1'],
21
+ ['args_parser', '>= 0.1.2'],
22
22
  ['rainbow', '>= 1.1.4', '< 2.0.0'],
23
23
  ['parallel', '>= 0.5.18', '< 1.0.0']]
24
24
  end
data/lib/tw/app/cmds.rb CHANGED
@@ -51,20 +51,42 @@ module Tw::App
51
51
  end
52
52
 
53
53
  cmd 'dm:to' do |to, opts|
54
- message = @parser.argv.join(' ')
55
- len = message.split(//u).size
56
- if len > 140
57
- STDERR.puts "message too long (#{len} chars)"
58
- on_error
59
- elsif len < 1
60
- STDERR.puts 'e.g. tw --dm:to=USERNAME "hello"'
61
- on_error
62
- else
63
- puts "dm \"#{message}\"? (#{len} chars)"
64
- puts '[Y/n]'
65
- on_exit if STDIN.gets.strip =~ /^n/i
66
- auth
67
- client.direct_message_create to, message
54
+ unless opts[:pipe]
55
+ message = @parser.argv.join(' ')
56
+ len = message.split(//u).size
57
+ if len > 140
58
+ STDERR.puts "message too long (#{len} chars)"
59
+ on_error
60
+ elsif len < 1
61
+ STDERR.puts 'e.g. tw --dm:to=USERNAME "hello"'
62
+ on_error
63
+ else
64
+ puts "dm \"#{message}\"? (#{len} chars)"
65
+ puts '[Y/n]'
66
+ on_exit if STDIN.gets.strip =~ /^n/i
67
+ auth
68
+ client.direct_message_create to, message
69
+ end
70
+ on_exit
71
+ end
72
+ end
73
+
74
+ cmd :pipe do |v, opts|
75
+ auth
76
+ while line = STDIN.gets do
77
+ line.split(/(.{140})/u).select{|m|m.size>0}.each do |message|
78
+ begin
79
+ if opts.has_param? 'dm:to'
80
+ puts to = opts['dm:to']
81
+ client.direct_message_create to, message
82
+ else
83
+ client.tweet message
84
+ end
85
+ rescue => e
86
+ STDERR.puts e.message
87
+ end
88
+ end
89
+ sleep 1
68
90
  end
69
91
  on_exit
70
92
  end
@@ -124,21 +146,6 @@ module Tw::App
124
146
  end
125
147
  end
126
148
 
127
- cmd :pipe do |v, opts|
128
- auth
129
- while line = STDIN.gets do
130
- line.split(/(.{140})/u).select{|m|m.size>0}.each do |message|
131
- begin
132
- client.tweet message
133
- rescue => e
134
- STDERR.puts e.message
135
- end
136
- end
137
- sleep 1
138
- end
139
- on_exit
140
- end
141
-
142
149
  cmd :version do |v, opts|
143
150
  puts "tw version #{Tw::VERSION}"
144
151
  on_exit
data/lib/tw.rb CHANGED
@@ -20,7 +20,7 @@ require 'tw/client/stream'
20
20
  require 'tw/client/error'
21
21
 
22
22
  module Tw
23
- VERSION = '0.3.0'
23
+ VERSION = '0.3.1'
24
24
  class Conf
25
25
  REQUIRE_VERSION = '0.1.0'
26
26
  end
metadata CHANGED
@@ -1,223 +1,240 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tw
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 1
10
+ version: 0.3.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Sho Hashimoto
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-10-10 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: oauth
16
- requirement: !ruby/object:Gem::Requirement
17
+
18
+ date: 2012-10-11 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
17
23
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 1
28
+ segments:
29
+ - 0
30
+ - 4
31
+ - 7
21
32
  version: 0.4.7
22
33
  - - <
23
- - !ruby/object:Gem::Version
34
+ - !ruby/object:Gem::Version
35
+ hash: 23
36
+ segments:
37
+ - 1
38
+ - 0
39
+ - 0
24
40
  version: 1.0.0
25
41
  type: :runtime
42
+ name: oauth
43
+ version_requirements: *id001
44
+ - !ruby/object:Gem::Dependency
26
45
  prerelease: false
27
- version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: 0.4.7
33
- - - <
34
- - !ruby/object:Gem::Version
35
- version: 1.0.0
36
- - !ruby/object:Gem::Dependency
37
- name: twitter
38
- requirement: !ruby/object:Gem::Requirement
46
+ requirement: &id002 !ruby/object:Gem::Requirement
39
47
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ hash: 63
52
+ segments:
53
+ - 4
54
+ - 0
55
+ - 0
43
56
  version: 4.0.0
44
57
  - - <
45
- - !ruby/object:Gem::Version
58
+ - !ruby/object:Gem::Version
59
+ hash: 55
60
+ segments:
61
+ - 5
62
+ - 0
63
+ - 0
46
64
  version: 5.0.0
47
65
  type: :runtime
66
+ name: twitter
67
+ version_requirements: *id002
68
+ - !ruby/object:Gem::Dependency
48
69
  prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: 4.0.0
55
- - - <
56
- - !ruby/object:Gem::Version
57
- version: 5.0.0
58
- - !ruby/object:Gem::Dependency
59
- name: userstream
60
- requirement: !ruby/object:Gem::Requirement
70
+ requirement: &id003 !ruby/object:Gem::Requirement
61
71
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ hash: 31
76
+ segments:
77
+ - 1
78
+ - 2
79
+ - 0
65
80
  version: 1.2.0
66
81
  - - <
67
- - !ruby/object:Gem::Version
82
+ - !ruby/object:Gem::Version
83
+ hash: 27
84
+ segments:
85
+ - 1
86
+ - 3
87
+ - 0
68
88
  version: 1.3.0
69
89
  type: :runtime
90
+ name: userstream
91
+ version_requirements: *id003
92
+ - !ruby/object:Gem::Dependency
70
93
  prerelease: false
71
- version_requirements: !ruby/object:Gem::Requirement
94
+ requirement: &id004 !ruby/object:Gem::Requirement
72
95
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: 1.2.0
77
- - - <
78
- - !ruby/object:Gem::Version
79
- version: 1.3.0
80
- - !ruby/object:Gem::Dependency
81
- name: json
82
- requirement: !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 1
100
+ segments:
101
+ - 1
102
+ - 7
103
+ - 5
87
104
  version: 1.7.5
88
105
  - - <
89
- - !ruby/object:Gem::Version
106
+ - !ruby/object:Gem::Version
107
+ hash: 55
108
+ segments:
109
+ - 1
110
+ - 8
111
+ - 0
90
112
  version: 1.8.0
91
113
  type: :runtime
114
+ name: json
115
+ version_requirements: *id004
116
+ - !ruby/object:Gem::Dependency
92
117
  prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
118
+ requirement: &id005 !ruby/object:Gem::Requirement
94
119
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: 1.7.5
99
- - - <
100
- - !ruby/object:Gem::Version
101
- version: 1.8.0
102
- - !ruby/object:Gem::Dependency
103
- name: args_parser
104
- requirement: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: 0.1.1
120
+ requirements:
121
+ - - ">="
122
+ - !ruby/object:Gem::Version
123
+ hash: 31
124
+ segments:
125
+ - 0
126
+ - 1
127
+ - 2
128
+ version: 0.1.2
110
129
  type: :runtime
130
+ name: args_parser
131
+ version_requirements: *id005
132
+ - !ruby/object:Gem::Dependency
111
133
  prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
134
+ requirement: &id006 !ruby/object:Gem::Requirement
113
135
  none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: 0.1.1
118
- - !ruby/object:Gem::Dependency
119
- name: rainbow
120
- requirement: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ hash: 27
140
+ segments:
141
+ - 1
142
+ - 1
143
+ - 4
125
144
  version: 1.1.4
126
145
  - - <
127
- - !ruby/object:Gem::Version
146
+ - !ruby/object:Gem::Version
147
+ hash: 15
148
+ segments:
149
+ - 2
150
+ - 0
151
+ - 0
128
152
  version: 2.0.0
129
153
  type: :runtime
154
+ name: rainbow
155
+ version_requirements: *id006
156
+ - !ruby/object:Gem::Dependency
130
157
  prerelease: false
131
- version_requirements: !ruby/object:Gem::Requirement
132
- none: false
133
- requirements:
134
- - - ! '>='
135
- - !ruby/object:Gem::Version
136
- version: 1.1.4
137
- - - <
138
- - !ruby/object:Gem::Version
139
- version: 2.0.0
140
- - !ruby/object:Gem::Dependency
141
- name: parallel
142
- requirement: !ruby/object:Gem::Requirement
158
+ requirement: &id007 !ruby/object:Gem::Requirement
143
159
  none: false
144
- requirements:
145
- - - ! '>='
146
- - !ruby/object:Gem::Version
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ hash: 47
164
+ segments:
165
+ - 0
166
+ - 5
167
+ - 18
147
168
  version: 0.5.18
148
169
  - - <
149
- - !ruby/object:Gem::Version
170
+ - !ruby/object:Gem::Version
171
+ hash: 23
172
+ segments:
173
+ - 1
174
+ - 0
175
+ - 0
150
176
  version: 1.0.0
151
177
  type: :runtime
178
+ name: parallel
179
+ version_requirements: *id007
180
+ - !ruby/object:Gem::Dependency
152
181
  prerelease: false
153
- version_requirements: !ruby/object:Gem::Requirement
154
- none: false
155
- requirements:
156
- - - ! '>='
157
- - !ruby/object:Gem::Version
158
- version: 0.5.18
159
- - - <
160
- - !ruby/object:Gem::Version
161
- version: 1.0.0
162
- - !ruby/object:Gem::Dependency
163
- name: rdoc
164
- requirement: !ruby/object:Gem::Requirement
182
+ requirement: &id008 !ruby/object:Gem::Requirement
165
183
  none: false
166
- requirements:
184
+ requirements:
167
185
  - - ~>
168
- - !ruby/object:Gem::Version
169
- version: '3.10'
186
+ - !ruby/object:Gem::Version
187
+ hash: 19
188
+ segments:
189
+ - 3
190
+ - 10
191
+ version: "3.10"
170
192
  type: :development
193
+ name: rdoc
194
+ version_requirements: *id008
195
+ - !ruby/object:Gem::Dependency
171
196
  prerelease: false
172
- version_requirements: !ruby/object:Gem::Requirement
173
- none: false
174
- requirements:
175
- - - ~>
176
- - !ruby/object:Gem::Version
177
- version: '3.10'
178
- - !ruby/object:Gem::Dependency
179
- name: newgem
180
- requirement: !ruby/object:Gem::Requirement
197
+ requirement: &id009 !ruby/object:Gem::Requirement
181
198
  none: false
182
- requirements:
183
- - - ! '>='
184
- - !ruby/object:Gem::Version
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ hash: 5
203
+ segments:
204
+ - 1
205
+ - 5
206
+ - 3
185
207
  version: 1.5.3
186
208
  type: :development
209
+ name: newgem
210
+ version_requirements: *id009
211
+ - !ruby/object:Gem::Dependency
187
212
  prerelease: false
188
- version_requirements: !ruby/object:Gem::Requirement
213
+ requirement: &id010 !ruby/object:Gem::Requirement
189
214
  none: false
190
- requirements:
191
- - - ! '>='
192
- - !ruby/object:Gem::Version
193
- version: 1.5.3
194
- - !ruby/object:Gem::Dependency
195
- name: hoe
196
- requirement: !ruby/object:Gem::Requirement
197
- none: false
198
- requirements:
215
+ requirements:
199
216
  - - ~>
200
- - !ruby/object:Gem::Version
201
- version: '3.1'
217
+ - !ruby/object:Gem::Version
218
+ hash: 5
219
+ segments:
220
+ - 3
221
+ - 1
222
+ version: "3.1"
202
223
  type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- none: false
206
- requirements:
207
- - - ~>
208
- - !ruby/object:Gem::Version
209
- version: '3.1'
210
- description: ! '* twitter client.'
211
- email:
224
+ name: hoe
225
+ version_requirements: *id010
226
+ description: "* twitter client."
227
+ email:
212
228
  - hashimoto@shokai.org
213
- executables:
229
+ executables:
214
230
  - tw
215
231
  extensions: []
216
- extra_rdoc_files:
232
+
233
+ extra_rdoc_files:
217
234
  - History.txt
218
235
  - Manifest.txt
219
236
  - README.rdoc
220
- files:
237
+ files:
221
238
  - Gemfile
222
239
  - Gemfile.lock
223
240
  - History.txt
@@ -248,33 +265,38 @@ files:
248
265
  - .gemtest
249
266
  homepage: http://shokai.github.com/tw
250
267
  licenses: []
251
- post_install_message: ! '!! Installed "tw" command. => http://shokai.github.com/tw'
252
- rdoc_options:
268
+
269
+ post_install_message: "!! Installed \"tw\" command. => http://shokai.github.com/tw"
270
+ rdoc_options:
253
271
  - --main
254
272
  - README.rdoc
255
- require_paths:
273
+ require_paths:
256
274
  - lib
257
- required_ruby_version: !ruby/object:Gem::Requirement
275
+ required_ruby_version: !ruby/object:Gem::Requirement
258
276
  none: false
259
- requirements:
260
- - - ! '>='
261
- - !ruby/object:Gem::Version
262
- version: '0'
263
- segments:
277
+ requirements:
278
+ - - ">="
279
+ - !ruby/object:Gem::Version
280
+ hash: 3
281
+ segments:
264
282
  - 0
265
- hash: 3459005174118460767
266
- required_rubygems_version: !ruby/object:Gem::Requirement
283
+ version: "0"
284
+ required_rubygems_version: !ruby/object:Gem::Requirement
267
285
  none: false
268
- requirements:
269
- - - ! '>='
270
- - !ruby/object:Gem::Version
271
- version: '0'
286
+ requirements:
287
+ - - ">="
288
+ - !ruby/object:Gem::Version
289
+ hash: 3
290
+ segments:
291
+ - 0
292
+ version: "0"
272
293
  requirements: []
294
+
273
295
  rubyforge_project: tw
274
296
  rubygems_version: 1.8.24
275
297
  signing_key:
276
298
  specification_version: 3
277
- summary: ! '* twitter client.'
278
- test_files:
299
+ summary: "* twitter client."
300
+ test_files:
279
301
  - test/test_helper.rb
280
302
  - test/test_tw.rb