{% set version = '0.1.5' %}

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

package:
  name: r-aws.ec2metadata
  version: {{ version|replace("-", "_") }}

source:
  fn: aws.ec2metadata_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/aws.ec2metadata_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/aws.ec2metadata/aws.ec2metadata_{{ version }}.tar.gz
  sha256: 3bd0cc28c266ecbc5b3463546750c5a44ff7a35aaba90de73ec30b2f9bb8fb1c

build:
  merge_build_host: True  # [win]
  number: 0

  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{posix}}zip               # [win]

  host:
    - r-base
    - r-curl
    - r-jsonlite

  run:
    - r-base
    - r-curl
    - r-jsonlite

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

about:
  home: https://github.com/cloudyr/aws.ec2metadata
  license: GPL (>= 2)
  summary: Retrieve Amazon EC2 instance metadata from within the running instance.
  license_family: GPL3
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/GPL-3'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses\GPL-3'  # [win]

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
    - cbrueffer
    - dbast
