# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
USE_RUBY="ruby31 ruby32 ruby33"

RUBY_FAKEGEM_TASK_DOC="build_rdoc"
RUBY_FAKEGEM_DOCDIR="doc"
RUBY_FAKEGEM_EXTRADOC="README.rdoc"
RUBY_FAKEGEM_BINWRAP="gli"
RUBY_FAKEGEM_EXTRAINSTALL="gli.rdoc"
RUBY_FAKEGEM_GEMSPEC="gli.gemspec"

inherit ruby-fakegem

DESCRIPTION="Git-Like Interface Command Line Parser"
HOMEPAGE="https://davetron5000.github.io/gli/"
SRC_URI="https://github.com/davetron5000/gli/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="Apache-2.0"

SLOT="0"
KEYWORDS="~amd64"

all_ruby_prepare() {
	sed -e '/sdoc/ s:^:#:' \
		-e '/bundler/I s:^:#:' \
		-i Rakefile || die

	sed -i -e '/test_size_using_stty/askip "Needs terminal"' test/unit/terminal_test.rb || die
	sed -i -e '/test_config_file_name/askip "Fails due to different HOME dir"' test/unit/gli_test.rb || die

	# Not clear why these fail:
	sed -i -e '/test_\(app_without_docs\|doc_command_works_as\)/askip "Fails"' test/unit/doc_test.rb || die
}

each_ruby_test() {
	RUBYOPT="" ${RUBY} -S rake test:unit || die
}