LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File discourse.spec of Package discourse (Project home:darix:apps)

#
# spec file for package 
#
# 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:           discourse
Version:        0
Release:        0
#
%define vhosts_dir     /srv/www/vhosts/
%define app_dir        %{vhosts_dir}/%{name}/
%define home_dir       %{app_dir}
License:        GPL-2.0+
Summary:        A platform for community discussion. Free, open, simple
Url:            http://www.discourse.org/
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:        dump-version-info.rb
Source7:        discourse-update.service
Patch:          discourse.fix.deps.patch
Patch1:         feedjira.patch
Patch2:         discourse.fix-puma-config.patch
Patch3:         discourse.fix-nginx-config.patch
# https://meta.discourse.org/t/letter-avatars-still-displayed-after-importing-phpbb3-avatars/69553/14
Patch4:         discourse.fix-resize.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
#
BuildRequires:  rsync
#
BuildRequires:  timezone
Requires:       timezone
Provides:       discourse-plugin-discourse-tagging =  0.2+git1454569548.ea1c930
Obsoletes:      discourse-plugin-discourse-tagging >= 0.2+git1454569548.ea1c930
#
BuildRequires:  npm >= 8
Requires:       nodejs >= 8
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
Requires:       ImageMagick
%define rb_build_versions ruby24
%define rb_build_abi      ruby:2.4.0
%define rb_ruby_suffix    ruby2.4
# generated!!!
#
BuildRequires:  %{rubygem feedjira}
Requires:       %{rubygem feedjira}
#
# Normal gem file
#
BuildRequires:  %{rubygem bootsnap}
Requires:       %{rubygem bootsnap}
#
BuildRequires:  %{rubygem rails:5 >= 5.1}
Requires:       %{rubygem rails:5 >= 5.1}
#
BuildRequires:  %{rubygem rake:12.0 >= 12.0.0}
Requires:       %{rubygem rake:12.0 >= 12.0.0}
#
BuildRequires:  %{rubygem rails-observers}
Requires:       %{rubygem rails-observers}
#
BuildRequires:  %{rubygem seed-fu:2.3} >= 2.3.5
Requires:       %{rubygem seed-fu:2.3 >= 2.3.5}
#
# versioned to help the OBS resolver
BuildRequires:  %{rubygem mail >= 2.6}
Requires:       %{rubygem mail >= 2.6}
#
BuildRequires:  %{rubygem rake:12.2}
Requires:       %{rubygem rake:12.2}
#
#/versioned to help the OBS resolver
BuildRequires:  %{rubygem mime-types:3}
Requires:       %{rubygem mime-types:3}
#
BuildRequires:  %{rubygem hiredis}
Requires:       %{rubygem hiredis}
#
BuildRequires:  %{rubygem redis}
Requires:       %{rubygem redis}
BuildRequires:  %{rubygem redis-namespace}
Requires:       %{rubygem redis-namespace}
#
#
BuildRequires:  %{rubygem active_model_serializers:0.8 >= 0.8.3}
Requires:       %{rubygem active_model_serializers:0.8 >= 0.8.3}
#
BuildRequires:  %{rubygem onebox}
Requires:       %{rubygem onebox}
# http_accept_language
BuildRequires:  %{rubygem http_accept_language:2.0 >= 2.0.5}
Requires:       %{rubygem http_accept_language:2.0 >= 2.0.5}
#
BuildRequires:  %{rubygem ember-rails:0.18 = 0.18.5}
Requires:       %{rubygem ember-rails:0.18 = 0.18.5}
#
BuildRequires:  %{rubygem ember-source >= 2.13.0}
Requires:       %{rubygem ember-source >= 2.13.0}
#
BuildRequires:  %{rubygem ember-handlebars-template = 0.7.5}
Requires:       %{rubygem ember-handlebars-template = 0.7.5}
#
BuildRequires:  %{rubygem barber}
Requires:       %{rubygem barber}
#
BuildRequires:  %{rubygem message_bus:2}
Requires:       %{rubygem message_bus:2}
#
BuildRequires:  %{rubygem rails_multisite:1.1}
Requires:       %{rubygem rails_multisite:1.1}
#
BuildRequires:  %{rubygem fast_xs}
Requires:       %{rubygem fast_xs}
#
BuildRequires:  %{rubygem fast_xor}
Requires:       %{rubygem fast_xor}
#
BuildRequires:  %{rubygem discourse_fastimage >= 2.1.0}
Requires:       %{rubygem discourse_fastimage >= 2.1.0}
#
BuildRequires:  %{rubygem aws-sdk-s3}
Requires:       %{rubygem aws-sdk-s3}
#
BuildRequires:  %{rubygem excon}
Requires:       %{rubygem excon}
#
BuildRequires:  %{rubygem unf}
Requires:       %{rubygem unf}
#
BuildRequires:  %{rubygem email_reply_trimmer:0.1 >= 0.1.6}
Requires:       %{rubygem email_reply_trimmer:0.1 >= 0.1.6}
#
BuildRequires:  %{rubygem discourse_image_optim}
Requires:       %{rubygem discourse_image_optim}
#
BuildRequires:  %{rubygem multi_json}
Requires:       %{rubygem multi_json}
#
BuildRequires:  %{rubygem mustache}
Requires:       %{rubygem mustache}
#
BuildRequires:  %{rubygem nokogiri}
Requires:       %{rubygem nokogiri}
#
BuildRequires:  %{rubygem oga}
Requires:       %{rubygem oga}
#
BuildRequires:  %{rubygem omniauth}
Requires:       %{rubygem omniauth}
#
BuildRequires:  %{rubygem omniauth-openid}
Requires:       %{rubygem omniauth-openid}
#
BuildRequires:  %{rubygem openid-redis-store}
Requires:       %{rubygem openid-redis-store}
#
BuildRequires:  %{rubygem omniauth-facebook}
Requires:       %{rubygem omniauth-facebook}
#
BuildRequires:  %{rubygem omniauth-twitter}
Requires:       %{rubygem omniauth-twitter}
#
BuildRequires:  %{rubygem omniauth-instagram}
Requires:       %{rubygem omniauth-instagram}
#
BuildRequires:  %{rubygem omniauth-github >= 1.3.0}
Requires:       %{rubygem omniauth-github >= 1.3.0}
#
BuildRequires:  %{rubygem omniauth-oauth2}
Requires:       %{rubygem omniauth-oauth2}
#
BuildRequires:  %{rubygem omniauth-google-oauth2}
Requires:       %{rubygem omniauth-google-oauth2}
#
BuildRequires:  %{rubygem oj}
Requires:       %{rubygem oj}
#
BuildRequires:  %{rubygem pg}
Requires:       %{rubygem pg}
#
BuildRequires:  %{rubygem pry-rails}
Requires:       %{rubygem pry-rails}
#
BuildRequires:  %{rubygem r2:0.2 >= 0.2.5}
Requires:       %{rubygem r2:0.2 >= 0.2.5}
#
BuildRequires:  %{rubygem thor}
Requires:       %{rubygem thor}
#
BuildRequires:  %{rubygem mini_mime}
Requires:       %{rubygem mini_mime}
#
BuildRequires:  %{rubygem mini_suffix}
Requires:       %{rubygem mini_suffix}
#
BuildRequires:  %{rubygem rinku}
Requires:       %{rubygem rinku}
#
# versioned to help the OBS resolver
BuildRequires:  %{rubygem sanitize >= 4}
Requires:       %{rubygem sanitize >= 4}
#
# versioned to help the OBS resolver
BuildRequires:  %{rubygem sassc}
Requires:       %{rubygem sassc}
#
BuildRequires:  %{rubygem sidekiq}
Requires:       %{rubygem sidekiq}
#
BuildRequires:  %{rubygem tilt}
Requires:       %{rubygem tilt}
#
BuildRequires:  %{rubygem execjs}
Requires:       %{rubygem execjs}
#
BuildRequires:  %{rubygem mini_racer}
Requires:       %{rubygem mini_racer}
#
BuildRequires:  %{rubygem jquery-rails >= 4}
Requires:       %{rubygem jquery-rails >= 4}
#
BuildRequires:  %{rubygem highline}
Requires:       %{rubygem highline}
#
BuildRequires:  %{rubygem rack-protection}
Requires:       %{rubygem rack-protection}
#
BuildRequires:  %{rubygem uglifier}
Requires:       %{rubygem uglifier}
#
BuildRequires:  %{rubygem rtlit}
Requires:       %{rubygem rtlit}
#
BuildRequires:  %{rubygem fast_blank}
Requires:       %{rubygem fast_blank}
#
BuildRequires:  %{rubygem lru_redux}
Requires:       %{rubygem lru_redux}
#
BuildRequires:  %{rubygem htmlentities:4.3 >= 4.3.4}
Requires:       %{rubygem htmlentities:4.3 >= 4.3.4}
#
BuildRequires:  %{rubygem flamegraph}
Requires:       %{rubygem flamegraph}
#
BuildRequires:  %{rubygem rack-mini-profiler}
Requires:       %{rubygem rack-mini-profiler}
#
BuildRequires:  %{rubygem unicorn}
Requires:       %{rubygem unicorn}
#
BuildRequires:  %{rubygem puma}
Requires:       %{rubygem puma}
#
BuildRequires:  %{rubygem gc_tracer}
Requires:       %{rubygem gc_tracer}
#
BuildRequires:  %{rubygem rbtrace}
Requires:       %{rubygem rbtrace}
#
BuildRequires:  %{rubygem ruby-readability}
Requires:       %{rubygem ruby-readability}
#
BuildRequires:  %{rubygem simple-rss}
Requires:       %{rubygem simple-rss}
#
BuildRequires:  %{rubygem stackprof}
Requires:       %{rubygem stackprof}
#
BuildRequires:  %{rubygem memory_profiler}
Requires:       %{rubygem memory_profiler}
#
BuildRequires:  %{rubygem cppjieba_rb}
Requires:       %{rubygem cppjieba_rb}
#
BuildRequires:  %{rubygem lograge}
Requires:       %{rubygem lograge}
#
BuildRequires:  %{rubygem logstash-event}
Requires:       %{rubygem logstash-event}
#
BuildRequires:  %{rubygem logstash-logger}
Requires:       %{rubygem logstash-logger}
#
BuildRequires:  %{rubygem logster}
Requires:       %{rubygem logster}
#
# /generated
%description
Discourse is the 100% open source discussion platform built for the next decade of the Internet. It works as:

- a mailing list
- a discussion forum
- a long-form chat room

%prep
%setup -q
cp Gemfile{,.upstream}
%patch -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1

%build
# 1.9.0.beta6~git14.d29fc781fb -> v1.9.0.beta6-14-gd29fc781fb
ruby %{S:6} %{version}

find -type f -name .gitkeep -print -delete
mv Gemfile.lock{,.upstream}
bundle exec rails --version
diff -urN Gemfile.lock{.upstream,} ||:
cp -v config/database.yml{,.example}
if [[ -e .gitattributes ]] ; then
  echo "Error: .gitattributes still exists"
  rm -rv .gitattributes
fi
for S in $(grep -r -l '@RUBY_SUFFIX@' ${RPM_SOURCE_DIR}/ | grep -v '\.spec$') ; do
  SB="${S}.backup"
  cp ${S} ${SB}
  perl -p -i -e 's|\@RUBY_SUFFIX\@|%{rb_ruby_suffix}|g' "${S}"
  diff -urN ${SB} ${S} || :
  rm ${SB}
done

rm -fv ./plugins/discourse-narrative-bot/public/public

%install
mkdir -p tmp/{sockets,pids} 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}/
rm -rv tmp/cache/bootsnap-*
rsync -av $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:4} %{buildroot}%{_unitdir}/%{name}-sidekiq.service
install -D -m 0644 %{S:7} %{buildroot}%{_unitdir}/%{name}-update.service
install -D -m 0644 %{S:5} %{buildroot}%{_unitdir}/%{name}.target
grep -h -r 'CREATE EXT' db/migrate/* | sed -e 's|.*"\(.*\)".*|\1;|g' | tee discourse.setup.extensions.sql

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

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

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

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

%files
%defattr(-,root,root)
%doc discourse.setup.extensions.sql
%{_unitdir}/%{name}.target
%{_unitdir}/%{name}-puma.service
%{_unitdir}/%{name}-sidekiq.service
%{_unitdir}/%{name}-update.service
%{_sbindir}/%{name}-update
%dir %{vhosts_dir}
%defattr(-,root,%{name})
%dir %{app_dir}/
%config(noreplace) %{app_dir}/config/
%{app_dir}/adminjs
%{app_dir}/app
%{app_dir}/bin
%{app_dir}/Brewfile
%{app_dir}/.codeclimate.yml
%{app_dir}/config.ru
%{app_dir}/CONTRIBUTING.md
%{app_dir}/COPYRIGHT.txt
%{app_dir}/d
%{app_dir}/db
%{app_dir}/discourse.sublime-project
%{app_dir}/docs
%{app_dir}/.editorconfig
%{app_dir}/.env.sample
%{app_dir}/.eslintignore
%{app_dir}/.eslintrc
%{app_dir}/Gemfile
%{app_dir}/Gemfile.upstream
%{app_dir}/Gemfile*.lock
%{app_dir}/Gemfile*.lock.upstream
%{app_dir}/images
%{app_dir}/jsapp
%{app_dir}/lib
%{app_dir}/LICENSE.txt
%{app_dir}/packaging
%{app_dir}/.pkgr.yml
%{app_dir}/plugins
%{app_dir}/Procfile
%{app_dir}/public
%{app_dir}/.overcommit.yml
%{app_dir}/Rakefile
%{app_dir}/README.md
%{app_dir}/.rspec
%{app_dir}/.rubocop.yml
%{app_dir}/.ruby-gemset.sample
%{app_dir}/.ruby-version.sample
%{app_dir}/script
%{app_dir}/spec
%{app_dir}/test
%{app_dir}/.travis.yml
%{app_dir}/.tx
%{app_dir}/Vagrantfile
%{app_dir}/vendor
%defattr(-,%{name},%{name})
%{app_dir}/public/plugins/
%{app_dir}/public/uploads/
%{app_dir}/tmp/
%{app_dir}/log/

%changelog