| 
					
				 | 
			
			
				@@ -8,7 +8,7 @@ use Log::Log4perl qw(:easy); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # TODO: This needs to be scoped properly 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use lib "/usr/local/lib"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use SimplyGit::Shellex qw(shellex findBin); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-use SimplyGit::Git qw(readConfig getStatus returnState addFiles commitChanges pushChanges stashAndReset resetFromUpstream updateGitIgnore appendRepoUserConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use SimplyGit::Git qw(readConfig getStatus returnState addFiles commitChanges pushChanges stashAndReset resetFromUpstream updateGitIgnore appendRepoUserConfig parseSGConfig warnOnUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # TODO: This should maybe be more robust? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if ( ! -d ".git" ) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -23,6 +23,7 @@ sub initSG($) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	chomp $homeDir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	my $path = $homeDir . "/" . $sgDir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	my $logFile = $homeDir . "/" . $sgDir . "/" . "sgLog.txt"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	my $configFile = $homeDir . "/" . $sgDir . "/" . "sg.config"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	if ( ! -d $path ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		print "Creating $path\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		shellex("mkdir $path"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -33,19 +34,29 @@ sub initSG($) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		shellex("touch $logFile"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	return ( $path, $logFile ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if ( ! -f $configFile ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		print "Creating $logFile\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		shellex("touch $logFile"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return ( $path, $logFile, $configFile ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-my ( $sgPath, $sgLogFile ) = initSG(".sg"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+my ( $sgPath, $sgLogFile, $sgConfigFile ) = initSG(".sg"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 sub getLogName { return $sgLogFile; }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 my $log_conf = q( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        log4perl.rootLogger              = ERROR, LOG1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log4perl.rootLogger              = ERROR, LOG1, screen 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log4perl.appender.LOG1           = Log::Log4perl::Appender::File 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log4perl.appender.LOG1.filename  = sub { getLogName(); } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log4perl.appender.LOG1.mode      = append 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log4perl.appender.LOG1.layout    = Log::Log4perl::Layout::PatternLayout 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        log4perl.appender.LOG1.layout.ConversionPattern = %d %p %m %n 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log4perl.appender.LOG1.layout.ConversionPattern = %d %p >> %m %n 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	log4perl.appender.screen = Log::Log4perl::Appender::Screen 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	log4perl.appender.screen.stderr = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	log4perl.appender.screen.layout = PatternLayout 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	log4perl.appender.screen.layout.ConversionPattern = %d %p >> %m %n 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 Log::Log4perl::init(\$log_conf); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -68,6 +79,7 @@ GetOptions( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	'configure-local-user', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	'user=s', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	'email=s', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	'config-file=s', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 sub printHelp { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -101,6 +113,9 @@ Usage: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	Configure local git user 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		* Can be used with interactive mode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	--config-file 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	Default is ~/.sg/sg.config, can use this opt to use another file 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 EOF 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -182,11 +197,14 @@ sub parseArgs { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	if ( ! defined $args{'config-file'} ) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		$args{'config-file'} = $sgConfigFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 parseArgs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#print "Args parsed successfully\n"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-#exit 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+parseSGConfig($args{'config-file'},$logger); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 # TODO: This sub could be more concise with a sub to print array refs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 if ( defined $args{'view'} ) { 
			 |