[SCM] vim-addon-manager packaging branch, master, updated. v0.4.4-52-geef7258

Antonio Terceiro terceiro at debian.org
Tue Jan 31 23:33:41 UTC 2012


The following commit has been merged in the master branch:
commit 1444f677045da7fb6ae32e96ccfa849263267a9c
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sun Jan 22 20:40:53 2012 -0200

    Allow addons to specify their own directory

diff --git a/lib/vim/addon_manager/addon/directory.rb b/lib/vim/addon_manager/addon/directory.rb
index 5f3c7f7..cf140b2 100644
--- a/lib/vim/addon_manager/addon/directory.rb
+++ b/lib/vim/addon_manager/addon/directory.rb
@@ -6,6 +6,13 @@ module Vim
 
       class Directory < Addon
 
+        def initialize(yaml, basedir)
+          @directory = yaml['directory']
+          super
+        end
+
+        attr_reader :directory
+
         def status(target_dir)
           if File.symlink?(destination(target_dir))
             AddonStatus.new :installed
@@ -35,7 +42,7 @@ module Vim
       protected
 
         def source
-          File.join(basedir, 'bundle', name)
+          directory || File.join(basedir, 'bundle', name)
         end
 
         def destination(target_dir)
diff --git a/spec/data/registry/newstylewithdir.yaml b/spec/data/registry/newstylewithdir.yaml
new file mode 100644
index 0000000..99a3fc7
--- /dev/null
+++ b/spec/data/registry/newstylewithdir.yaml
@@ -0,0 +1,4 @@
+addon: newstylewithdir
+description: "new style addon with a directory instead of files"
+directory: /path/to/newstylewithdir
+
diff --git a/spec/vim/addon_manager/addon/directory_spec.rb b/spec/vim/addon_manager/addon/directory_spec.rb
index 775949a..d4fdf64 100644
--- a/spec/vim/addon_manager/addon/directory_spec.rb
+++ b/spec/vim/addon_manager/addon/directory_spec.rb
@@ -13,6 +13,19 @@ describe Vim::AddonManager::Addon::Directory do
     addon.files.should include('syntax/newstyle.vim')
   end
 
+  it 'constructs source with basedir by default' do
+    addon = addon('newstyle')
+    addon.stub(:basedir).and_return('/base/dir')
+    addon.directory.should be_nil
+    addon.send(:source).should == '/base/dir/bundle/newstyle'
+  end
+
+  it 'uses directory as source if specified' do
+    addon = addon('newstylewithdir')
+    addon.directory.should == '/path/to/newstylewithdir'
+    addon.send(:source).should == '/path/to/newstylewithdir'
+  end
+
   context 'when installed' do
     before do
       @addon = addon('newstyle')

-- 
vim-addon-manager packaging



More information about the pkg-vim-maintainers mailing list