# Generated by go2rpm 1.8.2
%bcond_without check

# https://github.com/homeport/dyff
%global goipath         github.com/homeport/dyff
%global goname          dyff
Version:                1.5.6

%gometa -f

%global common_description %{expand:
diff tool for YAML files, and sometimes JSON.}

%global golicenses      LICENSE
%global godocs          README.md assets/bosh-yaml/README.md\\\
                        assets/kubernetes-yaml/README.md assets/raw-\\\
                        text/from.txt assets/raw-text/to.txt

Name:           %{goname}
Release:        %autorelease -b 2
Summary:        diff tool for YAML files, and sometimes JSON

License:        MIT
URL:            %{gourl}
Source0:        %{gosource}
Source1:        %{name}-%{version}-vendored-deps.tar.gz
Source2:        bundled.inc

%description %{common_description}

%gopkg

%prep
%autosetup
tar -xf %SOURCE1 --strip-components=1
%goprep -e -k
mv ./assets/bosh-yaml/README.md assets/bosh-yaml/README-bosh-yaml.md
mv ./assets/kubernetes-yaml/README.md ./assets/kubernetes-yaml/README-k8s-yaml.md

%build
for cmd in cmd/* ; do
  %gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
done
%{gobuilddir}/bin/%{name} completion bash > %{name}.bash
%{gobuilddir}/bin/%{name} completion zsh  > %{name}.zsh
%{gobuilddir}/bin/%{name} completion fish > %{name}.fish

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

# Install shell completions
install -Dpm 0644 %{name}.bash %{buildroot}%{bash_completions_dir}/%{name}
install -Dpm 0644 %{name}.zsh  %{buildroot}%{zsh_completions_dir}/_%{name}
install -Dpm 0644 %{name}.fish %{buildroot}%{fish_completions_dir}/%{name}.fish

%if %{with check}
%check
%gocheck
%endif

%files
%license LICENSE
%doc README.md assets/bosh-yaml/README-bosh-yaml.md
%doc assets/kubernetes-yaml/README-k8s-yaml.md assets/raw-text/from.txt
%doc assets/raw-text/to.txt
%{_bindir}/*
%{bash_completions_dir}/%{name}
%{zsh_completions_dir}/_%{name}
%{fish_completions_dir}/%{name}.fish

%gopkgfiles

%changelog
%autochangelog