lib/rye/box.rb in rye-0.8.13 vs lib/rye/box.rb in rye-0.8.14

- old
+ new

@@ -360,11 +360,12 @@ elsif ostmp == "darwin" user_defaults['HOME'] = '/Users' elsif ostmp == "windows" user_defaults['HOME'] = 'C:/Documents and Settings' else - raw = self.quietly { useradd(:D) } rescue ["HOME=/home"] + raw = self.quietly { useradd(:D) } rescue [] + raw = ["HOME=/home"] if raw.nil? || raw.empty? raw.each do |nv| n, v = nv.scan(/\A([\w_-]+?)=(.+)\z/).flatten user_defaults[n] = v end end @@ -388,21 +389,22 @@ prevdir = self.current_working_directory # The homedir path is important b/c this is where we're going to # look for the .ssh directory. That's where auth love is stored. - homedir = self.guess_user_home(this_user) + homedir = self.quietly { pwd }.first + homedir ||= self.guess_user_home(this_user) unless self.file_exists?(homedir) rap.add_exit_code(1) rap.add_stderr("Path does not exist: #{homedir}") raise Rye::CommandError.new(rap) end # Let's go into the user's home directory that we now know exists. self.cd homedir - files = ['.ssh/authorized_keys', '.ssh/authorized_keys2'] + files = ['.ssh/authorized_keys', '.ssh/authorized_keys2', '.ssh/identity'] files.each do |akey_path| if self.file_exists?(akey_path) # TODO: Make Rye::Cmd.incremental_backup self.cp(akey_path, "#{akey_path}-previous") authorized_keys = self.file_download("#{homedir}/#{akey_path}")