File monasca-kibana-plugin.spec of Package monasca-kibana-plugin

#
# spec file for package monasca-kibana-plugin
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright 2017 Fujitsu LIMITED
#
# 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:           monasca-kibana-plugin
Version:        1.0.1
Release:        0
Summary:        Monasca Kibana plugin for Keystone authentication
License:        BSD-3-Clause and MIT and BSD-2-Clause and Apache-2.0
Group:          Development/Languages/NodeJS
Url:            https://github.com/openstack/monasca-kibana-plugin
Source:         http://tarballs.openstack.org/%{name}/%{name}-%{version}.tar.gz
Source1:        %{name}.changes
# For new versions you can update this file by just running `make` in the
# package directory (replace the monasca-kibana-plugin source tarball by the
# tarball for the new version first). For this to work you will need to have
# npm installed and you will need Internet connectivity to download Node.js
# packages.
Source2:        node_modules.tar.bz2
Source99:       dependencies.json
Requires:       kibana
BuildRequires:  npm
BuildRequires:  rsync
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
Keystone authentication support and multi-tenancy for Kibana 4.6.x

%prep
%setup -q -n package
tar -xjf %{SOURCE2}

%build
PATH=$PATH:node_modules/.bin npm run package

%install
mkdir -p %{buildroot}%{_datarootdir}/%{name}
install -m 444 target/%{name}-%{version}.tar.gz %{buildroot}%{_datarootdir}/%{name}/%{name}.tar.gz

%post
cat <<'EOF'
==============================================================================

In order to install this plugin in Kibana, you will need to

1) Add the settings from %{_docdir}/%{name}/README.md to your
  /opt/kibana/config/kibana.yml. You MUST have the correct settings in
  this file before proceeding to the next step since plugin
  configuration will be generated based on kibana.yml

2) Run the following command:

   /opt/kibana/bin/kibana plugin \
     --install monasca-kibana-plugin \
     --url file://%{_datarootdir}/%{name}/target/%{name}-%{version}.tar.gz

==============================================================================
EOF

%preun
if [ -x /opt/kibana/bin/kibana ] ; then
    /opt/kibana/bin/kibana plugin --remove monasca-kibana-plugin
fi

%files
%defattr(-,root,root,-)
%doc README.md LICENSE
%{_datarootdir}/%{name}

%changelog
openSUSE Build Service is sponsored by