# File lib/rhc/ssh_key_helpers.rb, line 36
    def generate_ssh_key_ruby(type="RSA", bits = 2048, comment = "OpenShift-Key")
      key = RHC::Vendor::SSHKey.generate(:type => type,
                                         :bits => bits,
                                         :comment => comment)
      ssh_dir = "#{RHC::Config.home_dir}/.ssh"
      if File.exists?("#{ssh_dir}/id_rsa")
        say "SSH key already exists: #{ssh_dir}/id_rsa.  Reusing..."
        return nil
      else
        unless File.exists?(ssh_dir)
          FileUtils.mkdir_p(ssh_dir)
          File.chmod(0700, ssh_dir)
        end
        File.open("#{ssh_dir}/id_rsa", 'w') {|f| f.write(key.private_key)}
        File.chmod(0600, "#{ssh_dir}/id_rsa")
        File.open("#{ssh_dir}/id_rsa.pub", 'w') {|f| f.write(key.ssh_public_key)}

        ssh_add if exe?('ssh-add')
      end
      "#{ssh_dir}/id_rsa.pub"
    end