diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-04-23 19:16:06 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-23 19:16:06 +0900 |
commit | 5c6269c4593f8b1a83b72e157c460dd2b37338c7 (patch) | |
tree | d179fbf295790b083035ddaf454f1db4b4982986 /test/rdoc | |
parent | f563f3c5ef517b62f1a95ab03286335e4fe72314 (diff) |
Support XDG_* (#2174)
* Support XDG_CONFIG_HOME for gemrc.
* Support XDG_DATA_HOME for .gem
* Added test for XDG_DATA_HOME
* Do not reuse environmental variable.
* Unify .rdoc path to RDoc.home.
* Support XDG_DATA_HOME for .rdoc
* Ignore exists?
* Extracted config_home path
* Use XDG_CONFIG_HOME for default credential path
* Fixed inconsistency location.
* Fixed the broken tests.
* Support XDG_CONFIG_HOME for irbrc
* Introduce Gem.cache_home as XDG_CACHE_HOME
* Use Gem.cache_home instead of Gem.config_home for the credential file of RubyGems.
* Initialized the old configurations
* Fixed test failure related the configuration initialization
* restore XDG_DATA_HOME
* Fixed the broken examples of bundler with XDG_*
* Do not modify environmental variable on test file
* Use XDG_DATA_HOME insted of XDG_CACHE_HOME for credential file
* stub out Gem.data_home
* Move dir accessor to defaults.rb file
* Use XDG_DATA_HOME for signed gem features
* Use XDG_DATA_HOME for spec cache
* Do not rely on Gem.user_home
* Gem.user_home is always exists. Don't need to use FileUitls.mkdir_p
* Bump support version to RubyGems 3.2.0+
* Removed the needless fallback configuration
* Fixed the inconsistency methods that are find_config_file and config_file
* Use Gem.configuration.credentials_path instead of hard-coded path
* gem_path is always provided
* Removed the duplicated code of find_home
* Also removed the duplicated code of user_home
* use Gem::UNTAINT instead of untaint for surpressing the warnings
* Use File.directory
* Restore XDG_DATA_HOME
* Use File.write
Notes
Notes:
Merged-By: hsbt <hsbt@ruby-lang.org>
Diffstat (limited to 'test/rdoc')
-rw-r--r-- | test/rdoc/test_rdoc_ri_driver.rb | 22 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_store.rb | 7 |
2 files changed, 18 insertions, 11 deletions
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 6f17fecec9..1a8ac3dde5 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -15,6 +15,8 @@ class TestRDocRIDriver < RDoc::TestCase @orig_ri = ENV['RI'] @orig_home = ENV['HOME'] ENV['HOME'] = @tmpdir + @rdoc_home = File.join ENV["HOME"], ".rdoc" + FileUtils.mkdir_p @rdoc_home ENV.delete 'RI' @options = RDoc::RI::Driver.default_options @@ -81,7 +83,7 @@ class TestRDocRIDriver < RDoc::TestCase @RM::Rule.new(1), @RM::Paragraph.new('Also found in:'), @RM::Verbatim.new("ruby core", "\n", - "~/.rdoc", "\n")) + @rdoc_home, "\n")) assert_equal expected, out end @@ -231,7 +233,7 @@ class TestRDocRIDriver < RDoc::TestCase doc( head(1, 'Foo::Bar#blah'), blank_line, - para('(from ~/.rdoc)'), + para("(from #{@rdoc_home})"), head(3, 'Implementation from Bar'), rule(1), verb("blah(5) => 5\n", @@ -254,7 +256,7 @@ class TestRDocRIDriver < RDoc::TestCase doc( head(1, 'Qux#aliased'), blank_line, - para('(from ~/.rdoc)'), + para("(from #{@rdoc_home})"), rule(1), blank_line, para('alias comment'), @@ -280,7 +282,7 @@ class TestRDocRIDriver < RDoc::TestCase doc( head(1, 'Foo::Bar#attr'), blank_line, - para('(from ~/.rdoc)'), + para("(from #{@rdoc_home})"), rule(1), blank_line, blank_line) @@ -299,7 +301,7 @@ class TestRDocRIDriver < RDoc::TestCase doc( head(1, 'Bar#inherit'), blank_line, - para('(from ~/.rdoc)'), + para("(from #{@rdoc_home})"), head(3, 'Implementation from Foo'), rule(1), blank_line, @@ -343,13 +345,13 @@ class TestRDocRIDriver < RDoc::TestCase doc( head(1, 'Foo#inherit'), blank_line, - para('(from ~/.rdoc)'), + para("(from #{@rdoc_home})"), rule(1), blank_line, blank_line, head(1, 'Foo#override'), blank_line, - para('(from ~/.rdoc)'), + para("(from #{@rdoc_home})"), rule(1), blank_line, para('must not be displayed in Bar#override'), @@ -802,7 +804,7 @@ Foo::Bar#bother @driver.display_page 'home:README' end - assert_match %r%= README pages in ~/\.rdoc%, out + assert_match %r%= README pages in #{@rdoc_home}%, out assert_match %r%README\.rdoc%, out assert_match %r%README\.md%, out end @@ -856,7 +858,7 @@ Foo::Bar#bother @driver.display_page_list @store1 end - assert_match %r%= Pages in ~/\.rdoc%, out + assert_match %r%= Pages in #{@rdoc_home}%, out assert_match %r%README\.rdoc%, out end @@ -876,7 +878,7 @@ Foo::Bar#bother @driver.display_page_list @store1 end - assert_match %r%= Pages in ~/\.rdoc%, out + assert_match %r%= Pages in #{@rdoc_home}%, out assert_match %r%README\.rdoc%, out assert_match %r%OTHER\.rdoc%, out end diff --git a/test/rdoc/test_rdoc_store.rb b/test/rdoc/test_rdoc_store.rb index 8332d9233e..076b8e7d4e 100644 --- a/test/rdoc/test_rdoc_store.rb +++ b/test/rdoc/test_rdoc_store.rb @@ -317,6 +317,9 @@ class TestRDocStore < XrefTestCase end def test_friendly_path + @orig_xdg_data_home = ENV['XDG_DATA_HOME'] + ENV.delete('XDG_DATA_HOME') + @s.path = @tmpdir @s.type = nil assert_equal @s.path, @s.friendly_path @@ -331,11 +334,13 @@ class TestRDocStore < XrefTestCase assert_equal "ruby site", @s.friendly_path @s.type = :home - assert_equal "~/.rdoc", @s.friendly_path + assert_equal File.expand_path("~/.local/share/rdoc"), @s.friendly_path @s.type = :gem @s.path = "#{@tmpdir}/gem_repository/doc/gem_name-1.0/ri" assert_equal "gem gem_name-1.0", @s.friendly_path + ensure + ENV['XDG_DATA_HOME'] = @orig_xdg_data_home end def test_dry_run |