Blob Blame History Raw
%global packname  mockery
%global rlibdir  %{_datadir}/R/library

# knitr not available yet.
%global with_doc  0

Name:             R-%{packname}
Version:          0.4.1
Release:          1%{?dist}
Summary:          Mocking Library for R

License:          MIT
URL:              https://cran.r-project.org/web/packages/%{packname}/index.html
Source0:          https://cran.r-project.org/src/contrib/%{packname}_%{version}.tar.gz

# Here's the R view of the dependencies world:
# Depends:
# Imports:   R-testthat
# Suggests:  R-knitr R-rmarkdown
# LinkingTo:
# Enhances:

BuildArch:        noarch
Requires:         R-core

Requires:         R-testthat
BuildRequires:    R-devel tex(latex)
BuildRequires:    R-testthat
%if %{with_doc}
BuildRequires:    R-knitr R-rmarkdown
%endif

%description
The two main functionalities of this package are creating mock objects
(functions) and selectively intercepting calls to a given function that
originate in some other function. It can be used with any testing
framework available for R. Mock objects can be injected with either this
package's own stub() function or a similar with_mock() facility present in
the testthat package.


%prep
%setup -q -c -n %{packname}


%build


%install
mkdir -p %{buildroot}%{rlibdir}
%{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname}
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
rm -f %{buildroot}%{rlibdir}/R.css


%check
%if %{with_doc}
%{_bindir}/R CMD check %{packname}
%else
_R_CHECK_FORCE_SUGGESTS_=0 %{_bindir}/R CMD check %{packname} --ignore-vignettes
%endif


%files
%dir %{rlibdir}/%{packname}
%doc %{rlibdir}/%{packname}/doc
%doc %{rlibdir}/%{packname}/html
%{rlibdir}/%{packname}/DESCRIPTION
%doc %{rlibdir}/%{packname}/LICENSE
%doc %{rlibdir}/%{packname}/NEWS
%{rlibdir}/%{packname}/INDEX
%{rlibdir}/%{packname}/NAMESPACE
%{rlibdir}/%{packname}/Meta
%{rlibdir}/%{packname}/R
%{rlibdir}/%{packname}/help


%changelog
* Mon Mar 05 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> 0.4.1-1
- initial package for Fedora