{% set version = '0.2.10' %}

{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: r-minicran
  version: {{ version|replace("-", "_") }}

source:
  fn: miniCRAN_{{ version }}.tar.gz
  url:
    - https://cran.r-project.org/src/contrib/miniCRAN_{{ version }}.tar.gz
    - https://cran.r-project.org/src/contrib/Archive/miniCRAN/miniCRAN_{{ version }}.tar.gz
  sha256: ed413857e42c489a1aa7f4a401325e05ddd07e20ef7c1a60dca8bd73071f3ec3

build:
  number: 0
  skip: true  # [win32]
  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - r-base
    - r-xml
    - r-httr
    - r-igraph
    - r-magrittr

  run:
    - r-base
    - r-xml
    - r-httr
    - r-igraph
    - r-magrittr

test:
  commands:
    - $R -e "library('miniCRAN')"  # [not win]
    - "\"%R%\" -e \"library('miniCRAN')\""  # [win]

about:
  home: https://github.com/andrie/miniCRAN
  license_family: GPL2
  license: GPL-2
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-2'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses/GPL-2'      # [win]
  summary: Makes it possible to create an internally consistent repository consisting of selected
    packages from CRAN-like repositories. The user specifies a set of desired packages,
    and 'miniCRAN' recursively reads the dependency tree for these packages, then downloads
    only this subset. The user can then install packages from this repository directly,
    rather than from CRAN.  This is useful in production settings, e.g. server behind
    a firewall, or remote locations with slow (or zero) Internet access.

extra:
  recipe-maintainers:
    - mariusvniekerk
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
