File bundler.spec of Package bundler-2.0.1

#
# spec file for package bundler
#
# Copyright (c) 2017 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 https://bugzilla.suse.com/
#


Name:           bundler-2.0.1
Version:        2.0.1
Release:        1
%define mod_name bundler
%define mod_full_name %{mod_name}-%{version}
Summary: This is the bundler binary used in buildpacks in SUSE CloudFoundry (SCF)
License:        MIT
Group:          Cloud/Platform/scf
Url:            http://bundler.io
Source:         http://rubygems.org/gems/%{mod_full_name}.gem
%if 0%{?suse_version} == 1315
BuildRequires:  ruby2.3
%else
BuildRequires:  ruby
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

# BEGIN shared macros for all dependency packages
BuildRequires: aaa_stack_build_requires

%if 0%{?suse_version} == 1315
%define stack sle12
%else
%define stack sle15
%endif

%define otherdir %{_topdir}/OTHER
%define prefix_path /app/vendor/%{name}
%define destdir /tmp/%{name}
%define dependencydir %{destdir}%{prefix_path}
# END shared macros


%description

%prep
export GEM_HOME=$PWD
export GEM_PATH=$PWD
%if 0%{?suse_version} == 1315
unset RUBYOPT; gem.ruby2.3 install %{_sourcedir}/%{mod_full_name}.gem --no-ri --no-rdoc --env-shebang --no-format-executable
%else
unset RUBYOPT; gem install %{_sourcedir}/%{mod_full_name}.gem --no-ri --no-rdoc --env-shebang --no-format-executable
%endif
sed -i 's/ruby\.ruby2\.[3-9]/ruby/' bin/bundle*

rm -f bundler-%{version}.gem
rm -rf cache/bundler-%{version}.gem

%build

%install
mkdir -p %{buildroot}/var/binary-builder
cd %{_builddir}

TARBALL=%{otherdir}/%{mod_full_name}.tgz
# The upstream binary-builder is using `cp -r` which has the same effect
# as the --hard-dereference flag here.
# (https://github.com/cloudfoundry/binary-builder/blob/master/lib/archive_recipe.rb#L20)
tar czvf ${TARBALL} --hard-dereference . --owner=0 --group=0

CHECKSUM=`sha256sum ${TARBALL}`
NEW_TARBALL=%{otherdir}/%{mod_full_name}-%{stack}-${CHECKSUM:0:8}.tgz
mv ${TARBALL} ${NEW_TARBALL}

pushd $(dirname ${NEW_TARBALL})
sha256sum $(basename ${NEW_TARBALL}) > ${NEW_TARBALL}.sha256
popd

%post
%postun

%files
%defattr(-,root,root)

%changelog

openSUSE Build Service is sponsored by