[SCM] vim-addon-manager packaging branch, master, updated. v0.4.4-69-g5b98ccb
Antonio Terceiro
terceiro at debian.org
Mon Apr 9 00:23:13 UTC 2012
The following commit has been merged in the master branch:
commit 43914c1d9e5827fdb1df0e19979098a55de3a6ba
Author: Antonio Terceiro <terceiro at debian.org>
Date: Tue Mar 13 22:20:33 2012 -0300
Main program is now 'vim-addon-manager'
vim-addons was kept as an alias, and vam was added for brevity
diff --git a/TODO b/TODO
index 6dee91b..8eb8af1 100644
--- a/TODO
+++ b/TODO
@@ -9,12 +9,6 @@ Short term
execute 'source ' . rcfile
endfor
-- Rename main program to `vim-addon-manager` to be consistent with the package
- name. Install a symbolic link called vim-addons to keep backwards
- compatibility, and one called `vam` for brevity. Maybe move the code from the
- main program to a file under lib/, and then create these three programs as
- identical one-liners.
-
- update documentation:
+ doc/addons-proposal.txt
diff --git a/bin/vam b/bin/vam
new file mode 100755
index 0000000..8a9591f
--- /dev/null
+++ b/bin/vam
@@ -0,0 +1,2 @@
+#!/usr/bin/ruby -w
+load File.join(File.dirname(__FILE__), 'vim-addon-manager')
diff --git a/bin/vim-addons b/bin/vim-addon-manager
similarity index 99%
copy from bin/vim-addons
copy to bin/vim-addon-manager
index 8076c57..afd5e42 100755
--- a/bin/vim-addons
+++ b/bin/vim-addon-manager
@@ -160,7 +160,7 @@ require 'getoptlong'
require 'vim/addon_manager'
require 'vim/addon_manager/registry'
-def die_usage
+def usage(status = 0)
print <<EOS
Usage:
vim-addons [OPTION ...] [COMMAND [ADDON ...]]
@@ -182,7 +182,11 @@ Options:
-w, --system-wide set target directory to the system-wide one
(overrides -t setting)
EOS
- exit 1
+ exit status
+end
+
+def die_usage
+ usage(1)
end
def logger
@@ -215,7 +219,7 @@ def parse_cmdline
cmdline.each do |opt, arg|
case opt
when '--help'
- die_usage
+ usage
when '--registry-dir'
options[:registry_dir] = arg
when '--source-dir'
diff --git a/bin/vim-addons b/bin/vim-addons
index 8076c57..8a9591f 100755
--- a/bin/vim-addons
+++ b/bin/vim-addons
@@ -1,279 +1,2 @@
#!/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-addons - 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 <zack at debian.org>
-James Vega <jamessan at debian.org>
-
-== 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 'getoptlong'
-
-require 'vim/addon_manager'
-require 'vim/addon_manager/registry'
-
-def die_usage
- print <<EOS
-Usage:
- vim-addons [OPTION ...] [COMMAND [ADDON ...]]
-Commands:
- list, status (default command), install, remove, disable, enable, files, show
-Options:
- -h, --help show this usage message and exit
- -q, --query be quiet and make the output more parseable
- -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
- -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 target directory to the system-wide one
- (overrides -t setting)
-EOS
- exit 1
-end
-
-def logger
- Vim::AddonManager.logger
-end
-
-def parse_cmdline
- options = { # defaults
- :registry_dir => '/usr/share/vim/registry',
- :source_dir => '/usr/share/vim/addons',
- :system_dir => '/var/lib/vim/addons',
- :target_dir => File.join(ENV['HOME'], '.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'
- die_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
-
+load File.join(File.dirname(__FILE__), 'vim-addon-manager')
diff --git a/features/program-names.feature b/features/program-names.feature
new file mode 100644
index 0000000..fa49a03
--- /dev/null
+++ b/features/program-names.feature
@@ -0,0 +1,10 @@
+Feature: different program names
+
+ Scenario Outline:
+ When I run `<program_name> --help`
+ Then the output should match "Usage:"
+ Examples:
+ | program_name |
+ | vim-addons |
+ | vim-addon-manager |
+ | vam |
diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb
index 1164211..5a5eb05 100644
--- a/features/step_definitions/steps.rb
+++ b/features/step_definitions/steps.rb
@@ -2,11 +2,14 @@ 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__), '..', '..'))
-vim_addons = File.join($sources_root, 'bin', 'vim-addons')
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
@@ -15,8 +18,8 @@ After do
FileUtils.rm_rf($tmpdir)
end
-When /^I run `vim\-addons (.*)`$/ do |args|
- command = [ruby, "-I#{libdir}", vim_addons, '--silent', '--registry-dir', registry, '--source-dir', source, '--target-dir', $tmpdir]
+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')
@@ -63,7 +66,7 @@ Then /^(.*) should not be installed anymore$/ do |addon|
installed_addon_files(addon).should be_empty
end
-Then /^vim-addons must output "([^"]*)"$/ do |text|
+Then /^(?:vim-addons must output|the output should match) "([^"]*)"$/ do |text|
@stdout.should =~ Regexp.new(text)
end
--
vim-addon-manager packaging
More information about the pkg-vim-maintainers
mailing list