File collectrack.spec of Package collectrack

#
# spec file for package collectrack
#
# Copyright (c) 2025 SUSE LLC
#
# 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://bugs.opensuse.org/
#

%define app_root %{_datadir}/%{name}

Name:           collectrack
Version:        1.0.18~7
Release:        0
Summary:        A web interface for graphing .rrd files from collectd
License:        GPL-3.0
URL:            https://github.com/LevitatingBusinessMan/collectrack
Source0:        collectrack-%version.tar
Source1:        vendor.tar.xz
Source2:        collectrack.service
BuildRequires:  rubygem(bundler)
BuildRequires:  ruby-devel
Requires:       ruby
Requires:       ruby-rrdtool

%description
Collect Rack is a web interface for graphing .rrd files generated by collectd.

Made with Ruby using Sinatra.

%prep
%autosetup -a1

%build
sed -i '/BUNDLED WITH/{N;d;}' Gemfile.lock
bundle config set deployment true
bundle config set without development
bundle install --local
rm -r vendor/cache

%install
mkdir -p %{buildroot}%{app_root}
cp -r * %{buildroot}%{app_root}
cp -r .bundle %{buildroot}%{app_root}
install -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/collectrack.service

%pre
%service_add_pre collectrack.service

%post
%service_add_post collectrack.service

%preun
%service_del_preun collectrack.service

%postun
%service_del_postun collectrack.service

%files
%license LICENSE.odt
%doc README.adoc
%{app_root}
%{_unitdir}/collectrack.service

%changelog
openSUSE Build Service is sponsored by