Permalink
Browse files

...and this is how you set a PATH_PREFIX without having to supply it …

…up-front.
  • Loading branch information...
infovore committed Oct 25, 2010
1 parent 6c2d2bb commit bd484f9d48d3a1b28ad44e795e01e304373977d2
Showing with 5 additions and 4 deletions.
  1. +0 −1 creds.yml.example
  2. +5 −3 kanye-jordan.rb
View
@@ -3,5 +3,4 @@ config:
consumer_secret: 1234
access_token: 1234
access_token_secret: 1234
- path_prefix: your/path/here
View
@@ -1,16 +1,18 @@
-#!/usr/bin/env ruby -wKU
+#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'yaml'
require 'json'
+PATH_PREFIX = File.expand_path(File.dirname(__FILE__))
+
config = YAML.parse(File.read("creds.yml"))
-%w{consumer_key consumer_secret access_token access_token_secret path_prefix}.each do |key|
+%w{consumer_key consumer_secret access_token access_token_secret}.each do |key|
Object.const_set(key.upcase, config["config"][key].value)
end
-highestcount = File.read(PATH_PREFIX + "highest")
+highestcount = File.read(PATH_PREFIX + "/highest")
oauth = Twitter::OAuth.new(CONSUMER_KEY, CONSUMER_SECRET)
oauth.authorize_from_access(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

0 comments on commit bd484f9

Please sign in to comment.