From fc0df967d776c3c7b0c2e47400940ef91b25b978 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 26 Dec 2010 03:16:34 +0000 Subject: [PATCH] * lib/rdoc/ri/paths.rb (RDoc::RI::Paths::HOMEDIR): no exception if HOME is not set. [ruby-core:33867] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/rdoc/ri/paths.rb | 7 +------ test/rdoc/test_rdoc_ri_paths.rb | 9 +++++++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index a115950fa2..c734faa0de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Dec 26 12:16:29 2010 Nobuyoshi Nakada + + * lib/rdoc/ri/paths.rb (RDoc::RI::Paths::HOMEDIR): no exception if + HOME is not set. [ruby-core:33867] + Sun Dec 26 11:39:11 2010 Nobuyoshi Nakada * parse.y (stmt): missing ripper rule. i.e., `a::B ||= c 1'. diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb index ec4d16b857..f44b0e1e95 100644 --- a/lib/rdoc/ri/paths.rb +++ b/lib/rdoc/ri/paths.rb @@ -19,12 +19,7 @@ module RDoc::RI::Paths SYSDIR = File.join base, "system" SITEDIR = File.join base, "site" - homedir = File.expand_path('~') || - ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH'] - - HOMEDIR = if homedir then - File.join homedir, ".rdoc" - end + HOMEDIR = File.expand_path('~/.rdoc') rescue nil #:startdoc: @gemdirs = nil diff --git a/test/rdoc/test_rdoc_ri_paths.rb b/test/rdoc/test_rdoc_ri_paths.rb index e6f33d7d5e..91e6abbfbd 100644 --- a/test/rdoc/test_rdoc_ri_paths.rb +++ b/test/rdoc/test_rdoc_ri_paths.rb @@ -1,10 +1,11 @@ require 'rubygems' -require 'minitest/autorun' +require 'test/unit' require 'tmpdir' require 'fileutils' require 'rdoc/ri/paths' +require_relative '../ruby/envutil' -class TestRDocRIPaths < MiniTest::Unit::TestCase +class TestRDocRIPaths < Test::Unit::TestCase def setup RDoc::RI::Paths.instance_variable_set :@gemdirs, %w[/nonexistent/gemdir] @@ -39,5 +40,9 @@ class TestRDocRIPaths < MiniTest::Unit::TestCase assert_equal '/nonexistent/gemdir', path.shift end + def test_homeless + bug4202 = '[ruby-core:33867]' + assert(assert_in_out_err([{"HOME"=>nil}, *%w"-rrdoc/ri/paths -e;"], bug4202).success?, bug4202) + end end