# Generated from strelka-cors-0.0.1.gem by gem2rpm -*- rpm-spec -*-
%global gem_name strelka-cors

Name: rubygem-%{gem_name}
Version: 0.0.1
Release: 1%{?dist}
Summary: This is a Strelka application plugin for describing rules for [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
License: BSD-3-Clause
URL: http://deveiate.org/projects/strelka-cors
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
BuildRequires: ruby >= 2.2.0
# BuildRequires: rubygem(hoe-mercurial) >= 1.4
# BuildRequires: rubygem(hoe-mercurial) < 2
# BuildRequires: rubygem(hoe-deveiate) >= 0.8
# BuildRequires: rubygem(hoe-deveiate) < 1
# BuildRequires: rubygem(hoe-highline) >= 0.2
# BuildRequires: rubygem(hoe-highline) < 1
# BuildRequires: rubygem(rspec) >= 3.2
# BuildRequires: rubygem(rspec) < 4
# BuildRequires: rubygem(simplecov) >= 0.9
# BuildRequires: rubygem(simplecov) < 1
# BuildRequires: rubygem(timecop) >= 0.7
# BuildRequires: rubygem(timecop) < 1
# BuildRequires: rubygem(hoe) >= 3.15
# BuildRequires: rubygem(hoe) < 4
BuildArch: noarch

%description
This is a Strelka application plugin for describing rules for [Cross-Origin
Resource Sharing (CORS)](http://www.w3.org/TR/cors/).
NOTE: It's still a work in progress.
By default, the plugin has paranoid defaults, and doesn't do anything. You'll
need to grant access to the resources you want to share.
To grant access, you declare one or more `access_control` blocks which can
modify responses to matching access-control requests. All the blocks which
match the incoming request's URI are called with the request and response
objects in the order in which they're declared: 
# Allow access to all resources from any origin by default
access_control do |req, res|
res.allow_origin '*'
res.allow_methods 'GET', 'POST'
res.allow_credentials
res.allow_headers :content_type
end
These are applied in the order you declare them, with each matching block
passed the request if it matches. This happens before the application gets the
request, so it can do any further modification it needs to, and so it can
block requests from disallowed origins/methods/etc.
There are a number of helper methods added to the request and response objects
for applying and declaring access-control rules when this plugin is loaded:.


%package doc
Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description doc
Documentation for %{name}.

%prep
%setup -q -n %{gem_name}-%{version}

%build
# Create the gem as gem install only works on a gem file
gem build ../%{gem_name}-%{version}.gemspec

# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%gem_install

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
        %{buildroot}%{gem_dir}/



%check
pushd .%{gem_instdir}
# rspec spec
popd

%files
%dir %{gem_instdir}
%{gem_instdir}/Manifest.txt
%{gem_libdir}
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_docdir}
%doc %{gem_instdir}/ChangeLog
%doc %{gem_instdir}/History.md
%doc %{gem_instdir}/README.md
%{gem_instdir}/Rakefile
%{gem_instdir}/spec

%changelog
* Wed Aug 25 2021 mockbuilder - 0.0.1-1
- Initial package