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

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


The following commit has been merged in the master branch:
commit 939c3b8f0a7ee712e137e9b6cbe17963933ec526
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sun Jan 22 08:57:28 2012 -0200

    Simpler implementation of "load all addons"
    
    Motivation: YAML.load_documents is deprecated in Ruby 1.9. However, I
    had to add a small hack to keep compatibility with Ruby 1.8.

diff --git a/lib/vim/addon_manager/registry.rb b/lib/vim/addon_manager/registry.rb
index 954cad5..20ed86a 100644
--- a/lib/vim/addon_manager/registry.rb
+++ b/lib/vim/addon_manager/registry.rb
@@ -38,17 +38,11 @@ module Vim
       end
 
       def self.each_addon(dir, basedir)
-        Find.find(dir) do |path|
-          # selects .yaml files (non-recursively) contained in dir
-          next if path == dir
-          Find.prune if File.directory? path
-          if File.file? path
-            Find.prune if path !~ /\.yaml$/
-              File.open path do |f|
-                YAML.load_documents f do |ydoc|
-                  yield(Addon.new(ydoc, basedir)) if ydoc
-                end
-              end
+        Dir.glob(File.join(dir, '*.yaml')).each do |yaml|
+          stream = YAML.load_stream(File.read(yaml))
+          stream = stream.documents if stream.respond_to?(:documents) # Ruby 1.8 compatibility
+          stream.each do |ydoc|
+            yield(Addon.new(ydoc, basedir)) if ydoc
           end
         end
       end

-- 
vim-addon-manager packaging



More information about the pkg-vim-maintainers mailing list