]> git.cworth.org Git - sup/blobdiff - lib/sup.rb
bump version to 0.5
[sup] / lib / sup.rb
index cec36b636d06c82bab14f0013b2ac2c6c9fac56d..910b333841c28654d2abee3d95d0b83194ad7fbc 100644 (file)
@@ -33,7 +33,7 @@ class Module
 end
 
 module Redwood
-  VERSION = "git"
+  VERSION = "0.5"
 
   BASE_DIR   = ENV["SUP_BASE"] || File.join(ENV["HOME"], ".sup")
   CONFIG_FN  = File.join(BASE_DIR, "config.yaml")
@@ -72,7 +72,7 @@ module Redwood
   def save_yaml_obj object, fn, safe=false
     if safe
       safe_fn = "#{File.dirname fn}/safe_#{File.basename fn}"
-      mode = File.stat(fn) if File.exists? fn
+      mode = File.stat(fn).mode if File.exists? fn
       File.open(safe_fn, "w", mode) { |f| f.puts object.to_yaml }
       FileUtils.mv safe_fn, fn
     else
@@ -169,7 +169,8 @@ if File.exists? Redwood::CONFIG_FN
 else
   require 'etc'
   require 'socket'
-  name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first
+  name = Etc.getpwnam(ENV["USER"]).gecos.split(/,/).first rescue nil
+  name ||= ENV["USER"]
   email = ENV["USER"] + "@" + 
     begin
       Socket.gethostbyname(Socket.gethostname).first