--- /dev/null
+%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
+
+%global app_root %{_datadir}/%{name}
+%global semodule_name now
+%global commit0 7496c4388c785eee5c3115dc63eded398e17b349
+%global shortcommit0 %(c=%{commit0}; echo ${c:0:7})
+
+%if 0%{?rhel} && 0%{?rhel} <= 7
+# old rspec
+%global with_tests 0
+%else
+%global with_tests 1
+%endif
+
+Name: NOW
+Version: 0.0.1
+Release: 0%{?dist}.20160918git%{shortcommit0}
+Summary: Network Orchestrator Wrapper for OpenNebula
+
+License: ASL 2.0
+URL: https://github.com/CESNET/NOW
+Source0: https://github.com/CESNET/%{name}/archive/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz
+Source1: NOW.conf
+
+BuildArch: noarch
+BuildRequires: ruby-devel
+%if 0%{?with_tests}
+BuildRequires: rubygem(bigdecimal)
+BuildRequires: rubygem(ipaddress)
+BuildRequires: rubygem(json)
+BuildRequires: rubygem(minitest)
+BuildRequires: rubygem(opennebula)
+BuildRequires: rubygem(rack-test)
+BuildRequires: rubygem(rspec) >= 3
+BuildRequires: rubygem(rdoc)
+BuildRequires: rubygem(sinatra)
+BuildRequires: rubygem(sinatra-cross_origin)
+%endif
+Requires(pre): shadow-utils
+Requires: mod_passenger
+Requires: rubygem(bigdecimal)
+Requires: rubygem(ipaddress)
+Requires: rubygem(json)
+Requires: rubygem(opennebula)
+Requires: rubygem(sinatra)
+Requires: rubygem(sinatra-cross_origin)
+%if 0%{?rhel} && 0%{?rhel} <= 7
+Requires: ruby(release)
+%endif
+
+%description
+Network Orchestrator Wrapper is the component to extend OpenNebula network
+orchestration capabilities.
+
+%package doc
+Summary: Documentation for %{name}
+Group: Documentation
+BuildArch: noarch
+Requires: %{name} = %{version}-%{release}
+
+%description doc
+Documentation for %{name}.
+
+
+%prep
+%setup -q -n %{name}-%{commit0}
+
+
+%build
+
+
+%install
+mkdir -p %{buildroot}%{app_root}/
+mkdir -p %{buildroot}/etc/httpd/conf.d/
+mkdir -p %{buildroot}%{_pkgdocdir}/
+cp -r * %{buildroot}%{app_root}/
+install -m 0600 etc/now.yml %{buildroot}/etc/
+install -m 0640 %{SOURCE1} %{buildroot}/etc/httpd/conf.d/
+rdoc --op rdoc/ models/ lib/ *.rb README*
+mv rdoc %{buildroot}%{_pkgdocdir}/
+
+
+%check
+%if 0%{?with_tests}
+rspec
+ruby -rminitest/autorun -Ilib:test -e 'Dir.glob "./test/*_test.rb", &method(:require)'
+%endif
+
+
+%pre
+getent group now >/dev/null || groupadd -r now
+getent passwd now >/dev/null || \
+ useradd -r -g now -d %{app_root} -s /sbin/nologin -c "NOW user" now
+
+# no SELinux support yet (will be similar to rOCCI server)
+%if 0
+%post
+if [ "$1" -le "1" ] ; then # First install
+ semodule -i %{_datadir}/selinux/packages/%{name}/%{semodule_name}.pp 2>/dev/null || :
+ restorecon -R %{app_root} %{_localstatedir}/log/rocci-server 2>/dev/null || :
+ semanage port -a -t http_port_t -p tcp 11443 2>/dev/null || :
+fi
+
+%preun
+if [ "$1" -lt "1" ] ; then # Final removal
+ semodule -r %{semodule_name} 2>/dev/null || :
+ restorecon -R %{app_root} %{_localstatedir}/log/rocci-server 2>/dev/null || :
+ semanage port -d -t http_port_t -p tcp 11443 2>/dev/null || :
+fi
+%endif
+
+
+%files
+%dir %{app_root}/
+%license %{app_root}/LICENSE
+%license %{app_root}/NOTICE
+%attr(0600, now, now) %config(noreplace) /etc/now.yml
+%config(noreplace) /etc/httpd/conf.d/%{name}.conf
+%{app_root}/models/
+%{app_root}/lib/
+%{app_root}/templates/
+%{app_root}/config.ru
+%{app_root}/*.rb
+
+%files doc
+%doc %{app_root}/README.md
+%{_pkgdocdir}/rdoc/
+%{app_root}/etc/
+%{app_root}/spec/
+%{app_root}/test/
+%{app_root}/swagger.yaml
+%{app_root}/Gemfile.devel
+
+
+%changelog
+* Sun Sep 18 2016 František Dvořák <valtri@civ.zcu.cz> - 0.0.1-0.20160918git7496c43
+- Initial package