Commits

Jonathan Gilbert committed 02279a3

now sets HOME if undefined

Comments (0)

Files changed (3)

 Gem::Specification.new do |s|
   s.name        = 'flickrup'
-  s.version     = '1.1.2'
+  s.version     = '1.1.3'
   s.date        = '2012-12-21'
   s.summary     = "Flickr Uploader!"
   s.description = "Flickr auto uploading script"
 require "rubygems"
 require "trollop"
 require "logger"
+require "etc"
 require "flickrup/quick_listener"
 require "flickrup/slow_listener"
 require "flickrup/filetype/tagged_file"
 
       Logging.pre_init(Logger::Severity.const_get(opts.loglevel), opts.logfile == "--" ? STDOUT : opts.logfile)
 
+      #set home if unset
+      ENV['HOME'] ||= Etc.getpwuid.dir
+
       #load config, symbolise, merge with command line config
       config = YAML::load(File.open(opts.config, "r")).inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}.merge opts
 

lib/flickrup/flickr_client.rb

     FlickRaw.api_key= api_key
     FlickRaw.shared_secret=shared_secret
 
-    home = ENV['HOME'] || Etc.getpwuid.dir
-    @token_file = File.join(home, ".flickrup")
+    @token_file = File.join(ENV['HOME'], ".flickrup")
     set_client(FlickRaw::Flickr.new)
 
     if File.exist?(@token_file)