# $Id: Portfile 40509 2008-10-04 21:31:36Z jmr@macports.org $

PortSystem		1.0
PortGroup		ruby 1.0

ruby.setup		{password ruby-password} 0.5.2 extconf.rb {README doc example}
revision		1
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 6a33fb9dd039f07fe2b81a0d8eed7f6f
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

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

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