Explorar o código

Fix helptags generation for plugins with custom rtp

Close #684
Junegunn Choi %!s(int64=8) %!d(string=hai) anos
pai
achega
ddc67fc136
Modificáronse 3 ficheiros con 16 adicións e 1 borrados
  1. 1 1
      plug.vim
  2. 4 0
      test/run
  3. 11 0
      test/workflow.vader

+ 1 - 1
plug.vim

@@ -605,7 +605,7 @@ function! plug#helptags()
     return s:err('plug#begin was not called')
   endif
   for spec in values(g:plugs)
-    let docd = join([spec.dir, 'doc'], '/')
+    let docd = join([s:rtp(spec), 'doc'], '/')
     if isdirectory(docd)
       silent! execute 'helptags' s:esc(docd)
     endif

+ 4 - 0
test/run

@@ -77,6 +77,10 @@ DOC
 
   make_dirs yyy/ yyy
   make_dirs yyy/after yyy
+  mkdir -p "$PLUG_FIXTURES/yyy/rtp/doc"
+  cat > "$PLUG_FIXTURES/yyy/rtp/doc/yyy.txt" << DOC
+hello *yyy*
+DOC
   gitinit yyy
 
   make_dirs z1/ z1

+ 11 - 0
test/workflow.vader

@@ -1130,10 +1130,17 @@ Before:
 **********************************************************************
 
 Execute (plug#helptags):
+  call plug#begin()
+  Plug '$PLUG_FIXTURES/xxx'
+  Plug '$PLUG_FIXTURES/yyy', { 'rtp': 'rtp' }
+  call plug#end()
   silent! call delete(expand('$PLUG_FIXTURES/xxx/doc/tags'))
+  silent! call delete(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
   Assert !filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
+  Assert !filereadable(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
   AssertEqual 1, plug#helptags()
   Assert filereadable(expand('$PLUG_FIXTURES/xxx/doc/tags'))
+  Assert filereadable(expand('$PLUG_FIXTURES/yyy/rtp/doc/tags'))
 
 **********************************************************************
 ~ Manual loading
@@ -1141,6 +1148,10 @@ Execute (plug#helptags):
 
 Execute (plug#load - invalid arguments):
   call ResetPlug()
+  call plug#begin()
+  Plug '$PLUG_FIXTURES/xxx', { 'for': 'xxx' }
+  Plug '$PLUG_FIXTURES/yyy', { 'for': 'yyy' }
+  call plug#end()
   AssertEqual 0, plug#load()
   AssertEqual 0, plug#load('non-existent-plugin')
   AssertEqual 0, plug#load('non-existent-plugin', 'another-non-existent-plugin')