File errbit.spec of Package errbit

#
# spec file for package errbit
#
# Copyright (c) 2014 SUSE LINUX Products 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 http://bugs.opensuse.org/
#

Name:           errbit
Version:        0
Release:        0
#
%define vhosts_dir     /srv/www/vhosts/
%define app_dir        %{vhosts_dir}/%{name}/
%define home_dir       %{app_dir}
License:        MIT
Summary:        The open source error catcher that's Airbrake API compliant
Url:            https://github.com/errbit/errbit
Group:          Internal
Source:         %{name}-%{version}.tar.xz
Source1:        %{name}-rpmlintrc
Source2:        %{name}-update
Source3:        %{name}-puma.service
Source4:        %{name}-sidekiq.service
Source5:        %{name}.target
Source6:        %{name}-update.service
Patch:          errbit-no-dev.patch
Patch1:         errbit-fix-deps.patch
Patch2:         add-bundle.patch
Patch3:         https://github.com/openSUSE/errbit/commit/b5ba35d4af505bf5240c9d5059a8dbe42319f934.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
#
BuildRequires:  rsync
BuildRequires:  ruby-common-rails
#
BuildRequires:  timezone
Requires:       timezone
#
BuildRequires:  npm >= 8
Requires:       nodejs >= 8
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
Requires:       ImageMagick
%define rb_build_versions %{rb_default_ruby}
%define rb_build_abi      %{rb_default_ruby_abi}
%define rb_suffix         %{rb_default_ruby_suffix}
# generated!!!
BuildRequires:  %{rubygem actionmailer:4.2 >= 4.2.11.1}
BuildRequires:  %{rubygem actionpack:4.2 >= 4.2.11.1}
BuildRequires:  %{rubygem railties:4.2 >= 4.2.11.1}
BuildRequires:  %{rubygem rails:4.2 >= 4.2.11.1}
BuildRequires:  %{rubygem actionmailer_inline_css}
BuildRequires:  %{rubygem decent_exposure}
BuildRequires:  %{rubygem devise:4.6 >= 4}
BuildRequires:  %{rubygem dotenv-rails}
BuildRequires:  %{rubygem draper}
BuildRequires:  %{rubygem errbit_plugin}
BuildRequires:  %{rubygem errbit_github_plugin}
BuildRequires:  %{rubygem font-awesome-rails}
BuildRequires:  %{rubygem haml}
BuildRequires:  %{rubygem htmlentities}
BuildRequires:  %{rubygem kaminari}
BuildRequires:  %{rubygem kaminari-mongoid}
BuildRequires:  %{rubygem mongoid:5 >= 5.4}
BuildRequires:  %{rubygem mongoid_rails_migrations}
BuildRequires:  %{rubygem rack-ssl}
BuildRequires:  %{rubygem rack-ssl-enforcer}
BuildRequires:  %{rubygem rails_autolink}
BuildRequires:  %{rubygem useragent}
BuildRequires:  %{rubygem hoptoad_notifier:2 >= 2.4}
BuildRequires:  %{rubygem campy}
BuildRequires:  %{rubygem hipchat}
BuildRequires:  %{rubygem xmpp4r}
BuildRequires:  %{rubygem hoi}
BuildRequires:  %{rubygem rushover}
BuildRequires:  %{rubygem httparty}
BuildRequires:  %{rubygem flowdock}
BuildRequires:  %{rubygem omniauth-github}
BuildRequires:  %{rubygem omniauth-google-oauth2}
BuildRequires:  %{rubygem ri_cal}
BuildRequires:  %{rubygem yajl-ruby}
BuildRequires:  %{rubygem json}
BuildRequires:  %{rubygem puma}
BuildRequires:  %{rubygem sass-rails}
BuildRequires:  %{rubygem uglifier}
BuildRequires:  %{rubygem jquery-rails}
BuildRequires:  %{rubygem pjax_rails}
BuildRequires:  %{rubygem underscore-rails}
BuildRequires:  %{rubygem sucker_punch}
# /generated
%description
The open source error catcher that's Airbrake API compliant

%prep
%setup -q
%rails_save_gemfile
%patch -p1
%patch1 -p1
%patch2 -p1
#patch3 -p1

%build
%rails_regen_gemfile_lock
%rails_fix_ruby_suffix
%rails_write_appinfo

%install
mkdir -p tmp/{sockets,pids} log/ public/uploads/ public/plugins/
chmod -R u=rwX,g=rX,o= .
chmod -R o+rX public config.ru
chmod go+X .
chmod -R go+X tmp/
mkdir -p %{buildroot}%{app_dir}/
rsync -a $PWD/ %{buildroot}%{app_dir}/
install -D -m 0755 %{S:2} %{buildroot}%{_sbindir}/%{name}-update
install -D -m 0644 %{S:3} %{buildroot}%{_unitdir}/%{name}-puma.service
install -D -m 0644 %{S:6} %{buildroot}%{_unitdir}/%{name}-update.service
install -D -m 0644 %{S:5} %{buildroot}%{_unitdir}/%{name}.target

%pre
/usr/sbin/groupadd -r %{name} &>/dev/null || :
/usr/sbin/useradd  -g %{name} -s /bin/false -r -c "Errbit" -d %{home_dir} %{name} &>/dev/null || :
touch %{app_dir}/tmp/rebuild.txt
%service_add_pre %{name}-puma.service

%post
%service_add_post %{name}-puma.service

%preun
%service_del_preun %{name}-puma.service %{name}-update.service

%postun
%service_del_postun %{name}-update.service

%files
%defattr(-,root,root)
%{_unitdir}/%{name}.target
%{_unitdir}/%{name}-puma.service
%{_unitdir}/%{name}-update.service
%{_sbindir}/%{name}-update
%dir %{vhosts_dir}
%defattr(-,root,%{name})
%dir %{app_dir}/
%config(noreplace) %{app_dir}/config/
%{app_dir}/.env.default
%{app_dir}/.rspec
%{app_dir}/.appinfo.yml
%{app_dir}/.rubocop.yml
%{app_dir}/.rubocop_todo.yml
%{app_dir}/.travis.yml
%{app_dir}/CHANGELOG.md
%{app_dir}/CHECKS
%{app_dir}/CONTRIBUTING.md
%{app_dir}/Dockerfile
%{app_dir}/Gemfile
%{app_dir}/Gemfile.lock
%{app_dir}/Gemfile.lock.upstream
%{app_dir}/Gemfile.upstream
%{app_dir}/ISSUE_TEMPLATE.md
%{app_dir}/LICENSE
%{app_dir}/Procfile
%{app_dir}/README.md
%{app_dir}/RELEASE.md
%{app_dir}/Rakefile
%{app_dir}/app.json
%{app_dir}/config.ru
%{app_dir}/docker-compose.yml
%{app_dir}/app/
%{app_dir}/autotest/
%{app_dir}/bin/
%{app_dir}/db/
%{app_dir}/docs/
%{app_dir}/lib/
%dir %{app_dir}/public/
%{app_dir}/public/404.html
%{app_dir}/public/422.html
%{app_dir}/public/500.html
%{app_dir}/public/favicon.ico
%{app_dir}/public/robots.txt
%{app_dir}/script/
%{app_dir}/spec/
#{app_dir}/adminjs
%defattr(-,%{name},%{name})
%{app_dir}/public/plugins/
%{app_dir}/public/uploads/
%{app_dir}/tmp/
%{app_dir}/log/

%changelog