File vim-completor.spec of Package vim-completor

%global debug_package %{nil}
%if 0%{?suse_version}
%define vim_dir current
%else
%define vim_dir vimfiles
%endif
Name:           vim-completor
Version:        318.b23e8b8
Release:        1%{?dist}
Url:            https://github.com/maralla/completor.vim
Summary:        Async completion framework for the Vim editor
License:        MIT
Source0:        %{name}-git-%{version}.tar.xz
Conflicts:      vim-youcompleteme

%description
Completor is an asynchronous code completion framework for vim8. New features of vim8 are used to implement the fast completion engine with low overhead.
For using semantic completion, the sub-packages for completer should be installed.

%define add_subpackage(n:)                                                          \
%package %{-n*}                                                                     \
Summary:        Completion support for %{-n*} programming language                  \
Requires:       %{name} =  %{version}-%{release}                                    \
Requires:       %*                                                                  \
%description %{-n*}                                                                 \
Adds completion support for the %{-n*} programming language for %{name}             \

# Uncomment when racer package is available.
# %%add_subpackage -n rust racer
# Uncomment when gocode package is available.
# %%add_subpackage -n go gocode
%add_subpackage -n python python3-jedi
%add_subpackage -n js nodejs-tern
%add_subpackage -n cpp clang

%prep
%setup -qn completor.vim

%build

%install
install -Dm0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/COPYING
mkdir -p %{buildroot}%{_datadir}/vim/%{vim_dir}/
cp -r {autoload,doc,plugin,pythonx} %{buildroot}/%{_datadir}/vim/%{vim_dir}/

# Set permissions
find %{buildroot} -type d -exec chmod 0755 {} \;
find %{buildroot} -type f -exec chmod 0644 {} \;

%post
vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags /usr/share/vim/%{vim_dir}/doc/' '+qa!' < /dev/null &> /dev/null

%postun
vim -u NONE -U NONE -X -n '+set nobackup nomore' '+helptags /usr/share/vim/%{vim_dir}/doc/' '+qa!' < /dev/null &> /dev/null

%doc README.md
%files
%{_datadir}/licenses/%{name}/COPYING
%{_datadir}/vim/%{vim_dir}/autoload
%{_datadir}/vim/%{vim_dir}/doc
%{_datadir}/vim/%{vim_dir}/plugin
%dir %{_datadir}/vim/%{vim_dir}/pythonx
%{_datadir}/vim/%{vim_dir}/pythonx/completers/common
%{_datadir}/vim/%{vim_dir}/pythonx/completers/go.py
%{_datadir}/vim/%{vim_dir}/pythonx/completers/rust.py
%{_datadir}/vim/%{vim_dir}/pythonx/completers/__init__.py
%{_datadir}/vim/%{vim_dir}/pythonx/completor

# %%files rust
# %%{_datadir}/vim/%%{vim_dir}/pythonx/completers/rust.py

# %%files go
# %%{_datadir}/vim/%%{vim_dir}/pythonx/completers/go.py

%files python
%{_datadir}/vim/%{vim_dir}/pythonx/completers/python

%files js
%{_datadir}/vim/%{vim_dir}/pythonx/completers/javascript

%files cpp
%{_datadir}/vim/%{vim_dir}/pythonx/completers/cpp

%changelog
* Tue Nov 13 2018 Ben Reedy <breed808@breed808.com> - 318.b23e8b8-1
- Update to latest git commit

* Wed Apr 18 2018 Ben Reedy <breed808@breed808.com> - 246.9ef09cf-1
- Update to latest git commit

* Sat Jan 06 2018 Ben Reedy <breed808@breed808.com> - 228.f978a21-1
- Initial package