vim-addon-manager-0.5.3/0000755000000000000000000000000012247414262011677 5ustar vim-addon-manager-0.5.3/vim-addon-manager.gemspec0000644000000000000000000000124612044320526016527 0ustar require './lib/vim/addon_manager/version.rb' Gem::Specification.new do |s| s.name = 'vim-addon-manager' s.version = Vim::AddonManager::VERSION s.summary = "Extension manager for the Vim text editor" s.description = "vim-addon-manager lets you install, remove and upgrade extension for the Vim text editor. Those extensions can be obtained from system directories or from the internet." s.authors = `git log --format=%aN | sort | uniq -c | sort -n -r | sed -e 's/\\s*[0-9]\\+\\s*//'`.lines.map(&:strip) s.email = 'terceiro@softwarelivre.org' s.files = Dir.glob('**/*') s.homepage = 'http://rubygems.org/gems/vim-addon-manager' end vim-addon-manager-0.5.3/TODO0000644000000000000000000000342512032117301012355 0ustar Short term ========== - Get vim to load vimrc files provided by packages: " Support .d-style configuration directory. All files under /etc/vim/vimrc.d/ " will be sourced. for rcfile in split(glob('/etc/vim/vimrc.d/*.vim')) execute 'source ' . rcfile endfor - update documentation: + vim-policy (debian/policy/ on vim source package) Note the fact that new-style addons must provide pre-built tag files - figure out the upgrade path for addons that move from the "everything mixed together in /usr/share/vim/addons" to the "new layout", i.e. all addon files together, separated from other addons, in /usr/share/vim/addons/$whatever/$addonname - add a `cleanup` command to remove dangling symlinks from the target directory? - add an `upgrade` command to figure out which addons should be installed based on the dangling symlinks, them removing those symlinks and re-installing the addons in the new way? - addons could just change the 'files' attribute to 'oldfiles' or something like that, so that they could reconstruct objects using the legacy addon class, them remove the legacy installations, then installing the new addon. Middle/Long term ================ - Allow the admin to declare whether they want registered addons to be automatically installed system-wide. Use debconf & dpkg triggers? - implement some way to install stuff from remote servers: - git repositories - .zip files from vim.org - etc It would be cooler if these addons first went into a separate registry (e.g. /var/lib/vim/registry/ system-wide and ~/.vim/registry and them were installed like regular addons) - look closer at http://www.vim.org/scripts/script.php?script_id=2905 we must fix the view that vim-addon-manager is "Debian specific" vim-addon-manager-0.5.3/features/0000755000000000000000000000000011763235564013525 5ustar vim-addon-manager-0.5.3/features/remove.feature0000644000000000000000000000047711712074672016402 0ustar Feature: removing addons Scenario: removing foo Given foo is installed When I run `vim-addons remove foo` Then foo should not be installed anymore Scenario: removing newstyle Given newstyle is installed When I run `vim-addons remove newstyle` Then newstyle should not be installed anymore vim-addon-manager-0.5.3/features/step_definitions/0000755000000000000000000000000012044344033017054 5ustar vim-addon-manager-0.5.3/features/step_definitions/steps.rb0000644000000000000000000000516712044343340020550 0ustar require 'rbconfig' require 'tmpdir' ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) $sources_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')) libdir = File.join($sources_root, 'lib') registry = File.join($sources_root , 'spec/data/registry') source = File.join($sources_root, 'spec/data/scripts') def program_path(program) File.join($sources_root, 'bin', program) end Before do $tmpdir = Dir.mktmpdir end After do FileUtils.rm_rf($tmpdir) end When /^I run `(\S+) (.*)`$/ do |program, args| command = [ruby, "-I#{libdir}", program_path(program), '--silent', '--registry-dir', registry, '--source-dir', source, '--target-dir', $tmpdir] args.split.each { |a| command << a } stdout = File.join($tmpdir, 'stdout') stderr = File.join($tmpdir, 'stderr') cmd = command.join(' ') success = system("#{cmd} >#{stdout} 2>#{stderr}") @stdout = File.read(stdout) @stderr = File.read(stderr) if !success errormsgs = [] errormsgs << "Command `#{cmd}` failed with exit status #{$?.exitstatus}" errormsgs << "stdout:" errormsgs << '=======' errormsgs << @stdout errormsgs << "stderr:" errormsgs << '=======' errormsgs << @stderr raise errormsgs.join("\n") end end def installed_addon_files(addon) descriptor = File.join($sources_root, 'spec/data/registry/' + addon + '.yaml') if !File.exists?(descriptor) || YAML.load_file(descriptor)['files'] Dir.glob(File.join($tmpdir, '*', addon + '.vim')) else Dir.glob(File.join($tmpdir, 'vam', addon)) end end Then /^(.*) should be installed$/ do |addon| installed_addon_files(addon).should_not be_empty end Given /^(.*) is installed$/ do |addon| step "I run `vim-addons install #{addon}`" end Then /^(.*) should not be installed anymore$/ do |addon| installed_addon_files(addon).should be_empty end Then /^(?:vim-addons must output|the output should match) "([^"]*)"$/ do |text| @stdout.should =~ Regexp.new(text) end Then /^vim-addons should warn "([^"]*)"$/ do |text| @stderr.should =~ Regexp.new(text) end Then /^the documentation should be indexed$/ do Dir.glob(File.join($tmpdir, 'doc', 'tags')).should_not be_empty end Given /^(\S*) was previously installed as an old\-style addon$/ do |addon| Dir.chdir $tmpdir do FileUtils.mkdir_p 'syntax' FileUtils.ln_s '/not/existing/syntax', "syntax/#{addon}.vim" FileUtils.mkdir_p 'ftplugin' FileUtils.ln_s '/not/existing/ftplugin', "ftplugin/#{addon}.vim" end end Given /^there should be no broken symlinks$/ do Dir.glob(File.join($tmpdir, '**/*')).select { |f| File.symlink?(f) && !File.exists?(f) }.should be_empty end vim-addon-manager-0.5.3/features/show.feature0000644000000000000000000000043611712550016016047 0ustar Feature: showing addons Scenario: showing foo When I run `vim-addons show foo` Then vim-addons must output "Addon: foo" And vim-addons must output "Description:.*" And vim-addons must output " - syntax/foo.vim" And vim-addons must output " - ftplugin/foo.vim" vim-addon-manager-0.5.3/features/install.feature0000644000000000000000000000103211712107211016521 0ustar Feature: installing addons Scenario: installing foo When I run `vim-addons install foo` Then foo should be installed Scenario: unknown addons When I run `vim-addons install addonthatdoesnotexist` Then vim-addons should warn "Ignoring unknown addons: addonthatdoesnotexist" Scenario: installing newstyle When I run `vim-addons install newstyle` Then newstyle should be installed Scenario: addon with documentation When I run `vim-addons install withdoc` Then the documentation should be indexed vim-addon-manager-0.5.3/features/program-names.feature0000644000000000000000000000034111727771110017640 0ustar Feature: different program names Scenario Outline: When I run ` --help` Then the output should match "Usage:" Examples: | program_name | | vim-addons | | vim-addon-manager | | vam | vim-addon-manager-0.5.3/features/upgrade_from_legacy.feature0000644000000000000000000000043411716724320021070 0ustar Feature: upgrading legacy addons Scenario: upgrading newstylemigrated Given newstylemigrated was previously installed as an old-style addon When I run `vim-addons upgrade-from-legacy` Then there should be no broken symlinks And newstylemigrated should be installed vim-addon-manager-0.5.3/test/0000755000000000000000000000000011740424617012660 5ustar vim-addon-manager-0.5.3/test/console0000755000000000000000000000025711712106016014241 0ustar #!/bin/sh root=$(dirname $0 | xargs dirname | xargs readlink -f) irb -I$root/lib -rvim/addon_manager -rvim/addon_manager/registry -r./spec/spec_helper -r'./test/console.rb' vim-addon-manager-0.5.3/test/console.rb0000644000000000000000000000004211712105762014637 0ustar include VimAddonManagerSpecHelper vim-addon-manager-0.5.3/test/vimrc0000644000000000000000000000016311712213720013711 0ustar execute 'set runtimepath=' . $PWD . '/tmp' set nocompatible source etc/vim/vimrc.d/vim-addon-manager.vim syntax on vim-addon-manager-0.5.3/test/vim0000755000000000000000000000004211712213216013363 0ustar #!/bin/sh exec vim -u test/vimrc vim-addon-manager-0.5.3/test/vam0000777000000000000000000000000011740424617015347 2vim-addonsustar vim-addon-manager-0.5.3/test/vim-addons0000755000000000000000000000040211712074672014644 0ustar #!/bin/sh basename=$(basename $0) root=$(dirname $0 | xargs dirname | xargs readlink -f) export RUBYLIB="$root/lib" exec "$root/bin/$basename" --source-dir "$root/spec/data/scripts" --registry-dir "$root/spec/data/registry" --target-dir "$root/tmp" "$@" vim-addon-manager-0.5.3/test/vim-addon-manager0000777000000000000000000000000011740424616020051 2vim-addonsustar vim-addon-manager-0.5.3/doc/0000755000000000000000000000000012044343204012434 5ustar vim-addon-manager-0.5.3/doc/template.html0000644000000000000000000000422512044342047015144 0ustar $for(author-meta)$ $endfor$ $if(date-meta)$ $endif$ $if(title-prefix)$$title-prefix$ - $endif$$if(pagetitle)$$pagetitle$$endif$ $if(highlighting-css)$ $endif$ $for(css)$ $endfor$ $if(math)$ $math$ $endif$ $for(header-includes)$ $header-includes$ $endfor$ $for(include-before)$ $include-before$ $endfor$
$if(toc)$
$toc$
$endif$ $body$
$for(include-after)$ $include-after$ $endfor$ vim-addon-manager-0.5.3/doc/registry-format.txt0000644000000000000000000000741511727776336016371 0ustar Vim Addon Registry ================== On-Disk Format -------------- The registry is stored on disk as a single directory directly (i.e. not in any sub-directory) containing a set of files in YAML [1] format. At the time of writing the directory containing the Vim addon registry is /usr/share/vim/registry/. Each file is a multi-document YAML file (i.e. it can be composed by several different YAML documents separated by "---" lines). Each YAML document represent a registry entry, that is the information describing a single addon. Ideally, the registry directory contains one file per package shipping addons; with a filename obeying to the convention PACKAGE-NAME.yaml. Hence a single package can contribute to the registry with multiple entries described in a single YAML file. For example, the "vim-scripts" package should ship a single /usr/share/vim/registry/vim-scripts.yaml file, containing one YAML document per shipped addon. The first lines of such file can look like the following (two space of indentation manually added to the present text file): addon: alternate description: "alternate pairing files (e.g. .c/.h) with short ex-commands" basedir: /usr/share/vim-scripts/ files: - plugin/a.vim - doc/alternate.txt --- addon: whatdomain description: "query the meaning of a Top Level Domain" basedir: /usr/share/vim-scripts/ files: - plugin/whatdomain.vim --- Each registry entry may contain the following fields, to be typeset according to the YAML specification: addon: name of the addon (required field) description: human understandable textual description of the addon (required field) type: The type of the addon. Currently there are two types of addons. Addons with type "legacy" (the default) are old-style addons: each of its files (listed in the "files" field) will be symlinked into the target installation directory. Addons with type "directory" must install to a single directory, and their installation will result in a single symlink under $target_dir/vam, which will be added to vim's runtimepath. This is the recommended addon type; see addon-directory.markdown for details. If the "type" field is ommitted, it is assumed "legacy". This is to keep backwards compatibility with previous addons. files: list of the files which compose the addon and are required to be present in a component of the Vim runtime path for the addon to be enabled. Each file is specified relative to a component of the Vim runtime path (required field for addons of type "legacy".) directory: for addons of type "directory", this field should indicate the directory in which the addon is installed. If ommitted, it is assumed the addon is installed to a subdirectory of /usr/share/vim/addons/vam. legacy_files: for addons that were of type "legacy" and migrated to the type "directory", this field must list the files that the addon used to contain. This information is used when trying to automatically upgrade the addons installed by users from the old format to the new format. basedir: directory where the files shipped by the addon (i.e. where the symlinks of the user/sysadm should point to) reside on the filesystem (optional field, default to: /usr/share/vim/addons) disabledby: vim script command that can be used (usually by adding it to ~/.vimrc) to prevent the addon from being used even when it is installed. The intended usage of this field is to "blacklist" an undesired addon whose files are available, and hence automatically loaded by Vim, in a component of the Vim runtime path. (optional field) References ---------- [1] http://www.yaml.org/ Stefano Zacchiroli -- Tue, 23 Jan 2007 15:12:00 +0100 zack vim-addon-manager-0.5.3/doc/addon-directory.markdown0000644000000000000000000000566011740374256017313 0ustar # vim-addon-manager: one addon per directory The original addon format used by vim-addon-manager has a serious problem. When you have the addon installed (say, into your ~/.vim), then you have one symlink for each file contained by the addon. When that addon is upgraded system-wide and new files are added, or existing files are removed, then it effectively becomes broken, because you will either have missing symlinks or broken ones. Another problem with the current addon system is that you cannot easily install new addons that are not packaged. This new addon type tries to solve both issues. ## Registry entry The registry file for directory addons must be like this: addon: my-addon description: "new style addon with a directory instead of files" type: directory directory: /path/to/my/addon The "type" field must contain the value "directory". The "directory" field must contain the path were the addon is installed. If this field is omitted, vim-addon-manager will assume that the addon was installed to /usr/share/vim/addons/vam/$(addon), where $(addon) is the addon name from the "addon" field. ## Addon contents Each addon must reproduce the contents of a vim runtimepath directory, i.e. it can contain subdirectories doc/, plugin/, autoload/, syntax/, etc. For example, the migrated vim-rails package installs the following files. /usr/share/vim/addons/vam/rails/doc/tags /usr/share/vim/addons/vam/rails/doc/rails.txt /usr/share/vim/addons/vam/rails/plugin/rails.vim /usr/share/vim/addons/vam/rails/autoload/rails.vim These files were previously installed directly into /usr/share/vim/addons, and they are now being installed to /usr/share/vim/addons/vam/rails. When such an addon is installed vim `vim-addon-manager install rails`, you will end up with a symlink at ~/.vim/vam/rails pointing at /usr/share/vim/addons/vam/rails. That symlink will be added to the vim runtimepath during startup. ## Tags files Since the installation involves a single symlink to a directory writable only by root, new style addons must include pre-buit tags files. Note the listing of the vim-rails package above: it already includes a tags file under `doc/tags`. ## Migrating from the old-style addon format If you maintain an existing addon and want to migrate it to the new addon format, follow these steps: * add a "type" field to the registry file, with "directory" as value * rename the "files" field to "legacy\_files". This will help vim-addon-manager with upgrading the addon. * change the package to install to /usr/share/vim/addons/vam/$(addon) instead of scatering its files into /usr/share/vim/addons. During package upgrades, a dpkg trigger vim vim-addon-manager will remove the existing multiple symlinks from the target directory and install the new symlink into $(target\_dir)/vam. ## See also See the dh-vim-addon package, which automates most of the work needed to package vim addons in this new format supported by vim-addon-manager. vim-addon-manager-0.5.3/doc/index.markdown0000644000000000000000000000203612044343144015313 0ustar # vim-addon-manager ## Installation If you use [Debian](http://debian.org/) (or any derivative), you can install from the Debian repository. ```debian $ apt-get install vim-addon-manager ``` On other systems, you can install vim-addon-manager using [Rubygems](http://rubygems.org/): ```rubygems $ gem install vim-addon-manager ``` ## Usage Addon installation: ```shell $ vam install tetris # from vim-scripts package on Debian $ vam install https://github.com/user/extension.git # from git repository ``` Checking the status of your addons: ```shell $ vam status # Name User Status System Status align installed removed alternate removed removed bufexplorer removed removed calendar removed removed closetag removed removed [...] ``` Removing installed addons: ```shell $ vam remove tetris ``` For more in-depth information, check the [documentation](documentation.html). vim-addon-manager-0.5.3/doc/addons-proposal.txt0000644000000000000000000000742111710125410016302 0ustar Handling of Vim Addons ====================== Vim "Addons" ------------ With "addon" we will refer to every additional (set of) feature that can be added to Vim using its extension mechanisms (color schemes, syntaxes, indentation, plugins, ftplugins, ...) Present Issues -------------- Every vim addon is currently installed in /usr/share/vim/addons/, directory which is in the runtimepath. As a consequence every installed addon is always enabled. The only way to choose which ones to load is to override the runtimepath so that /usr/share/vim/addons/ is not listed and manually load the desired one. The "vim-scripts" package is an exception to this rule installing everything under /usr/share/vim-scripts/ and requiring (as documented in the package's README.Debian) the sysadm (resp. local user) to symlink the desired addons to a system-wide directory (resp. ~/.vim). That is to say that none of the vim-scripts addons are enabled per default. Proposed Solution ----------------- Keep on installing addons under /usr/share/vim/addons/ (no changes are needed for all packages which ship addons), but remove this directory from the runtimepath. Adds a directory /var/vim/addons/ to the runtimepath and implement a flexible symlink mechanism (a-la /etc/init.d/) to selectively enable addons. Implementation -------------- 1 registry, 2 tools. ### The Addon Registry The registry keep track of all installed vim addons, associating to each addon name a list of files that should be in the runtimepath for the addon to be enabled. E.g., an entry in the registry can be (in YAML syntax): addon: utl description: "Universal Text Linking: URL-based hyperlinking" basedir: /usr/share/vim-scripts/ files: - plugin/utl.vim - doc/utl_ref.txt - doc/utl_usr.txt - plugin/utl_arr.vim - plugin/utl_rc.vim - plugin/utl_scm.vim - plugin/utl_uri.vim A single package can ship more than one addon. Still, it is recommended that each package named vim- installs a single addon called so that its easier for the user to know the canonical name of addons. The "vim-scripts" package is an exception to this rule being conceived as a bundle of addons. ### Tool 1: update-vim-addons The tool "update-vim-addons" (to be used by sysadms) consumes as input the configuration file /etc/vim/addons which lists, one per line, the name of the addons which should be system-wide enabled. The invocation of "update-vim-addons" is idempotent. Result of the invocation is the setting of all the needed symlinks pointing from /var/vim/addons/ to /usr/share/vim/addons/ (or alternatively to the basedir specified in registry entries), and of course the removal of all the no longer needed symlinks. Companion tools which automatically add/remove lines to /etc/vim/addons and then invoke update-vim-addons (a la apache-modconf) can be made available to be invoked by package postints. All packages shipping vim addons should have in their postinst scripts (conditional) invocations of the above companion tools so that, if the vim addon infrastructure is installed on the target machine, after the installation a given vim-addon is enabled per default. The invocation is conditional so that the installation of the addon infrastructure does not become a vim dependency (since vim itself ships some addons, e.g. matchit). ### Tool 2: vim-addons The tool "vim-addons" (to be used by users) can be used to enable/disable addons on a per user basis. It provides also inspecting facilities (e.g.: list the available addons or query their status for the current user). It additionally provides an override mechanism that let the user enable for her addons which are disabled system-wide and prevent the usage of addons which are enabled system-wide. -- Stefano Zacchiroli Tue, 23 Jan 2007 11:40:29 +0100 zack vim-addon-manager-0.5.3/doc/community.markdown0000644000000000000000000000000012044330074016213 0ustar vim-addon-manager-0.5.3/doc/vim-registry.50000644000000000000000000000537011634506717015206 0ustar .TH vim-registry 5 "January 2010" "Debian Project" "vim addons" .SH NAME vim\-registry \- syntax for vim\-addons registry files .SH SYNOPSIS .I PACKAGE\-NAME.yaml .SH DESCRIPTION A registry file is a multi-document YAML file (i.e. it can be composed by several different YAML documents separated by \*(lq\-\-\-\*(rq lines). Each YAML document represents a registry entry, that is the information describing a single addon. Ideally, the registry directory contains one file per package shipping addons; with a filename obeying to the convention .IR PACKAGE\-NAME.yaml . Hence a single package can contribute to the registry with multiple entries described in a single YAML file. For example, the \*(lqvim-scripts\*(rq package should ship a single .I /usr/share/vim/registry/vim-scripts.yaml file, containing one YAML document per shipped addon. The first lines of such file can look like the following: .PP .RS 4 .EX addon: alternate description: "alternate pairing files (e.g. .c/.h) with short ex\-commands" basedir: \fI/usr/share/vim\-scripts/\fR disabledby: "let loaded_alternateFile = 1" files: \- \fIplugin/a.vim\fR \- \fIdoc/alternate.txt\fR \-\-\- addon: whatdomain description: "query the meaning of a Top Level Domain" basedir: \fI/usr/share/vim-scripts/\fR disabledby: "let loaded_whatdomain = 1" files: \- \fIplugin/whatdomain.vim\fR \-\-\- .EE .RE .PP Each registry entry may contain the following fields, to be typeset according to the YAML specification: .TP addon (Required) Name of the addon. .TP description (Required) Human understandable textual description of the addon. .TP files (Required) List of the files which compose the addon and are required to be present in a component of the Vim runtime path for the addon to be enabled. Each file is specified relative to a component of the Vim runtime path. .TP basedir (Optional) Directory where the files shipped by the addon (i.e., where the symlinks of the user/sysadm should point to) reside on the filesystem. Default is .IR /usr/share/vim/addons . .TP disabledby (Optional) Vim script command that can be used (usually by adding it to \fI~/.vimrc\fR) to prevent the addon from being used even when it is installed. The intended usage of this field is to \*(lqblacklist\*(rq an undesired addon whose files are available, and hence automatically loaded by Vim, in a component of the Vim runtime path. .SH AUTHOR James Vega .SH SEE ALSO .BR vim\-addons (1), .UR http://www.yaml.org/ YAML specification .UE .SH COPYRIGHT Copyright (C) 2010 James Vega .PP This program is free software, you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. vim-addon-manager-0.5.3/doc/img/0000755000000000000000000000000012044333174013215 5ustar vim-addon-manager-0.5.3/doc/img/rubygems.png0000644000000000000000000000465512044334360015570 0ustar PNG  IHDR$$gAMA asRGB cHRMz&u0`:pQ<bKGD pHYs  IDATXi]er{mޙ.]hEiJ j[PD#$~P YˢKĤ&,6@(:-:LgܹsλaTiy~y\c~cqpCyHG}q3lkz[q\ח^pH-nG?tEp]۶mÖ#s W+V_D7 MCӌ[wHʢֆj7IvEz/('IiJ,Jl~zllzGI-jETڕ0 ` mի+0=yךkY^PUZRQKewzjgSz utu.3/v1ZBW岡X"qLNc ,%S;v|=^~Ktuݹb9 ݿuRЫ"l0 2Kmٕ- lvu/ba;h.2H @.jr<4¥֣:\(*}TDE9:hj졃Gϔ38^%uPz=YALx2&0c7H$U B ,!C>2ޏukK,W.c!ep]vCD]:uJI^+p0`0C'w]CChol6NMA󐞇ZXJ8-$JFu=潛9w+Sn/Z\ P$;qo4r]jل CA֨i [k_ׁ5UP PB{ɽǪg.|=;i#F8iF}u } L,B[6TS)sc18(Gg6Ln+7" iؔ-|㝇Kԯp7LvR07g&- 'A %R2 24͂ZNeug73k6vp|ƈQ[ec Tg*Zbo3_پw6/+xNj#ƍ=;|?XA)VpP*Zx̧{T|wB^c^zB录Sl4yK--0. u|/1W'I)b ¾zCyvLg;"HDB`2( Z&Mhe+ _ w=ct O*i QxPG.{늴 :?jlRsrxm5$}aݠdnfAAbKGD pHYs..*'  IDAT8c`@\<| VǦDBed1+$TTՀ,u t5@q-mq]s n52EQcb Tc&fںEV#%;!{[:9[yh 몬nw뭜p<@}|o + j%KR2,Ďj (0vL8~$dQ|B"L"ikr 闚pTT 8'skc!wk"DCYST`dRס%aT* ʲ+0*DtU5uP Tym]ـjj65a`himq;:ኢ¬\>³ʝ0qdH+PW%KMigtҶAMqfu͙;cb֭Y'); }); }); vim-addon-manager-0.5.3/doc/Makefile0000644000000000000000000000022411740435026014100 0ustar all: vim-addon-manager.1 clean: rm -f vim-addon-manager.1 vim-addon-manager.1: ../bin/vim-addon-manager rd2 -r rd/rd2man-lib -o $(basename $@) $< vim-addon-manager-0.5.3/spec/0000755000000000000000000000000012247414661012634 5ustar vim-addon-manager-0.5.3/spec/spec_helper.rb0000644000000000000000000000247512247413032015451 0ustar require 'vim/addon_manager' require 'vim/addon_manager/registry' require 'tmpdir' begin require 'pry' rescue LoadError end FAKE_REGISTRY = File.join(File.dirname(__FILE__), 'data/registry') FAKE_SCRIPTS = File.join(File.dirname(__FILE__), 'data/scripts') module VimAddonManagerSpecHelper class Target attr :path def initialize(path) @path = path end alias :to_s :path def has_file?(file) File.exists?(File.join(path, file)) end def has_symlink?(file) File.symlink?(File.join(path, file)) end def rm(file) FileUtils.rm(File.join(path, file)) end end def tmpdir @tmpdir ||= Dir.mktmpdir end def target_dir @target_dir ||= Target.new(tmpdir) end def registry @registry ||= Vim::AddonManager::Registry.new(FAKE_REGISTRY, FAKE_SCRIPTS) end def addon(name) registry[name] end def addons(*addon_names) addon_names.map { |name| registry[name] } end def addon_manager @addon_manager ||= Vim::AddonManager.new(target_dir.path) end def override_file @override_file ||= Vim::AddonManager.override_file(target_dir.path) end end require 'rspec' RSpec.configure do |config| config.before { Vim::AddonManager.logger.quiet! } config.after { FileUtils.rm_rf(tmpdir) } config.include VimAddonManagerSpecHelper end vim-addon-manager-0.5.3/spec/vim/0000755000000000000000000000000012247414661013427 5ustar vim-addon-manager-0.5.3/spec/vim/addon_manager/0000755000000000000000000000000011716722172016205 5ustar vim-addon-manager-0.5.3/spec/vim/addon_manager/addon_spec.rb0000644000000000000000000000056311712074672020636 0ustar require 'spec_helper' describe Vim::AddonManager::Addon do it 'should build legacy addon objects if files atribute is specified' do addon('foo').should be_a(Vim::AddonManager::Addon::Legacy) end it 'should build new style addon objects if files attribute is not specified' do addon('newstyle').should be_a(Vim::AddonManager::Addon::Directory) end end vim-addon-manager-0.5.3/spec/vim/addon_manager/registry_spec.rb0000644000000000000000000000051011712074672021411 0ustar require 'spec_helper' describe Vim::AddonManager::Registry do before do @registry = Vim::AddonManager::Registry.new(FAKE_REGISTRY, FAKE_SCRIPTS) end it 'finds all addons in a directory' do list = []; @registry.each { |a| list << a.name } list.should include('foo') list.should include('bar') end end vim-addon-manager-0.5.3/spec/vim/addon_manager/addon/0000755000000000000000000000000011727767063017304 5ustar vim-addon-manager-0.5.3/spec/vim/addon_manager/addon/legacy_spec.rb0000644000000000000000000000172511712074672022103 0ustar require 'spec_helper' describe Vim::AddonManager::Addon::Legacy do it 'should have a :unavailable status if it misses files' do addon('missingfiles').status(target_dir.path).status.should == :unavailable end it 'should have a :broken status if files are removed in the target dir' do addon_manager.install addons('foo') target_dir.rm('syntax/foo.vim') addon('foo').status(target_dir.path).status.should == :broken end it 'should have a :not_installed status by default' do addon('foo').status(target_dir.path).status.should == :not_installed end it 'should have a :installed status after being installed' do addon_manager.install addons('foo') addon('foo').status(target_dir.path).status.should == :installed end it 'go back to :not_installed after being removed' do addon_manager.install addons('foo') addon_manager.remove addons('foo') addon('foo').status(target_dir.path).status.should == :not_installed end end vim-addon-manager-0.5.3/spec/vim/addon_manager/addon/directory_spec.rb0000644000000000000000000000343011727767063022647 0ustar require 'spec_helper' describe Vim::AddonManager::Addon::Directory do it 'report status as :not_installed by default' do addon('newstyle').status(target_dir).status.should == :not_installed end it 'lists files inside the directory' do addon = addon('newstyle') addon.stub(:basedir).and_return(File.join(FAKE_SCRIPTS)) addon.files.should include('vam/newstyle/ftplugin/newstyle.vim') addon.files.should include('vam/newstyle/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/vam/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') @addon.install(target_dir) end it 'installs symlink into ~/.vim/vam/' do Dir.glob(File.join(target_dir.path, 'vam', 'newstyle')).should_not be_empty end it 'points to the source directory' do File.readlink(File.join(target_dir.path, 'vam', 'newstyle')).should == @addon.send(:source) end it 'reports status as :installed' do @addon.status(target_dir).status.should == :installed end context 'and removed' do before do @addon.remove(target_dir) end it 'reports status as :not_installed' do @addon.status(target_dir.path).status.should == :not_installed end it 'removes symlink from ~/.vim/vam/' do Dir.glob(File.join(target_dir.path, 'vam', 'newstyle')).should be_empty end end end end vim-addon-manager-0.5.3/spec/vim/addon_manager_spec.rb0000644000000000000000000000274512247413441017550 0ustar require 'spec_helper' describe Vim::AddonManager do it 'installs addons' do addon_manager.install addons('foo') target_dir.should have_file('syntax/foo.vim') end it 'installs multiple addons at once' do addon_manager.install addons('foo', 'bar') target_dir.should have_file('syntax/foo.vim') target_dir.should have_file('syntax/bar.vim') end it 'removes addons' do addon_manager.install addons('foo') addon_manager.remove addons('foo') target_dir.should_not have_file('syntax/foo.vim') end it 'fixes broken addons after they are upgraded to the new style' do Dir.chdir target_dir.path do FileUtils.mkdir_p 'syntax' FileUtils.ln_s '/non/existing/path', 'syntax/newstylemigrated.vim' end addon_manager.upgrade_from_legacy(registry.to_a) target_dir.should_not have_symlink('syntax/newstylemigrated.vim') target_dir.should have_file('vam/newstylemigrated/syntax/newstylemigrated.vim') end it 'disables addons' do addon_list = addons('foo') addon_manager.install(addon_list) addon_manager.disable(addon_list) output = File.readlines(override_file).map(&:strip) output.should include(addon_list.first.disabled_by_line) end it 're-enables addons' do addon_list = addons('foo') addon_manager.install(addon_list) addon_manager.disable(addon_list) File.exists?(override_file).should be_true addon_manager.enable(addon_list) File.exists?(override_file).should be_false end end vim-addon-manager-0.5.3/spec/data/0000755000000000000000000000000011712074672013545 5ustar vim-addon-manager-0.5.3/spec/data/registry/0000755000000000000000000000000012247400726015412 5ustar vim-addon-manager-0.5.3/spec/data/registry/newstylemigrated.yaml0000644000000000000000000000027511727773022021675 0ustar addon: newstylemigrated description: "new style addon that had a previous old-style version" type: directory legacy_files: - syntax/newstylemigrated.vim - ftplugin/newstylemigrated.vim vim-addon-manager-0.5.3/spec/data/registry/newstyle.yaml0000644000000000000000000000014111727773042020152 0ustar addon: newstyle description: "new style addon with a directory instead of files" type: directory vim-addon-manager-0.5.3/spec/data/registry/missingfiles.yaml0000644000000000000000000000012311712074672020771 0ustar addon: missingfiles description: "missingfiles" files: - syntax/missingfiles.vim vim-addon-manager-0.5.3/spec/data/registry/withdoc.yaml0000644000000000000000000000010111712107332017720 0ustar addon: withdoc description: "withdoc" files: - doc/withdoc.txt vim-addon-manager-0.5.3/spec/data/registry/bogus1.yaml0000644000000000000000000000000011712074672017467 0ustar vim-addon-manager-0.5.3/spec/data/registry/foo.yaml0000644000000000000000000000016012247400274017054 0ustar addon: foo description: "foo" files: - syntax/foo.vim - ftplugin/foo.vim disabledby: "let foo_disabled = 1" vim-addon-manager-0.5.3/spec/data/registry/bar.yaml0000644000000000000000000000007011712074672017042 0ustar addon: bar description: "bar" files: - syntax/bar.vim vim-addon-manager-0.5.3/spec/data/registry/newstylewithdir.yaml0000644000000000000000000000021511727773032021546 0ustar addon: newstylewithdir description: "new style addon with a directory instead of files" type: directory directory: /path/to/newstylewithdir vim-addon-manager-0.5.3/spec/data/scripts/0000755000000000000000000000000011727767112015240 5ustar vim-addon-manager-0.5.3/spec/data/scripts/ftplugin/0000755000000000000000000000000011712074672017064 5ustar vim-addon-manager-0.5.3/spec/data/scripts/ftplugin/foo.vim0000644000000000000000000000000011712074672020352 0ustar vim-addon-manager-0.5.3/spec/data/scripts/syntax/0000755000000000000000000000000011712074672016562 5ustar vim-addon-manager-0.5.3/spec/data/scripts/syntax/foo.vim0000644000000000000000000000000011712074672020050 0ustar vim-addon-manager-0.5.3/spec/data/scripts/syntax/bar.vim0000644000000000000000000000000011712074672020031 0ustar vim-addon-manager-0.5.3/spec/data/scripts/doc/0000755000000000000000000000000011712107376015777 5ustar vim-addon-manager-0.5.3/spec/data/scripts/doc/withdoc.txt0000644000000000000000000000025211712107376020200 0ustar *withdoc.txt* test addon VIM REFERENCE MANUAL by Antonio Terceiro *withdoc* *withdoc.vim* This plugin is a test. {Vi does not have any of this - of course!} vim-addon-manager-0.5.3/spec/data/scripts/vam/0000755000000000000000000000000011716722757016027 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstyle/0000755000000000000000000000000011712100267017657 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstyle/ftplugin/0000755000000000000000000000000011712074672021521 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstyle/ftplugin/newstyle.vim0000644000000000000000000000000011712074672024076 0ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstyle/syntax/0000755000000000000000000000000011712074672021217 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstyle/syntax/newstyle.vim0000644000000000000000000000000011712074672023574 0ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstyle/doc/0000755000000000000000000000000011712106101020415 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstyle/doc/newstyle.txt0000644000000000000000000000025611712100350023033 0ustar *newstyle.txt* test addon VIM REFERENCE MANUAL by Antonio Terceiro *newstyle* *newstyle.vim* This plugin is a test. {Vi does not have any of this - of course!} vim-addon-manager-0.5.3/spec/data/scripts/vam/newstylemigrated/0000755000000000000000000000000011716723002021376 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstylemigrated/ftplugin/0000755000000000000000000000000011716723007023233 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstylemigrated/ftplugin/newstylemigrated.vim0000644000000000000000000000000011716723007027325 0ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstylemigrated/syntax/0000755000000000000000000000000011716722776022745 5ustar vim-addon-manager-0.5.3/spec/data/scripts/vam/newstylemigrated/syntax/newstylemigrated.vim0000644000000000000000000000000011716722776027037 0ustar vim-addon-manager-0.5.3/Rakefile0000644000000000000000000000107512044340304013335 0ustar desc 'run all the tests' task :default => [:rspec, :cucumber] desc 'run unit tests' task :rspec do ruby '-S rspec --color spec' end desc 'run acceptance tests' task :cucumber do ruby '-S cucumber --format progress' end html = FileList['doc/*.markdown'].gsub(/\.markdown$/, '.html') desc 'build documentation' task :doc => html rule '.html' => ['.markdown', 'doc/template.html'] do |t| sh %{pandoc --smart -f markdown --section-divs -t html5 --template=doc/template.html -o #{t.name} #{t.source}} end desc 'remove generated files' task :clean do rm_f html end vim-addon-manager-0.5.3/etc/0000755000000000000000000000000011763230426012452 5ustar vim-addon-manager-0.5.3/etc/bash_completion.d/0000755000000000000000000000000012043727415016043 5ustar vim-addon-manager-0.5.3/etc/bash_completion.d/vim-addon-manager0000644000000000000000000000573312043727413021262 0ustar # vim-addon-manager: completion script for vim-addons # # Copyright (c) 2007, Antonio Terceiro # # This program is free software, you can redistribute it and/or modify it under # the terms of the GNU General Public License version 3, or (at your option) # any later version published by the Free Software Foundation. _complete_vim_addons() { COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} commands="list status install remove disable amend files show" any_command=$(echo $commands | sed -e 's/\s\+/|/g') options="-h --help -r --registry-dir -s --source-dir -t --target-dir -v --verbose -y --system-dir -w --system-wide -q --query" any_option=$(echo $options | sed -e 's/\s\+/|/g') # complete commands if [[ "$prev" == 'vim-addons' ]] || [[ "$prev" == 'vim-addon-manager' ]] || [[ "$prev" == 'vam' ]]; then COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) return 0 fi # complete option names if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$options" -- $cur) ) return 0 fi # complete directory name for some options if [[ "$prev" == @(-r|--registry-dir|-s|--source-dir|-t|--target-dir|-y|--system-dir) ]]; then COMPREPLY=( $( compgen -o dirnames -- $cur ) ) return 0 fi command='' target_dir='' system_wide='' system_dir='' for (( i=0; i < ${#COMP_WORDS[@]}-1; i++)); do # check for command if [[ ${COMP_WORDS[i]} == @($any_command) ]]; then command=${COMP_WORDS[i]} fi # check for -w or --system-wide if [[ ${COMP_WORDS[i]} == @(-w|--system-wide) ]]; then system_wide="--system-wide" fi if [[ $i -gt 0 ]]; then # check for -t or --target-dir if [[ ${COMP_WORDS[i-1]} == @(-t|--target-dir) ]]; then target_dir="--target-dir ${COMP_WORDS[i]}" fi # check for -y or --system-dir if [[ ${COMP_WORDS[i-1]} == @(-y|--system-dir) ]]; then system_dir="--system-dir ${COMP_WORDS[i]}" fi fi done # build the query command query="vim-addons status --query $system_wide $system_dir $target_dir" # no command, cannot know how to complete if [[ -z "$command" ]]; then COMPREPLY=() return 0; fi case "$command" in # no addon names if command is 'list' list) COMPREPLY=() ;; # list only non-installed addons install) COMPREPLY=( $( $query | grep -e "^$cur" | grep -v -e "installed$" | sed -e 's/^\(\S\+\).*/\1/' ) ) ;; # list only installed addons remove|disable|amend) COMPREPLY=( $( $query | grep -e "^$cur" | grep -e "installed$" | sed -e 's/^\(\S\+\).*/\1/' ) ) ;; # complete addon names *) COMPREPLY=($(grep -h "^addon: $cur" /usr/share/vim/registry/*.yaml | sed -e 's/^addon:\s*//')) ;; esac } complete -F _complete_vim_addons -o default vim-addons complete -F _complete_vim_addons -o default vim-addon-manager complete -F _complete_vim_addons -o default vam # vim: sw=2 expandtab ft=sh vim-addon-manager-0.5.3/.mailmap0000644000000000000000000000004212044315122013302 0ustar James McCoy vim-addon-manager-0.5.3/bin/0000755000000000000000000000000012247354166012455 5ustar vim-addon-manager-0.5.3/bin/vam0000755000000000000000000000011711727767776013206 0ustar #!/usr/bin/ruby -w load File.join(File.dirname(__FILE__), 'vim-addon-manager') vim-addon-manager-0.5.3/bin/vim-addons0000755000000000000000000000011711727767675014462 0ustar #!/usr/bin/ruby -w load File.join(File.dirname(__FILE__), 'vim-addon-manager') vim-addon-manager-0.5.3/bin/vim-addon-manager0000755000000000000000000002155112247344230015664 0ustar #!/usr/bin/ruby -w # # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # Copyright (C) 2009 James Vega # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Created: Tue, 16 Jan 2007 10:04:20 +0100 zack # =begin == NAME vim-addon-manager - command line manager of Vim add-ons == SYNOPSIS vim-addons [OPTION ...] [COMMAND [ADDON ...]] == DESCRIPTION Manage Vim addons installed system-wide, enabling on a per-user basis their installation, removal, ... vim-addons is capable of managing all Vim addons registered in the system-wide registry of Vim addons (see vim-registry(5)). Each system-wide addon can be, with respect to a user Vim configuration, in one of the following states: :installed all of the files composing the addon are installed (i.e. symlinked) to their respective places under the target directory. The addon is fully functional for the current user :removed the files composing the addon are not installed under the target directory. The addon might still be working for the current user if it is installed system-wide by the local administrator :disabled the files composing the addon are not installed under the target directory, but the addon is installed system-wide. However, the addon has been disabled for the current user explicitly via some configuration line in plugin/vim-addons.vim under the target directory. The addon is not working for the current user :broken only some of the files composing the addon are installed under the target directory. The addon is probably not working for the current user :unavailable some (or all) of the files composing the addon are missing from the source directory === COMMANDS A number of commands can be given to vim-addons to inspect or alter the status of the addons: list, status, install, remove, disable, amend, files, show. A description of the semantics of each command is reported below. :list list, one per line, the names of the addons available in the system (i.e. of all the addons mentioned in the registry, not necessarily of all enabled addons) :status show, one per line, the status of the addons available in the system. If one or more addon arguments are specified only show the status of those addons. This is the default command if nothing is specified. :install install one or more addons under the target directory. Requires at least one addon argument :remove remove one or more addons from the target directory. Requires at least one addon argument :disable disable one or more addons to be used by the current user. Usually used for addons which are system-wide enabled by the local administrator but that the current user does not want to be used. Using this command will automatically change the content of plugin/vim-addons.vim under the target directory, probably adding ":let" commands which will inhibit the given addon from being used. Requires at least one addon argument :enable undo the effects of a previous disable command. Requires at least one addon argument :files list, one per line, the files composing the specified addons. Files are listed relative to components of the Vim runtimepath (see 'runtimepath' in the Vim help). Requires at least one addon argument :show displays detailed information about the specified addons == OPTIONS All commands accept the following options: :-h, --help show this usage message and exit :-q, --query be quiet and make the output more parseable (for "status") :-r, --registry-dir set the registry directory (default: /usr/share/vim/registry) :-s, --source-dir set the addons source directory (default: /usr/share/vim/addons) :-t, --target-dir set the addons target directory (default: $HOME/.vim) :-v, --verbose increase verbosity level :-z, --silent silent mode: supress most of the output :-y, --system-dir set the system-wide target directory (default: /var/lib/vim/addons) :-w, --system-wide set the addons target directory to the system-wide target directory, possibly overriding the -t option == AUTHOR Stefano Zacchiroli James Vega == SEE ALSO vim(1), vim-registry(5) == COPYRIGHT Copyright (C) 2007 Stefano Zacchiroli Copyright (C) 2009 James Vega This program is free software, you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. =end require 'etc' require 'getoptlong' require 'vim/addon_manager' require 'vim/addon_manager/registry' def usage(status = 0) print < '/usr/share/vim/registry', :source_dir => '/usr/share/vim/addons', :system_dir => '/var/lib/vim/addons', :target_dir => File.join(ENV['HOME'] || (Etc.getpwnam Etc.getlogin).dir, '.vim'), :query => false, :system_wide => false, } cmds = %w{install remove disable enable list status files show upgrade-from-legacy} req_arg_cmds = # commands requiring >= 1 arg %w{install remove disable amend files} cmdline = GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT], ['--registry-dir', '-r', GetoptLong::REQUIRED_ARGUMENT], ['--source-dir', '-s', GetoptLong::REQUIRED_ARGUMENT], ['--target-dir', '-t', GetoptLong::REQUIRED_ARGUMENT], ['--query', '-q', GetoptLong::NO_ARGUMENT], ['--verbose', '-v', GetoptLong::NO_ARGUMENT], ['--silent', '-z', GetoptLong::NO_ARGUMENT], ['--system-dir', '-y', GetoptLong::REQUIRED_ARGUMENT], ['--system-wide', '-w', GetoptLong::NO_ARGUMENT]) begin cmdline.each do |opt, arg| case opt when '--help' usage when '--registry-dir' options[:registry_dir] = arg when '--source-dir' options[:source_dir] = arg when '--target-dir' options[:target_dir] = arg when '--query' options[:query] = true when '--verbose' logger.increase_verbosity when '--silent' logger.quiet! when '--system-dir' options[:system_dir] = arg when '--system-wide' options[:system_wide] = true end end rescue GetoptLong::Error die_usage end options[:target_dir] = options[:system_dir] if options[:system_wide] cmd = 'status' unless cmd = ARGV.shift die_usage unless cmds.member? cmd die_usage if req_arg_cmds.member? cmd and ARGV.empty? [cmd, ARGV, options] end cmd, args, options = parse_cmdline registry = Vim::AddonManager::Registry.new(options[:registry_dir], options[:source_dir]) selected_addons = args.empty? ? registry.to_a : registry.select {|a| args.member? a.name} unknown = args.select {|name| registry.all? {|a| a.name != name} } logger.warn "Ignoring unknown addons: #{unknown.join ', '}" unless unknown.empty? case cmd when 'list' puts registry.sort when 'status' if options[:query] selected_addons.sort.each do |a| printf("%s\t%s\n", a, options[:system_wide] ? \ a.status(options[:system_dir]) : a.status(options[:target_dir])) end else printf("# %-25s%-13s%-14s\n", 'Name', 'User Status', 'System Status') selected_addons.sort.each do |a| printf("%-28s%-14s%-14s\n", a, a.status(options[:target_dir]), a.status(options[:system_dir])) end end when 'files' selected_addons.each {|a| puts a.files.to_a} when 'upgrade-from-legacy' mgr = Vim::AddonManager.new options[:target_dir] mgr.upgrade_from_legacy(registry.to_a) else mgr = Vim::AddonManager.new options[:target_dir] mgr.send cmd, selected_addons end vim-addon-manager-0.5.3/debian/0000755000000000000000000000000012247632123013117 5ustar vim-addon-manager-0.5.3/debian/vim-addon-manager.manpages0000644000000000000000000000005311740434776020133 0ustar doc/vim-addon-manager.1 doc/vim-registry.5 vim-addon-manager-0.5.3/debian/compat0000644000000000000000000000000211634506717014325 0ustar 5 vim-addon-manager-0.5.3/debian/changelog0000644000000000000000000001310612247414125014772 0ustar vim-addon-manager (0.5.3) unstable; urgency=low [ James McCoy ] * Use a standard directory mode when installing an addon as root. (Closes: #680624) * Fallback to using getent if $HOME isn't set. Thanks to Helmut Grohne for the patch. (Closes: #726329) * Write each element of override_lines to 000-vim-addons.vim instead of a stringified version of the array. (Closes: #731191) * Lintian: - ancient-standards-version: Bump to 3.9.5, no changes needed. - vcs-field-not-canonical: Update Vcs-* to canoncial URLs. -- Antonio Terceiro Tue, 03 Dec 2013 14:43:47 -0300 vim-addon-manager (0.5.2) unstable; urgency=low * New upload to remove `tags` file accidentally included in the source package. -- Antonio Terceiro Tue, 30 Oct 2012 18:51:40 +0100 vim-addon-manager (0.5.1) unstable; urgency=low [ James McCoy ] * Fix calls to override_file and logger.info. (Closes: #681870) [ Antonio Terceiro ] * Fix regression that caused bash completion file to not be installed. * Fix bash completion function to work with alternative program names -- Antonio Terceiro Tue, 30 Oct 2012 16:39:20 +0100 vim-addon-manager (0.5.0) unstable; urgency=low * Addons now can now use a new layout: instead of having its files symlinked into the target dir, they can install all their files into a single directory that will be installed in the target dir and added to the vim runtimepath. This feature is not complete yet, and will be finished with the next release. * New maintainer = myself. * Turn vim-addon-manager into a proper Ruby package. This should have no impact on end users, though. The source layout was changed to: + library code in lib/ + main program in bin/ + src/Makefile moved to doc/Makefile; debian/rules and the Makefile itself changed accordingly. * Migrate to gem2deb. This adds support for having Ruby 1.9 as /usr/bin/ruby (Closes: #655245) * Bumped Standards-Version to 3.9.2. No changes needed. * Avoid installing manpage sources into /usr/share/doc. Only install doc/*.txt instead. -- Antonio Terceiro Sun, 22 Jan 2012 20:20:04 -0200 vim-addon-manager (0.4.4) unstable; urgency=low * Correct a check when removing an addon to avoid getting into a loop when the target directory is a symlink. (Closes: #634379) -- James Vega Sun, 11 Sep 2011 11:09:48 -0400 vim-addon-manager (0.4.3) unstable; urgency=low * Don't try to remove “/path/to/addons/.”. (Closes: #566186) * Do not regenerate the helptags after removing the last documentation-providing addon. Simply remove the docs directory instead. -- James Vega Thu, 21 Jan 2010 23:55:41 -0500 vim-addon-manager (0.4.2) unstable; urgency=low * debian/control: - Add myself as an uploader - Update Vcs-* fields to point to git - Remove vim-tiny from Recommends since it's lacking +eval which most addons need. * Rename amend sub-command to enable. Leave amend as an undocumented command for a little while for people that are used to the old name. (Closes: #501439) * Remove empty directories left behind when removing addons. * Include the target directory in the install/remove informational messages. (Closes: #499563) * Fix a spelling error in vim-addons(1). * Add a man page describing the registry file format. (Closes: #457040) -- James Vega Wed, 20 Jan 2010 19:23:04 -0500 vim-addon-manager (0.4.1) unstable; urgency=low * bump Standards-Version, no changes needed * set "Debian Vim Maintainers" as Maintainer, no Uploaders for the moment. So long. -- Debian Vim Maintainers Tue, 21 Jul 2009 13:19:28 +0200 vim-addon-manager (0.4) unstable; urgency=low * vim-addons manpage: fix typo, s/linst/list/ (closes: #446527) * remove TODO.Debian, the only item was done in 0.3 * use "status" as the default command when none is given * fix the license header of the vim-addons main executable to GPL v3 -- Stefano Zacchiroli Thu, 29 Nov 2007 14:26:52 +0100 vim-addon-manager (0.3) unstable; urgency=low * debian/control - better long description * debian/copyright - change license to GPL 3 or above, fixed source file headers accordingly * vim-addons - add 'show' command which show in a 822-like format a more detailed report of each addons and its status (closes: #438154) - add '-q' option which make the output of the 'status' command more parsable and only show addons wrt the current execution mode (system-wide or not) * add bash completion script contributed by Antonio Terceiro (closes: #440843); fix debian/*.install accordingly -- Stefano Zacchiroli Mon, 24 Sep 2007 10:24:22 +0200 vim-addon-manager (0.2) unstable; urgency=low * uploading to unstable * vim-addons: - when files are installed or removed under doc/ run helpztags afterwards to regenerate help tags - avoid performing an action when there is no need to perform it - added feedback messages for the user - handle gracefully command line parsing errors (Closes: #420029) * debian/control - added dependency on vim-common, which ships /usr/bin/helpztags - added XS-Vcs-* fields -- Stefano Zacchiroli Sun, 29 Apr 2007 11:29:11 +0200 vim-addon-manager (0.1) experimental; urgency=low * Initial release (closes: #409627) -- Stefano Zacchiroli Mon, 5 Feb 2007 00:32:42 +0100 vim-addon-manager-0.5.3/debian/copyright0000644000000000000000000000104611712077316015056 0ustar Format: http://dep.debian.net/deps/dep5/ Source: http://git.debian.org/?p=pkg-vim/vim-addon-manager.git Files: * Copyright: 2007 Stefano Zacchiroli 2012 Antonio Terceiro License: GPL-3+ This program (together with its packaging) is free software; you can redistribute it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. . See `/usr/share/common-licenses/GPL-3' for the license text. vim-addon-manager-0.5.3/debian/control0000644000000000000000000000235012247344230014521 0ustar Source: vim-addon-manager Section: editors Priority: extra Maintainer: Debian Vim Maintainers Uploaders: Antonio Terceiro , James McCoy Build-Depends: debhelper (>= 7.0.50~), rdtool, gem2deb (>= 0.2.13~), rake, cucumber, ruby-rspec, vim-common Standards-Version: 3.9.5 Vcs-Git: git://anonscm.debian.org/pkg-vim/vim-addon-manager.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-vim/vim-addon-manager.git XS-Ruby-Versions: all Package: vim-addon-manager Architecture: all Depends: ruby, # Need vim-common for helpztags vim-common, ${misc:Depends} Recommends: vim | gvim Description: manager of addons for the Vim editor vim-addon-manager is a tool for managing addons for the Vim editor. . Using the vim-addons command line the user can list the addons installed on its system (i.e. which are registered in the vim addons registry) and install or uninstall each of them in its per-user configuration directory (~/.vim). Similar actions can be performed by the system administrator to affect all system users. . Override of addons which are enabled per default on the system, so that they are not enabled for the current user, is possible too. vim-addon-manager-0.5.3/debian/rules0000755000000000000000000000026311712074672014205 0ustar #!/usr/bin/make -f %: dh $@ --buildsystem=ruby --with ruby override_dh_auto_install: dh_auto_install make -C doc/ override_dh_auto_clean: dh_auto_clean make -C doc/ clean vim-addon-manager-0.5.3/debian/source/0000755000000000000000000000000012044010450014403 5ustar vim-addon-manager-0.5.3/debian/source/format0000644000000000000000000000001511712074672015633 0ustar 3.0 (native) vim-addon-manager-0.5.3/debian/vim-addon-manager.docs0000644000000000000000000000001211712074672017255 0ustar doc/*.txt vim-addon-manager-0.5.3/debian/ruby-tests.rake0000777000000000000000000000000011712074672017766 2../Rakefileustar vim-addon-manager-0.5.3/debian/vim-addon-manager.links0000644000000000000000000000020711740434775017460 0ustar usr/share/man/man1/vim-addon-manager.1 usr/share/man/man1/vim-addons.1 usr/share/man/man1/vim-addon-manager.1 usr/share/man/man1/vam.1 vim-addon-manager-0.5.3/debian/vim-addon-manager.install0000644000000000000000000000007612032125461017772 0ustar etc/bash_completion.d/vim-addon-manager etc/bash_completion.d vim-addon-manager-0.5.3/debian/gbp.conf0000644000000000000000000000004312032125377014533 0ustar [DEFAULT] debian-tag = %(version)s vim-addon-manager-0.5.3/lib/0000755000000000000000000000000011712074672012450 5ustar vim-addon-manager-0.5.3/lib/vim/0000755000000000000000000000000012247413302013232 5ustar vim-addon-manager-0.5.3/lib/vim/addon_manager/0000755000000000000000000000000012247414163016017 5ustar vim-addon-manager-0.5.3/lib/vim/addon_manager/constants.rb0000644000000000000000000000073111712074672020364 0ustar # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. module Vim class AddonManager OVERRIDE_FILE = 'plugin/000-vim-addons.vim' HELPZTAGS = '/usr/bin/helpztags' end end vim-addon-manager-0.5.3/lib/vim/addon_manager/addon/0000755000000000000000000000000012247344230017101 5ustar vim-addon-manager-0.5.3/lib/vim/addon_manager/addon/legacy.rb0000644000000000000000000000757312247344230020706 0ustar # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. module Vim class AddonManager class Addon class Legacy < Addon def initialize(yaml, basedir) @files = Set.new yaml['files'] raise ArgumentError.new('empty addon') if @files.size == 0 super end attr_reader :files def status(target_dir) expected_dest = @files.collect {|f| File.join(target_dir, f)} installed = expected_dest.select do |f| File.exist? f end expected_src = @files.collect {|f| File.join(@basedir, f)} available = expected_src.select do |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 status.disabled = is_disabled_in? target_dir status end def install(target_dir) installed_files = [] symlink = lambda do |file| dest = File.join(target_dir, file) self.mkdir(dest) FileUtils.ln_sf(File.join(basedir, file), dest) end status = self.status(target_dir) case status.status when :broken logger.info "installing broken addon '#{self}' to #{target_dir}" status.missing_files.each(&symlink) installed_files.concat(status.missing_files.to_a) when :not_installed logger.info "installing removed addon '#{self}' to #{target_dir}" self.files.each(&symlink) installed_files.concat(self.files.to_a) when :unavailable s = "ignoring '#{self}' which is missing source files" s << "\n- #{status.missing_files.join "\n- "}" if logger.verbose? logger.warn s else logger.info "ignoring '#{self}' which is neither removed nor broken" end installed_files end def remove(target_dir) removed_files = [] status = self.status(target_dir) case status.status when :installed logger.info "removing installed addon '#{self}' from #{target_dir}" self.files.each { |f| rmdirs(target_dir, f) } removed_files.concat(self.files.to_a) when :broken logger.info "removing broken addon '#{self}' from #{target_dir}" files = (self.files - status.missing_files) files.each { |f| rmdirs(target_dir, f) } removed_files.concat(files.to_a) else logger.info "ignoring '#{self}' which is neither installed nor broken" end removed_files end private def rmdirs(target_dir, 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 end end end end end vim-addon-manager-0.5.3/lib/vim/addon_manager/addon/directory.rb0000644000000000000000000000271612247344230021440 0ustar # vim-addons: command line manager of Vim addons # # Copyright (c) 2012 Antonio Terceiro # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. module Vim class AddonManager class Addon 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 else AddonStatus.new :not_installed end end def install(target_dir) dest = destination(target_dir) self.mkdir(dest) FileUtils.ln_sf(source, dest) files end def remove(target_dir) FileUtils.rm_f(destination(target_dir)) files end def files Dir.chdir(source) do Dir.glob('**/*') end.map do |filename| File.join('vam', name, filename) end end protected def source directory || File.join(basedir, 'vam', name) end def destination(target_dir) File.join(target_dir.to_s, 'vam', name) end end end end end vim-addon-manager-0.5.3/lib/vim/addon_manager/registry.rb0000644000000000000000000000240712001132425020201 0ustar # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. require 'find' require 'set' require 'yaml' require 'vim/addon_manager/addon' module Vim class AddonManager class Registry include Enumerable def initialize(registry_dir, source_dir) @basedir = source_dir # default basedir, can be overridden by addons @addons = {} self.class.each_addon(registry_dir, @basedir) {|a| @addons[a.name] = a} end def [](name) @addons[name] end def each @addons.each_value {|a| yield a} end def self.each_addon(dir, basedir) 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 if stream stream.each do |ydoc| yield(Addon.build(ydoc, basedir)) if ydoc end end end end end end end vim-addon-manager-0.5.3/lib/vim/addon_manager/addon.rb0000644000000000000000000000751012247344230017431 0ustar # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. require 'vim/addon_manager/addon_status' module Vim class AddonManager class Addon # Initializes a new Addon instance. # # If a subclass defines its own +initialize+ method, then it *must* call # super at some point to make sure essential data is properly # initialized. # def initialize(yaml, basedir) @metadata = yaml @basedir = (yaml['basedir'] or basedir) @description = yaml['description'] @name = yaml['addon'] @disabled_by_line = yaml['disabledby'] if @disabled_by_line then @disabled_by_RE = /^\s*#{Regexp.escape @disabled_by_line}\s*$/ else @disabled_by_RE = nil end end # Returns a Set of the files contained in this addon. # # This method must be overriden by subclasses. # def files Set.new end # return the status of the self add-on wrt a target installation # directory, and the system wide installation directory. # # A status may be one of the following values # * :not_installed (the addon is not installed at all) # * :installed (the addon is completely installed) # * :broken (the addon is only partially installed) # * :unavailable (source files are missing) # * :unkonwn (the addon is unkonwn to the system) # # This method must be overriden by subclasses. # def status(target_dir) AddonStatus.new :unkonwn end def mkdir(dest) dest_dir = File.dirname dest if Process.euid == 0 FileUtils.mkdir_p dest_dir, :mode => 0755 else FileUtils.mkdir_p dest_dir end end # Installs addon files into +target_dir+ and returns a list of installed # files. # # This method must be overriden by subclasses. # def install(target_dir) [] end # Removes addon files from +target_dir+ and returns a list of installed # files. # # This method must be overriden by subclasses. # def remove(target_dir) [] end def to_s name end def <=>(other) self.name <=> other.name end # checks if a given line (when present in a Vim configuration file) is # suitable for disabling the addon # def is_disabled_by?(line) return false unless @disabled_by_RE # the addon can't be disabled if no # disabledby field has been provided line =~ @disabled_by_RE ? true : false end attr_reader :metadata attr_reader :basedir attr_reader :description attr_reader :name attr_reader :disabled_by_line alias_method :addon, :name def self.build(yaml, basedir) case yaml['type'] when 'directory' Vim::AddonManager::Addon::Directory.new(yaml, basedir) else Vim::AddonManager::Addon::Legacy.new(yaml, basedir) end end private def logger Vim::AddonManager.logger end # checks whether the addon is disabled wrt a given target installation dir # def is_disabled_in?(target_dir) filename = Vim::AddonManager.override_file(target_dir) return false unless File.exist?(filename) File.open(filename) do |file| file.any? {|line| is_disabled_by? line} end end end end end require 'vim/addon_manager/addon/legacy' require 'vim/addon_manager/addon/directory' vim-addon-manager-0.5.3/lib/vim/addon_manager/addon_status.rb0000644000000000000000000000302711712074672021041 0ustar # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. module Vim class AddonManager # an addon status is one of the following # - :not_installed # - :installed # - :broken (missing_files attribute is then used to list not installed # files) # - :unavailable (missing_files attribute is then used to list source files # that weren't found) # AddonStatusStruct = Struct.new(:status, :missing_files) class AddonStatus < AddonStatusStruct def initialize(*args) super(*args) @disabled = false end def logger Vim::AddonManager.logger end attr_accessor :disabled def to_s if @disabled 'disabled' else case status when :installed 'installed' when :not_installed 'removed' when :broken s = 'broken' if logger.verbose? s << " (missing: #{missing_files.join ', '})" end s when :unavailable s = 'unavailable' if logger.verbose? s << " (missing source files: #{missing_files.join ', '})" end s end end end end end end vim-addon-manager-0.5.3/lib/vim/addon_manager/upgrade_from_legacy.rb0000644000000000000000000000112611725373063022345 0ustar module Vim class AddonManager def upgrade_from_legacy(addons) addons.each do |addon| upgrade_addon_from_legacy(addon, @target_dir) end end def upgrade_addon_from_legacy(addon, target_dir) if addon.metadata['legacy_files'] links = addon.metadata['legacy_files'].map do |f| File.join(target_dir, f) end.select do |f| File.symlink?(f) end unless links.empty? links.each do |f| File.unlink(f) end addon.install(target_dir) end end end end end vim-addon-manager-0.5.3/lib/vim/addon_manager/logger.rb0000644000000000000000000000146611712074672017635 0ustar # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. module Vim class AddonManager class Logger def initialize @verbosity = 1 end def increase_verbosity @verbosity += 1 end def quiet! @verbosity = 0 end def quiet? @verbosity < 1 end def verbose? @verbosity > 1 end def warn(s) $stderr.puts "Warning: #{s}" end def info(s) puts "Info: #{s}" unless quiet? end end end end vim-addon-manager-0.5.3/lib/vim/addon_manager/version.rb0000644000000000000000000000010012247414163020020 0ustar module Vim class AddonManager VERSION = '0.5.3' end end vim-addon-manager-0.5.3/lib/vim/addon_manager.rb0000644000000000000000000001041612247401002016332 0ustar # vim-addons: command line manager of Vim addons # # Copyright (C) 2007 Stefano Zacchiroli # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. require 'fileutils' require 'vim/addon_manager/constants' require 'vim/addon_manager/addon' require 'vim/addon_manager/logger' require 'vim/addon_manager/upgrade_from_legacy' module Vim class AddonManager def initialize(target_dir) @target_dir = target_dir end attr_accessor :target_dir def self.override_file(dir) File.join dir, OVERRIDE_FILE end def self.system(cmd) logger.info "executing '#{cmd}'" if logger.verbose? Kernel::system cmd end def self.logger @logger ||= Vim::AddonManager::Logger.new end def logger self.class.logger end def install(addons) installed_files = [] addons.each do |addon| installed_files.concat(addon.install(@target_dir)) end rebuild_tags(installed_files) end def remove(addons) removed_files = [] addons.each do |addon| removed_files.concat(addon.remove(@target_dir)) 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 end end def disable(addons) map_override_lines do |lines| addons.each do |addon| # disable each not yet disabled addon if not addon.disabled_by_line logger.warn \ "#{addon} can't be disabled (since it has no 'disabledby' field)" next end if lines.any? {|line| addon.is_disabled_by? line} logger.info "ignoring addon '#{addon}' which is already disabled" else logger.info "disabling enabled addon '#{addon}'" lines << addon.disabled_by_line + "\n" end end end end def enable(addons) map_override_lines do |lines| addons.each do |addon| if not addon.disabled_by_line logger.warn \ "#{addon} can't be enabled (since it has no disabledby field)" next end if lines.any? {|line| addon.is_disabled_by? line} logger.info "enabling disabled addon '#{addon}'" lines.reject! {|line| addon.is_disabled_by? line} else logger.info "ignoring addon '#{addon}' which is enabled" end end end end def amend(addons) logger "the 'amend' command is deprecated and will disappear in a " + "future release. Please use the 'enable' command instead." enable(addons) end def show(addons) addons.each do |addon| puts "Addon: #{addon}" puts "Status: #{addon.status(@target_dir)}" puts "Description: #{addon.description}" puts "Files:\n#{addon.files.map { |f| " - #{f}\n"}.join}" puts "" end end private def map_override_lines override_lines = [] override_file = Vim::AddonManager.override_file @target_dir if File.exist? override_file File.open(override_file) do |file| override_lines += file.to_a end end checksum = override_lines.hash yield override_lines if override_lines.empty? FileUtils.rm override_file if File.exist? override_file elsif override_lines.hash != checksum FileUtils.mkdir_p(File.dirname(override_file)) File.open(override_file, 'w') do |file| override_lines.each do |line| file.write line end end end end def rebuild_tags(files) needs_rebuilding = files.any? {|file| file =~ /^doc\//} if needs_rebuilding logger.info 'Rebuilding tags since documentation has been modified ...' Vim::AddonManager.system "#{HELPZTAGS} #{File.join(@target_dir, 'doc/')}" logger.info 'done.' end end end end