mirror of
				https://github.com/Mibew/java.git
				synced 2025-10-31 10:31:07 +03:00 
			
		
		
		
	update header script
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@605 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
		
							parent
							
								
									f9898e5b85
								
							
						
					
					
						commit
						fe8af1fe34
					
				
							
								
								
									
										14
									
								
								src/messenger/tools/header.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/messenger/tools/header.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | ||||
| This file is part of Mibew Messenger project. | ||||
| 
 | ||||
| Copyright (c) 2005-2009 Mibew Messenger Community | ||||
| All rights reserved. The contents of this file are subject to the terms of | ||||
| the Eclipse Public License v1.0 which accompanies this distribution, and | ||||
| is available at http://www.eclipse.org/legal/epl-v10.html | ||||
| 
 | ||||
| Alternatively, the contents of this file may be used under the terms of | ||||
| the GNU General Public License Version 2 or later (the "GPL"), in which case | ||||
| the provisions of the GPL are applicable instead of those above. If you wish | ||||
| to allow use of your version of this file only under the terms of the GPL, and | ||||
| not to allow others to use your version of this file under the terms of the | ||||
| EPL, indicate your decision by deleting the provisions above and replace them | ||||
| with the notice and other provisions required by the GPL. | ||||
							
								
								
									
										63
									
								
								src/messenger/tools/header_update.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										63
									
								
								src/messenger/tools/header_update.pl
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,63 @@ | ||||
| #!/usr/bin/perl | ||||
| 
 | ||||
| $sourceFolder = "../webim"; | ||||
| 
 | ||||
| sub file_content($) { | ||||
| 	my $input = $_[0]; | ||||
| 	open( IN1, "< $input" ) or die "cannot find file $input"; | ||||
| 	$/ = EOI; | ||||
| 	$content = <IN1>; | ||||
| 	$content =~ s/\r//g; | ||||
| 	close( IN1 ); | ||||
| 	return $content; | ||||
| } | ||||
| 
 | ||||
| $php_header = file_content("header.txt"); | ||||
| $php_header =~ s/\s+$//; | ||||
| 
 | ||||
| @allfiles = (); | ||||
| 
 | ||||
| sub process_folder($) { | ||||
| 	my($from) = @_; | ||||
| 	 | ||||
| 	opendir(DIR, $from) || die "can't opendir $from: $!"; | ||||
| 	my @content = readdir(DIR); | ||||
| 	closedir DIR; | ||||
| 
 | ||||
| 	for(grep { -f "$from/$_" && ($_ !~ /^\./ || $_ eq ".htaccess") } @content) { | ||||
| 		push @allfiles, "$from/$_"; | ||||
| 	} | ||||
| 	for(grep { -d "$from/$_" && $_ !~ /^\./ } @content) { | ||||
| 		process_folder("$from/$_"); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| process_folder($sourceFolder); | ||||
| 
 | ||||
| P: for $phpfile (grep { /\.php$/ } @allfiles) { | ||||
| 	$content = file_content($phpfile); | ||||
| 	$content =~ s/\s+$//g; | ||||
| 	die "not a php: $phpfile" unless $content =~ /^<\?php\n(\/\*.*?\*\/)?/s; | ||||
| 	die "no comment in $phpfile" unless defined($1); | ||||
| 	$comment = $1; | ||||
| 	if($comment =~ /\[external\]/) { | ||||
| 		next P; | ||||
| 	}; | ||||
| 	die "no contributors in $phpfile" unless $comment =~ /Contributors:/; | ||||
| 	$newcomment = $comment; | ||||
| 	$newcomment =~ s/\s\*\s//g; | ||||
| 	$newcomment =~ s/^\/\*//; | ||||
| 	$newcomment =~ s/\*\/$//; | ||||
| 	$newcomment =~ s/.*(Contributors:)/$1/s; | ||||
| 	$newcomment =~ s/^\s+//; | ||||
| 	$newcomment =~ s/\s+$//; | ||||
| 	$newcomment = "$php_header\n\n$newcomment"; | ||||
| 	$newcomment =~ s/^/ * /gm; | ||||
| 	$newcomment = "/*\n$newcomment\n */"; | ||||
| 	 | ||||
| 	$content =~ s/^(<\?php\n)\/\*.*?\*\//$1$newcomment/s; | ||||
| 	 | ||||
|     open( OUT, "> $phpfile" ) or die "cannot write file: $phpfile\n"; | ||||
|     print OUT $content; | ||||
|     close( OUT ); | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user