I was (am) in the middle of playing around with Jenkins CI, and I had the need to resolve source code dependencies of supporting libraries. Currently, my Netbeans based projects don’t use Maven or Ivy (or Gradle), so I have to resolve those dependencies manual. The first step, however, is getting the libraries on the Jenkins server so I can register them with Jenkins.
Read the rest of this entry »
faq
I forgot Perl (been about 10 years), but this script I wrote does the job. Released under GPL v2. Modify and share as you see fit.
#!/usr/bin/perl
use Fcntl qw(:flock :seek);
use WWW::Mechanize;
# Would like to accept the javadoc root path as a parameter. Right now, need to hard code.
$allClassesFile = "./allclasses-noframe.html";
my $mech = WWW::Mechanize->new();
$mech->get( "file:$allClassesFile" );
my @links = $mech->links();
# This is the new single file
$sitedata="single.html";
open(DAT,">$sitedata") || die("Cannot Open File $sitedata");
flock(DAT, LOCK_EX);
seek(DAT, 0, SEEK_SET);
print DAT "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
print DAT "<HTML><HEAD><META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";
print DAT "<TITLE>Single Page</TITLE><LINK REL =\"stylesheet\" TYPE=\"text/css\" HREF=\"stylesheet.css\" TITLE=\"Style\"></HEAD><BODY BGCOLOR=\"white\">";
# Would like to include a table of contents of all classes docs included, with an href="#someclass" linking to the proper section in the page
# TOC
print DAT "<UL>";
for my $link ( @links ) {
$linkText = $link->text;
chomp($linkText);
$linkUrl = $link->url;
chomp($linkUrl);
if (($linkText ne '') && ($linkUrl ne '')){
$linkUrl =~ s/\//\./g;
$linkUrl =~ s/\.html//;
print DAT "<LI><a href='#$linkUrl'>$linkUrl</a>";
}
}
print DAT "</UL>";
print DAT "<hr /><br/>\n";
print DAT "<div style=\"page-break-before: always;\"></div>\n";
# maybe fix to better handle errors
for my $link ( @links ) {
$linkText = $link->text;
chomp($linkText);
$linkUrl = $link->url;
chomp($linkUrl);
if (($linkText ne '') && ($linkUrl ne '')){
#printf "%s, %s\n", $linkText, $linkUrl;
open ACF, "<./$linkUrl" || die("Cannot Open File $linkUrl");
$infile_contents = do { local $/; <ACF> };
close ACF;
# I'm sure there is a better way to split this
@content = split(/<!-- ======== START OF CLASS DATA ======== -->/, $infile_contents);
@content = split(/<!-- ========= END OF CLASS DATA ========= -->/, $content[1]);
print DAT "<a name='$linkUrl'\n";
print DAT "$content[0]\n";
print DAT "<div style=\"page-break-before: always;\"></div>\n";
}
}
print DAT "</BODY></HTML>";
close(DAT);
jobs
Posted by John Manko | Posted in Linux | Posted on 28-09-2009
I wrote a script to ease the creation of subversion repositories in Gentoo. This script assumes the existence of three files:
authz - Standard svn authorization file,
located svn root conf directory,
used for all repos.
passwd - Standard passwd file, and
is used for all repos.
svnserve.conf - Template file (points back to
authz & passwd), copied to each
newly created repo conf
directory.
Here is the script:
#! /bin/bash
REPO_ROOT=/var/svn
echo -n "New Repository Name: "
read -e REPO_NAME
if [ "$REPO_NAME" = "" ]; then
echo "A valid repository name must be entered. Cannot create repository.";
exit;
fi
REPO_PATH=$REPO_ROOT/$REPO_NAME
if [ -e $REPO_PATH ]; then
echo "The file or directory ($REPO_PATH) already exists. Cannot create repository.";
exit;
fi
svnadmin create $REPO_PATH
cp $REPO_ROOT/conf/svnserve.conf $REPO_PATH/conf/
rm $REPO_PATH/conf/authz
rm $REPO_PATH/conf/passwd
chown -R svn:svnusers $REPO_PATH
chmod -R g+w $REPO_PATH
chmod -R o-rwx $REPO_PATH
/etc/init.d/svnserve restart
echo $REPO_PATH has been created!
feedback