# Maintainer: Andrew Sun <adsun701@gmail.com>

_gemname=native-package-installer
_realname=ruby-${_gemname}
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.0.9
pkgrel=2
pkgdesc="native-package-installer helps to install native packages on gem install (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url="https://github.com/ruby-gnome2/native-package-installer"
license=('LGPL3')
depends=("${MINGW_PACKAGE_PREFIX}-ruby")
source=("https://rubygems.org/downloads/${_gemname}-${pkgver}.gem")
noextract=("${_gemname}-${pkgver}.gem")
sha256sums=('80bad0273706eeb4fc49ac8fa589b25eb6728c85a09fd241c8f0f06bdca32c5e')

package() {
  local _gemdir="$(ruby -e'puts Gem.default_dir')"
  _gemdir="$(cygpath -u ${_gemdir})"
  
  ${MINGW_PREFIX}/bin/gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" -n "${pkgdir}${MINGW_PREFIX}/bin" ${_gemname}-${pkgver}.gem
  
  rm "${pkgdir}${_gemdir}/cache/${_gemname}-${pkgver}.gem"  
}
