diff options
author | wjoe <joe@lc8n.com> | 2012-02-07 13:10:43 +0000 |
---|---|---|
committer | wjoe <joe@lc8n.com> | 2012-02-07 13:10:43 +0000 |
commit | f417a871ab16e63a64e07a4ff29a1ab39ef764f5 (patch) | |
tree | 527d488224d96fc2f1aab54d11fd560d6c6f4696 | |
parent | 711b79a0e678845432c466ebfe04cd652118e162 (diff) |
Historic commit 1.0.2 - config file added (02-Feb-2012 15:31)
-rw-r--r-- | blatweet.rb | 16 | ||||
-rw-r--r-- | config.yaml | 4 |
2 files changed, 13 insertions, 7 deletions
diff --git a/blatweet.rb b/blatweet.rb index cef1f83..46b2112 100644 --- a/blatweet.rb +++ b/blatweet.rb @@ -4,7 +4,7 @@ require 'optparse' username = nil number_of_tweets = 1 -output = '' +output = [] STDIN.gets.split(' ').each{|arg| ARGV << arg} if ARGV == [] args = ARGV.dup @@ -21,17 +21,19 @@ if args == [] exit(-1) end +twitter_config = YAML::load( File.open( 'config.yaml' ) ) + Twitter.configure do |config| - config.consumer_key = 'vXaBVIrxiJw2TKVJyI1w' - config.consumer_secret = 'Xrg8ezA461OlLP94951kWxONMs9CkDCVkW25KZICjY8' - config.oauth_token = '143847685-6uQb9mhDCqhNASYtsi6ZwZoO3Am5Yq2IbPtcjUJ0' - config.oauth_token_secret = 'YxnmXtywSbIvJHyX6pdGhDnkQiR2Z1KJ84DQyzVpUk' + config.consumer_key = twitter_config[:consumer_key] + config.consumer_secret = twitter_config[:consumer_secret] + config.oauth_token = twitter_config[:oauth_token] + config.oauth_token_secret = twitter_config[:oauth_token_secret] end begin if username - Twitter.search("from:#{username}", :rpp => number_of_tweets, :result_type => "recent").each{|tweet| output += "#{tweet.text}\n"} - puts output + Twitter.search("from:#{username}", :rpp => number_of_tweets, :result_type => "recent").each_with_index{|tweet, index| output << "#{index+1}: #{tweet.text}"} + puts output.join ' ' else Twitter.update ARGV.join ' ' end diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..6d452cd --- /dev/null +++ b/config.yaml @@ -0,0 +1,4 @@ +consumer_key: vXaBVIrxiJw2TKVJyI1w +consumer_secret: Xrg8ezA461OlLP94951kWxONMs9CkDCVkW25KZICjY8 +oauth_token: 143847685-6uQb9mhDCqhNASYtsi6ZwZoO3Am5Yq2IbPtcjUJ0 +oauth_token_secret: YxnmXtywSbIvJHyX6pdGhDnkQiR2Z1KJ84DQyzVpUk |