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

%global appdata_dir %{_datadir}/appdata

Name: vim-command-t
Version: 1.10
Release: 2%{?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
# git clone git://git.wincent.com/command-t.git && cd command-t/
# git archive 1.10 -o command-t-1.10.tar.gz
Source0: command-t-%{version}.tar.gz
# Plug-in AppData for Gnome Software.
# https://github.com/wincent/Command-T/issues/99
Source1: vim-command-t.metainfo.xml
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 {autoload,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

# Install AppData.
mkdir -p %{buildroot}%{appdata_dir}
install -m 644 %{SOURCE1} %{buildroot}%{appdata_dir}

%check
# Get rid of Bundler
sed -i '/Bundler/,/^end$/ s/^/#/' spec/spec_helper.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}/autoload/*
%{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
%{appdata_dir}/vim-command-t.metainfo.xml


%changelog
* Mon Aug 11 2014 Vít Ondruch <vondruch@redhat.com> - 1.10-2
- Add missing autoload directory.

* Mon Aug 11 2014 Vít Ondruch <vondruch@redhat.com> - 1.10-1
- Update to Command-T 1.10.
- Add Gnome Software plug-in AppData (rhbz#1110300).

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue Apr 29 2014 Vít Ondruch <vondruch@redhat.com> - 1.8-1
- Update to Command-T 1.8.

* Thu Dec 19 2013 Vít Ondruch <vondruch@redhat.com> - 1.6-1
- Update to command-t 1.6.

* 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.