Name:           perl-SMS-Send-Adapter-Node-Red
Version:        0.07
Release:        1%{?dist}
Summary:        SMS::Send Adapter to Node-RED JSON HTTP request
License:        mit
Group:          Development/Libraries
URL:            http://search.cpan.org/dist/SMS-Send-Adapter-Node-Red/
Source0:        http://www.cpan.org/modules/by-module/SMS/SMS-Send-Adapter-Node-Red-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
BuildRequires:  perl(CGI)
BuildRequires:  perl(JSON)
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  perl(Package::New)
BuildRequires:  perl(SMS::Send)
BuildRequires:  perl(SMS::Send::VoIP::MS)
Requires:       perl(CGI)
Requires:       perl(JSON)
Requires:       perl(Package::New)
Requires:       perl(SMS::Send)
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description
This Perl package provides an adapter from Node-RED HTTP request object with a JSON payload to the SMS::Send infrastructure using a CGI Apache script.  The architecture works easiest with SMS::Send drivers based off on the SMS::Send::Driver::WebService base object since common settings can be stored in the configuration file.

%package cgi
Summary:        SMS::Send Adapter to Node-RED JSON HTTP request CGI Script
Requires:       %{name} = %{version}-%{release}
Requires:       httpd

%description cgi
A CGI application to control SMS::Send with a web service.

%prep
%setup -q -n SMS-Send-Adapter-Node-Red-%{version}

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \;

%{_fixperms} $RPM_BUILD_ROOT/*

mkdir -p               $RPM_BUILD_ROOT%{_localstatedir}/www/cgi-bin/cgi-bin
cp scripts/%{name}.cgi $RPM_BUILD_ROOT%{_localstatedir}/www/cgi-bin/cgi-bin/
mkdir -p               $RPM_BUILD_ROOT/%{_datadir}/%{name}/
cp scripts/*.psgi      $RPM_BUILD_ROOT/%{_datadir}/%{name}/

%check
make test

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc Changes META.json README
%{perl_vendorlib}/*
%{_mandir}/man3/*
%{_datadir}/%{name}/*.psgi

%files cgi
%defattr(0755,root,root,-)
%{_localstatedir}/www/cgi-bin/cgi-bin/%{name}.cgi

%changelog
* Sun Dec 27 2020 Michael R. Davis <mdavis@stopllc.com> 0.03-1
- Specfile autogenerated by cpanspec 1.78.