# $Id: Portfile 70499 2010-08-11 14:19:12Z kimuraw@macports.org $

PortSystem		1.0
PortGroup		ruby 1.0

ruby.setup		{password ruby-password} 0.5.3 extconf.rb {README doc example}
revision		0
maintainers		nomaintainer
description		password manipulation methods for Ruby
long_description	Ruby/Password comprises a set of useful methods for \
					creating, verifying and manipulating passwords. It \
					includes an interface to CrackLib, a library \
					commonly used for checking password strength.  The \
					target audience for this library is system \
					administrators who need to write Ruby programs that \
					prompt for, generate, verify and encrypt passwords.
categories-append	sysutils
homepage		http://www.caliban.org/ruby/
master_sites	http://www.caliban.org/files/ruby/
checksums		md5 b4304bab359bdc95bc7f0938b0db4bed
platforms		darwin

depends_lib-append		port:cracklib \
				port:rb-termios

patchfiles		patch-tc_password.rb.diff
post-patch {
	reinplace "s|^#!.*ruby|#!${ruby.bin}|" ${worksrcpath}/example/example.rb \
			${worksrcpath}/example/pwgen
	reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/extconf.rb
	reinplace "s|pw_dict|cracklib/&|g" ${worksrcpath}/extconf.rb
}

configure.args-append --with-crack-dict=${prefix}/share/cracklib/pw_dict.pwd

post-build {
	system "cd ${worksrcpath} && ${ruby.rdoc} -x CVS rbcrack.c"
}

test.run		yes
test.cmd		${ruby.bin} test/tc_password.rb
