tw 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/README.md +1 -0
- data/lib/tw/app/main.rb +14 -1
- data/lib/tw/client/request.rb +7 -0
- data/lib/tw/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf35055e90ba261fb927c4c51c084d367507ee1
|
4
|
+
data.tar.gz: 85edfd86d3c033f7c5611fe75e8738ccb6720811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f61c945f1a8c90d77f7376be33cbf4e0c6f89e8a7c4603eb239bb7965f49a090ec7ca1e2fad920fb76280df5bae11af9d9c61942bf611d97c60e210d622bea24
|
7
|
+
data.tar.gz: ec55e554f853e275c642293fe06daf90766fc64d4f67794a635acc9b991ebc73efd8fcf8034523b08ea356515fbd920912dfda90417d3541136f40ccad0881bc
|
data/History.txt
CHANGED
data/README.md
CHANGED
data/lib/tw/app/main.rb
CHANGED
@@ -54,6 +54,7 @@ module Tw::App
|
|
54
54
|
arg :search, 'search public timeline', :alias => :s
|
55
55
|
arg :stream, 'show user stream', :alias => :st
|
56
56
|
arg :status_id, 'show status_id', :alias => :id
|
57
|
+
arg :file, 'upload file'
|
57
58
|
arg :pipe, 'pipe tweet'
|
58
59
|
arg :format, 'output format', :default => 'text'
|
59
60
|
arg :silent, 'silent mode'
|
@@ -72,6 +73,10 @@ module Tw::App
|
|
72
73
|
validate 'dm:to', 'invalid user name' do |v|
|
73
74
|
v =~ /^[a-zA-Z0-9_]+$/
|
74
75
|
end
|
76
|
+
|
77
|
+
validate :file, "file does not exists" do |v|
|
78
|
+
File.exists? v
|
79
|
+
end
|
75
80
|
end
|
76
81
|
|
77
82
|
if @parser.has_option? :help
|
@@ -83,6 +88,7 @@ module Tw::App
|
|
83
88
|
STDERR.puts "e.g."
|
84
89
|
STDERR.puts "tweet tw hello world"
|
85
90
|
STDERR.puts " echo 'hello' | tw --pipe"
|
91
|
+
STDERR.puts " tw 'yummy!!' --file=food.jpg"
|
86
92
|
STDERR.puts "read tw @username"
|
87
93
|
STDERR.puts " tw @username @user2 @user2/listname"
|
88
94
|
STDERR.puts " tw --search=ruby"
|
@@ -140,12 +146,19 @@ module Tw::App
|
|
140
146
|
tweet_opts[:in_reply_to_status_id] = @parser[:status_id]
|
141
147
|
else
|
142
148
|
puts "tweet \"#{message}\"? (#{len} chars)"
|
149
|
+
if @parser.has_param? :file
|
150
|
+
puts "upload \"#{@parser[:file]}\"? (#{File.size @parser[:file]} bytes)"
|
151
|
+
end
|
143
152
|
end
|
144
153
|
puts '[Y/n]'
|
145
154
|
on_exit if STDIN.gets.strip =~ /^n/i
|
146
155
|
end
|
147
156
|
begin
|
148
|
-
|
157
|
+
if @parser.has_param? :file
|
158
|
+
client.tweet_with_file message, File.open(@parser[:file]), tweet_opts
|
159
|
+
else
|
160
|
+
client.tweet message, tweet_opts
|
161
|
+
end
|
149
162
|
rescue => e
|
150
163
|
STDERR.puts e.message
|
151
164
|
end
|
data/lib/tw/client/request.rb
CHANGED
@@ -80,6 +80,13 @@ module Tw
|
|
80
80
|
puts res.created_at
|
81
81
|
end
|
82
82
|
|
83
|
+
def tweet_with_file(message, file, opts={})
|
84
|
+
res = Twitter.update_with_media message, file, opts
|
85
|
+
puts res.text
|
86
|
+
puts "http://twitter.com/#{res.user.screen_name}/status/#{res.id}"
|
87
|
+
puts res.created_at
|
88
|
+
end
|
89
|
+
|
83
90
|
def direct_message_create(to, message)
|
84
91
|
res = Twitter.direct_message_create to, message
|
85
92
|
puts res.text
|
data/lib/tw/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter
|