[SCM] vim-addon-manager packaging branch, master, updated. v0.4.4-52-geef7258
Antonio Terceiro
terceiro at debian.org
Tue Jan 31 23:32:56 UTC 2012
The following commit has been merged in the master branch:
commit 77a7fc2d643e2136607741fcc8c47b4c1a15969c
Author: Antonio Terceiro <terceiro at debian.org>
Date: Mon Jan 9 15:22:12 2012 -0200
Fix indentation
diff --git a/lib/vim/addon-manager.rb b/lib/vim/addon-manager.rb
index b89a1c7..725fdc6 100644
--- a/lib/vim/addon-manager.rb
+++ b/lib/vim/addon-manager.rb
@@ -29,30 +29,30 @@ module Vim
def install(addons)
installed_files = []
addons.each do |addon|
- base_dir = (addon.basedir or @source_dir)
- symlink = lambda do |file|
- dest = File.join(@target_dir, file)
- dest_dir = File.dirname dest
- FileUtils.mkdir_p dest_dir
- FileUtils.ln_sf(File.join(base_dir, file), dest)
- end
- status = addon.status(@target_dir)
- case status.status
- when :broken
- Vim.info "installing broken addon '#{addon}' to #{@target_dir}"
- status.missing_files.each(&symlink)
- installed_files.concat(status.missing_files.to_a)
- when :not_installed
- Vim.info "installing removed addon '#{addon}' to #{@target_dir}"
- addon.files.each(&symlink)
- installed_files.concat(addon.files.to_a)
- when :unavailable
- s = "ignoring '#{addon}' which is missing source files"
- s << "\n- #{status.missing_files.join "\n- "}" if Vim.verbose?
- Vim.warn s
- else
- Vim.info "ignoring '#{addon}' which is neither removed nor broken"
- end
+ base_dir = (addon.basedir or @source_dir)
+ symlink = lambda do |file|
+ dest = File.join(@target_dir, file)
+ dest_dir = File.dirname dest
+ FileUtils.mkdir_p dest_dir
+ FileUtils.ln_sf(File.join(base_dir, file), dest)
+ end
+ status = addon.status(@target_dir)
+ case status.status
+ when :broken
+ Vim.info "installing broken addon '#{addon}' to #{@target_dir}"
+ status.missing_files.each(&symlink)
+ installed_files.concat(status.missing_files.to_a)
+ when :not_installed
+ Vim.info "installing removed addon '#{addon}' to #{@target_dir}"
+ addon.files.each(&symlink)
+ installed_files.concat(addon.files.to_a)
+ when :unavailable
+ s = "ignoring '#{addon}' which is missing source files"
+ s << "\n- #{status.missing_files.join "\n- "}" if Vim.verbose?
+ Vim.warn s
+ else
+ Vim.info "ignoring '#{addon}' which is neither removed nor broken"
+ end
end
rebuild_tags(installed_files)
end
@@ -60,43 +60,43 @@ module Vim
def remove(addons)
removed_files = []
rmdirs = lambda do |file|
- File.delete(File.join(@target_dir, file))
- dir = File.dirname(file)
- paths = (dir.include? File::Separator) ? File.split(dir) : [dir]
- while paths.size > 0
- begin
- FileUtils.rmdir(File.join(@target_dir, paths))
- rescue Errno::ENOTEMPTY
- break
- end
- paths.pop
- end
+ File.delete(File.join(@target_dir, file))
+ dir = File.dirname(file)
+ paths = (dir.include? File::Separator) ? File.split(dir) : [dir]
+ while paths.size > 0
+ begin
+ FileUtils.rmdir(File.join(@target_dir, paths))
+ rescue Errno::ENOTEMPTY
+ break
+ end
+ paths.pop
+ end
end
addons.each do |addon|
- status = addon.status(@target_dir)
- case status.status
- when :installed
- Vim.info "removing installed addon '#{addon}' from #{@target_dir}"
- addon.files.each(&rmdirs)
- removed_files.concat(addon.files.to_a)
- when :broken
- Vim.info "removing broken addon '#{addon}' from #{@target_dir}"
- files = (addon.files - status.missing_files)
- files.each(&rmdirs)
- removed_files.concat(files.to_a)
- else
- Vim.info "ignoring '#{addon}' which is neither installed nor broken"
- end
+ status = addon.status(@target_dir)
+ case status.status
+ when :installed
+ Vim.info "removing installed addon '#{addon}' from #{@target_dir}"
+ addon.files.each(&rmdirs)
+ removed_files.concat(addon.files.to_a)
+ when :broken
+ Vim.info "removing broken addon '#{addon}' from #{@target_dir}"
+ files = (addon.files - status.missing_files)
+ files.each(&rmdirs)
+ removed_files.concat(files.to_a)
+ else
+ Vim.info "ignoring '#{addon}' which is neither installed nor broken"
+ end
end
# Try to clean up the tags file and doc dir if it's empty
tagfile = File.join(@target_dir, 'doc', 'tags')
if File.exists? tagfile
- File.unlink tagfile
- begin
- FileUtils.rmdir File.join(@target_dir, 'doc')
- rescue Errno::ENOTEMPTY
- rebuild_tags(removed_files)
- end
+ File.unlink tagfile
+ begin
+ FileUtils.rmdir File.join(@target_dir, 'doc')
+ rescue Errno::ENOTEMPTY
+ rebuild_tags(removed_files)
+ end
end
end
@@ -109,9 +109,9 @@ module Vim
next
end
if lines.any? {|line| addon.is_disabled_by? line}
- Vim.info "ignoring addon '#{addon}' which is already disabled"
- else
- Vim.info "disabling enabled addon '#{addon}'"
+ Vim.info "ignoring addon '#{addon}' which is already disabled"
+ else
+ Vim.info "disabling enabled addon '#{addon}'"
lines << addon.disabled_by_line + "\n"
end
end
@@ -126,12 +126,12 @@ module Vim
"#{addon} can't be enabled (since it has no disabledby field)"
next
end
- if lines.any? {|line| addon.is_disabled_by? line}
- Vim.info "enabling disabled addon '#{addon}'"
- lines.reject! {|line| addon.is_disabled_by? line}
- else
- Vim.info "ignoring addon '#{addon}' which is enabled"
- end
+ if lines.any? {|line| addon.is_disabled_by? line}
+ Vim.info "enabling disabled addon '#{addon}'"
+ lines.reject! {|line| addon.is_disabled_by? line}
+ else
+ Vim.info "ignoring addon '#{addon}' which is enabled"
+ end
end
end
end
diff --git a/lib/vim/registry.rb b/lib/vim/registry.rb
index fd6d9d0..45de91c 100644
--- a/lib/vim/registry.rb
+++ b/lib/vim/registry.rb
@@ -38,26 +38,26 @@ module Vim
def to_s
if @disabled
- 'disabled'
+ 'disabled'
else
- case status
- when :installed
- 'installed'
- when :not_installed
- 'removed'
- when :broken
- s = 'broken'
- if Vim.verbose?
- s << " (missing: #{missing_files.join ', '})"
- end
- s
- when :unavailable
- s = 'unavailable'
- if Vim.verbose?
- s << " (missing source files: #{missing_files.join ', '})"
- end
- s
- end
+ case status
+ when :installed
+ 'installed'
+ when :not_installed
+ 'removed'
+ when :broken
+ s = 'broken'
+ if Vim.verbose?
+ s << " (missing: #{missing_files.join ', '})"
+ end
+ s
+ when :unavailable
+ s = 'unavailable'
+ if Vim.verbose?
+ s << " (missing source files: #{missing_files.join ', '})"
+ end
+ s
+ end
end
end
@@ -93,27 +93,27 @@ module Vim
def status(target_dir)
expected_dest = @files.collect {|f| File.join(target_dir, f)}
installed = expected_dest.select do |f|
- File.exist? f
+ File.exist? f
end
expected_src = @files.collect {|f| File.join(@basedir, f)}
available = expected_src.select do |f|
- File.exist? f
+ File.exist? f
end
status =
- if available.size != expected_src.size
- missing = expected_src - available
- AddonStatus.new(:unavailable, missing)
- elsif installed.size == expected_dest.size
- AddonStatus.new :installed
- elsif installed.size == 0
- AddonStatus.new :not_installed
- else
- missing = expected_dest - installed
- prefix = /^#{Regexp.escape target_dir}\/+/o
- missing.collect! {|f| f.gsub(prefix, '')}
- AddonStatus.new(:broken, missing)
- end
+ if available.size != expected_src.size
+ missing = expected_src - available
+ AddonStatus.new(:unavailable, missing)
+ elsif installed.size == expected_dest.size
+ AddonStatus.new :installed
+ elsif installed.size == 0
+ AddonStatus.new :not_installed
+ else
+ missing = expected_dest - installed
+ prefix = /^#{Regexp.escape target_dir}\/+/o
+ missing.collect! {|f| f.gsub(prefix, '')}
+ AddonStatus.new(:broken, missing)
+ end
status.disabled = is_disabled_in? target_dir
status
@@ -177,17 +177,17 @@ module Vim
def AddonRegistry.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
- end
+ # 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
+ end
end
end
--
vim-addon-manager packaging
More information about the pkg-vim-maintainers
mailing list