Blame | Last modification | View Log | RSS feed
#! perl######################################################################### COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.## Module name : jats.sh# Module type : Makefile system# Compiler(s) : n\a# Environment(s): jats## Description : Process a hijacked file(s)# Check it in on a branch## Usage:## Version Who Date Description##......................................................................#require 5.006_001;use strict;use warnings;#use Data::Dumper;use Getopt::Long;use Pod::Usage; # required for help supportuse Win32::Shortcut;my $opt_verbose = 0; # Verbositymy $opt_help = 0;my $opt_manual;my $VERSION = "1.0.0";## Globals#my $svnDir = 'C:\Program Files\TortoiseSVN\bin';my $svnExe = $svnDir . '\TortoiseProc.exe';#-------------------------------------------------------------------------------# Function : Main Entry## Description : This small program will process hijacked files in a# static view. It will create a branch for the file and then# check the file in on the branch### Inputs : None## Returns : Even less.#my $result = GetOptions ("help+" => \$opt_help, # flag, multiple use allowed"manual" => \$opt_manual, # flag"verbose+" => \$opt_verbose, # flag);## Process help and manual options#pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);pod2usage(-verbose => 1) if ($opt_help == 2 );pod2usage(-verbose => 2) if ($opt_manual || ($opt_help > 2));createSpecials();## Process files one by one#foreach ( glob ('//auawsasvn001/d$/Repositories/*') ){next unless ( -d $_ );process_file( $_ );}exit;#-------------------------------------------------------------------------------# Function : process_file## Description :## Inputs :## Returns :#sub process_file{my ($fpath) = @_;my $reponame = $fpath;$reponame =~ s~.*/~~;my $svnCmd = '/command:repobrowser /path:https://auawsasvn001.vix.local/svn/';print "Shortcut: $reponame\n";my $link = Win32::Shortcut->new();$link->{'File'} = $reponame . '.lnk';$link->{'Path'} = $svnExe;$link->{'Arguments'} = $svnCmd . $reponame;$link->{'Description'} = $reponame . ' Repository';$link->{'ShowCmd'} = 1;$link->{'IconLocation'} = $svnExe;$link->{'IconNumber'} = '1';$link->{'WorkingDirectory'} = $svnDir;my $rv = $link->Save();unless ( defined $rv ){print "Error creating $link->{'File'}\n";}}#-------------------------------------------------------------------------------# Function : createSpecial## Description :## Inputs :## Returns :#sub createSpecials{my $link = Win32::Shortcut->new();$link->{'File'} = 'TortoiseSVN Config' . '.lnk';$link->{'Path'} = 'C:\Users\dpurdie\AppData\Roaming\Subversion\config';#$link->{'Arguments'} = '';$link->{'Description'} = 'Edit Tortoise SVN Config';$link->{'ShowCmd'} = 1;#$link->{'IconLocation'} = $svnExe;#$link->{'IconNumber'} = '1';$link->{'WorkingDirectory'} = 'C:\Users\dpurdie\AppData\Roaming\Subversion';my $rv = $link->Save();unless ( defined $rv ){print "Error creating $link->{'File'}\n";}$link = Win32::Shortcut->new();$link->{'File'} = 'TortoiseSVN Settings' . '.lnk';$link->{'Path'} = $svnExe;$link->{'Arguments'} = '/command:settings';$link->{'Description'} = 'TortoiseSVN Settings';$link->{'ShowCmd'} = 1;$link->{'IconLocation'} = $svnExe;$link->{'IconNumber'} = '1';$link->{'WorkingDirectory'} = $svnDir;$rv = $link->Save();unless ( defined $rv ){print "Error creating $link->{'File'}\n";}$link = Win32::Shortcut->new();$link->{'File'} = 'TortoiseSVN' . '.lnk';$link->{'Path'} = $svnExe;$link->{'Arguments'} = '/command:repobrowser';$link->{'Description'} = 'TortoiseSVN Repo Browser';$link->{'ShowCmd'} = 1;$link->{'IconLocation'} = $svnExe;$link->{'IconNumber'} = '1';$link->{'WorkingDirectory'} = $svnDir;$rv = $link->Save();unless ( defined $rv ){print "Error creating $link->{'File'}\n";}}#-------------------------------------------------------------------------------# Documentation#=pod=head1 NAMExxxxx - Save a hijacked file on a private branch=head1 SYNOPSISxxxxxx [options] files...Options:-help - brief help message-help -help - Detailed help message-man - Full documentation-verbose - Verbose operation=head1 OPTIONS=over 8=item B<-help>Print a brief help message and exits.=item B<-help -help>Print a detailed help message with an explanation for each option.=item B<-man>Prints the manual page and exits.=item B<-verbose>Increases program output. This option may be specified mutiple times=back=head1 DESCRIPTIONThis small program will process hijacked files in a static view. It will createa branch for the file and then check the file in on the branch=cut