tweeter-bachue 0.0.2 → 0.0.3
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/bin/tweet +10 -4
- data/lib/tweeter/version.rb +1 -1
- metadata +4 -4
data/bin/tweet
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
#!/usr/bin/env ruby -KU
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'twitter'
|
@@ -32,7 +32,7 @@ def twitter(tweet)
|
|
32
32
|
proxies_info.each { |proxy|
|
33
33
|
remote_twitter proxy[:host], proxy[:port], proxy[:user], proxy[:path], proxy[:gemset]
|
34
34
|
}
|
35
|
-
|
35
|
+
write_file(lost_file, tweet) unless $is_proxy # reach here means failed in all proxies
|
36
36
|
exit 1
|
37
37
|
}
|
38
38
|
end
|
@@ -41,7 +41,7 @@ end
|
|
41
41
|
def remote_twitter(host, port, user, path, gemset)
|
42
42
|
options = {:keys_only => true, :compression => true} # Password is forbidden here
|
43
43
|
options.merge! :port => port if port.present?
|
44
|
-
output = Net::SSH.start(host, user, :keys_only => true) { |ssh|
|
44
|
+
puts output = Net::SSH.start(host, user, :keys_only => true) { |ssh|
|
45
45
|
ssh.exec! <<-SHELL
|
46
46
|
#{"rvm use #{gemset} &&" if gemset.present?}
|
47
47
|
#{path.present? ? path : 'tweet'} proxy #{tweet.dump}
|
@@ -74,7 +74,9 @@ def exit_if_invalid!(tweet)
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def valid?(tweet)
|
77
|
-
tweet.gsub(URL_REGEX, '*' * SHORT_URL_LENGTH)
|
77
|
+
string = tweet.gsub(URL_REGEX, '*' * SHORT_URL_LENGTH)
|
78
|
+
string = string.scan(/./) unless string.respond_to? :encoding # to be compatible with 1.8
|
79
|
+
string.size <= TWEET_MAX_LENGTH
|
78
80
|
end
|
79
81
|
|
80
82
|
def exit_if_no_args!
|
@@ -127,4 +129,8 @@ def client
|
|
127
129
|
@client ||= Twitter::Client.new(client_info)
|
128
130
|
end
|
129
131
|
|
132
|
+
def write_file(file, content)
|
133
|
+
File.open(file, 'w') {|f| f << content}
|
134
|
+
end
|
135
|
+
|
130
136
|
start!
|
data/lib/tweeter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tweeter-bachue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: twitter
|
@@ -173,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
segments:
|
175
175
|
- 0
|
176
|
-
hash:
|
176
|
+
hash: -515015736600580446
|
177
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
178
|
none: false
|
179
179
|
requirements:
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
segments:
|
184
184
|
- 0
|
185
|
-
hash:
|
185
|
+
hash: -515015736600580446
|
186
186
|
requirements: []
|
187
187
|
rubyforge_project:
|
188
188
|
rubygems_version: 1.8.24
|