function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FaridKognozFaridKognoz 

force.com sites Project Status

I've created a tool on PERL that creates a csv file with the following information regarding a force.com project:

 

Page Name, Page Controller, Component, Component Controller, Component inside Component, Comp Controller.

 

In order to use it you just need the  source code and execute the following line from the comand line

 (asuming you save the file as status.pl):

 

perl status.pl "PathToSRCDir" >outputfile.csv

 

for example:

perl status.pl "c:\Documents and Settings\Use\workspace\someproject\src"  > output.csv

 

If you open the CSV from excel or google spreadsheet you will have the information
for all the pages in the project, their controllers and each of the components they have, also if the components have components inside they will be listed.

I think this could be a useful tool for force.com sites projects.

Bellow is the source code (just save it on your disk and run it).

 

 

 

 

 

$dirname = @ARGV[0]; $classesDir = $dirname."\classes"; $pagesDir = $dirname."\\pages"; $componentsDir = $dirname."\\components"; #print "$pagesDir\n"; my %compController = (); my %componentComponents = (); my %pagesComponents = (); my %pageController = (); opendir(DIR, $componentsDir) or die "can't opendir $dirname: $!"; while (defined($file = readdir(DIR))) { # do something with "$dirname/$file" $filepath = $componentsDir."\\".$file; #print $filepath."\n"; if($file ne "." && $file ne ".."){ open FILE, "<", $filepath or die $!; @farid = <FILE>; $todo = ""; foreach(@farid){ $todo=$todo.$_; } $_ = $todo; @pageTag = /<apex:component .*?>/gmsi; @componentTags = /<c:.*?>/gmsi; foreach(@pageTag){ #print $_."\n"; #$pageController{$file} $thestring = $_; if($thestring =~ m/controller="([^ >]*?)"/i) { $compController{$file}=$1; } #print $_; } foreach(@componentTags){ #print "$_\n"; $thestring = $_; #print $thestring; #if($thestring =~ m/(.*?)/i) { if($thestring =~ m/<c:([^ \/]*)/i) { $nomComponente = $1.".component"; if($componentComponents{$file} eq ""){ $componentComponents{$file} = $1; } else{ $componentComponents{$file} = $componentComponents{$file}.":".$1; } } } } #<apex:page showHeader="false" standardStylesheets="false" sidebar="false"> } closedir(DIR); opendir(DIR, $pagesDir) or die "can't opendir $dirname: $!"; while (defined($file = readdir(DIR))) { # do something with "$dirname/$file" $filepath = $pagesDir."\\".$file; #print $filepath."\n"; if($file ne "." && $file ne ".."){ open FILE, "<", $filepath or die $!; @farid = <FILE>; $todo = ""; foreach(@farid){ $todo=$todo.$_; } $_ = $todo; @pageTag = /<apex:page .*?>/gmsi; @componentTags = /<c:.*?>/gmsi; foreach(@pageTag){ $thestring = $_; if($thestring =~ m/controller="([^ >]*?)"/i) { $pageController{$file}=$1; } if($thestring =~ m/extensions="([^ >]*?)"/i) { $pageController{$file}=$1; } #print $_; } foreach(@componentTags){ #print "$_\n"; $thestring = $_; #print $thestring; #if($thestring =~ m/(.*?)/i) { if($thestring =~ m/<c:([^ \/]*)/i) { $nomComponente = $1.".component"; if($pagesComponents{$file} ne ""){ @temp = ($1); $pagesComponents{$file} = $pagesComponents{$file}.":".$1; } else{ $pagesComponents{$file} = $1; } } } } #<apex:page showHeader="false" standardStylesheets="false" sidebar="false"> } closedir(DIR); print "NOMBRE PAGINA,CONTROLADOR PAGINA,NOMBRE COMPONENTE,CONTROLADOR COMPONENTE, COMPONENTE INSIDE, CONTROLADOR COMPONENTE\n"; @pages = (); foreach my $llave (keys %pagesComponents){ push(@pages,$llave); } @pages = sort(@pages); foreach my $llave (@pages){ print "$llave,"; if($pageController{$llave} ne ""){ print "$pageController{$llave},,,,\n"; } else{ print",,,,,\n"; } if($pagesComponents{$llave} ne ""){ @pageComponent = split(/:/,$pagesComponents{$llave}); foreach $component (@pageComponent){ print ",,".$component.","; $nomComponente = $component.".component"; if($compController{$nomComponente} ne ""){ print $compController{$nomComponente}.",,\n"; } else{ print",,,\n"; } if($componentComponents{$nomComponente} ne ""){ @components = split(/:/,$componentComponents{$nomComponente}); foreach $compcomp (@components){ $nomCompComp = $compcomp.".component"; print ",,,,".$nomCompComp.","; if($compController{$nomCompComp} ne ""){ print $compController{$nomCompComp}."\n"; } else{ print",\n"; } } } } } else{ print ",,,\n"; } }