File ripgrep.spec of Package ripgrep

# spec file for package ripgrep
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

Name:           ripgrep
Version:        0.8.1
Release:        0
Summary:        A search tool combines the usability of ag with the raw speed of grep
License:        MIT AND Unlicense
Group:          Productivity/Text/Utilities
Source1:        vendor.tar.xz
BuildRequires:  asciidoc
BuildRequires:  cargo
BuildRequires:  rust
BuildRequires:  rust-std

ripgrep is a line oriented search tool that combines the usability of
The Silver Searcher (similar to ack) with the raw speed of GNU grep.
ripgrep works by recursively searching your current directory
for a regex pattern.

%package bash-completion
Summary:        Bash Completion for %{name}
Requires:       bash-completion
Supplements:    packageand(%{name}:bash)
BuildArch:      noarch

%description bash-completion
The official bash completion script for ripgrep, generated during the build.

%package zsh-completion
Summary:        ZSH Completion for %{name}
Supplements:    packageand(%{name}:zsh)
BuildArch:      noarch

%description zsh-completion
The official zsh completion script for ripgrep, generated during the build.

%package fish-completion
Summary:        Fish Completion for %{name}
Supplements:    packageand(%{name}:fish)
BuildArch:      noarch

%description fish-completion
The official fish completion script for ripgrep, generated during the build.

%setup -q
%setup -q -D -T -a 1
mkdir cargo-home
cat >cargo-home/config <<EOF
registry = ''
replace-with = 'vendored-sources'
directory = './vendor'

export CARGO_HOME=$PWD/cargo-home
cargo build --release %{?_smp_mflags}

export CARGO_HOME=$PWD/cargo-home
cargo install --root=%{buildroot}%{_prefix}

# remove residue crate file
rm %{buildroot}%{_prefix}/.crates.toml

install -Dm 644 target/release/build/ripgrep-*/out/rg.1 %{buildroot}%{_mandir}/man1/rg.1
install -Dm 644 target/release/build/ripgrep-*/out/rg.bash %{buildroot}%{_datadir}/bash-completion/completions/rg
install -Dm 644 target/release/build/ripgrep-*/out/ %{buildroot}%{_datadir}/fish/vendor_completions.d/
install -Dm 644 complete/_rg %{buildroot}%{_datadir}/zsh/site-functions/_rg


%files bash-completion

%files fish-completion

%files zsh-completion

openSUSE Build Service is sponsored by