[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Wed Mar 19 16:55:35 UTC 2008


kawas
Wed Mar 19 12:55:35 EDT 2008
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts
In directory dev.open-bio.org:/tmp/cvs-serv28455/Perl/MOBY-Server/bin/scripts

Modified Files:
	moby-s-install.pl 
Log Message:
fixed bug where authority script wasnt being installed by script
moby-live/Perl/MOBY-Server/bin/scripts moby-s-install.pl,1.2,1.3
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl	2008/03/06 16:44:55	1.2
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/bin/scripts/moby-s-install.pl	2008/03/19 16:55:35	1.3
@@ -90,7 +90,7 @@
 		check_module('WSRF::Lite');
 		check_module('Crypt::OpenSSL::X509');
 		check_module('IPC::Shareable');
-	}    
+	}
 
 	if ($errors_found) {
 		say "\nSorry, some needed modules were not found.";
@@ -131,20 +131,24 @@
 }
 
 sub prompt_for_directory_expand {
-    my ($prompt, $prompted_dir) = @_;
-    while (1) {
-	my $dir = pprompt ("$prompt [$prompted_dir] ");
-	$dir =~ s/^\s*//; $dir =~ s/\s*$//;
-	$dir = $prompted_dir unless $dir;
-	return $dir if -d $dir and -w $dir;  # okay: writable directory
-	$prompted_dir = $dir;
-	next if -e $dir and say "'$dir' is not a writable directory. Try again please.";
-	next unless pprompt ("Directory '$dir' does not exists. Create? ", -yn);
-
-	# okay, we agreed to create it
-	mkdir ($dir, 0755 )and return $dir;
-	say "'$dir' not created: $!";
-    }
+	my ( $prompt, $prompted_dir ) = @_;
+	while (1) {
+		my $dir = pprompt("$prompt [$prompted_dir] ");
+		$dir =~ s/^\s*//;
+		$dir =~ s/\s*$//;
+		$dir = $prompted_dir unless $dir;
+		return $dir if -d $dir and -w $dir;    # okay: writable directory
+		$prompted_dir = $dir;
+		next
+		  if -e $dir
+		  and say "'$dir' is not a writable directory. Try again please.";
+		next
+		  unless pprompt( "Directory '$dir' does not exists. Create? ", -yn );
+
+		# okay, we agreed to create it
+		mkdir( $dir, 0755 ) and return $dir;
+		say "'$dir' not created: $!";
+	}
 }
 
 sub prompt_user_input {
@@ -186,11 +190,14 @@
 	if ($@) {
 		say "ERROR: $file_desc was (probably) not created.\n$@";
 	} else {
-		say "\n$file_desc created: '$file'\n\tPlease ensure that the file is executable!\n";
+		say
+"\n$file_desc created: '$file'\n\tPlease ensure that the file is executable!\n";
 	}
+
 	# try to make file executable
 	eval {
-		my $mode = 0655;   chmod $mode, "$file";
+		my $mode = 0655;
+		chmod $mode, "$file";
 	};
 }
 
@@ -472,8 +479,7 @@
   prompt_for_directory( "What is the path of the apache 'cgi-bin' directory?",
 						"$apache_base/cgi-bin" );
 $perl_exec =
-  prompt_user_input( "What is the path to your perl executable?", 
-  						$perl_exec );
+  prompt_user_input( "What is the path to your perl executable?", $perl_exec );
 $perl_exec = "$perl_exec -w";
 
 say "\nusing $apache_base as base directory ...";
@@ -540,7 +546,7 @@
 												   'MOBY', 'cgi/MOBY-Central.pl'
 						),
 						'MOBY-Central Dispatch file',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
 	);
 	file_from_template(
 						"$apache_cgi/OntologyServer.cgi",
@@ -548,8 +554,9 @@
 												'MOBY', 'cgi/OntologyServer.cgi'
 						),
 						'MOBY-Central Ontology Server file',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
 	);
+
 	#install the moby-admin module
 	file_from_template(
 						"$apache_cgi/MOBY-Admin.pl",
@@ -557,7 +564,7 @@
 												   'MOBY', 'cgi/MOBY-Admin.pl'
 						),
 						'MOBY-Admin Dispatch file',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
 	);
 
 	# configure httpd.conf
@@ -662,12 +669,18 @@
 
 do {
 	my $ready_to_go = 0;
-	my $sql_error = 0;
+	my $sql_error   = 0;
+
 	#check to see if we can call mysql ... if not, then die!
-	print "mysql is installed ...\n" if `mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/;
-	print "mysql is started ...\n" unless `mysql 2>&1` =~ m/^ERROR 200.*Can't connect to .*$/ ;
+	print "mysql is installed ...\n"
+	  if `mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/;
+	print "mysql is started ...\n"
+	  unless `mysql 2>&1` =~ m/^ERROR 200.*Can't connect to .*$/;
 
-	unless ( `mysql --version 2>&1`  =~ m/^mysql\s+Ver\s+.*$/ and not (`mysql 2>&1` =~ m/^ERROR .*Can't connect to local MySQL .*$/) ) {
+	unless ( `mysql --version 2>&1` =~ m/^mysql\s+Ver\s+.*$/
+		 and not( `mysql 2>&1` =~ m/^ERROR .*Can't connect to local MySQL .*$/ )
+	  )
+	{
 		say
 "\nmysql doesn't seem to be accessible ... please ensure that it is on the path, started and try again.\n";
 		$sql_error = 1;
@@ -675,274 +688,278 @@
 
 	# proceed if mysql check was good
 	do {
-	# have the values been set already?
-	$ready_to_go = 1
-	  if $username
-	  and $url
-	  and $port
-	  and $m_object
-	  and $m_relationship
-	  and $m_service
-	  and $m_namespace
-	  and $m_central;
+
+		# have the values been set already?
+		$ready_to_go = 1
+		  if $username
+		  and $url
+		  and $port
+		  and $m_object
+		  and $m_relationship
+		  and $m_service
+		  and $m_namespace
+		  and $m_central;
 
 #check to see if mobycentral.config has been created in the conf directory first -> if so, parse it
-	if (    -e "$apache_conf/mobycentral.config"
-		 && !( -d "$apache_conf/mobycentral.config" )
-		 && !$ready_to_go )
-	{
-		my %db_sections = ();
-		open IN, "$apache_conf/mobycentral.config"
-		  or die
+		if (    -e "$apache_conf/mobycentral.config"
+			 && !( -d "$apache_conf/mobycentral.config" )
+			 && !$ready_to_go )
+		{
+			my %db_sections = ();
+			open IN, "$apache_conf/mobycentral.config"
+			  or die
 "can't open MOBY Configuration file '$apache_conf/mobycentral.config' for unknown reasons: $!\n";
-		my @sections = split /(\[\s*\S+\s*\][^\[]*)/s, join "", <IN>;
-		foreach my $section (@sections) {
-			my $dbConfig = MOBY::dbConfig->new( section => $section );
-			next unless $dbConfig;
-			my $dbname = $dbConfig->section_title;
-			next unless $dbname;
-			$db_sections{$dbname} = $dbConfig;
-		}
+			my @sections = split /(\[\s*\S+\s*\][^\[]*)/s, join "", <IN>;
+			foreach my $section (@sections) {
+				my $dbConfig = MOBY::dbConfig->new( section => $section );
+				next unless $dbConfig;
+				my $dbname = $dbConfig->section_title;
+				next unless $dbname;
+				$db_sections{$dbname} = $dbConfig;
+			}
 
-		$username       = $db_sections{mobycentral}->{username};
-		$password       = $db_sections{mobycentral}->{password} || "";
-		$url            = $db_sections{mobycentral}->{url};
-		$port           = $db_sections{mobycentral}->{port};
-		$m_object       = $db_sections{mobyobject}->{dbname};
-		$m_relationship = $db_sections{mobyrelationship}->{dbname};
-		$m_service      = $db_sections{mobyservice}->{dbname};
-		$m_namespace    = $db_sections{mobynamespace}->{dbname};
-		$m_central      = $db_sections{mobycentral}->{dbname};
+			$username       = $db_sections{mobycentral}->{username};
+			$password       = $db_sections{mobycentral}->{password} || "";
+			$url            = $db_sections{mobycentral}->{url};
+			$port           = $db_sections{mobycentral}->{port};
+			$m_object       = $db_sections{mobyobject}->{dbname};
+			$m_relationship = $db_sections{mobyrelationship}->{dbname};
+			$m_service      = $db_sections{mobyservice}->{dbname};
+			$m_namespace    = $db_sections{mobynamespace}->{dbname};
+			$m_central      = $db_sections{mobycentral}->{dbname};
 
-		$ready_to_go = 1;
-	}
+			$ready_to_go = 1;
+		}
 
-	# if the values havent been set, then prompt for them
-	do {
+		# if the values havent been set, then prompt for them
+		do {
 
-		say "  Installing the file '$apache_conf/mobycentral.config' ...";
+			say "  Installing the file '$apache_conf/mobycentral.config' ...";
 
-		# fill out mobycentral.config
-		(
-		   $username,  $password,    $url,
-		   $port,      $m_object,    $m_relationship,
-		   $m_service, $m_namespace, $m_central
-		  )
-		  = prompt_moby_config_info;
-		fill_out_moby_conf(
-							"$apache_conf/mobycentral.config",
-							$username,  $password,    $url,
-							$port,      $m_object,    $m_relationship,
-							$m_service, $m_namespace, $m_central
-		);
+			# fill out mobycentral.config
+			(
+			   $username,  $password,    $url,
+			   $port,      $m_object,    $m_relationship,
+			   $m_service, $m_namespace, $m_central
+			  )
+			  = prompt_moby_config_info;
+			fill_out_moby_conf(
+								"$apache_conf/mobycentral.config",
+								$username,  $password,    $url,
+								$port,      $m_object,    $m_relationship,
+								$m_service, $m_namespace, $m_central
+			);
 
-	} unless $ready_to_go;
+		} unless $ready_to_go;
 
-	# now start creating the tables
-	say "   creating the tables to use for the registry ...";
-	my %dbsections = (
-					   'mobycentral'      => $m_central,
-					   'mobyobject'       => $m_object,
-					   'mobyservice'      => $m_service,
-					   'mobynamespace'    => $m_namespace,
-					   'mobyrelationship' => $m_relationship
-	);
+		# now start creating the tables
+		say "   creating the tables to use for the registry ...";
+		my %dbsections = (
+						   'mobycentral'      => $m_central,
+						   'mobyobject'       => $m_object,
+						   'mobyservice'      => $m_service,
+						   'mobynamespace'    => $m_namespace,
+						   'mobyrelationship' => $m_relationship
+		);
 
-	my $clone = 0;
-	my $central;
-	do {
-		$clone = 1;
-		my %registries = (
-			default => {
-				url =>
-"http://moby.ucalgary.ca/moby/MOBY-Central.pl",
-				uri => "http://moby.ucalgary.ca/MOBY/Central"
-			},
-			testing => {
-				url =>
+		my $clone = 0;
+		my $central;
+		do {
+			$clone = 1;
+			my %registries = (
+				default => {
+						  url => "http://moby.ucalgary.ca/moby/MOBY-Central.pl",
+						  uri => "http://moby.ucalgary.ca/MOBY/Central"
+				},
+				testing => {
+					url =>
 "http://bioinfo.icapture.ubc.ca/cgi-bin/mobycentral/MOBY-Central.pl",
-				uri => "http://bioinfo.icapture.ubc.ca/MOBY/Central"
-			},
-			IRRI => {
+					uri => "http://bioinfo.icapture.ubc.ca/MOBY/Central"
+				},
+				IRRI => {
 					  url => "http://cropwiki.irri.org/cgi-bin/MOBY-Central.pl",
 					  uri => "http://cropwiki.irri.org/MOBY/Central"
-			},
+				},
 
-			#			localhost => {
-			#					url=>"http://localhost/cgi-bin/MOBY-Central.pl",
-			#					uri=>"http://localhost/MOBY/Central"
-			#			},
-		);
-		my $registry = pprompt( "What registry to use? [b] ",
-								-m => [ sort keys %registries ] );
+				#			localhost => {
+				#					url=>"http://localhost/cgi-bin/MOBY-Central.pl",
+				#					uri=>"http://localhost/MOBY/Central"
+				#			},
+			);
+			my $registry = pprompt( "What registry to use? [b] ",
+									-m => [ sort keys %registries ] );
 
-		$central = MOBY::Client::Central->new(
+			$central = MOBY::Client::Central->new(
 									 Registries => {
 										 mobycentral => {
 											 URL => $registries{$registry}{url},
 											 URI => $registries{$registry}{uri}
 										 }
 									 }
-		);
-	  }
-	  if pprompt( "Would you like to clone a mobycentral registry? [n] ",
-				  -ynd => 'n' ) eq 'y';
-	my $error = 0;
-	if ($clone) {
-		say "Getting db dumps ...";
-		my (
-			 $mobycentral,   $mobyobject, $mobyservice,
-			 $mobynamespace, $mobyrelationship
-		  )
-		  = $central->MOBY::Client::Central::DUMP();
-		my $drh = DBI->install_driver("mysql");
-
-		my ( $fh, $filename ) = tempfile( UNLINK => 1 );
-		say "Processing dump for service instances ...";
-		print $fh $mobycentral;
-		eval {
-			$drh->func( 'dropdb', $dbsections{mobycentral},
-						$url, $username, $password, 'admin' );
-		};
-		eval {
-			$drh->func( 'createdb', $dbsections{mobycentral},
-						$url, $username, $password, 'admin' );
-		};
-		system(   "mysql -h $url -P $port -u $username --password=$password "
-				. $dbsections{mobycentral}
-				. "<$filename" ) == 0
-		  or ( say "Error populating service instance ontology ...\n$!"
-			   and $error++ );
-
-		( $fh, $filename ) = tempfile( UNLINK => 1 );
-		say "Processing dump for the objects ontology ...";
-		print $fh $mobyobject;
-		eval {
-			$drh->func( 'dropdb', $dbsections{mobyobject}, $url, $username,
-						$password, 'admin' );
-		};
-		eval {
-			$drh->func( 'createdb', $dbsections{mobyobject}, $url, $username,
-						$password, 'admin' );
-		};
-		system(   "mysql -h $url -P $port -u $username --password=$password "
-				. $dbsections{mobyobject}
-				. "<$filename" ) == 0
-		  or ( say "Error populating objects ontology ...\n$!" and $error++ );
-
-		( $fh, $filename ) = tempfile( UNLINK => 1 );
-		say "Processing dump for service types ...";
-		print $fh $mobyservice;
-		eval {
-			$drh->func( 'dropdb', $dbsections{mobyservice},
-						$url, $username, $password, 'admin' );
-		};
-		eval {
-			$drh->func( 'createdb', $dbsections{mobyservice},
-						$url, $username, $password, 'admin' );
-		};
-		system(   "mysql -h $url -P $port -u $username --password=$password "
-				. $dbsections{mobyservice}
-				. "<$filename" ) == 0
-		  or ( say "Error populating service types ontology ...\n$!"
-			   and $error++ );
-
-		( $fh, $filename ) = tempfile( UNLINK => 1 );
-		say "Processing dump for the namespace ontology ...";
-		print $fh $mobynamespace;
-		eval {
-			$drh->func( 'dropdb', $dbsections{mobynamespace},
-						$url, $username, $password, 'admin' );
-		};
-		eval {
-			$drh->func( 'createdb', $dbsections{mobynamespace},
-						$url, $username, $password, 'admin' );
-		};
-		system(   "mysql -h $url -P $port -u $username --password=$password "
-				. $dbsections{mobynamespace}
-				. "<$filename" ) == 0
-		  or ( say "Error populating namespace ontology ...\n$!" and $error++ );
-
-		( $fh, $filename ) = tempfile( UNLINK => 1 );
-		say "Processing dump for the relationships ontology ...";
-		print $fh $mobyrelationship;
-		eval {
-			$drh->func( 'dropdb', $dbsections{mobyrelationship},
-						$url, $username, $password, 'admin' );
-		};
-		eval {
-			$drh->func( 'createdb', $dbsections{mobyrelationship},
-						$url, $username, $password, 'admin' );
-		};
-		system(   "mysql -h $url -P $port -u $username --password=$password "
-				. $dbsections{mobyrelationship}
-				. "<$filename" ) == 0
-		  or ( say "Error populating relationships ontology ...\n$!"
-			   and $error++ );
-
-	} else {
-
-		# no clone, so create minimalist databases
-		my $drop_db = 0;
-
-		#ask for permission on dropping data from db ...
-		do {
-			$drop_db = 1;
+			);
 		  }
-		  if pprompt(
-				"Shall I drop all pre-existing databases used by BioMOBY? [n] ",
-				-ynd => 'n' ) eq 'y';
-
-		#process each db
-		foreach my $section ( keys %dbsections ) {
-			my $sqlfilepath =
-			  File::ShareDir::dist_file( 'MOBY', "db/schema/$section.mysql" );
+		  if pprompt( "Would you like to clone a mobycentral registry? [n] ",
+					  -ynd => 'n' ) eq 'y';
+		my $error = 0;
+		if ($clone) {
+			say "Getting db dumps ...";
+			my (
+				 $mobycentral,   $mobyobject, $mobyservice,
+				 $mobynamespace, $mobyrelationship
+			  )
+			  = $central->MOBY::Client::Central::DUMP();
 			my $drh = DBI->install_driver("mysql");
 
-			# drop the db
+			my ( $fh, $filename ) = tempfile( UNLINK => 1 );
+			say "Processing dump for service instances ...";
+			print $fh $mobycentral;
 			eval {
-				$drh->func( 'dropdb', $dbsections{$section}, $url, $username,
-							$password, 'admin' );
-			} if $drop_db;
-
-			# create the db
+				$drh->func( 'dropdb', $dbsections{mobycentral},
+							$url, $username, $password, 'admin' );
+			};
 			eval {
-				$drh->func( 'createdb', $dbsections{$section}, $url, $username,
+				$drh->func( 'createdb', $dbsections{mobycentral},
+							$url, $username, $password, 'admin' );
+			};
+			system( "mysql -h $url -P $port -u $username --password=$password "
+					. $dbsections{mobycentral}
+					. "<$filename" ) == 0
+			  or ( say "Error populating service instance ontology ...\n$!"
+				   and $error++ );
+
+			( $fh, $filename ) = tempfile( UNLINK => 1 );
+			say "Processing dump for the objects ontology ...";
+			print $fh $mobyobject;
+			eval {
+				$drh->func( 'dropdb', $dbsections{mobyobject}, $url, $username,
 							$password, 'admin' );
 			};
+			eval {
+				$drh->func( 'createdb', $dbsections{mobyobject}, $url,
+							$username, $password, 'admin' );
+			};
+			system( "mysql -h $url -P $port -u $username --password=$password "
+					. $dbsections{mobyobject}
+					. "<$filename" ) == 0
+			  or
+			  ( say "Error populating objects ontology ...\n$!" and $error++ );
+
+			( $fh, $filename ) = tempfile( UNLINK => 1 );
+			say "Processing dump for service types ...";
+			print $fh $mobyservice;
+			eval {
+				$drh->func( 'dropdb', $dbsections{mobyservice},
+							$url, $username, $password, 'admin' );
+			};
+			eval {
+				$drh->func( 'createdb', $dbsections{mobyservice},
+							$url, $username, $password, 'admin' );
+			};
+			system( "mysql -h $url -P $port -u $username --password=$password "
+					. $dbsections{mobyservice}
+					. "<$filename" ) == 0
+			  or ( say "Error populating service types ontology ...\n$!"
+				   and $error++ );
+
+			( $fh, $filename ) = tempfile( UNLINK => 1 );
+			say "Processing dump for the namespace ontology ...";
+			print $fh $mobynamespace;
+			eval {
+				$drh->func( 'dropdb', $dbsections{mobynamespace},
+							$url, $username, $password, 'admin' );
+			};
+			eval {
+				$drh->func( 'createdb', $dbsections{mobynamespace},
+							$url, $username, $password, 'admin' );
+			};
+			system( "mysql -h $url -P $port -u $username --password=$password "
+					. $dbsections{mobynamespace}
+					. "<$filename" ) == 0
+			  or ( say "Error populating namespace ontology ...\n$!"
+				   and $error++ );
+
+			( $fh, $filename ) = tempfile( UNLINK => 1 );
+			say "Processing dump for the relationships ontology ...";
+			print $fh $mobyrelationship;
+			eval {
+				$drh->func( 'dropdb', $dbsections{mobyrelationship},
+							$url, $username, $password, 'admin' );
+			};
+			eval {
+				$drh->func( 'createdb', $dbsections{mobyrelationship},
+							$url, $username, $password, 'admin' );
+			};
+			system( "mysql -h $url -P $port -u $username --password=$password "
+					. $dbsections{mobyrelationship}
+					. "<$filename" ) == 0
+			  or ( say "Error populating relationships ontology ...\n$!"
+				   and $error++ );
+
+		} else {
+
+			# no clone, so create minimalist databases
+			my $drop_db = 0;
 
-			#create the tables in the db
+			#ask for permission on dropping data from db ...
 			do {
-				say "\n\tProblem creating tables in the db: $section: $!";
+				$drop_db = 1;
 			  }
-			  unless system(
+			  if pprompt(
+				"Shall I drop all pre-existing databases used by BioMOBY? [n] ",
+				-ynd => 'n'
+			  ) eq 'y';
+
+			#process each db
+			foreach my $section ( keys %dbsections ) {
+				my $sqlfilepath = File::ShareDir::dist_file( 'MOBY',
+												   "db/schema/$section.mysql" );
+				my $drh = DBI->install_driver("mysql");
+
+				# drop the db
+				eval {
+					$drh->func( 'dropdb', $dbsections{$section}, $url,
+								$username, $password, 'admin' );
+				} if $drop_db;
+
+				# create the db
+				eval {
+					$drh->func( 'createdb', $dbsections{$section}, $url,
+								$username, $password, 'admin' );
+				};
+
+				#create the tables in the db
+				do {
+					say "\n\tProblem creating tables in the db: $section: $!";
+				  }
+				  unless system(
 					 "mysql -h $url -P $port -u $username --password=$password "
 					   . $dbsections{$section}
 					   . "<$sqlfilepath" ) == 0;
-			say "\tProcessing of $section completed ... ";
-		}
-		say "populating the tables with basic data ...";
-		%dbsections = (
-						'mobyobject'       => $m_object,
-						'mobyservice'      => $m_service,
-						'mobyrelationship' => $m_relationship
-		);
-		foreach my $section ( keys %dbsections ) {
-			my $sqlfilepath =
-			  File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" );
-			system( "mysql -h $url -P $port -u $username --password=$password "
-					. $dbsections{$section}
-					. "<$sqlfilepath" ) == 0
-			  or say "\n\tProblem populating the db: $section: $!";
-			say "\tPopulation processing for db $section completed ...";
+				say "\tProcessing of $section completed ... ";
+			}
+			say "populating the tables with basic data ...";
+			%dbsections = (
+							'mobyobject'       => $m_object,
+							'mobyservice'      => $m_service,
+							'mobyrelationship' => $m_relationship
+			);
+			foreach my $section ( keys %dbsections ) {
+				my $sqlfilepath =
+				  File::ShareDir::dist_file( 'MOBY', "db/data/$section.data" );
+				system(
+					 "mysql -h $url -P $port -u $username --password=$password "
+					   . $dbsections{$section}
+					   . "<$sqlfilepath" ) == 0
+				  or say "\n\tProblem populating the db: $section: $!";
+				say "\tPopulation processing for db $section completed ...";
+			}
 		}
-	}
 
-	say "Set up of mySQL complete!" if $error == 0;
-	say
+		say "Set up of mySQL complete!" if $error == 0;
+		say
 "There were some problems encountered. Please correct the errors and re-run this script!"
-	  if $error > 0;
-} unless $sql_error;
+		  if $error > 0;
+	} unless $sql_error;
 } if pprompt( "Would you like to set up mySQL? [n] ", -ynd => 'n' ) eq 'y';
 
 do {
@@ -957,15 +974,22 @@
 		  if pprompt( "The RESOURCES script already exists, overwrite? [n] ",
 					  -ynd => 'n' ) eq 'y';
 	} if -e "$apache_cgi/RESOURCES";
-	
-	my $rdf_cache_location =  prompt_for_directory_expand( "Where would you like to store the RDF cache?", "$apache_base/moby_cache" );
-	
-	say 'Please make sure that you make that directory read/writable by your web server!\n';
-	
+
+	my $rdf_cache_location =
+	  prompt_for_directory_expand(
+								 "Where would you like to store the RDF cache?",
+								 "$apache_base/moby_cache" );
+
+	say
+"Please make sure that you make that directory read/writable by your web server!\n";
+
 	# copy the file
-	file_from_template( "$apache_cgi/RESOURCES",
+	file_from_template(
+						"$apache_cgi/RESOURCES",
 						File::ShareDir::dist_file( 'MOBY', 'cgi/RESOURCES' ),
-						'RESOURCES script', {'#!/usr/bin/perl -w'    => "#!$perl_exec",} )
+						'RESOURCES script',
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	  )
 	  if $exists == 0;
 
 	# update mobycentral.config file to reflect the location of the script
@@ -985,7 +1009,7 @@
 									 'mobycentral' => {
 														'resourceURL'  => 0,
 														'allResources' => 0,
-														'rdf_cache' => 0
+														'rdf_cache'    => 0
 									 },
 									 'mobyobject'    => { 'resourceURL' => 0 },
 									 'mobyservice'   => { 'resourceURL' => 0 },
@@ -1002,7 +1026,7 @@
 			'MOBY/SQL Configuration file',
 
 			# mysql settings
-			{'rdf_cache'		=> "$rdf_cache_location"},
+			{ 'rdf_cache' => "$rdf_cache_location" },
 
 			# db section mappings
 			{},
@@ -1039,16 +1063,16 @@
 		  }
 		  if pprompt( "The authority script already exists, overwrite? [n] ",
 					  -ynd => 'n' ) eq 'y';
-		file_from_template(
-						"$apache_cgi/authority.pl",
-						File::ShareDir::dist_file(
-												'MOBY', 'cgi/authority.pl'
-						),
-						'MOBY-Central LSID authority server file',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
-		) if $exists == 0;
 	} if -e "$apache_cgi/authority.pl";
 
+	file_from_template(
+		"$apache_cgi/authority.pl",    
+		File::ShareDir::dist_file( 'MOBY', 'cgi/authority.pl' ),
+		'MOBY-Central LSID authority server file',
+		{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	  )
+	  if $exists == 0;
+
 	# update mobycentral.config file to reflect the particulars of the script
 	do {
 
@@ -1167,97 +1191,99 @@
 
 do {
 
-		# prompt for a location for the service_tester_path
-		my $service_tester_path =  prompt_for_directory_expand( "Where would you like to place the service pinger script?", "$apache_base/moby_tester" );
-		say 'Please make sure that you make that directory read/writable by your web server!\n';
-		# make sure that the key service_tester_path exists for the config file
-		my $search = search_config_file(
-								   "$apache_conf/mobycentral.config",
-								   {
-									 'mobycentral' => {
-														'service_tester_path'  => 0,
-									 }
-								   }
-		);
-		add_missing_keys_to_config_file( "$apache_conf/mobycentral.config", $search );
+	# prompt for a location for the service_tester_path
+	my $service_tester_path =
+	  prompt_for_directory_expand(
+					 "Where would you like to place the service pinger script?",
+					 "$apache_base/moby_tester" );
+	say
+'Please make sure that you make that directory read/writable by your web server!\n';
 
-		# copy the information
-		config_file_from_template(
-			"$apache_conf/mobycentral.config",
-			"$apache_conf/mobycentral.config",
-			'MOBY/SQL Configuration file',
+	# make sure that the key service_tester_path exists for the config file
+	my $search = search_config_file( "$apache_conf/mobycentral.config",
+						 { 'mobycentral' => { 'service_tester_path' => 0, } } );
+	add_missing_keys_to_config_file( "$apache_conf/mobycentral.config",
+									 $search );
 
-			# mysql settings
-			{'service_tester_path'	=> "$service_tester_path"},
+	# copy the information
+	config_file_from_template(
+		"$apache_conf/mobycentral.config",
+		"$apache_conf/mobycentral.config",
+		'MOBY/SQL Configuration file',
 
-			# db section mappings
-			{},
+		# mysql settings
+		{ 'service_tester_path' => "$service_tester_path" },
 
-			# resource urls
-			{},
+		# db section mappings
+		{},
 
-			# lsid info
-			{}
-		);
-		
-		file_from_template(
+		# resource urls
+		{},
+
+		# lsid info
+		{}
+	);
+
+	file_from_template(
 						"$service_tester_path/service_tester.pl",
 						File::ShareDir::dist_file(
-												'MOBY', 'cgi/service_tester.pl'
+												 'MOBY', 'cgi/service_tester.pl'
 						),
 						'MOBY-Central service tester script',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
-		);
-		say 'Please don\'t forget to place the service pinger on a cron! TODO - explain how to do that!';
-		
-		#copy the other scripts now
-		file_from_template(
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	);
+	say
+'Please don\'t forget to place the service pinger on a cron! TODO - explain how to do that!';
+
+	#copy the other scripts now
+	file_from_template(
 						"$apache_cgi/AgentRDFValidator",
 						File::ShareDir::dist_file(
-												'MOBY', 'cgi/AgentRDFValidator'
+												 'MOBY', 'cgi/AgentRDFValidator'
 						),
 						'The RDF agent validator page',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
-		);
-		file_from_template(
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	);
+	file_from_template(
 						"$apache_cgi/GenerateRDF.cgi",
 						File::ShareDir::dist_file(
-												'MOBY', 'cgi/GenerateRDF.cgi'
+												   'MOBY', 'cgi/GenerateRDF.cgi'
 						),
 						'MOBY-Central service instance RDF generating form',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
-		);
-		file_from_template(
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	);
+	file_from_template(
 						"$apache_cgi/Moby",
-						File::ShareDir::dist_file(
-												'MOBY', 'cgi/Moby'
-						),
+						File::ShareDir::dist_file( 'MOBY', 'cgi/Moby' ),
 						'MOBY-Central test page for auxillary scripts',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
-		);
-		file_from_template(
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	);
+	file_from_template(
 						"$apache_cgi/ServicePingerValidator",
 						File::ShareDir::dist_file(
-												'MOBY', 'cgi/ServicePingerValidator'
+											'MOBY', 'cgi/ServicePingerValidator'
 						),
 						'MOBY-Central service invocation test form',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
-		);
-		file_from_template(
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	);
+	file_from_template(
 						"$apache_cgi/ValidateService",
 						File::ShareDir::dist_file(
-												'MOBY', 'cgi/ValidateService'
+												   'MOBY', 'cgi/ValidateService'
 						),
 						'MOBY-Central service tester information page',
-						{'#!/usr/bin/perl -w'    => "#!$perl_exec",}
-		);
+						{ '#!/usr/bin/perl -w' => "#!$perl_exec", }
+	);
   }
-	  if pprompt( "Would you like to auxillary scripts? These include the service pinger, a test page for the rdf agent, an RDF generator page, etc? [y] ",
-			  -ynd => 'y' ) eq 'y';
+  if pprompt(
+"Would you like to auxillary scripts? These include the service pinger, a test page for the rdf agent, an RDF generator page, etc? [y] ",
+	-ynd => 'y'
+  ) eq 'y';
 
 #
 
-say "Please remember to set up the RDF agent! Just restart apache and your registry has been set up!\n\nDone.";
+say
+"Please remember to set up the RDF agent! Just restart apache and your registry has been set up!\n\nDone.";
 
 package SimplePrompt;
 




More information about the MOBY-guts mailing list