remi-vim-twitter 0.1.0 → 0.1.1
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/lib/vim-twitter.rb +26 -18
- data/vim-twitter.gemspec +1 -1
- metadata +1 -1
data/lib/vim-twitter.rb
CHANGED
@@ -2,28 +2,36 @@ $:.unshift File.dirname(__FILE__)
|
|
2
2
|
|
3
3
|
%w( rubygems vimilicious twitter ).each { |lib| require lib }
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
def tweets
|
11
|
-
# @twit.timeline.each { |tweet| puts tweet.text, tweet.user.name }
|
12
|
-
end
|
13
|
-
|
14
|
-
def tweet message
|
15
|
-
@twit.update message.to_s unless message.to_s.strip.empty? or message.to_s.length > 140
|
16
|
-
end
|
17
|
-
end
|
5
|
+
# @twit = Twitter::Base.new email, password
|
6
|
+
# @twit.timeline.each { |tweet| puts tweet.text, tweet.user.name }
|
7
|
+
# @twit.update message.to_s unless message.to_s.strip.empty? or message.to_s.length > 140
|
8
|
+
# ruby email = vim_eval('input("email: ")') ... prompt
|
18
9
|
|
19
10
|
def twit
|
20
|
-
|
11
|
+
$global_twitter_client ||= Twitter::Base.new prompt('twitter email'), prompt('twitter password') if $global_twitter_client.nil?
|
21
12
|
end
|
22
13
|
|
23
|
-
def tweets
|
24
|
-
|
14
|
+
def tweets *args
|
15
|
+
clear
|
16
|
+
set_current_line 'tweets:'
|
17
|
+
twit.timeline.each do |tweet|
|
18
|
+
append " [#{ tweet.user.name }]"
|
19
|
+
append " #{ tweet.text }"
|
20
|
+
end
|
25
21
|
end
|
26
22
|
|
27
|
-
def tweet
|
28
|
-
|
23
|
+
def tweet text
|
24
|
+
unless text.nil? or text.to_s.strip.empty? or text.to_s.length > 140
|
25
|
+
begin
|
26
|
+
twit.update(text)
|
27
|
+
puts 'tweeted successfully'
|
28
|
+
rescue
|
29
|
+
puts 'there was a problem tweeting!'
|
30
|
+
end
|
31
|
+
else
|
32
|
+
puts "invalid tweet message ... make sure your tweet length is between 1 and 141 characters"
|
33
|
+
end
|
29
34
|
end
|
35
|
+
|
36
|
+
create_command :tweet
|
37
|
+
create_command :tweets
|
data/vim-twitter.gemspec
CHANGED