Blob Blame History Raw
# There is no better way how to obtain the vimfiles folder location :/
# https://bugzilla.redhat.com/show_bug.cgi?id=844975
%global vimfiles  %{_datadir}/vim/vimfiles

%global commandt_so_dir %{ruby_vendorarchdir}/command-t

Name: vim-command-t
Version: 1.5
Release: 1%{?dist}
Summary: An extremely fast, intuitive mechanism for opening files in VIM
Group: Applications/Editors
License: BSD
URL: https://wincent.com/products/command-t
# Officialy distributed only using vimball:
# https://wincent.com/issues/1978
# .gitattributes are used to ignore huge benchmark.yml file.
# https://github.com/wincent/Command-T/pull/56
# git clone git://git.wincent.com/command-t.git && cd command-t/
# echo "data/benchmark.yml export-ignore" > .gitattributes
# git archive 1.5 -o command-t-1.5.tar.gz --worktree-attributes
Source0: command-t-%{version}.tar.gz
Requires: ruby(release)
# Although command-t does not depend on rubygems directly, the RubyGems are
# required by Ruby, but not always (rhbz#845011). So it is necessary to enforce
# the RubyGems dependency, to fix possile SEGFAULT (rhbz#858135). There is
# unfortunately nothing better to do about it, as long as RPM/YUM does not
# support some conditional requires.
Requires: ruby(rubygems)
Requires: vim-common
BuildRequires: ruby(release)
BuildRequires: ruby-devel
BuildRequires: rubygem(rspec)
BuildRequires: rubygem(rr)
Requires(post): %{_bindir}/vim
Requires(postun): %{_bindir}/vim

%description
The Command-T plug-in for VIM provides an extremely fast, intuitive mechanism
for opening files with a minimal number of keystrokes. It's named "Command-T"
because it is inspired by the "Go to File" window bound to Command-T
in TextMate.

Files are selected by typing characters that appear in their paths, and are
ordered by an algorithm which knows that characters that appear in certain
locations (for example, immediately after a path separator) should be given
more weight.

%prep
%setup -q -c

%build
pushd ./ruby/command-t

export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
ruby extconf.rb --vendor
make %{?_smp_mflags}

popd


%install
mkdir -p %{buildroot}%{vimfiles}
cp -par {doc,plugin,ruby} %{buildroot}%{vimfiles}

mkdir -p %{buildroot}%{commandt_so_dir}
chmod 0755 %{buildroot}%{vimfiles}/ruby/command-t/ext.so
mv %{buildroot}%{vimfiles}/ruby/command-t/ext.so %{buildroot}%{commandt_so_dir}

# Remove all dot files.
find %{buildroot}%{vimfiles} -name '.*' -delete

# Replace symlink with copy.
rm README.txt
cp -pa doc/command-t.txt README.txt

%check
# Get rid of Bundler
sed -i '24,+5d' spec/spec_helper.rb

# Test suite fails with "NoMethodError: undefined method `evaluate' for VIM:Module".
# https://wincent.com/issues/2111
sed -i '/@base_wild_ignore     = VIM::wild_ignore/ s/^/#/' ruby/command-t/scanner/file_scanner.rb

rspec -Iruby spec

%post
vim -c ":helptags %{vimfiles}/doc" -c :q &> /dev/null

%postun
> %{vimfiles}/doc/tags
vim -c ":helptags %{vimfiles}/doc" -c :q &> /dev/null

%files
%doc LICENSE
%doc README.txt
%{commandt_so_dir}
%{vimfiles}/doc/*
%{vimfiles}/plugin/*
%exclude %{vimfiles}/ruby/command-t/ext*
%exclude %{vimfiles}/ruby/command-t/*.o
%exclude %{vimfiles}/ruby/command-t/*.h
%exclude %{vimfiles}/ruby/command-t/*.c
%exclude %{vimfiles}/ruby/command-t/Makefile
%exclude %{vimfiles}/ruby/command-t/mkmf.log
%exclude %{vimfiles}/ruby/command-t/depend
%{vimfiles}/ruby/*


%changelog
* Mon Sep 23 2013 Vít Ondruch <vondruch@redhat.com> - 1.5-1
- Update to command-t 1.5.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Apr 10 2013 Vít Ondruch <vondruch@redhat.com> - 1.4-4
- Add dependency on RubyGems to fix possible SEGFAULT (rhbz#858135).

* Wed Feb 27 2013 Vít Ondruch <vondruch@redhat.com> - 1.4-3
- Rebuild for https://fedoraproject.org/wiki/Features/Ruby_2.0.0

* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Fri Aug 03 2012 Vít Ondruch <vondruch@redhat.com> - 1.4-1
- Initial package.