%define mattermost_user mattermost
%define mattermost_group mattermost
%define mattermost_home /var/lib/mattermost
%define debug_package %{nil}

Name:		mattermost-plugin-walltime
Version:	1.0.0
Release:	1%{?dist}
URL:            https://github.com/mattermost/mattermost-plugin-walltime
Summary:	Plugin for Mattermost to convert time
License:	Apache
BuildRequires:	golang
Requires:	mattermost


%description


%prep
%setup -q -T -c %{name}-%{version}
git clone https://github.com/mattermost/mattermost-plugin-walltime com.mattermost.walltime-plugin


%build
cd com.mattermost.walltime-plugin
pushd webapp
npm install
npm run build
popd


%install
mkdir -p %{buildroot}%{mattermost_home}/plugins/com.mattermost.walltime-plugin/webapp/dist/
cd com.mattermost.walltime-plugin
cp -rv webapp/dist/main.js %{buildroot}%{mattermost_home}/plugins/com.mattermost.walltime-plugin/webapp/dist/
cp -rv plugin.json %{buildroot}%{mattermost_home}/plugins/com.mattermost.walltime-plugin/plugin.json


%files
%{mattermost_home}/plugins/com.mattermost.walltime-plugin/plugin.json
%{mattermost_home}/plugins/com.mattermost.walltime-plugin/webapp/dist/main.js


%changelog
