%define exagrid_release .exagrid1

Name:           swagger-ui
Version:        3.16.0
Release:        0%{?dist}.0%{?exagrid_release}
Summary:        Swagger UI
License:        Apache
URL:            https://github.com/swagger-api/swagger-ui
Source:         %{name}-%{version}.tar.gz
Requires:       exagrid-httpd-config 

%define debug_package %{nil}
%define exagrid_default_arch noarch

%description
Swagger UI is part of the Swagger project.  The Swagger project allows you to
produce, visualize and consume your OWN RESTful services.  No proxy or 3rd
party services required.  Do it your own way.

Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets
that dynamically generate beautiful documentation and sandbox from a
Swagger-compliant API. Because Swagger UI has no dependencies, you can host it
in any server environment, or on your local machine.

%prep
%setup -q

%build
# nothing to build

%install
rm -r $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_datarootdir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf/exagrid/proxy.conf.d
cp -a dist $RPM_BUILD_ROOT%{_datarootdir}/%{name}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/swagger-ui/
install -D -m 755 exagrid/50-swagger-ui.conf $RPM_BUILD_ROOT%{_sysconfdir}/swagger-ui/50-swagger-ui.conf
install -D -m 755 exagrid/swagger-enable $RPM_BUILD_ROOT%{_bindir}/swagger-enable
install -D -m 755 exagrid/swagger-disable $RPM_BUILD_ROOT%{_bindir}/swagger-disable


%files
%defattr(-,root,root)
%config %{_sysconfdir}/swagger-ui/50-swagger-ui.conf
%{_datarootdir}/%{name}
/usr/bin/swagger-disable
/usr/bin/swagger-enable

