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 https://bugs.opensuse.org/
#

%bcond_with     discourse_ruby26

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:          Productivity/Networking/Web/Frontends
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
Source9:        series
Patch:          discourse.fix.deps.patch
Patch2:         discourse.fix-puma-config.patch
Patch3:         discourse.fix-nginx-config.patch
Patch4:         es6.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
#
BuildRequires:  postgresql-contrib
BuildRequires:  postgresql-server
BuildRequires:  redis
BuildRequires:  rsync
BuildRequires:  ruby-common-rails >= 2.6
#
BuildRequires:  timezone
Requires:       timezone
BuildRequires:  brotli
Requires:       brotli
BuildRequires:  npm%{nodejs_min_version}
%requires_eq    nodejs%{nodejs_min_version}
#
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
Requires:       ImageMagick
%if 0%{suse_version} && 0%{suse_version} < 1330
%define rb_build_versions ruby25
%define rb_build_abi      ruby:2.5.0
%define rb_suffix         ruby2.5
%else
%define rb_build_versions %{rb_default_ruby}
%define rb_build_abi      %{rb_default_ruby_abi}
%define rb_suffix    %{rb_default_ruby_suffix}
%endif
#
%if %{with discourse_ruby26}
%define rb_build_versions ruby26
%define rb_build_abi      ruby:2.6.0
%define rb_suffix         ruby2.6
%endif
# for a better rails console
BuildRequires:  %{rubygem pry-rails}
# generated!!!
#
BuildRequires:  %{rubygem bundler:1.17}
BuildRequires:  %{rubygem bootsnap}
BuildRequires:  %{rubygem actionmailer = 5.2.3}
BuildRequires:  %{rubygem actionpack = 5.2.3}
BuildRequires:  %{rubygem actionview = 5.2.3}
BuildRequires:  %{rubygem activemodel = 5.2.3}
BuildRequires:  %{rubygem activerecord = 5.2.3}
BuildRequires:  %{rubygem activesupport = 5.2.3}
BuildRequires:  %{rubygem railties = 5.2.3}
BuildRequires:  %{rubygem sprockets-rails}
BuildRequires:  %{rubygem seed-fu}
BuildRequires:  %{rubygem mail}
BuildRequires:  %{rubygem mini_mime}
BuildRequires:  %{rubygem mini_suffix}
BuildRequires:  %{rubygem hiredis}
BuildRequires:  %{rubygem redis:4.0}
BuildRequires:  %{rubygem redis-namespace}
BuildRequires:  %{rubygem active_model_serializers:0.8 >= 0.8.3}
BuildRequires:  %{rubygem onebox}
BuildRequires:  %{rubygem http_accept_language:2.0 >= 2.0.5}
BuildRequires:  %{rubygem ember-rails = 0.18.5}
BuildRequires:  %{rubygem discourse-ember-source:3.8 >= 3.8.0}
BuildRequires:  %{rubygem ember-handlebars-template = 0.8.0}
BuildRequires:  %{rubygem barber}
BuildRequires:  %{rubygem message_bus}
BuildRequires:  %{rubygem rails_multisite}
BuildRequires:  %{rubygem fast_xs}
BuildRequires:  %{rubygem fast_xor}
BuildRequires:  %{rubygem fastimage}
BuildRequires:  %{rubygem aws-sdk-s3}
BuildRequires:  %{rubygem aws-sdk-sns}
BuildRequires:  %{rubygem excon}
BuildRequires:  %{rubygem unf}
BuildRequires:  %{rubygem email_reply_trimmer:0 >= 0.1}
BuildRequires:  %{rubygem discourse_image_optim}
BuildRequires:  %{rubygem multi_json}
BuildRequires:  %{rubygem mustache}
BuildRequires:  %{rubygem nokogiri}
BuildRequires:  %{rubygem omniauth}
BuildRequires:  %{rubygem omniauth-openid}
BuildRequires:  %{rubygem openid-redis-store}
BuildRequires:  %{rubygem omniauth-facebook}
BuildRequires:  %{rubygem omniauth-twitter}
BuildRequires:  %{rubygem omniauth-instagram}
BuildRequires:  %{rubygem omniauth-github}
BuildRequires:  %{rubygem omniauth-oauth2}
BuildRequires:  %{rubygem omniauth-google-oauth2}
BuildRequires:  %{rubygem oj}
BuildRequires:  %{rubygem pg}
BuildRequires:  %{rubygem mini_sql}
BuildRequires:  %{rubygem pry-rails}
BuildRequires:  %{rubygem r2:0.2 >= 0.2.5}
BuildRequires:  %{rubygem rake}
BuildRequires:  %{rubygem thor}
BuildRequires:  %{rubygem rinku}
BuildRequires:  %{rubygem sanitize}
BuildRequires:  %{rubygem sidekiq}
BuildRequires:  %{rubygem mini_scheduler}
BuildRequires:  %{rubygem tilt}
BuildRequires:  %{rubygem execjs}
BuildRequires:  %{rubygem mini_racer}
BuildRequires:  %{rubygem highline:1.7 >= 1.7.0}
BuildRequires:  %{rubygem rack-protection}
BuildRequires:  %{rubygem uglifier}
BuildRequires:  %{rubygem rtlit}
BuildRequires:  %{rubygem fast_blank}
BuildRequires:  %{rubygem lru_redux}
BuildRequires:  %{rubygem htmlentities}
BuildRequires:  %{rubygem flamegraph}
BuildRequires:  %{rubygem rack-mini-profiler}
BuildRequires:  %{rubygem unicorn}
BuildRequires:  %{rubygem puma}
BuildRequires:  %{rubygem rbtrace}
BuildRequires:  %{rubygem gc_tracer}
BuildRequires:  %{rubygem ruby-readability}
BuildRequires:  %{rubygem stackprof}
BuildRequires:  %{rubygem memory_profiler}
BuildRequires:  %{rubygem cppjieba_rb}
BuildRequires:  %{rubygem lograge}
BuildRequires:  %{rubygem logstash-event}
BuildRequires:  %{rubygem logstash-logger}
BuildRequires:  %{rubygem logster}
BuildRequires:  %{rubygem sassc}
BuildRequires:  %{rubygem sassc-rails}
BuildRequires:  %{rubygem rotp}
BuildRequires:  %{rubygem rqrcode}
BuildRequires:  %{rubygem sshkey}
BuildRequires:  %{rubygem rchardet}
BuildRequires:  %{rubygem webpush}
BuildRequires:  %{rubygem colored2}
BuildRequires:  %{rubygem maxminddb}
#
# /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
%rails_save_gemfile
%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}
%rails_fix_ruby_shebang bin/* qa/bin/qa script/* script/*/*
%rails_regen_gemfile_lock
%rails_fix_ruby_suffix
%rails_write_appinfo
#RAILS_ENV="production" \
#DATABASE_URL=postgresql://none:none@127.0.0.1/none \
#./bin/bundle exec ./bin/rake assets:clean assets:precompile
cp -v config/database.yml{,.example}


mkdir -p tmp/{sockets,pids} public/uploads/ public/plugins/ public/backups/default/
chmod -R u=rwX,g=rX,o= .
chmod -R o+rX public/ config.ru
chmod -R go=X public/backups/
chmod go+X .
chmod -R go+X tmp/
chmod go+X plugins/ plugins/*/
chmod -R go+rX plugins/*/public/

if [[ -e .gitattributes ]] ; then
  echo "Error: .gitattributes still exists"
  rm -rv .gitattributes
fi

#find -name \*.swp -print -delete
find -type f \( -name .gitkeep -o -name .gitignore \) -print -delete

chmod a-x                                 \
  bin/docker/README.md                    \
  script/import_scripts/json_generic.rb   \
  vendor/assets/javascripts/sweetalert.js
rm -rv tmp/cache/bootsnap-*

%install
install -D -d -m 0751 %{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: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

for i in puma sidekiq update ; do
  ln -s /sbin/service %{buildroot}%{_sbindir}/rc%{name}-$i
done

%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 || :
%service_add_pre %{name}-update.service %{name}-puma.service %{name}-sidekiq.service discourse.target

%post
%service_add_post %{name}-update.service %{name}-puma.service %{name}-sidekiq.service discourse.target

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

%postun
touch %{app_dir}/tmp/rebuild.txt
%service_del_postun %{name}-update.service %{name}-puma.service %{name}-sidekiq.service discourse.target

%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
%{_sbindir}/rc%{name}*
%dir %{vhosts_dir}
%defattr(-,root,%{name})
%dir %{app_dir}/
%dir %{app_dir}/public
%config(noreplace) %{app_dir}/config/
%{app_dir}/.appinfo.yml
%{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}/Dangerfile
%{app_dir}/d
%{app_dir}/db
%{app_dir}/discourse.*
%{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}/package.json
%{app_dir}/packaging
%{app_dir}/.pkgr.yml
%{app_dir}/.prettierignore
%{app_dir}/public/*.html
%{app_dir}/public/*.json
%{app_dir}/public/images/
%{app_dir}/public/javascripts/
#{app_dir}/public/
%{app_dir}/plugins
%{app_dir}/.overcommit.yml
%{app_dir}/Rakefile
%{app_dir}/README.md
%{app_dir}/.rspec
%{app_dir}/.rspec_parallel
%{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}/vendor
%{app_dir}/yarn.lock
%defattr(-,%{name},%{name})
%{app_dir}/public/plugins/
%{app_dir}/public/backups/
%{app_dir}/public/uploads/
%{app_dir}/tmp/
%{app_dir}/log/

%changelog